From 06e70372fd65dd72643a08418ad83f2afc8b5afe Mon Sep 17 00:00:00 2001 From: Elio Bischof Date: Thu, 28 Jul 2022 04:15:06 +0200 Subject: [PATCH] fix e2e tests --- console/cypress/e2e/humans/humans.cy.ts | 11 ++++++----- console/cypress/e2e/machines/machines.cy.ts | 9 +++++---- console/package.json | 4 ++-- .../user-list/user-table/user-table.component.html | 1 + e2e/dev.env | 12 ++++++++++++ e2e/local.env | 12 ------------ 6 files changed, 26 insertions(+), 23 deletions(-) create mode 100644 e2e/dev.env delete mode 100644 e2e/local.env diff --git a/console/cypress/e2e/humans/humans.cy.ts b/console/cypress/e2e/humans/humans.cy.ts index 8ce6828150..680071a1dc 100644 --- a/console/cypress/e2e/humans/humans.cy.ts +++ b/console/cypress/e2e/humans/humans.cy.ts @@ -46,11 +46,12 @@ describe('humans', () => { }); it('should delete a human user', () => { - cy.contains('tr', testHumanUserNameRemove, { timeout: 1000 }) - .find('button') - //force due to angular hidden buttons - .click({ force: true }); - cy.get('[e2e-data="confirm-dialog-input"]').type(username(testHumanUserNameRemove, Cypress.env('org'))); + 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(username(testHumanUserNameRemove, Cypress.env('org'))); cy.get('[e2e-data="confirm-dialog-button"]').click(); cy.get('.data-e2e-success'); cy.wait(200); diff --git a/console/cypress/e2e/machines/machines.cy.ts b/console/cypress/e2e/machines/machines.cy.ts index 8734fd10bf..5efce818a3 100644 --- a/console/cypress/e2e/machines/machines.cy.ts +++ b/console/cypress/e2e/machines/machines.cy.ts @@ -45,10 +45,11 @@ describe('machines', () => { it('should delete a machine', () => { cy.contains('tr', testMachineUserNameRemove, { timeout: 1000 }) - .find('button') - //force due to angular hidden buttons - .click({ force: true }); - cy.get('[e2e-data="confirm-dialog-input"]').type(username(testMachineUserNameRemove, Cypress.env('org'))); + // 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(username(testMachineUserNameRemove, Cypress.env('org'))); cy.get('[e2e-data="confirm-dialog-button"]').click(); cy.get('.data-e2e-success'); cy.wait(200); diff --git a/console/package.json b/console/package.json index c67950e0cf..37b08967be 100644 --- a/console/package.json +++ b/console/package.json @@ -7,8 +7,8 @@ "build": "ng build", "prodbuild": "ng build --configuration production --base-href=/ui/console/", "lint": "ng lint && stylelint './src/**/*.scss' --syntax scss", - "e2e": "./cypress.sh run ../e2e/local.env", - "e2e:open": "./cypress.sh open ../e2e/local.env" + "e2e": "./cypress.sh run ../e2e/dev.env", + "e2e:open": "./cypress.sh open ../e2e/dev.env" }, "private": true, "dependencies": { diff --git a/console/src/app/pages/users/user-list/user-table/user-table.component.html b/console/src/app/pages/users/user-list/user-table/user-table.component.html index 75b088073c..cc3c938e37 100644 --- a/console/src/app/pages/users/user-list/user-table/user-table.component.html +++ b/console/src/app/pages/users/user-list/user-table/user-table.component.html @@ -191,6 +191,7 @@ color="warn" (click)="deleteUser(user)" [disabled]="!canWrite || !canDelete" + [attr.e2e-data]="!canWrite || !canDelete ? 'disabled-delete-button' : 'enabled-delete-button'" mat-icon-button > diff --git a/e2e/dev.env b/e2e/dev.env new file mode 100644 index 0000000000..af809c8cf2 --- /dev/null +++ b/e2e/dev.env @@ -0,0 +1,12 @@ +ZITADEL_E2E_CYPRESS_PORT=5000 +ZITADEL_E2E_ORG=e2e-tests +ZITADEL_E2E_ORGOWNERPW=Password1! +ZITADEL_E2E_ORGOWNERVIEWERPW=Password1! +ZITADEL_E2E_ORGPROJECTCREATORPW=Password1! +ZITADEL_E2E_PASSWORDCOMPLEXITYUSERPW=Password1! +ZITADEL_E2E_LOGINPOLICYUSERPW=Password1! +ZITADEL_E2E_MACHINEKEYPATH="${projectRoot}/.keys/e2e.json" +ZITADEL_E2E_BASEURL="http://zitadel:8080" +ZITADEL_E2E_OTHERZITADELIDPINSTANCE=false +ZITADEL_EXTERNALDOMAIN=zitadel +ZITADEL_S3DEFAULTINSTANCE_CUSTOMDOMAIN=zitadel diff --git a/e2e/local.env b/e2e/local.env deleted file mode 100644 index 6f29bbab52..0000000000 --- a/e2e/local.env +++ /dev/null @@ -1,12 +0,0 @@ -ZITADEL_E2E_CYPRESS_PORT=5000 -ZITADEL_E2E_ORG=e2e-tests -ZITADEL_E2E_ORGOWNERPW=Password1! -ZITADEL_E2E_ORGOWNERVIEWERPW=Password1! -ZITADEL_E2E_ORGPROJECTCREATORPW=Password1! -ZITADEL_E2E_PASSWORDCOMPLEXITYUSERPW=Password1! -ZITADEL_E2E_LOGINPOLICYUSERPW=Password1! -ZITADEL_E2E_MACHINEKEYPATH="${projectRoot}/.keys/e2e.json" -ZITADEL_E2E_BASEURL="http://localhost:8080" -ZITADEL_E2E_OTHERZITADELIDPINSTANCE=false -ZITADEL_E2E_ZITADELPROJECTRESOURCEID="bignumber-$(echo -n $(${projectRoot}/e2e/docker-compose.sh exec --no-TTY db cockroach sql --database zitadel --insecure --execute "select aggregate_id from eventstore.events where event_type = 'project.added' and event_data = '{\"name\": \"ZITADEL\"}';" --format tsv) | cut -d " " -f 2)" -ZITADEL_E2E_INSTANCEID="$(echo -n $(${projectRoot}/e2e/docker-compose.sh exec --no-TTY db cockroach sql --database zitadel --insecure --execute "select aggregate_id from eventstore.events where event_type = 'instance.added' and event_data = '{\"name\": \"Localhost\"}';" --format tsv) | cut -d " " -f 2)"