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
+40 -29
View File
@@ -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");
});
});
});