From 44fc2efbb7af315c1708f7660b232481d44fdc1c Mon Sep 17 00:00:00 2001 From: Max Peintner Date: Tue, 16 Aug 2022 14:02:59 +0200 Subject: [PATCH] fix(console, e2e): static data-e2e attributes, consistent naming (#4188) * fix(console, e2e): static data-e2e attributes, consistent naming * quote cypress attribute selectors * Update console/src/app/modules/policies/private-labeling-policy/private-labeling-policy.component.html Co-authored-by: Elio Bischof * Update console/src/app/modules/project-roles-table/project-roles-table.component.html Co-authored-by: Elio Bischof * fix , Co-authored-by: Elio Bischof --- .../action-keys/action-keys.component.html | 13 +- .../src/app/modules/card/card.component.html | 13 +- .../paginator/paginator.component.html | 2 +- .../color/color.component.html | 2 +- .../private-labeling-policy.component.html | 8 +- .../project-roles-table.component.html | 111 ++++++++---- .../settings-grid.component.html | 2 +- .../table-actions.component.html | 11 +- .../warn-dialog/warn-dialog.component.html | 4 +- .../apps/app-create/app-create.component.html | 16 +- .../app-secret-dialog.component.html | 2 +- .../redirect-uris.component.html | 2 +- .../application-grid.component.html | 4 +- .../project-role-create.component.html | 2 +- .../project-create.component.html | 2 +- .../project-grid/project-grid.component.html | 4 +- .../project-list/project-list.component.html | 167 ++++++++++++------ .../pages/projects/projects.component.html | 2 +- .../user-create-machine.component.html | 8 +- .../user-create/user-create.component.html | 2 +- .../user-table/user-table.component.html | 8 +- e2e/cypress/e2e/humans/humans.cy.ts | 75 ++++---- e2e/cypress/e2e/machines/machines.cy.ts | 69 +++++--- e2e/cypress/e2e/projects/projects.cy.ts | 77 ++++---- e2e/cypress/e2e/settings/login-policy.cy.ts | 2 +- .../e2e/settings/password-complexity.cy.ts | 2 +- .../e2e/settings/private-labeling.cy.ts | 12 +- 27 files changed, 375 insertions(+), 247 deletions(-) diff --git a/console/src/app/modules/action-keys/action-keys.component.html b/console/src/app/modules/action-keys/action-keys.component.html index 609b61c395..8d127a5314 100644 --- a/console/src/app/modules/action-keys/action-keys.component.html +++ b/console/src/app/modules/action-keys/action-keys.component.html @@ -1,12 +1,16 @@ -
+
ESC
-
+
N @@ -38,7 +42,6 @@
-
+
@@ -56,4 +59,4 @@ crtl - \ No newline at end of file + diff --git a/console/src/app/modules/card/card.component.html b/console/src/app/modules/card/card.component.html index d484d20090..3abfeb87ca 100644 --- a/console/src/app/modules/card/card.component.html +++ b/console/src/app/modules/card/card.component.html @@ -1,18 +1,17 @@ -
-
+
+
-

{{title}}

+

{{ title }}

-
-

{{description}}

+

{{ description }}

-
\ No newline at end of file +
diff --git a/console/src/app/modules/paginator/paginator.component.html b/console/src/app/modules/paginator/paginator.component.html index 3206d854d3..ab29ca228e 100644 --- a/console/src/app/modules/paginator/paginator.component.html +++ b/console/src/app/modules/paginator/paginator.component.html @@ -3,7 +3,7 @@

{{ length }} {{ 'PAGINATOR.COUNT' | translate }}

-

+

{{ timestamp | timestampToDate | localizedDate: 'EEEE dd. MMM YYYY, HH:mm' }}

diff --git a/console/src/app/modules/policies/private-labeling-policy/color/color.component.html b/console/src/app/modules/policies/private-labeling-policy/color/color.component.html index a8142eaba6..a1909de9f2 100644 --- a/console/src/app/modules/policies/private-labeling-policy/color/color.component.html +++ b/console/src/app/modules/policies/private-labeling-policy/color/color.component.html @@ -1,4 +1,4 @@ -
+

{{ name }}

diff --git a/console/src/app/modules/policies/private-labeling-policy/private-labeling-policy.component.html b/console/src/app/modules/policies/private-labeling-policy/private-labeling-policy.component.html index 1a6fb38694..58ed3cb4dc 100644 --- a/console/src/app/modules/policies/private-labeling-policy/private-labeling-policy.component.html +++ b/console/src/app/modules/policies/private-labeling-policy/private-labeling-policy.component.html @@ -101,7 +101,7 @@
- +
@@ -127,7 +127,7 @@ {{ 'POLICY.PRIVATELABELING.EMAILNOSVG' | translate }} -
+
Logo
-
+
Icon
- +
diff --git a/console/src/app/modules/project-roles-table/project-roles-table.component.html b/console/src/app/modules/project-roles-table/project-roles-table.component.html index 188bb80a1b..9f51d79f40 100644 --- a/console/src/app/modules/project-roles-table/project-roles-table.component.html +++ b/console/src/app/modules/project-roles-table/project-roles-table.component.html @@ -1,15 +1,25 @@ - - + - - add + + add {{ 'ACTIONS.NEW' | translate }} - - + @@ -17,55 +27,70 @@ - + - - + + - + - + - + @@ -73,9 +98,16 @@ - - +
- + [indeterminate]="selection.hasValue() && !isAllSelected()" + > - + {{ 'PROJECT.ROLE.KEY' | translate }} {{ 'PROJECT.ROLE.KEY' | translate }}
- {{ role.key }} - + {{ role.key }}
{{ 'PROJECT.ROLE.DISPLAY_NAME' | translate }} {{role.displayName}} {{ 'PROJECT.ROLE.DISPLAY_NAME' | translate }}{{ role.displayName }} {{ 'PROJECT.ROLE.GROUP' | translate }} {{ 'PROJECT.ROLE.GROUP' | translate }} - {{role.group}} + [matTooltip]="selectionAllowed ? ('PROJECT.ROLE.SELECTGROUPTOOLTIP' | translate: role) : null" + >{{ role.group }} {{ 'PROJECT.ROLE.CREATIONDATE' | translate }} {{ 'PROJECT.ROLE.CREATIONDATE' | translate }} - {{role.details.creationDate | timestampToDate | - localizedDate: 'dd. MMM, HH:mm' }} + {{ + role.details.creationDate | timestampToDate | localizedDate: 'dd. MMM, HH:mm' + }} {{ 'PROJECT.ROLE.CHANGEDATE' | translate }} {{ 'PROJECT.ROLE.CHANGEDATE' | translate }} - {{role.details.changeDate | timestampToDate | - localizedDate: 'dd. MMM, HH:mm' }} + {{ + role.details.changeDate | timestampToDate | localizedDate: 'dd. MMM, HH:mm' + }} - @@ -83,17 +115,22 @@
- {{'PROJECT.ROLE.EMPTY' | translate}} + {{ 'PROJECT.ROLE.EMPTY' | translate }}
- + - \ No newline at end of file + diff --git a/console/src/app/modules/settings-grid/settings-grid.component.html b/console/src/app/modules/settings-grid/settings-grid.component.html index a75db95114..eba9de4796 100644 --- a/console/src/app/modules/settings-grid/settings-grid.component.html +++ b/console/src/app/modules/settings-grid/settings-grid.component.html @@ -14,7 +14,7 @@ : [] " > -
+
diff --git a/console/src/app/modules/table-actions/table-actions.component.html b/console/src/app/modules/table-actions/table-actions.component.html index fe4eabe7c1..5032f4dace 100644 --- a/console/src/app/modules/table-actions/table-actions.component.html +++ b/console/src/app/modules/table-actions/table-actions.component.html @@ -2,9 +2,14 @@
- @@ -12,4 +17,4 @@
-
\ No newline at end of file +
diff --git a/console/src/app/modules/warn-dialog/warn-dialog.component.html b/console/src/app/modules/warn-dialog/warn-dialog.component.html index 98f8da4853..b70d8620b2 100644 --- a/console/src/app/modules/warn-dialog/warn-dialog.component.html +++ b/console/src/app/modules/warn-dialog/warn-dialog.component.html @@ -10,7 +10,7 @@ }} {{ data.confirmationKey | translate: { value: data.confirmation } }} - +
@@ -24,7 +24,7 @@ mat-raised-button class="ok-button" (click)="closeDialogWithSuccess()" - [attr.e2e-data]="'confirm-dialog-button'" + data-e2e="confirm-dialog-button" > {{ data.confirmKey | translate }} diff --git a/console/src/app/pages/projects/apps/app-create/app-create.component.html b/console/src/app/pages/projects/apps/app-create/app-create.component.html index 7835c60031..82bd772227 100644 --- a/console/src/app/pages/projects/apps/app-create/app-create.component.html +++ b/console/src/app/pages/projects/apps/app-create/app-create.component.html @@ -40,7 +40,7 @@ [disabled]="firstFormGroup.invalid" color="primary" matStepperNext - [attr.data-e2e]="'continue-button-nameandtype'" + data-e2e="continue-button-nameandtype" > {{ 'ACTIONS.CONTINUE' | translate }} @@ -72,7 +72,7 @@ color="primary" [disabled]="secondFormGroup.invalid" matStepperNext - [attr.data-e2e]="'continue-button-authmethod'" + data-e2e="continue-button-authmethod" > {{ 'ACTIONS.CONTINUE' | translate }} @@ -130,7 +130,7 @@
-
@@ -234,13 +234,7 @@
-
@@ -248,7 +242,7 @@
-
+
{{ 'APP.NAME' | translate }} diff --git a/console/src/app/pages/projects/apps/app-secret-dialog/app-secret-dialog.component.html b/console/src/app/pages/projects/apps/app-secret-dialog/app-secret-dialog.component.html index 2fca079282..396818a197 100644 --- a/console/src/app/pages/projects/apps/app-secret-dialog/app-secret-dialog.component.html +++ b/console/src/app/pages/projects/apps/app-secret-dialog/app-secret-dialog.component.html @@ -46,7 +46,7 @@ mat-raised-button class="ok-button" (click)="closeDialog()" - [attr.data-e2e]="'close-dialog'" + data-e2e="close-dialog" > {{ 'ACTIONS.CLOSE' | translate }} diff --git a/console/src/app/pages/projects/apps/redirect-uris/redirect-uris.component.html b/console/src/app/pages/projects/apps/redirect-uris/redirect-uris.component.html index 4ff326a471..6a0efe8a30 100644 --- a/console/src/app/pages/projects/apps/redirect-uris/redirect-uris.component.html +++ b/console/src/app/pages/projects/apps/redirect-uris/redirect-uris.component.html @@ -1,4 +1,4 @@ - + {{ title }} diff --git a/console/src/app/pages/projects/owned-projects/owned-project-detail/application-grid/application-grid.component.html b/console/src/app/pages/projects/owned-projects/owned-project-detail/application-grid/application-grid.component.html index f297673cd4..f5d043c4d4 100644 --- a/console/src/app/pages/projects/owned-projects/owned-project-detail/application-grid/application-grid.component.html +++ b/console/src/app/pages/projects/owned-projects/owned-project-detail/application-grid/application-grid.component.html @@ -12,7 +12,7 @@
diff --git a/console/src/app/pages/projects/owned-projects/project-role-create/project-role-create.component.html b/console/src/app/pages/projects/owned-projects/project-role-create/project-role-create.component.html index 851741cd76..8e68738c85 100644 --- a/console/src/app/pages/projects/owned-projects/project-role-create/project-role-create.component.html +++ b/console/src/app/pages/projects/owned-projects/project-role-create/project-role-create.component.html @@ -46,7 +46,7 @@ class="continue-button" [disabled]="formArray.invalid" type="submit" - [attr.data-e2e]="'save-button'" + data-e2e="save-button" > {{ 'ACTIONS.SAVE' | translate }} diff --git a/console/src/app/pages/projects/project-create/project-create.component.html b/console/src/app/pages/projects/project-create/project-create.component.html index 16c4311fa8..2dd98dec0e 100644 --- a/console/src/app/pages/projects/project-create/project-create.component.html +++ b/console/src/app/pages/projects/project-create/project-create.component.html @@ -20,7 +20,7 @@ [disabled]="!project.name" cdkFocusInitial type="submit" - [attr.data-e2e]="'continue-button'" + data-e2e="continue-button" > {{ 'ACTIONS.CONTINUE' | translate }} diff --git a/console/src/app/pages/projects/project-grid/project-grid.component.html b/console/src/app/pages/projects/project-grid/project-grid.component.html index 59edac1a4d..df618192ed 100644 --- a/console/src/app/pages/projects/project-grid/project-grid.component.html +++ b/console/src/app/pages/projects/project-grid/project-grid.component.html @@ -47,7 +47,7 @@ *ngFor="let item of notPinned; index as i" (click)="navigateToProject(type, $any(item), $event)" [ngClass]="{ inactive: item.state !== ProjectState.PROJECT_STATE_ACTIVE }" - [attr.data-e2e]="'grid-card'" + data-e2e="grid-card" >
diff --git a/console/src/app/pages/projects/project-list/project-list.component.html b/console/src/app/pages/projects/project-list/project-list.component.html index 409603b3bd..695868c881 100644 --- a/console/src/app/pages/projects/project-list/project-list.component.html +++ b/console/src/app/pages/projects/project-list/project-list.component.html @@ -1,81 +1,136 @@
- - - + + - + add {{ 'ACTIONS.NEW' | translate }} - - +
- - + - + + {{ project.projectOwnerName }} + - - + - - - + - - - + @@ -83,9 +138,15 @@ - +
- + [indeterminate]="selection.hasValue() && !isAllSelected()" + > - + {{ 'PROJECT.NAME' | translate }} - {{project.name}} - {{project.projectName}} + {{ 'PROJECT.NAME' | translate }} + {{ project.name }} + {{ project.projectName }} {{ 'PROJECT.TABLE.RESOURCEOWNER' | translate }} {{ 'PROJECT.TABLE.RESOURCEOWNER' | translate }} - {{project.projectOwnerName}} {{ 'PROJECT.TABLE.STATE' | translate }} - {{'PROJECT.STATE.'+project.state | translate}} + {{ 'PROJECT.TABLE.STATE' | translate }} + {{ 'PROJECT.STATE.' + project.state | translate }} {{ 'PROJECT.TABLE.CREATIONDATE' | translate }} - {{project.details.creationDate | timestampToDate | - localizedDate: 'EEE dd. MMM, HH:mm'}} + {{ 'PROJECT.TABLE.CREATIONDATE' | translate }} + {{ + project.details.creationDate | timestampToDate | localizedDate: 'EEE dd. MMM, HH:mm' + }} {{ 'PROJECT.TABLE.CHANGEDATE' | translate }} - {{project.details.changeDate | timestampToDate | - localizedDate: 'EEE dd. MMM, HH:mm'}} + {{ 'PROJECT.TABLE.CHANGEDATE' | translate }} + {{ + project.details.changeDate | timestampToDate | localizedDate: 'EEE dd. MMM, HH:mm' + }} - @@ -93,15 +154,21 @@
- {{'PROJECT.TABLE.EMPTY' | translate}} + {{ 'PROJECT.TABLE.EMPTY' | translate }}
- +
-
\ No newline at end of file +
diff --git a/console/src/app/pages/projects/projects.component.html b/console/src/app/pages/projects/projects.component.html index 9d62108cb3..af78f0cc0c 100644 --- a/console/src/app/pages/projects/projects.component.html +++ b/console/src/app/pages/projects/projects.component.html @@ -25,7 +25,7 @@
- diff --git a/console/src/app/pages/users/user-create-machine/user-create-machine.component.html b/console/src/app/pages/users/user-create-machine/user-create-machine.component.html index 46a29181fd..d2ae668c77 100644 --- a/console/src/app/pages/users/user-create-machine/user-create-machine.component.html +++ b/console/src/app/pages/users/user-create-machine/user-create-machine.component.html @@ -32,13 +32,7 @@
-
diff --git a/console/src/app/pages/users/user-create/user-create.component.html b/console/src/app/pages/users/user-create/user-create.component.html index 7887ef49b3..fbb5245572 100644 --- a/console/src/app/pages/users/user-create/user-create.component.html +++ b/console/src/app/pages/users/user-create/user-create.component.html @@ -149,7 +149,7 @@
@@ -58,7 +58,7 @@ mat-raised-button [disabled]="!canWrite" class="cnsl-action-button" - [attr.data-e2e]="'create-user-button'" + data-e2e="create-user-button" > add {{ 'ACTIONS.NEW' | translate }} @@ -197,7 +197,7 @@ color="warn" (click)="deleteUser(user)" [disabled]="!canWrite || !canDelete" - [attr.e2e-data]="!canWrite || !canDelete ? 'disabled-delete-button' : 'enabled-delete-button'" + [attr.data-e2e]="!canWrite || !canDelete ? 'disabled-delete-button' : 'enabled-delete-button'" mat-icon-button > diff --git a/e2e/cypress/e2e/humans/humans.cy.ts b/e2e/cypress/e2e/humans/humans.cy.ts index f7fdd14f2a..47fa33b879 100644 --- a/e2e/cypress/e2e/humans/humans.cy.ts +++ b/e2e/cypress/e2e/humans/humans.cy.ts @@ -1,57 +1,68 @@ -import { apiAuth } from '../../support/api/apiauth'; -import { ensureHumanUserExists, ensureUserDoesntExist } from '../../support/api/users'; -import { loginname } from '../../support/login/users'; +import { apiAuth } from "../../support/api/apiauth"; +import { + ensureHumanUserExists, + ensureUserDoesntExist, +} from "../../support/api/users"; +import { loginname } from "../../support/login/users"; -describe.skip('humans', () => { +describe.skip("humans", () => { const humansPath = `/ui/console/users?type=human`; - const testHumanUserNameAdd = 'e2ehumanusernameadd'; - const testHumanUserNameRemove = 'e2ehumanusernameremove'; + const testHumanUserNameAdd = "e2ehumanusernameadd"; + const testHumanUserNameRemove = "e2ehumanusernameremove"; - describe('add', () => { + describe("add", () => { before(`ensure it doesn't exist already`, () => { apiAuth().then((apiCallProperties) => { - ensureUserDoesntExist(apiCallProperties, testHumanUserNameAdd).then(()=>{ - cy.visit(humansPath); - }); + ensureUserDoesntExist(apiCallProperties, testHumanUserNameAdd).then( + () => { + cy.visit(humansPath); + } + ); }); }); - it('should add a user', () => { - cy.get('[data-e2e="action-key-add"]').parents('[data-e2e="create-user-button"]').click(); - cy.url().should('contain', 'users/create'); - cy.get('[formcontrolname="email"]').type(loginname('e2ehuman')); + it("should add a user", () => { + cy.get('[data-e2e="action-key-add"]') + .parents('[data-e2e="create-user-button"]') + .click(); + cy.url().should("contain", "users/create"); + cy.get('[formcontrolname="email"]').type(loginname("e2ehuman")); //force needed due to the prefilled username prefix - cy.get('[formcontrolname="userName"]').type(testHumanUserNameAdd, { force: true }); - cy.get('[formcontrolname="firstName"]').type('e2ehumanfirstname'); - cy.get('[formcontrolname="lastName"]').type('e2ehumanlastname'); - cy.get('[formcontrolname="phone"]').type('+41 123456789'); + cy.get('[formcontrolname="userName"]').type(testHumanUserNameAdd, { + force: true, + }); + cy.get('[formcontrolname="firstName"]').type("e2ehumanfirstname"); + cy.get('[formcontrolname="lastName"]').type("e2ehumanlastname"); + cy.get('[formcontrolname="phone"]').type("+41 123456789"); cy.get('[data-e2e="create-button"]').click(); - cy.get('.data-e2e-success'); + cy.get(".data-e2e-success"); cy.wait(200); - cy.get('.data-e2e-failure', { timeout: 0 }).should('not.exist'); + cy.get(".data-e2e-failure", { timeout: 0 }).should("not.exist"); }); }); - describe('remove', () => { - before('ensure it exists', () => { + describe("remove", () => { + before("ensure it exists", () => { apiAuth().then((api) => { - ensureHumanUserExists(api, testHumanUserNameRemove).then(()=>{ + ensureHumanUserExists(api, testHumanUserNameRemove).then(() => { cy.visit(humansPath); }); }); }); - it('should delete a human user', () => { - cy.contains('tr', testHumanUserNameRemove) + it("should delete a human user", () => { + cy.contains("tr", testHumanUserNameRemove) // doesn't work, need to force click. // .trigger('mouseover') - .find('[e2e-data="enabled-delete-button"]') - .click({force: true}); - cy.get('[e2e-data="confirm-dialog-input"]').click().type(loginname(testHumanUserNameRemove, Cypress.env('org'))); - cy.get('[e2e-data="confirm-dialog-button"]').click(); - cy.get('.data-e2e-success'); + .find('[data-e2e="enabled-delete-button"]') + .click({ force: true }); + cy.get('[data-e2e="confirm-dialog-input"]') + .click() + .type(loginname(testHumanUserNameRemove, Cypress.env("org"))); + cy.get('[data-e2e="confirm-dialog-button"]').click(); + cy.get(".data-e2e-success"); cy.wait(200); - cy.get('.data-e2e-failure', { timeout: 0 }).should('not.exist'); + cy.get(".data-e2e-failure", { timeout: 0 }).should("not.exist"); }); }); -}); \ No newline at end of file +}); diff --git a/e2e/cypress/e2e/machines/machines.cy.ts b/e2e/cypress/e2e/machines/machines.cy.ts index 6bccb64e70..632bcf7cb2 100644 --- a/e2e/cypress/e2e/machines/machines.cy.ts +++ b/e2e/cypress/e2e/machines/machines.cy.ts @@ -1,55 +1,66 @@ -import { apiAuth } from '../../support/api/apiauth'; -import { ensureMachineUserExists, ensureUserDoesntExist } from '../../support/api/users'; -import { loginname } from '../../support/login/users'; +import { apiAuth } from "../../support/api/apiauth"; +import { + ensureMachineUserExists, + ensureUserDoesntExist, +} from "../../support/api/users"; +import { loginname } from "../../support/login/users"; -describe.skip('machines', () => { +describe.skip("machines", () => { const machinesPath = `/ui/console/users?type=machine`; - const testMachineUserNameAdd = 'e2emachineusernameadd'; - const testMachineUserNameRemove = 'e2emachineusernameremove'; + const testMachineUserNameAdd = "e2emachineusernameadd"; + const testMachineUserNameRemove = "e2emachineusernameremove"; - describe('add', () => { + describe("add", () => { before(`ensure it doesn't exist already`, () => { apiAuth().then((apiCallProperties) => { - ensureUserDoesntExist(apiCallProperties, testMachineUserNameAdd).then(()=>{ - cy.visit(machinesPath); - }); + ensureUserDoesntExist(apiCallProperties, testMachineUserNameAdd).then( + () => { + cy.visit(machinesPath); + } + ); }); }); - it('should add a machine', () => { - cy.get('[data-e2e="action-key-add"]').parents('[data-e2e="create-user-button"]').click(); - cy.url().should('contain', 'users/create-machine'); + it("should add a machine", () => { + cy.get('[data-e2e="action-key-add"]') + .parents('[data-e2e="create-user-button"]') + .click(); + cy.url().should("contain", "users/create-machine"); //force needed due to the prefilled username prefix - cy.get('[formcontrolname="userName"]').type(testMachineUserNameAdd, { force: true }); - cy.get('[formcontrolname="name"]').type('e2emachinename'); - cy.get('[formcontrolname="description"]').type('e2emachinedescription'); + cy.get('[formcontrolname="userName"]').type(testMachineUserNameAdd, { + force: true, + }); + cy.get('[formcontrolname="name"]').type("e2emachinename"); + cy.get('[formcontrolname="description"]').type("e2emachinedescription"); cy.get('[data-e2e="create-button"]').click(); - cy.get('.data-e2e-success'); + cy.get(".data-e2e-success"); cy.wait(200); - cy.get('.data-e2e-failure', { timeout: 0 }).should('not.exist'); + cy.get(".data-e2e-failure", { timeout: 0 }).should("not.exist"); }); }); - describe('remove', () => { - before('ensure it exists', () => { + describe("remove", () => { + before("ensure it exists", () => { apiAuth().then((api) => { - ensureMachineUserExists(api, testMachineUserNameRemove).then(()=>{ + ensureMachineUserExists(api, testMachineUserNameRemove).then(() => { cy.visit(machinesPath); }); }); }); - it('should delete a machine', () => { - cy.contains('tr', testMachineUserNameRemove, { timeout: 1000 }) + it("should delete a machine", () => { + cy.contains("tr", testMachineUserNameRemove, { timeout: 1000 }) // doesn't work, need to force click. // .trigger('mouseover') - .find('[e2e-data="enabled-delete-button"]') - .click({force: true}); - cy.get('[e2e-data="confirm-dialog-input"]').click().type(loginname(testMachineUserNameRemove, Cypress.env('org'))); - cy.get('[e2e-data="confirm-dialog-button"]').click(); - cy.get('.data-e2e-success'); + .find('[data-e2e="enabled-delete-button"]') + .click({ force: true }); + cy.get('[data-e2e="confirm-dialog-input"]') + .click() + .type(loginname(testMachineUserNameRemove, Cypress.env("org"))); + cy.get('[data-e2e="confirm-dialog-button"]').click(); + cy.get(".data-e2e-success"); cy.wait(200); - cy.get('.data-e2e-failure', { timeout: 0 }).should('not.exist'); + cy.get(".data-e2e-failure", { timeout: 0 }).should("not.exist"); }); }); }); diff --git a/e2e/cypress/e2e/projects/projects.cy.ts b/e2e/cypress/e2e/projects/projects.cy.ts index c21f4b1b84..e9806badac 100644 --- a/e2e/cypress/e2e/projects/projects.cy.ts +++ b/e2e/cypress/e2e/projects/projects.cy.ts @@ -1,12 +1,15 @@ -import { apiAuth } from '../../support/api/apiauth'; -import { ensureProjectDoesntExist, ensureProjectExists } from '../../support/api/projects'; +import { apiAuth } from "../../support/api/apiauth"; +import { + ensureProjectDoesntExist, + ensureProjectExists, +} from "../../support/api/projects"; -describe('projects', () => { - const testProjectNameCreate = 'e2eprojectcreate'; - const testProjectNameDeleteList = 'e2eprojectdeletelist'; - const testProjectNameDeleteGrid = 'e2eprojectdeletegrid'; +describe("projects", () => { + const testProjectNameCreate = "e2eprojectcreate"; + const testProjectNameDeleteList = "e2eprojectdeletelist"; + const testProjectNameDeleteGrid = "e2eprojectdeletegrid"; - describe('add project', () => { + describe("add project", () => { beforeEach(`ensure it doesn't exist already`, () => { apiAuth().then((api) => { ensureProjectDoesntExist(api, testProjectNameCreate); @@ -14,57 +17,61 @@ describe('projects', () => { cy.visit(`/ui/console/projects`); }); - it('should add a project', () => { - cy.get('.add-project-button').click({ force: true }); - cy.get('input').type(testProjectNameCreate); + it("should add a project", () => { + cy.get(".add-project-button").click({ force: true }); + cy.get("input").type(testProjectNameCreate); cy.get('[data-e2e="continue-button"]').click(); - cy.get('.data-e2e-success'); + cy.get(".data-e2e-success"); cy.wait(200); - cy.get('.data-e2e-failure', { timeout: 0 }).should('not.exist'); + cy.get(".data-e2e-failure", { timeout: 0 }).should("not.exist"); }); }); - describe.skip('remove project', () => { - describe('list view', () => { - beforeEach('ensure it exists', () => { + describe.skip("remove project", () => { + describe("list view", () => { + beforeEach("ensure it exists", () => { apiAuth().then((api) => { ensureProjectExists(api, testProjectNameDeleteList); }); cy.visit(`/ui/console/projects`); }); - it('removes the project', () => { - cy.get('[data-e2e=toggle-grid]').click(); - cy.get('[data-e2e=timestamp]'); - cy.contains('tr', testProjectNameDeleteList, { timeout: 1000 }) - .find('[data-e2e=delete-project-button]') - .click({force: true}); - cy.get('[e2e-data="confirm-dialog-input"]').type(testProjectNameDeleteList); - cy.get('[e2e-data="confirm-dialog-button"]').click(); - cy.get('.data-e2e-success'); + it("removes the project", () => { + cy.get('[data-e2e="toggle-grid"]').click(); + cy.get('[data-e2e="timestamp"]'); + cy.contains("tr", testProjectNameDeleteList, { timeout: 1000 }) + .find('[data-e2e="delete-project-button"]') + .click({ force: true }); + cy.get('[data-e2e="confirm-dialog-input"]').type( + testProjectNameDeleteList + ); + cy.get('[data-e2e="confirm-dialog-button"]').click(); + cy.get(".data-e2e-success"); cy.wait(200); - cy.get('.data-e2e-failure', { timeout: 0 }).should('not.exist'); + cy.get(".data-e2e-failure", { timeout: 0 }).should("not.exist"); }); }); - describe('grid view', () => { - beforeEach('ensure it exists', () => { + describe("grid view", () => { + beforeEach("ensure it exists", () => { apiAuth().then((api) => { ensureProjectExists(api, testProjectNameDeleteGrid); }); cy.visit(`/ui/console/projects`); }); - it('removes the project', () => { - cy.contains('[data-e2e=grid-card]', testProjectNameDeleteGrid) - .find('[data-e2e=delete-project-button]') - .trigger('mouseover') + it("removes the project", () => { + cy.contains('[data-e2e="grid-card"]', testProjectNameDeleteGrid) + .find('[data-e2e="delete-project-button"]') + .trigger("mouseover") .click(); - cy.get('[e2e-data="confirm-dialog-input"]').type(testProjectNameDeleteGrid); - cy.get('[e2e-data="confirm-dialog-button"]').click(); - cy.get('.data-e2e-success'); + cy.get('[data-e2e="confirm-dialog-input"]').type( + testProjectNameDeleteGrid + ); + cy.get('[data-e2e="confirm-dialog-button"]').click(); + cy.get(".data-e2e-success"); cy.wait(200); - cy.get('.data-e2e-failure', { timeout: 0 }).should('not.exist'); + cy.get(".data-e2e-failure", { timeout: 0 }).should("not.exist"); }); }); }); diff --git a/e2e/cypress/e2e/settings/login-policy.cy.ts b/e2e/cypress/e2e/settings/login-policy.cy.ts index 327476d715..b04a8c06b8 100644 --- a/e2e/cypress/e2e/settings/login-policy.cy.ts +++ b/e2e/cypress/e2e/settings/login-policy.cy.ts @@ -14,7 +14,7 @@ describe("login policy", ()=> { login(user) cy.visit(orgPath) // TODO: Why force? - cy.contains('[data-e2e=policy-card]', 'Login Policy').contains('button', 'Modify').click({force: true}) // TODO: select data-e2e + cy.contains('[data-e2e="policy-card"]', 'Login Policy').contains('button', 'Modify').click({force: true}) // TODO: select data-e2e apiAuth().then(api => { ensureHumanUserExists(api, User.LoginPolicyUser) }) diff --git a/e2e/cypress/e2e/settings/password-complexity.cy.ts b/e2e/cypress/e2e/settings/password-complexity.cy.ts index 48e95ec87c..5518aa7d5a 100644 --- a/e2e/cypress/e2e/settings/password-complexity.cy.ts +++ b/e2e/cypress/e2e/settings/password-complexity.cy.ts @@ -13,7 +13,7 @@ describe("password complexity", ()=> { login(user) cy.visit(orgPath) // TODO: Why force? - cy.contains('[data-e2e=policy-card]', 'Password Complexity').contains('button', 'Modify').click({force: true}) // TODO: select data-e2e + cy.contains('[data-e2e="policy-card"]', 'Password Complexity').contains('button', 'Modify').click({force: true}) // TODO: select data-e2e }) // TODO: fix saving password complexity policy bug diff --git a/e2e/cypress/e2e/settings/private-labeling.cy.ts b/e2e/cypress/e2e/settings/private-labeling.cy.ts index 4fdcd922fa..8094e39e10 100644 --- a/e2e/cypress/e2e/settings/private-labeling.cy.ts +++ b/e2e/cypress/e2e/settings/private-labeling.cy.ts @@ -13,7 +13,7 @@ describe('private labeling', () => { login(user); cy.visit(orgPath); // TODO: Why force? - cy.contains('[data-e2e=policy-card]', 'Private Labeling').contains('button', 'Modify').click({ force: true }); // TODO: select data-e2e + cy.contains('[data-e2e="policy-card"]', 'Private Labeling').contains('button', 'Modify').click({ force: true }); // TODO: select data-e2e }); customize('white', user); @@ -32,12 +32,12 @@ function customize(theme: string, user: User) { describe.skip('logo', () => { beforeEach('expand logo category', () => { - cy.contains('[data-e2e=policy-category]', 'Logo').click(); // TODO: select data-e2e + cy.contains('[data-e2e="policy-category"]', 'Logo').click(); // TODO: select data-e2e cy.fixture('logo.png').as('logo'); }); it('should update a logo', () => { - cy.get('[data-e2e=image-part-logo]') + cy.get('[data-e2e="image-part-logo"]') .find('input') .then(function (el) { const blob = Cypress.Blob.base64StringToBlob(this.logo, 'image/png'); @@ -56,10 +56,10 @@ function customize(theme: string, user: User) { it('should update an icon'); it('should delete an icon'); it.skip('should update the background color', () => { - cy.contains('[data-e2e=color]', 'Background Color').find('button').click(); // TODO: select data-e2e + cy.contains('[data-e2e="color"]', 'Background Color').find('button').click(); // TODO: select data-e2e cy.get('color-editable-input').find('input').clear().type('#ae44dc'); - cy.get('[data-e2e=save-colors-button]').click(); - cy.get('[data-e2e=header-user-avatar]').click(); + cy.get('[data-e2e="save-colors-button"]').click(); + cy.get('[data-e2e="header-user-avatar"]').click(); cy.contains('Logout All Users').click(); // TODO: select data-e2e login(User.LoginPolicyUser, undefined, true, null, () => { cy.pause();