From eae82c2c8d0f1c5f21f064d281d3dff67aa4d626 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 c30c49849..66f9a03cc 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 39c086fac..de117e552 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('flush', flush) Cypress.Commands.add('writePoints', writePoints) -Cypress.Commands.add('clickAttached', clickAttached) +Cypress.Commands.add('clickAttached', {prevSubject: 'element'} ,clickAttached)