From f4ff143242a3e29ab80586625a3899d68e5203d6 Mon Sep 17 00:00:00 2001 From: k3yi0 Date: Tue, 14 Jun 2022 16:08:30 +0200 Subject: [PATCH] test(cypress): add All User test --- ui/cypress/integration/admin.test.ts | 96 ++++++++++++++++++++- ui/cypress/integration/queryBuilder.test.ts | 5 +- 2 files changed, 97 insertions(+), 4 deletions(-) diff --git a/ui/cypress/integration/admin.test.ts b/ui/cypress/integration/admin.test.ts index 1d01daaaf..0f9015a7a 100644 --- a/ui/cypress/integration/admin.test.ts +++ b/ui/cypress/integration/admin.test.ts @@ -84,6 +84,100 @@ describe('Use Admin tab', () => { }) }) }) + + describe('All Users', () => { + beforeEach(() => { + cy.visit(url + '/all-users') + }) + + it('add user, edit user, and remove it', () => { + cy.getByTestID('turn-on-new-users-superAdmin--toggle') + .click() + .should('have.class', 'active') + cy.getByTestID('add-user--button').click() + cy.getByTestID('new-user--table-row') + .should('exist') + .within(() => { + cy.getByTestID('cancel-new-user--button').click() + }) + cy.getByTestID('add-user--button').click() + cy.getByTestID('new-user--table-row') + .should('exist') + .within(() => { + cy.getByTestID('username--input').type(chronograf.user.name) + cy.getByTestID('dropdown-toggle').click() + cy.getByTestID('dropdown-ul') + .contains(chronograf.user.orgs[0]) + .click() + cy.getByTestID( + `dropdown-selected--${chronograf.user.orgs[0]}` + ).should('exist') + cy.getByTestID('oauth-provider--input').type( + chronograf.user.oauthProvider + ) + cy.getByTestID('confirm-new-user--button').click() + }) + + cy.getByTestID('turn-off-new-users-superAdmin--toggle') + .click() + .should('not.have.class', 'active') + + cy.getByTestID(`${chronograf.user.name}--table-row`) + .should('exist') + .realHover() + .then(() => { + cy.getByTestID(`${chronograf.user.name}--table-row`).within(() => { + cy.getByTestID('turn-off-superAdmin--toggle').click() + }) + }) + + cy.getByTestID(`${chronograf.user.name}--table-row`) + .realHover() + .then(() => { + cy.getByTestID(`${chronograf.user.name}--table-row`).within(() => { + cy.getByTestID(`${chronograf.user.orgs[0]}-tag--item`).should( + 'exist' + ) + + cy.getByTestID('delete-tag--button') + .click() + .within(() => { + cy.getByTestID('confirm-btn').click() + }) + + cy.getByTestID(`${chronograf.user.orgs[0]}-tag--item`).should( + 'not.exist' + ) + }) + }) + + cy.getByTestID(`${chronograf.user.name}--table-row`) + .realHover() + .then(() => { + cy.getByTestID(`${chronograf.user.name}--table-row`).within(() => { + cy.get('.tags-add') + .click() + .within(() => { + cy.get('.tags-add--menu-item') + .contains(chronograf.user.orgs[0]) + .click() + }) + }) + }) + + cy.getByTestID(`${chronograf.user.name}--table-row`) + .realHover() + .then(() => { + cy.getByTestID(`${chronograf.user.name}--table-row`).within(() => { + cy.getByTestID('delete-user--button') + .click() + .within(() => { + cy.getByTestID('confirm-btn').click() + }) + }) + }) + }) + }) }) describe('InfluxDB', () => { @@ -313,7 +407,7 @@ describe('Use Admin tab', () => { cy.get('th').contains('Users').should('exist') }) - cy.getByTestID('hide-users--toggle').click() + cy.getByTestID('turn-off-users--toggle').click() cy.getByTestID('admin-table--head').within(() => { cy.get('th').contains('Users').should('not.exist') }) diff --git a/ui/cypress/integration/queryBuilder.test.ts b/ui/cypress/integration/queryBuilder.test.ts index 4c0ce313b..24d21ead7 100644 --- a/ui/cypress/integration/queryBuilder.test.ts +++ b/ui/cypress/integration/queryBuilder.test.ts @@ -106,9 +106,8 @@ describe('query builder', () => { cy.getByTestID('builder-card--body').within(() => { cy.get('.dropdown-selected').click() cy.get('.dropdown-menu').within(() => { - cy.getByTestID('dropdown-item') - .contains('custom') - .click({force: true}) + cy.getByTestID('custom-dropdown-item') + .click() }) cy.get('input').type('13s{enter}') cy.get('.dropdown-selected').should('contain.text', '13s')