fix e2e tests

This commit is contained in:
Elio Bischof 2022-07-28 04:15:06 +02:00
parent 8e707e18a7
commit 06e70372fd
No known key found for this signature in database
GPG Key ID: 7B383FDE4DDBF1BD
6 changed files with 26 additions and 23 deletions

View File

@ -46,11 +46,12 @@ describe('humans', () => {
}); });
it('should delete a human user', () => { it('should delete a human user', () => {
cy.contains('tr', testHumanUserNameRemove, { timeout: 1000 }) cy.contains('tr', testHumanUserNameRemove)
.find('button') // doesn't work, need to force click.
//force due to angular hidden buttons // .trigger('mouseover')
.click({ force: true }); .find('[e2e-data="enabled-delete-button"]')
cy.get('[e2e-data="confirm-dialog-input"]').type(username(testHumanUserNameRemove, Cypress.env('org'))); .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('[e2e-data="confirm-dialog-button"]').click();
cy.get('.data-e2e-success'); cy.get('.data-e2e-success');
cy.wait(200); cy.wait(200);

View File

@ -45,10 +45,11 @@ describe('machines', () => {
it('should delete a machine', () => { it('should delete a machine', () => {
cy.contains('tr', testMachineUserNameRemove, { timeout: 1000 }) cy.contains('tr', testMachineUserNameRemove, { timeout: 1000 })
.find('button') // doesn't work, need to force click.
//force due to angular hidden buttons // .trigger('mouseover')
.click({ force: true }); .find('[e2e-data="enabled-delete-button"]')
cy.get('[e2e-data="confirm-dialog-input"]').type(username(testMachineUserNameRemove, Cypress.env('org'))); .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('[e2e-data="confirm-dialog-button"]').click();
cy.get('.data-e2e-success'); cy.get('.data-e2e-success');
cy.wait(200); cy.wait(200);

View File

@ -7,8 +7,8 @@
"build": "ng build", "build": "ng build",
"prodbuild": "ng build --configuration production --base-href=/ui/console/", "prodbuild": "ng build --configuration production --base-href=/ui/console/",
"lint": "ng lint && stylelint './src/**/*.scss' --syntax scss", "lint": "ng lint && stylelint './src/**/*.scss' --syntax scss",
"e2e": "./cypress.sh run ../e2e/local.env", "e2e": "./cypress.sh run ../e2e/dev.env",
"e2e:open": "./cypress.sh open ../e2e/local.env" "e2e:open": "./cypress.sh open ../e2e/dev.env"
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {

View File

@ -191,6 +191,7 @@
color="warn" color="warn"
(click)="deleteUser(user)" (click)="deleteUser(user)"
[disabled]="!canWrite || !canDelete" [disabled]="!canWrite || !canDelete"
[attr.e2e-data]="!canWrite || !canDelete ? 'disabled-delete-button' : 'enabled-delete-button'"
mat-icon-button mat-icon-button
> >
<i class="las la-trash"></i> <i class="las la-trash"></i>

12
e2e/dev.env Normal file
View File

@ -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

View File

@ -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)"