fix(console, e2e): optimize console and activate tests (#4207)

* activate some tests

* unskip remove project tests

* focus input elements before typing

* fix: prune permissions observable

* cleanup

* remove timeout

* remove ngIf

* test with chrome

* with ngIf

* single observable

* juhu

* maybe better

* fix isAllowed response

* cleanup

Co-authored-by: Max Peintner <max@caos.ch>
This commit is contained in:
Elio Bischof
2022-09-02 15:43:44 +02:00
committed by GitHub
parent adb5394ae3
commit f0250a3fdb
10 changed files with 178 additions and 151 deletions

View File

@@ -5,7 +5,7 @@ import {
} from "../../support/api/users";
import { loginname } from "../../support/login/users";
describe.skip("humans", () => {
describe("humans", () => {
const humansPath = `/users?type=human`;
const testHumanUserNameAdd = "e2ehumanusernameadd";
const testHumanUserNameRemove = "e2ehumanusernameremove";
@@ -22,18 +22,20 @@ describe.skip("humans", () => {
});
it("should add a user", () => {
cy.get('[data-e2e="action-key-add"]')
.parents('[data-e2e="create-user-button"]')
cy.get('[data-e2e="create-user-button"]')
.click();
cy.url().should("contain", "users/create");
cy.get('[formcontrolname="email"]').type(loginname("e2ehuman"));
cy.get('[formcontrolname="email"]')
.type(loginname("e2ehuman", Cypress.env("ORGANIZATION")));
//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);
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.wait(200);
@@ -55,10 +57,10 @@ describe.skip("humans", () => {
// doesn't work, need to force click.
// .trigger('mouseover')
.find('[data-e2e="enabled-delete-button"]')
.click({ force: true });
.click({force: true});
cy.get('[data-e2e="confirm-dialog-input"]')
.click()
.type(loginname(testHumanUserNameRemove, Cypress.env("org")));
.focus()
.type(loginname(testHumanUserNameRemove, Cypress.env("ORGANIZATION")));
cy.get('[data-e2e="confirm-dialog-button"]').click();
cy.get(".data-e2e-success");
cy.wait(200);

View File

@@ -5,7 +5,7 @@ import {
} from "../../support/api/users";
import { loginname } from "../../support/login/users";
describe.skip("machines", () => {
describe("machines", () => {
const machinesPath = `/users?type=machine`;
const testMachineUserNameAdd = "e2emachineusernameadd";
const testMachineUserNameRemove = "e2emachineusernameremove";
@@ -22,16 +22,16 @@ describe.skip("machines", () => {
});
it("should add a machine", () => {
cy.get('[data-e2e="action-key-add"]')
.parents('[data-e2e="create-user-button"]')
cy.get('[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);
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.wait(200);
@@ -49,14 +49,14 @@ describe.skip("machines", () => {
});
it("should delete a machine", () => {
cy.contains("tr", testMachineUserNameRemove, { timeout: 1000 })
cy.contains("tr", testMachineUserNameRemove)
// doesn't work, need to force click.
// .trigger('mouseover')
.find('[data-e2e="enabled-delete-button"]')
.click({ force: true });
.click({force: true});
cy.get('[data-e2e="confirm-dialog-input"]')
.click()
.type(loginname(testMachineUserNameRemove, Cypress.env("org")));
.focus()
.type(loginname(testMachineUserNameRemove, Cypress.env("ORGANIZATION")));
cy.get('[data-e2e="confirm-dialog-button"]').click();
cy.get(".data-e2e-success");
cy.wait(200);

View File

@@ -1,7 +1,7 @@
import { apiAuth } from "../../support/api/apiauth";
import { ensureProjectExists, ensureProjectResourceDoesntExist, Roles } from "../../support/api/projects";
describe.skip('permissions', () => {
describe('permissions', () => {
const testProjectName = 'e2eprojectpermission'
const testAppName = 'e2eapppermission'
@@ -28,12 +28,16 @@ describe.skip('permissions', () => {
})
})
it('should add a role', () => {
it('should add a role', () => {
cy.get('[data-e2e="add-new-role"]').click()
cy.get('[formcontrolname="key"]').type(testRoleName)
cy.get('[formcontrolname="displayName"]').type(testRoleDisplay)
cy.get('[formcontrolname="group"]').type(testRoleGroup)
cy.get('[data-e2e="save-button"]').click()
cy.get('[formcontrolname="key"]')
.type(testRoleName)
cy.get('[formcontrolname="displayName"]')
.type(testRoleDisplay)
cy.get('[formcontrolname="group"]')
.type(testRoleGroup)
cy.get('[data-e2e="save-button"]')
.click()
cy.get('.data-e2e-success')
cy.wait(200)
cy.get('.data-e2e-failure', { timeout: 0 }).should('not.exist')

View File

@@ -42,9 +42,9 @@ describe("projects", () => {
cy.contains("tr", testProjectNameDeleteList, { timeout: 1000 })
.find('[data-e2e="delete-project-button"]')
.click({ force: true });
cy.get('[data-e2e="confirm-dialog-input"]').focus().type(
testProjectNameDeleteList
);
cy.get('[data-e2e="confirm-dialog-input"]')
.focus()
.type(testProjectNameDeleteList);
cy.get('[data-e2e="confirm-dialog-button"]').click();
cy.get(".data-e2e-success");
cy.wait(200);
@@ -63,11 +63,10 @@ describe("projects", () => {
it("removes the project", () => {
cy.contains('[data-e2e="grid-card"]', testProjectNameDeleteGrid)
.find('[data-e2e="delete-project-button"]')
.trigger("mouseover")
.click();
cy.get('[data-e2e="confirm-dialog-input"]').focus().type(
testProjectNameDeleteGrid
);
.click({force: true});
cy.get('[data-e2e="confirm-dialog-input"]')
.focus()
.type(testProjectNameDeleteGrid);
cy.get('[data-e2e="confirm-dialog-button"]').click();
cy.get(".data-e2e-success");
cy.wait(200);