From 1002e4b8f787aabd31eed653ab0d9867ac4ca262 Mon Sep 17 00:00:00 2001 From: k3yi0 Date: Fri, 17 Jun 2022 18:29:56 +0200 Subject: [PATCH] chore(cypress): adjust clickAttached function --- ui/cypress/integration/admin.test.ts | 27 ++++++++++----------------- ui/cypress/support/commands.ts | 2 +- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/ui/cypress/integration/admin.test.ts b/ui/cypress/integration/admin.test.ts index 1713d22c9..25f6d0f8c 100644 --- a/ui/cypress/integration/admin.test.ts +++ b/ui/cypress/integration/admin.test.ts @@ -45,6 +45,7 @@ describe('Use Admin tab', () => { 'contain.text', chronograf.user.role[0] ) + cy.getByTestID('oauth-provider--input') .type(chronograf.user.oauthProvider) .should('have.value', chronograf.user.oauthProvider) @@ -52,6 +53,7 @@ describe('Use Admin tab', () => { 'contain.text', chronograf.user.role[0] ) + cy.getByTestID('confirm-new-user--button') .should('be.enabled') .click() @@ -60,37 +62,28 @@ describe('Use Admin tab', () => { cy.getByTestID(`${chronograf.user.name}--table-row`).should( 'be.visible' ) + cy.getByTestID(`${chronograf.user.name}--table-row`).realHover() cy.getByTestID(`${chronograf.user.name}--table-row`).within(() => { cy.get('.dropdown-selected').should('be.visible') cy.get('.dropdown-selected').realHover() - cy.get('.dropdown-selected').then(el => { - cy.clickAttached(el) - }) - + cy.get('.dropdown-selected').clickAttached() cy.getByTestID(`${chronograf.user.role[1]}-dropdown-item`).realHover() - - cy.getByTestID(`${chronograf.user.role[1]}-dropdown-item`).then( - el => { - cy.clickAttached(el) - } - ) + cy.getByTestID( + `${chronograf.user.role[1]}-dropdown-item` + ).clickAttached() }) cy.getByTestID(`${chronograf.user.name}--table-row`).should( 'be.visible' ) + cy.getByTestID(`${chronograf.user.name}--table-row`).realHover() cy.getByTestID(`${chronograf.user.name}--table-row`).within(() => { cy.getByTestID('remove-user--button').should('be.visible') - cy.getByTestID('remove-user--button').then(el => { - cy.clickAttached(el) - }) - + cy.getByTestID('remove-user--button').clickAttached() cy.getByTestID('confirm-btn').should('be.visible') - cy.getByTestID('confirm-btn').then(el => { - cy.clickAttached(el) - }) + cy.getByTestID('confirm-btn').clickAttached() }) }) }) diff --git a/ui/cypress/support/commands.ts b/ui/cypress/support/commands.ts index 77470a032..23fece13f 100644 --- a/ui/cypress/support/commands.ts +++ b/ui/cypress/support/commands.ts @@ -571,4 +571,4 @@ Cypress.Commands.add('deleteInfluxDB', deleteInfluxDB) Cypress.Commands.add('deleteInfluxDBs', deleteInfluxDBs) Cypress.Commands.add('toInitialState', toInitialState) Cypress.Commands.add('writePoints', writePoints) -Cypress.Commands.add('clickAttached', clickAttached) +Cypress.Commands.add('clickAttached', {prevSubject: 'element'} ,clickAttached)