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 <[email protected]>

* Update console/src/app/modules/project-roles-table/project-roles-table.component.html

Co-authored-by: Elio Bischof <[email protected]>

* fix ,

Co-authored-by: Elio Bischof <[email protected]>
This commit is contained in:
Max Peintner
2022-08-16 14:02:59 +02:00
committed by GitHub
co-authored by Elio Bischof
parent dcac08b1d5
commit 44fc2efbb7
27 changed files with 375 additions and 247 deletions
+43 -32
View File
@@ -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");
});
});
});
});