mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-19 14:27:32 +00:00
08ae39ae19
* new console * move npm ci to angular build * rel path for assets * local grpc copy * login policy, rm clear views, features rel path * lock Co-authored-by: Livio Amstutz <livio.a@gmail.com>
61 lines
2.3 KiB
TypeScript
61 lines
2.3 KiB
TypeScript
import { apiAuth } from '../../support/api/apiauth';
|
|
import { ensureMachineUserExists, ensureUserDoesntExist } from '../../support/api/users';
|
|
import { login, User, username } from '../../support/login/users';
|
|
|
|
describe('machines', () => {
|
|
const machinesPath = `${Cypress.env('consoleUrl')}/users?type=machine`;
|
|
const testMachineUserNameAdd = 'e2emachineusernameadd';
|
|
const testMachineUserNameRemove = 'e2emachineusernameremove';
|
|
|
|
[User.OrgOwner].forEach((user) => {
|
|
describe(`as user "${user}"`, () => {
|
|
beforeEach(() => {
|
|
login(user);
|
|
cy.visit(machinesPath);
|
|
cy.get('[data-cy=timestamp]');
|
|
});
|
|
|
|
describe('add', () => {
|
|
before(`ensure it doesn't exist already`, () => {
|
|
apiAuth().then((apiCallProperties) => {
|
|
ensureUserDoesntExist(apiCallProperties, testMachineUserNameAdd);
|
|
});
|
|
});
|
|
|
|
it('should add a machine', () => {
|
|
cy.get('a[href="/users/create-machine"]').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('[data-e2e="create-button"]').click();
|
|
cy.get('.data-e2e-success');
|
|
cy.wait(200);
|
|
cy.get('.data-e2e-failure', { timeout: 0 }).should('not.exist');
|
|
});
|
|
});
|
|
|
|
describe('remove', () => {
|
|
before('ensure it exists', () => {
|
|
apiAuth().then((api) => {
|
|
ensureMachineUserExists(api, testMachineUserNameRemove);
|
|
});
|
|
});
|
|
|
|
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')));
|
|
cy.get('[e2e-data="confirm-dialog-button"]').click();
|
|
cy.get('.data-e2e-success');
|
|
cy.wait(200);
|
|
cy.get('.data-e2e-failure', { timeout: 0 }).should('not.exist');
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|