mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 18:07:31 +00:00
fix(console): remove navigation flakiness (#8439)
# Which Problems Are Solved The navigation in the console default settings is flaky. Sometimes it arbitrarily jumps to the organizations page. # How the Problems Are Solved The lifecycle hooks were extended to react differently to changes that come from 'outside' and from the component itself. # Additional Changes The e2e tests are supposed to run against Firefox and Chrome. However they are run twice against Electon. Fixing this revealed the console navigation flakiness that was less visible on Electron. The following issues are also fixed with this PR to reduce flakiness in e2e tests. - The custom command in the pipeline is removed from the e2e action step, so the browser argument is respected. - The npm packages of the e2e tests are updated to their latest version. - Notification tests run against a clean state now so they don't depend on each other anymore. This resolved some flakiness and improved debuggability of the tests. - E2E page load timeout is increased, reducing flakiness. - E2E tests wait on some elements to be enabled before they interact with them, reducing flakiness. # Additional Context - Closes #8404 - Follow-up: https://github.com/zitadel/zitadel/issues/8471 The e2e tests ran three times in a row successfully in the pipeline against both browsers. --------- Co-authored-by: Max Peintner <max@caos.ch> Co-authored-by: Livio Spring <livio.a@gmail.com> Co-authored-by: Tim Möhlmann <tim+github@zitadel.com>
This commit is contained in:
@@ -26,13 +26,16 @@ describe('applications', () => {
|
||||
|
||||
it('add web pkce app', () => {
|
||||
cy.get('[data-e2e="app-card-add"]').should('be.visible').click();
|
||||
cy.get('[formcontrolname="name"]').focus().type(testPKCEAppName);
|
||||
cy.get('[formcontrolname="name"]').focus().should('be.enabled').type(testPKCEAppName);
|
||||
cy.get('[for="WEB"]').click();
|
||||
cy.get('[data-e2e="continue-button-nameandtype"]').click();
|
||||
cy.get('[for="PKCE"]').should('be.visible').click();
|
||||
cy.get('[data-e2e="continue-button-authmethod"]').click();
|
||||
cy.get('[data-e2e="redirect-uris"] input').focus().type('http://localhost:3000/api/auth/callback/zitadel');
|
||||
cy.get('[data-e2e="postlogout-uris"] input').focus().type('http://localhost:3000');
|
||||
cy.get('[data-e2e="redirect-uris"] input')
|
||||
.focus()
|
||||
.should('be.enabled')
|
||||
.type('http://localhost:3000/api/auth/callback/zitadel');
|
||||
cy.get('[data-e2e="postlogout-uris"] input').focus().should('be.enabled').type('http://localhost:3000');
|
||||
cy.get('[data-e2e="continue-button-redirecturis"]').click();
|
||||
cy.get('[data-e2e="create-button"]').click();
|
||||
cy.get('[id*=overlay]').should('exist');
|
||||
@@ -56,7 +59,7 @@ describe('applications', () => {
|
||||
|
||||
it('add device code app', () => {
|
||||
cy.get('[data-e2e="app-card-add"]').should('be.visible').click();
|
||||
cy.get('[formcontrolname="name"]').focus().type(testDEVICECODEAppName);
|
||||
cy.get('[formcontrolname="name"]').focus().should('be.enabled').type(testDEVICECODEAppName);
|
||||
cy.get('[for="N"]').click();
|
||||
cy.get('[data-e2e="continue-button-nameandtype"]').click();
|
||||
cy.get('[for="DEVICECODE"]').should('be.visible').click();
|
||||
|
@@ -28,14 +28,14 @@ describe('humans', () => {
|
||||
it('should add a user', () => {
|
||||
cy.get('[data-e2e="create-user-button"]').should('be.visible').click();
|
||||
cy.url().should('contain', 'users/create');
|
||||
cy.get('[formcontrolname="email"]').type('dummy@dummy.com');
|
||||
cy.get('[formcontrolname="email"]').should('be.enabled').type('dummy@dummy.com');
|
||||
//force needed due to the prefilled username prefix
|
||||
cy.get('[formcontrolname="userName"]').type(user.addName);
|
||||
cy.get('[formcontrolname="firstName"]').type('e2ehumanfirstname');
|
||||
cy.get('[formcontrolname="lastName"]').type('e2ehumanlastname');
|
||||
cy.get('[formcontrolname="userName"]').should('be.enabled').type(user.addName);
|
||||
cy.get('[formcontrolname="firstName"]').should('be.enabled').type('e2ehumanfirstname');
|
||||
cy.get('[formcontrolname="lastName"]').should('be.enabled').type('e2ehumanlastname');
|
||||
cy.get('mat-select[data-cy="country-calling-code"]').click();
|
||||
cy.contains('mat-option', 'Switzerland').scrollIntoView().click();
|
||||
cy.get('[formcontrolname="phone"]').type('123456789');
|
||||
cy.get('[formcontrolname="phone"]').should('be.enabled').type('123456789');
|
||||
cy.get('[data-e2e="create-button"]').click({ force: true });
|
||||
cy.shouldConfirmSuccess();
|
||||
let loginName = user.addName;
|
||||
@@ -58,7 +58,7 @@ describe('humans', () => {
|
||||
it('should delete a human user', () => {
|
||||
const rowSelector = `tr:contains(${user.removeName})`;
|
||||
cy.get(rowSelector).find('[data-e2e="enabled-delete-button"]').click({ force: true });
|
||||
cy.get('[data-e2e="confirm-dialog-input"]').focus().type(user.removeName);
|
||||
cy.get('[data-e2e="confirm-dialog-input"]').focus().should('be.enabled').type(user.removeName);
|
||||
cy.get('[data-e2e="confirm-dialog-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
cy.shouldNotExist({
|
||||
|
@@ -1,3 +1,10 @@
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
import { Context } from '../../../support/commands';
|
||||
import { ensureOrgExists } from '../../../support/api/orgs';
|
||||
import { activateSMTPProvider, ensureSMTPProviderExists } from '../../../support/api/smtp';
|
||||
import { ensureSMSProviderDoesntExist, ensureSMSProviderExists } from '../../../support/api/sms';
|
||||
|
||||
const notificationPath = `/instance?id=notifications`;
|
||||
const smtpPath = `/instance?id=smtpprovider`;
|
||||
const smsPath = `/instance?id=smsprovider`;
|
||||
@@ -6,6 +13,11 @@ beforeEach(() => {
|
||||
cy.context().as('ctx');
|
||||
});
|
||||
|
||||
type SMTPProvider = {
|
||||
description: string;
|
||||
rowSelector: string;
|
||||
};
|
||||
|
||||
describe('instance notifications', () => {
|
||||
describe('notification settings', () => {
|
||||
it(`should show notification settings`, () => {
|
||||
@@ -15,243 +27,195 @@ describe('instance notifications', () => {
|
||||
});
|
||||
|
||||
describe('smtp settings', () => {
|
||||
it(`should show SMTP provider settings`, () => {
|
||||
cy.visit(smtpPath);
|
||||
cy.contains('SMTP Provider');
|
||||
beforeEach(() => {
|
||||
const description = `mailgun-${uuidv4()}`;
|
||||
cy.wrap<SMTPProvider>({ description, rowSelector: `tr:contains('${description}')` }).as('provider');
|
||||
});
|
||||
|
||||
it(`should add Mailgun SMTP provider settings`, () => {
|
||||
let rowSelector = `a:contains('Mailgun')`;
|
||||
cy.visit(smtpPath);
|
||||
cy.get(rowSelector).click();
|
||||
cy.get('[formcontrolname="hostAndPort"]').should('have.value', 'smtp.mailgun.org:587');
|
||||
cy.get('[formcontrolname="user"]').clear().type('user@example.com');
|
||||
cy.get('[formcontrolname="password"]').clear().type('password');
|
||||
cy.get('[data-e2e="continue-to-2nd-form"]').click();
|
||||
cy.get('[formcontrolname="senderAddress"]').clear().type('sender1@example.com');
|
||||
cy.get('[formcontrolname="senderName"]').clear().type('Test1');
|
||||
cy.get('[formcontrolname="replyToAddress"]').clear().type('replyto1@example.com');
|
||||
cy.get('[data-e2e="continue-button"]').click();
|
||||
cy.get('[data-e2e="create-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
cy.get('[data-e2e="close-button"]').click();
|
||||
cy.get('tr').contains('mailgun');
|
||||
cy.get('tr').contains('smtp.mailgun.org:587');
|
||||
cy.get('tr').contains('sender1@example.com');
|
||||
});
|
||||
it(`should change Mailgun SMTP provider settings`, () => {
|
||||
let rowSelector = `tr:contains('mailgun')`;
|
||||
cy.visit(smtpPath);
|
||||
cy.get(rowSelector).click();
|
||||
cy.get('[formcontrolname="hostAndPort"]').should('have.value', 'smtp.mailgun.org:587');
|
||||
cy.get('[formcontrolname="user"]').should('have.value', 'user@example.com');
|
||||
cy.get('[formcontrolname="user"]').clear().type('change@example.com');
|
||||
cy.get('[data-e2e="continue-to-2nd-form"]').click();
|
||||
cy.get('[formcontrolname="senderAddress"]').should('have.value', 'sender1@example.com');
|
||||
cy.get('[formcontrolname="senderName"]').should('have.value', 'Test1');
|
||||
cy.get('[formcontrolname="replyToAddress"]').should('have.value', 'replyto1@example.com');
|
||||
cy.get('[formcontrolname="senderAddress"]').clear().type('senderchange1@example.com');
|
||||
cy.get('[formcontrolname="senderName"]').clear().type('Change1');
|
||||
cy.get('[data-e2e="continue-button"]').click();
|
||||
cy.get('[data-e2e="create-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
cy.get('[data-e2e="close-button"]').click();
|
||||
rowSelector = `tr:contains('mailgun')`;
|
||||
cy.get(rowSelector).contains('mailgun');
|
||||
cy.get(rowSelector).contains('smtp.mailgun.org:587');
|
||||
cy.get(rowSelector).contains('senderchange1@example.com');
|
||||
});
|
||||
it(`should activate Mailgun SMTP provider settings`, () => {
|
||||
let rowSelector = `tr:contains('smtp.mailgun.org:587')`;
|
||||
cy.visit(smtpPath);
|
||||
cy.get(rowSelector).find('[data-e2e="activate-provider-button"]').click({ force: true });
|
||||
cy.get('[data-e2e="confirm-dialog-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
rowSelector = `tr:contains('smtp.mailgun.org:587')`;
|
||||
cy.get(rowSelector).find('[data-e2e="active-provider"]');
|
||||
cy.get(rowSelector).contains('mailgun');
|
||||
cy.get(rowSelector).contains('smtp.mailgun.org:587');
|
||||
cy.get(rowSelector).contains('senderchange1@example.com');
|
||||
});
|
||||
it(`should add Mailjet SMTP provider settings`, () => {
|
||||
let rowSelector = `a:contains('Mailjet')`;
|
||||
cy.visit(smtpPath);
|
||||
cy.get(rowSelector).click();
|
||||
cy.get('[formcontrolname="hostAndPort"]').should('have.value', 'in-v3.mailjet.com:587');
|
||||
cy.get('[formcontrolname="user"]').clear().type('user@example.com');
|
||||
cy.get('[formcontrolname="password"]').clear().type('password');
|
||||
cy.get('[data-e2e="continue-to-2nd-form"]').click();
|
||||
cy.get('[formcontrolname="senderAddress"]').clear().type('sender2@example.com');
|
||||
cy.get('[formcontrolname="senderName"]').clear().type('Test2');
|
||||
cy.get('[formcontrolname="replyToAddress"]').clear().type('replyto2@example.com');
|
||||
cy.get('[data-e2e="continue-button"]').click();
|
||||
cy.get('[data-e2e="create-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
cy.get('[data-e2e="close-button"]').click();
|
||||
rowSelector = `tr:contains('mailjet')`;
|
||||
cy.get(rowSelector).contains('mailjet');
|
||||
cy.get(rowSelector).contains('in-v3.mailjet.com:587');
|
||||
cy.get(rowSelector).contains('sender2@example.com');
|
||||
});
|
||||
it(`should activate Mailjet SMTP provider settings an disable Mailgun`, () => {
|
||||
let rowSelector = `tr:contains('in-v3.mailjet.com:587')`;
|
||||
cy.visit(smtpPath);
|
||||
cy.get(rowSelector).find('[data-e2e="activate-provider-button"]').click({ force: true });
|
||||
cy.get('[data-e2e="confirm-dialog-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
cy.get(rowSelector).find('[data-e2e="active-provider"]');
|
||||
cy.get(rowSelector).contains('mailjet');
|
||||
cy.get(rowSelector).contains('in-v3.mailjet.com:587');
|
||||
cy.get(rowSelector).contains('sender2@example.com');
|
||||
rowSelector = `tr:contains('mailgun')`;
|
||||
cy.get(rowSelector).find('[data-e2e="active-provider"]').should('not.exist');
|
||||
});
|
||||
it(`should deactivate Mailjet SMTP provider`, () => {
|
||||
let rowSelector = `tr:contains('mailjet')`;
|
||||
cy.visit(smtpPath);
|
||||
cy.get(rowSelector).find('[data-e2e="deactivate-provider-button"]').click({ force: true });
|
||||
cy.get('[data-e2e="confirm-dialog-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
rowSelector = `tr:contains('mailjet')`;
|
||||
cy.get(rowSelector).find('[data-e2e="active-provider"]').should('not.exist');
|
||||
rowSelector = `tr:contains('mailgun')`;
|
||||
cy.get(rowSelector).find('[data-e2e="active-provider"]').should('not.exist');
|
||||
});
|
||||
it(`should delete Mailjet SMTP provider`, () => {
|
||||
let rowSelector = `tr:contains('mailjet')`;
|
||||
cy.visit(smtpPath);
|
||||
cy.get(rowSelector).find('[data-e2e="delete-provider-button"]').click({ force: true });
|
||||
cy.get('[data-e2e="confirm-dialog-input"]').focus().type('Test2');
|
||||
cy.get('[data-e2e="confirm-dialog-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
rowSelector = `tr:contains('mailjet')`;
|
||||
cy.get(rowSelector).should('not.exist');
|
||||
});
|
||||
it(`should delete Mailgun SMTP provider`, () => {
|
||||
let rowSelector = `tr:contains('mailgun')`;
|
||||
cy.visit(smtpPath);
|
||||
cy.get(rowSelector).find('[data-e2e="delete-provider-button"]').click({ force: true });
|
||||
cy.get('[data-e2e="confirm-dialog-input"]').focus().type('Change1');
|
||||
cy.get('[data-e2e="confirm-dialog-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
rowSelector = `tr:contains('mailgun')`;
|
||||
cy.get(rowSelector).should('not.exist');
|
||||
cy.get<SMTPProvider>('@provider').then((provider) => {
|
||||
cy.visit(smtpPath);
|
||||
cy.get(`a:contains('Mailgun')`).click();
|
||||
cy.get('[formcontrolname="description"]').should('be.enabled').clear().type(provider.description);
|
||||
cy.get('[formcontrolname="hostAndPort"]').should('have.value', 'smtp.mailgun.org:587');
|
||||
cy.get('[formcontrolname="user"]').should('be.enabled').clear().type('user@example.com');
|
||||
cy.get('[formcontrolname="password"]').should('be.enabled').clear().type('password');
|
||||
cy.get('[data-e2e="continue-to-2nd-form"]').should('be.enabled').click();
|
||||
cy.get('[formcontrolname="senderAddress"]').should('be.enabled').clear().type('sender1@example.com');
|
||||
cy.get('[formcontrolname="senderName"]').should('be.enabled').clear().type('Test1');
|
||||
cy.get('[formcontrolname="replyToAddress"]').should('be.enabled').clear().type('replyto1@example.com');
|
||||
cy.get('[data-e2e="continue-button"]').should('be.enabled').click();
|
||||
cy.get('[data-e2e="create-button"]').should('be.enabled').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
cy.get('[data-e2e="close-button"]').should('be.enabled').click();
|
||||
cy.get(provider.rowSelector).contains('smtp.mailgun.org:587');
|
||||
cy.get(provider.rowSelector).contains('sender1@example.com');
|
||||
});
|
||||
});
|
||||
|
||||
it(`should add Mailgun SMTP provider settings and activate it using wizard`, () => {
|
||||
let rowSelector = `a:contains('Mailgun')`;
|
||||
cy.visit(smtpPath);
|
||||
cy.get(rowSelector).click();
|
||||
cy.get('[formcontrolname="hostAndPort"]').should('have.value', 'smtp.mailgun.org:587');
|
||||
cy.get('[formcontrolname="user"]').clear().type('user@example.com');
|
||||
cy.get('[formcontrolname="password"]').clear().type('password');
|
||||
cy.get('[data-e2e="continue-to-2nd-form"]').click();
|
||||
cy.get('[formcontrolname="senderAddress"]').clear().type('sender1@example.com');
|
||||
cy.get('[formcontrolname="senderName"]').clear().type('Test1');
|
||||
cy.get('[formcontrolname="replyToAddress"]').clear().type('replyto1@example.com');
|
||||
cy.get('[data-e2e="continue-button"]').click();
|
||||
cy.get('[data-e2e="create-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
cy.get('[data-e2e="activate-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
cy.get('[data-e2e="close-button"]').click();
|
||||
rowSelector = `tr:contains('smtp.mailgun.org:587')`;
|
||||
cy.get(rowSelector).find('[data-e2e="active-provider"]');
|
||||
cy.get(rowSelector).contains('mailgun');
|
||||
cy.get(rowSelector).contains('smtp.mailgun.org:587');
|
||||
cy.get(rowSelector).contains('sender1@example.com');
|
||||
cy.get<SMTPProvider>('@provider').then((provider) => {
|
||||
cy.visit(smtpPath);
|
||||
cy.get(`a:contains('Mailgun')`).click();
|
||||
cy.get('[formcontrolname="description"]').should('be.enabled').clear().type(provider.description);
|
||||
cy.get('[formcontrolname="hostAndPort"]').should('have.value', 'smtp.mailgun.org:587');
|
||||
cy.get('[formcontrolname="user"]').should('be.enabled').clear().type('user@example.com');
|
||||
cy.get('[formcontrolname="password"]').should('be.enabled').clear().type('password');
|
||||
cy.get('[data-e2e="continue-to-2nd-form"]').should('be.enabled').click();
|
||||
cy.get('[formcontrolname="senderAddress"]').should('be.enabled').clear().type('sender1@example.com');
|
||||
cy.get('[formcontrolname="senderName"]').should('be.enabled').clear().type('Test1');
|
||||
cy.get('[formcontrolname="replyToAddress"]').should('be.enabled').clear().type('replyto1@example.com');
|
||||
cy.get('[data-e2e="continue-button"]').should('be.enabled').click();
|
||||
cy.get('[data-e2e="create-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
cy.get('[data-e2e="activate-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
cy.get('[data-e2e="close-button"]').click();
|
||||
cy.get(provider.rowSelector).find('[data-e2e="active-provider"]');
|
||||
cy.get(provider.rowSelector).contains('smtp.mailgun.org:587');
|
||||
cy.get(provider.rowSelector).contains('sender1@example.com');
|
||||
});
|
||||
});
|
||||
it(`should add Mailgun SMTP provider settings and deactivate it using wizard`, () => {
|
||||
let rowSelector = `tr:contains('mailgun')`;
|
||||
cy.visit(smtpPath);
|
||||
cy.get(rowSelector).click();
|
||||
cy.get('[data-e2e="continue-to-2nd-form"]').click();
|
||||
cy.get('[data-e2e="continue-button"]').click();
|
||||
cy.get('[data-e2e="create-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
cy.get('[data-e2e="deactivate-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
cy.get('[data-e2e="close-button"]').click();
|
||||
rowSelector = `tr:contains('mailgun')`;
|
||||
cy.get(rowSelector).find('[data-e2e="active-provider"]').should('not.exist');
|
||||
|
||||
describe('with inactive existing', () => {
|
||||
beforeEach(() => {
|
||||
cy.get<Context>('@ctx').then((ctx) => {
|
||||
cy.get<SMTPProvider>('@provider').then(({ description }) => {
|
||||
ensureSMTPProviderExists(ctx.api, description);
|
||||
});
|
||||
});
|
||||
cy.visit(smtpPath);
|
||||
});
|
||||
|
||||
it(`should change Mailgun SMTP provider settings`, () => {
|
||||
cy.get<SMTPProvider>('@provider').then(({ rowSelector }) => {
|
||||
cy.get(rowSelector).click();
|
||||
cy.get('[data-e2e="continue-to-2nd-form"]').click();
|
||||
cy.get('[formcontrolname="senderAddress"]').should('be.enabled').clear().type('senderchange1@example.com');
|
||||
cy.get('[formcontrolname="senderName"]').clear().type('Change1');
|
||||
cy.get('[data-e2e="continue-button"]').click();
|
||||
cy.get('[data-e2e="create-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
cy.get('[data-e2e="close-button"]').click();
|
||||
cy.get(rowSelector).contains('senderchange1@example.com');
|
||||
});
|
||||
});
|
||||
it(`should activate Mailgun SMTP provider settings`, () => {
|
||||
cy.get<SMTPProvider>('@provider').then(({ rowSelector }) => {
|
||||
cy.get(rowSelector).find('[data-e2e="activate-provider-button"]').click({ force: true });
|
||||
cy.get('[data-e2e="confirm-dialog-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
cy.get(rowSelector).find('[data-e2e="active-provider"]');
|
||||
});
|
||||
});
|
||||
|
||||
it(`should delete Mailgun SMTP provider`, () => {
|
||||
cy.get<SMTPProvider>('@provider').then(({ rowSelector }) => {
|
||||
cy.get(rowSelector).find('[data-e2e="delete-provider-button"]').click({ force: true });
|
||||
cy.get('[data-e2e="confirm-dialog-input"]').focus().should('be.enabled').type('A Sender');
|
||||
cy.get('[data-e2e="confirm-dialog-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
cy.get(rowSelector).should('not.exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
it(`should delete Mailgun SMTP provider`, () => {
|
||||
let rowSelector = `tr:contains('mailgun')`;
|
||||
cy.visit(smtpPath);
|
||||
cy.get(rowSelector).find('[data-e2e="delete-provider-button"]').click({ force: true });
|
||||
cy.get('[data-e2e="confirm-dialog-input"]').focus().type('Test1');
|
||||
cy.get('[data-e2e="confirm-dialog-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
rowSelector = `tr:contains('mailgun')`;
|
||||
cy.get(rowSelector).should('not.exist');
|
||||
describe('with active existing', () => {
|
||||
beforeEach(() => {
|
||||
cy.get<Context>('@ctx').then((ctx) => {
|
||||
cy.get<SMTPProvider>('@provider').then(({ description }) => {
|
||||
ensureSMTPProviderExists(ctx.api, description).then((providerId) => {
|
||||
activateSMTPProvider(ctx.api, providerId);
|
||||
});
|
||||
});
|
||||
});
|
||||
cy.pause();
|
||||
cy.visit(smtpPath);
|
||||
});
|
||||
|
||||
it(`should deactivate an existing Mailgun SMTP provider using wizard`, () => {
|
||||
cy.get<SMTPProvider>('@provider').then(({ rowSelector }) => {
|
||||
cy.get(rowSelector).click();
|
||||
cy.get('[data-e2e="continue-to-2nd-form"]').click();
|
||||
cy.get('[data-e2e="continue-button"]').click();
|
||||
cy.get('[data-e2e="create-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
cy.get('[data-e2e="deactivate-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
cy.get('[data-e2e="close-button"]').click();
|
||||
cy.get(rowSelector).find('[data-e2e="active-provider"]').should('not.exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('sms settings', () => {
|
||||
it(`should show SMS provider settings`, () => {
|
||||
cy.visit(smsPath);
|
||||
cy.contains('SMS Settings');
|
||||
beforeEach(() => {
|
||||
cy.wrap<string>(`twilio-${uuidv4()}`).as('uniqueSid');
|
||||
});
|
||||
|
||||
it(`should add SMS provider`, () => {
|
||||
cy.visit(smsPath);
|
||||
cy.get('[data-e2e="new-twilio-button"]').click();
|
||||
cy.get('[formcontrolname="sid"]').clear().type('test');
|
||||
cy.get('[formcontrolname="token"]').clear().type('token');
|
||||
cy.get('[formcontrolname="senderNumber"]').clear().type('2312123132');
|
||||
cy.get('[data-e2e="save-sms-settings-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
cy.get('h4').contains('Twilio');
|
||||
cy.get('.state').contains('Inactive');
|
||||
describe('without existing', () => {
|
||||
beforeEach(() => {
|
||||
cy.get<Context>('@ctx').then((ctx) => {
|
||||
ensureSMSProviderDoesntExist(ctx.api);
|
||||
});
|
||||
});
|
||||
|
||||
it(`should add SMS provider`, () => {
|
||||
cy.visit(smsPath);
|
||||
cy.get('[data-e2e="new-twilio-button"]').click();
|
||||
cy.get('[formcontrolname="sid"]').should('be.enabled').clear().type('test');
|
||||
cy.get('[formcontrolname="token"]').should('be.enabled').clear().type('token');
|
||||
cy.get('[formcontrolname="senderNumber"]').should('be.enabled').clear().type('2312123132');
|
||||
cy.get('[data-e2e="save-sms-settings-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
cy.get('h4').contains('Twilio');
|
||||
cy.get('.state').contains('Inactive');
|
||||
});
|
||||
});
|
||||
|
||||
it(`should activate SMS provider`, () => {
|
||||
cy.visit(smsPath);
|
||||
cy.get('h4').contains('Twilio');
|
||||
cy.get('.state').contains('Inactive');
|
||||
cy.get('[data-e2e="activate-sms-provider-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
cy.get('.state').contains('Active');
|
||||
});
|
||||
describe('with inactive existing', () => {
|
||||
beforeEach(() => {
|
||||
cy.get<Context>('@ctx').then((ctx) => {
|
||||
ensureSMSProviderExists(ctx.api);
|
||||
cy.visit(smsPath);
|
||||
});
|
||||
});
|
||||
|
||||
it(`should edit SMS provider`, () => {
|
||||
cy.visit(smsPath);
|
||||
cy.get('h4').contains('Twilio');
|
||||
cy.get('.state').contains('Active');
|
||||
cy.get('[data-e2e="new-twilio-button"]').click();
|
||||
cy.get('[formcontrolname="sid"]').should('have.value', 'test');
|
||||
cy.get('[formcontrolname="senderNumber"]').should('have.value', '2312123132');
|
||||
cy.get('[formcontrolname="sid"]').clear().type('test2');
|
||||
cy.get('[formcontrolname="senderNumber"]').clear().type('6666666666');
|
||||
cy.get('[data-e2e="save-sms-settings-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
});
|
||||
it(`should activate SMS provider`, () => {
|
||||
cy.get('h4').contains('Twilio');
|
||||
cy.get('.state').contains('Inactive');
|
||||
cy.get('[data-e2e="activate-sms-provider-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
cy.get('.state').contains('Active');
|
||||
});
|
||||
|
||||
it(`should contain edited values`, () => {
|
||||
cy.visit(smsPath);
|
||||
cy.get('h4').contains('Twilio');
|
||||
cy.get('.state').contains('Active');
|
||||
cy.get('[data-e2e="new-twilio-button"]').click();
|
||||
cy.get('[formcontrolname="sid"]').should('have.value', 'test2');
|
||||
cy.get('[formcontrolname="senderNumber"]').should('have.value', '6666666666');
|
||||
});
|
||||
it(`should edit SMS provider`, () => {
|
||||
cy.get('h4').contains('Twilio');
|
||||
cy.get('[data-e2e="new-twilio-button"]').click();
|
||||
cy.get('[formcontrolname="sid"]').should('be.enabled').clear().type('test2');
|
||||
cy.get('[formcontrolname="senderNumber"]').should('be.enabled').clear().type('6666666666');
|
||||
cy.get('[data-e2e="save-sms-settings-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
cy.get('[data-e2e="new-twilio-button"]').click();
|
||||
cy.get('[formcontrolname="sid"]').should('have.value', 'test2');
|
||||
cy.get('[formcontrolname="senderNumber"]').should('have.value', '6666666666');
|
||||
});
|
||||
|
||||
it(`should edit SMS provider token`, () => {
|
||||
cy.visit(smsPath);
|
||||
cy.get('h4').contains('Twilio');
|
||||
cy.get('.state').contains('Active');
|
||||
cy.get('[data-e2e="new-twilio-button"]').click();
|
||||
cy.get('[data-e2e="edit-sms-token-button"]').click();
|
||||
cy.get('[data-e2e="notification-setting-password"]').clear().type('newsupertoken');
|
||||
cy.get('[data-e2e="save-notification-setting-password-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
});
|
||||
it(`should edit SMS provider token`, () => {
|
||||
cy.get('h4').contains('Twilio');
|
||||
cy.get('[data-e2e="new-twilio-button"]').click();
|
||||
cy.get('[data-e2e="edit-sms-token-button"]').click();
|
||||
cy.get('[data-e2e="notification-setting-password"]').should('be.enabled').clear().type('newsupertoken');
|
||||
cy.get('[data-e2e="save-notification-setting-password-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
});
|
||||
|
||||
it(`should remove SMS provider`, () => {
|
||||
cy.visit(smsPath);
|
||||
cy.get('h4').contains('Twilio');
|
||||
cy.get('.state').contains('Active');
|
||||
cy.get('[data-e2e="remove-sms-provider-button"]').click();
|
||||
cy.get('[data-e2e="confirm-dialog-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
it(`should remove SMS provider`, () => {
|
||||
cy.get('h4').contains('Twilio');
|
||||
cy.get('[data-e2e="remove-sms-provider-button"]').click();
|
||||
cy.get('[data-e2e="confirm-dialog-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -101,7 +101,7 @@ describe('instance secret generators', () => {
|
||||
it(`Initialization Mail should update settings`, () => {
|
||||
cy.visit(secretGeneratorSettingsPath);
|
||||
cy.wait(1000);
|
||||
cy.get('input[id="length1"]').clear().type('64');
|
||||
cy.get('input[id="length1"]').should('be.enabled').clear().type('64');
|
||||
cy.get('mat-slide-toggle#includeLowerLetters1 button').click();
|
||||
cy.get('button[id="saveSecretGenerator1"]').click();
|
||||
cy.wait(1000);
|
||||
@@ -116,7 +116,7 @@ describe('instance secret generators', () => {
|
||||
it(`Email verification should update settings`, () => {
|
||||
cy.visit(secretGeneratorSettingsPath);
|
||||
cy.wait(1000);
|
||||
cy.get('input[id="length2"]').clear().type('64');
|
||||
cy.get('input[id="length2"]').should('be.enabled').clear().type('64');
|
||||
cy.get('mat-slide-toggle#includeUpperLetters2 button').click();
|
||||
cy.get('button[id="saveSecretGenerator2"]').click();
|
||||
cy.wait(1000);
|
||||
@@ -131,7 +131,7 @@ describe('instance secret generators', () => {
|
||||
it(`Phone verification should update settings`, () => {
|
||||
cy.visit(secretGeneratorSettingsPath);
|
||||
cy.wait(1000);
|
||||
cy.get('input[id="expiry3"]').clear().type('10');
|
||||
cy.get('input[id="expiry3"]').should('be.enabled').clear().type('10');
|
||||
cy.get('mat-slide-toggle#includeSymbols3 button').click();
|
||||
cy.get('button[id="saveSecretGenerator3"]').click();
|
||||
cy.wait(1000);
|
||||
@@ -146,7 +146,7 @@ describe('instance secret generators', () => {
|
||||
it(`Password Reset should update settings`, () => {
|
||||
cy.visit(secretGeneratorSettingsPath);
|
||||
cy.wait(1000);
|
||||
cy.get('input[id="expiry4"]').clear().type('5');
|
||||
cy.get('input[id="expiry4"]').should('be.enabled').clear().type('5');
|
||||
cy.get('mat-slide-toggle#includeDigits4 button').click();
|
||||
cy.get('button[id="saveSecretGenerator4"]').click();
|
||||
cy.wait(1000);
|
||||
@@ -161,7 +161,7 @@ describe('instance secret generators', () => {
|
||||
it(`Passwordless Initialization should update settings`, () => {
|
||||
cy.visit(secretGeneratorSettingsPath);
|
||||
cy.wait(1000);
|
||||
cy.get('input[id="length5"]').clear().type('64');
|
||||
cy.get('input[id="length5"]').should('be.enabled').clear().type('64');
|
||||
cy.get('mat-slide-toggle#includeDigits5 button').click();
|
||||
cy.get('button[id="saveSecretGenerator5"]').click();
|
||||
cy.wait(1000);
|
||||
@@ -176,8 +176,8 @@ describe('instance secret generators', () => {
|
||||
it(`App Secret should update settings`, () => {
|
||||
cy.visit(secretGeneratorSettingsPath);
|
||||
cy.wait(1000);
|
||||
cy.get('input[id="length6"]').clear().type('32');
|
||||
cy.get('input[id="expiry6"]').clear().type('120');
|
||||
cy.get('input[id="length6"]').should('be.enabled').clear().type('32');
|
||||
cy.get('input[id="expiry6"]').should('be.enabled').clear().type('120');
|
||||
cy.get('mat-slide-toggle#includeUpperLetters6 button').click();
|
||||
cy.get('button[id="saveSecretGenerator6"]').click();
|
||||
cy.wait(1000);
|
||||
@@ -192,7 +192,7 @@ describe('instance secret generators', () => {
|
||||
it(`One Time Password (OTP) - SMS should update settings`, () => {
|
||||
cy.visit(secretGeneratorSettingsPath);
|
||||
cy.wait(1000);
|
||||
cy.get('input[id="expiry7"]').clear().type('120');
|
||||
cy.get('input[id="expiry7"]').should('be.enabled').clear().type('120');
|
||||
cy.get('mat-slide-toggle#includeLowerLetters7 button').click();
|
||||
cy.get('button[id="saveSecretGenerator7"]').click();
|
||||
cy.wait(1000);
|
||||
@@ -207,8 +207,8 @@ describe('instance secret generators', () => {
|
||||
it(`One Time Password (OTP) should update settings`, () => {
|
||||
cy.visit(secretGeneratorSettingsPath);
|
||||
cy.wait(1000);
|
||||
cy.get('input[id="length8"]').clear().type('12');
|
||||
cy.get('input[id="expiry8"]').clear().type('90');
|
||||
cy.get('input[id="length8"]').should('be.enabled').clear().type('12');
|
||||
cy.get('input[id="expiry8"]').should('be.enabled').clear().type('90');
|
||||
cy.get('mat-slide-toggle#includeDigits8 button').click();
|
||||
cy.get('mat-slide-toggle#includeSymbols8 button').click();
|
||||
cy.get('button[id="saveSecretGenerator8"]').click();
|
||||
|
@@ -29,9 +29,9 @@ describe('machines', () => {
|
||||
cy.get('[data-e2e="create-user-button"]').should('be.visible').click();
|
||||
cy.url().should('contain', 'users/create-machine');
|
||||
//force needed due to the prefilled username prefix
|
||||
cy.get('[formcontrolname="userName"]').type(machine.addName);
|
||||
cy.get('[formcontrolname="name"]').type('e2emachinename');
|
||||
cy.get('[formcontrolname="description"]').type('e2emachinedescription');
|
||||
cy.get('[formcontrolname="userName"]').should('be.enabled').type(machine.addName);
|
||||
cy.get('[formcontrolname="name"]').should('be.enabled').type('e2emachinename');
|
||||
cy.get('[formcontrolname="description"]').should('be.enabled').type('e2emachinedescription');
|
||||
cy.get('[data-e2e="create-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
let loginName = machine.addName;
|
||||
@@ -58,7 +58,7 @@ describe('machines', () => {
|
||||
it('should delete a machine', () => {
|
||||
const rowSelector = `tr:contains(${machine.removeName})`;
|
||||
cy.get(rowSelector).find('[data-e2e="enabled-delete-button"]').click({ force: true });
|
||||
cy.get('[data-e2e="confirm-dialog-input"]').focus().type(loginName);
|
||||
cy.get('[data-e2e="confirm-dialog-input"]').focus().should('be.enabled').type(loginName);
|
||||
cy.get('[data-e2e="confirm-dialog-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
cy.shouldNotExist({
|
||||
|
@@ -18,7 +18,7 @@ describe('organizations', () => {
|
||||
describe('add and delete org', () => {
|
||||
it('should create an org', () => {
|
||||
cy.visit(orgsPathCreate);
|
||||
cy.get('[data-e2e="org-name-input"]').focus().clear().type(newOrg);
|
||||
cy.get('[data-e2e="org-name-input"]').focus().clear().should('be.enabled').type(newOrg);
|
||||
cy.get('[data-e2e="create-org-button"]').click();
|
||||
cy.contains('tr', newOrg);
|
||||
});
|
||||
@@ -30,7 +30,7 @@ describe('organizations', () => {
|
||||
cy.wait(1000);
|
||||
cy.get('[data-e2e="actions"]').click();
|
||||
cy.get('[data-e2e="delete"]', { timeout: 1000 }).should('be.visible').click();
|
||||
cy.get('[data-e2e="confirm-dialog-input"]').focus().clear().type(newOrg);
|
||||
cy.get('[data-e2e="confirm-dialog-input"]').focus().clear().should('be.enabled').type(newOrg);
|
||||
cy.get('[data-e2e="confirm-dialog-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
cy.contains('tr', newOrg).should('not.exist');
|
||||
@@ -49,7 +49,7 @@ describe('organizations', () => {
|
||||
cy.get('[data-e2e="actions"]').click();
|
||||
cy.get('[data-e2e="rename"]', { timeout: 1000 }).should('be.visible').click();
|
||||
|
||||
cy.get('[data-e2e="name"]').focus().clear().type(testOrgNameChange);
|
||||
cy.get('[data-e2e="name"]').focus().clear().should('be.enabled').type(testOrgNameChange);
|
||||
cy.get('[data-e2e="dialog-submit"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
cy.visit(orgPath);
|
||||
|
@@ -45,7 +45,7 @@ describe('permissions', () => {
|
||||
|
||||
it('should add a manager', () => {
|
||||
cy.get('[data-e2e="add-member-button"]').click();
|
||||
cy.get('[data-e2e="add-member-input"]').type(testManagerUsername);
|
||||
cy.get('[data-e2e="add-member-input"]').should('be.enabled').type(testManagerUsername);
|
||||
cy.get('[data-e2e="user-option"]').first().click();
|
||||
cy.contains('[data-e2e="role-checkbox"]', roles[0]).click();
|
||||
cy.get('[data-e2e="confirm-add-member-button"]').click();
|
||||
@@ -174,9 +174,9 @@ describe('permissions', () => {
|
||||
it('should add a role', () => {
|
||||
cy.get('[data-e2e="sidenav-element-roles"]').click();
|
||||
cy.get('[data-e2e="add-new-role"]').click();
|
||||
cy.get('[formcontrolname="key"]').type(testRoleName);
|
||||
cy.get('[formcontrolname="displayName"]').type('e2eroleundertestdisplay');
|
||||
cy.get('[formcontrolname="group"]').type('e2eroleundertestgroup');
|
||||
cy.get('[formcontrolname="key"]').should('be.enabled').type(testRoleName);
|
||||
cy.get('[formcontrolname="displayName"]').should('be.enabled').type('e2eroleundertestdisplay');
|
||||
cy.get('[formcontrolname="group"]').should('be.enabled').type('e2eroleundertestgroup');
|
||||
cy.get('[data-e2e="save-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
cy.contains('tr', testRoleName);
|
||||
|
@@ -1,29 +1,29 @@
|
||||
import { Context } from 'support/commands';
|
||||
import { ensureProjectDoesntExist, ensureProjectExists } from '../../support/api/projects';
|
||||
import { ensureProjectDoesntExist, ensureProjectExists, ensureRoleExists } from '../../support/api/projects';
|
||||
import { ensureOrgExists } from 'support/api/orgs';
|
||||
import { ensureProjectGrantDoesntExist, ensureProjectGrantExists } from '../../support/api/grants';
|
||||
|
||||
describe('projects', () => {
|
||||
beforeEach(() => {
|
||||
cy.context().as('ctx');
|
||||
});
|
||||
|
||||
const defaultOrg = 'e2eorgnewdefault';
|
||||
const foreignOrg = 'e2eorgnewdefault';
|
||||
const testProjectNameCreate = 'e2eprojectcreate';
|
||||
const testProjectNameDelete = 'e2eprojectdelete';
|
||||
const testProjectRole = 'e2eprojectrole';
|
||||
|
||||
describe('add project', () => {
|
||||
beforeEach(`ensure it doesn't exist already`, () => {
|
||||
cy.get<Context>('@ctx').then((ctx) => {
|
||||
ensureOrgExists(ctx, defaultOrg).then(() => {
|
||||
ensureProjectDoesntExist(ctx.api, testProjectNameCreate);
|
||||
cy.visit(`/projects`);
|
||||
});
|
||||
ensureProjectDoesntExist(ctx.api, testProjectNameCreate);
|
||||
cy.visit(`/projects`);
|
||||
});
|
||||
});
|
||||
|
||||
it('should add a project', () => {
|
||||
cy.get('.add-project-button').click({ force: true });
|
||||
cy.get('input').type(testProjectNameCreate);
|
||||
cy.get('input').should('be.enabled').type(testProjectNameCreate);
|
||||
cy.get('[data-e2e="continue-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
});
|
||||
@@ -32,41 +32,54 @@ describe('projects', () => {
|
||||
});
|
||||
|
||||
describe('create project grant', () => {
|
||||
const testRoleName = 'e2eroleundertestname';
|
||||
|
||||
beforeEach('ensure it exists', () => {
|
||||
cy.get<Context>('@ctx').then((ctx) => {
|
||||
ensureProjectExists(ctx.api, testProjectNameCreate).as('projectId');
|
||||
cy.get<number>('@projectId').then((projectId) => {
|
||||
cy.visit(`/projects/${projectId}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should add a role', () => {
|
||||
const testRoleName = 'e2eroleundertestname';
|
||||
cy.get<number>('@projectId').then((projectId) => {
|
||||
cy.visit(`/projects/${projectId}`);
|
||||
});
|
||||
cy.get('[data-e2e="sidenav-element-roles"]').click();
|
||||
cy.get('[data-e2e="add-new-role"]').click();
|
||||
cy.get('[formcontrolname="key"]').should('be.enabled').type(testRoleName);
|
||||
cy.get('[formcontrolname="displayName"]').type('e2eroleundertestdisplay');
|
||||
cy.get('[formcontrolname="group"]').type('e2eroleundertestgroup');
|
||||
cy.get('[data-e2e="role-key-input"]').should('be.enabled').type(testRoleName);
|
||||
cy.get('[formcontrolname="displayName"]').should('be.enabled').type('e2eroleundertestdisplay');
|
||||
cy.get('[formcontrolname="group"]').should('be.enabled').type('e2eroleundertestgroup');
|
||||
cy.get('[data-e2e="save-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
cy.contains('tr', testRoleName);
|
||||
});
|
||||
|
||||
it('should add a project grant', () => {
|
||||
const rowSelector = `tr:contains(${testRoleName})`;
|
||||
describe('with existing role, without project grant', () => {
|
||||
beforeEach(() => {
|
||||
cy.get<Context>('@ctx').then((ctx) => {
|
||||
cy.get<number>('@projectId').then((projectId) => {
|
||||
ensureOrgExists(ctx, foreignOrg).then((foreignOrgID) => {
|
||||
ensureRoleExists(ctx.api, projectId, testProjectRole);
|
||||
ensureProjectGrantDoesntExist(ctx, projectId, foreignOrgID);
|
||||
cy.visit(`/projects/${projectId}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
cy.get('[data-e2e="sidenav-element-projectgrants"]').click();
|
||||
cy.get('[data-e2e="create-project-grant-button"]').click();
|
||||
cy.get('[data-e2e="add-org-input"]').type(defaultOrg);
|
||||
cy.get('mat-option').contains(defaultOrg).click();
|
||||
cy.get('button').should('be.enabled');
|
||||
cy.get('[data-e2e="project-grant-continue"]').first().click();
|
||||
cy.get(rowSelector).find('input').click({ force: true });
|
||||
cy.get('[data-e2e="save-project-grant-button"]').click();
|
||||
cy.contains('tr', defaultOrg);
|
||||
cy.contains('tr', testRoleName);
|
||||
it('should add a project grant', () => {
|
||||
const rowSelector = `tr:contains(${testProjectRole})`;
|
||||
|
||||
cy.get('[data-e2e="sidenav-element-projectgrants"]').click();
|
||||
cy.get('[data-e2e="create-project-grant-button"]').click();
|
||||
cy.get('[data-e2e="add-org-input"]').should('be.enabled').type(foreignOrg);
|
||||
cy.get('mat-option').contains(foreignOrg).click();
|
||||
cy.get('button').should('be.enabled');
|
||||
cy.get('[data-e2e="project-grant-continue"]').first().click();
|
||||
cy.get(rowSelector).find('input').click({ force: true });
|
||||
cy.get('[data-e2e="save-project-grant-button"]').click();
|
||||
cy.contains('tr', foreignOrg);
|
||||
cy.contains('tr', testProjectRole);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -84,7 +97,7 @@ describe('projects', () => {
|
||||
cy.get('[data-e2e="toggle-grid"]').click();
|
||||
cy.get('[data-e2e="timestamp"]');
|
||||
cy.get(rowSelector).find('[data-e2e="delete-project-button"]').click({ force: true });
|
||||
cy.get('[data-e2e="confirm-dialog-input"]').focus().type(testProjectNameDelete);
|
||||
cy.get('[data-e2e="confirm-dialog-input"]').focus().should('be.enabled').type(testProjectNameDelete);
|
||||
cy.get('[data-e2e="confirm-dialog-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
cy.shouldNotExist({
|
||||
@@ -96,7 +109,7 @@ describe('projects', () => {
|
||||
it('removes the project from grid view', () => {
|
||||
const cardSelector = `[data-e2e="grid-card"]:contains(${testProjectNameDelete})`;
|
||||
cy.get(cardSelector).find('[data-e2e="delete-project-button"]').click({ force: true });
|
||||
cy.get('[data-e2e="confirm-dialog-input"]').focus().type(testProjectNameDelete);
|
||||
cy.get('[data-e2e="confirm-dialog-input"]').focus().should('be.enabled').type(testProjectNameDelete);
|
||||
cy.get('[data-e2e="confirm-dialog-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
cy.shouldNotExist({
|
||||
|
@@ -17,7 +17,6 @@ describe('external link settings', () => {
|
||||
});
|
||||
|
||||
describe('instance', () => {
|
||||
|
||||
beforeEach(`visit`, () => {
|
||||
cy.visit(`/instance?id=privacypolicy`);
|
||||
});
|
||||
@@ -94,5 +93,4 @@ describe('external link settings', () => {
|
||||
cy.get('[formcontrolname="docsLink"]').should('value', docsLink);
|
||||
});
|
||||
});
|
||||
})
|
||||
|
||||
});
|
||||
|
@@ -22,15 +22,25 @@ describe('oidc settings', () => {
|
||||
});
|
||||
|
||||
it(`should update oidc settings`, () => {
|
||||
cy.get('[formcontrolname="accessTokenLifetime"]').should('value', accessTokenPrecondition).clear().type('2');
|
||||
cy.get('[formcontrolname="idTokenLifetime"]').should('value', idTokenPrecondition).clear().type('24');
|
||||
cy.get('[formcontrolname="accessTokenLifetime"]')
|
||||
.should('value', accessTokenPrecondition)
|
||||
.clear()
|
||||
.should('be.enabled')
|
||||
.type('2');
|
||||
cy.get('[formcontrolname="idTokenLifetime"]')
|
||||
.should('value', idTokenPrecondition)
|
||||
.clear()
|
||||
.should('be.enabled')
|
||||
.type('24');
|
||||
cy.get('[formcontrolname="refreshTokenExpiration"]')
|
||||
.should('value', refreshTokenExpirationPrecondition)
|
||||
.clear()
|
||||
.should('be.enabled')
|
||||
.type('30');
|
||||
cy.get('[formcontrolname="refreshTokenIdleExpiration"]')
|
||||
.should('value', refreshTokenIdleExpirationPrecondition)
|
||||
.clear()
|
||||
.should('be.enabled')
|
||||
.type('7');
|
||||
cy.get('[data-e2e="save-button"]').click();
|
||||
cy.shouldConfirmSuccess();
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import { Context } from 'support/commands';
|
||||
import { ensureItemExists } from './ensure';
|
||||
import { ensureItemDoesntExist, ensureItemExists } from './ensure';
|
||||
import { getOrgUnderTest } from './orgs';
|
||||
import { API, Entity } from './types';
|
||||
|
||||
export function ensureProjectGrantExists(ctx: Context, foreignOrgId: string, foreignProjectId: string) {
|
||||
return getOrgUnderTest(ctx).then((orgUnderTest) => {
|
||||
@@ -16,3 +17,16 @@ export function ensureProjectGrantExists(ctx: Context, foreignOrgId: string, for
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
export function ensureProjectGrantDoesntExist(ctx: Context, projectId: number, foreignOrgId: string) {
|
||||
return getOrgUnderTest(ctx).then((orgUnderTest) => {
|
||||
console.log('removing grant to foreignOrgId', foreignOrgId, 'in orgUnderTest', orgUnderTest, 'projectId', projectId);
|
||||
return ensureItemDoesntExist(
|
||||
ctx.api,
|
||||
`${ctx.api.mgmtBaseURL}/projectgrants/_search`,
|
||||
(grant: any) => grant.grantedOrgId == foreignOrgId && grant.projectId == projectId,
|
||||
(grant: any) => `${ctx.api.mgmtBaseURL}/projects/${projectId}/grants/${grant.grantId}`,
|
||||
orgUnderTest.toString(),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
@@ -23,7 +23,11 @@ export function ensureProjectDoesntExist(api: API, projectName: string, orgId?:
|
||||
}
|
||||
|
||||
class ResourceType {
|
||||
constructor(public resourcePath: string, public compareProperty: string, public identifierProperty: string) {}
|
||||
constructor(
|
||||
public resourcePath: string,
|
||||
public compareProperty: string,
|
||||
public identifierProperty: string,
|
||||
) {}
|
||||
}
|
||||
|
||||
export const Apps = new ResourceType('apps', 'name', 'id');
|
||||
@@ -47,19 +51,16 @@ export function ensureProjectResourceDoesntExist(
|
||||
);
|
||||
}
|
||||
|
||||
export function ensureApplicationExists(api: API, projectId: number, appName: string) {
|
||||
export function ensureRoleExists(api: API, projectId: number, roleName: string) {
|
||||
return ensureItemExists(
|
||||
api,
|
||||
`${api.mgmtBaseURL}/projects/${projectId}/${Apps.resourcePath}/_search`,
|
||||
(resource: any) => resource.name === appName,
|
||||
`${api.mgmtBaseURL}/projects/${projectId}/${Apps.resourcePath}/oidc`,
|
||||
`${api.mgmtBaseURL}/projects/${projectId}/${Roles.resourcePath}/_search`,
|
||||
(resource: any) => resource.key === roleName,
|
||||
`${api.mgmtBaseURL}/projects/${projectId}/${Roles.resourcePath}`,
|
||||
{
|
||||
name: appName,
|
||||
redirectUris: ['https://e2eredirecturl.org'],
|
||||
responseTypes: ['OIDC_RESPONSE_TYPE_CODE'],
|
||||
grantTypes: ['OIDC_GRANT_TYPE_AUTHORIZATION_CODE'],
|
||||
authMethodType: 'OIDC_AUTH_METHOD_TYPE_NONE',
|
||||
postLogoutRedirectUris: ['https://e2elogoutredirecturl.org'],
|
||||
name: roleName,
|
||||
roleKey: roleName,
|
||||
displayName: roleName,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
28
e2e/cypress/support/api/sms.ts
Normal file
28
e2e/cypress/support/api/sms.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { ensureItemDoesntExist, ensureItemExists } from './ensure';
|
||||
import { API, Entity } from './types';
|
||||
import { ensureSMTPProviderExists } from './smtp';
|
||||
|
||||
export function ensureSMSProviderExists(api: API) {
|
||||
// remove and create
|
||||
ensureSMSProviderDoesntExist(api);
|
||||
return ensureItemExists(
|
||||
api,
|
||||
`${api.adminBaseURL}/sms/_search`,
|
||||
({ twilio: { sid: foundSid } }: any) => foundSid === 'initial-sid',
|
||||
`${api.adminBaseURL}/sms/twilio`,
|
||||
{
|
||||
sid: 'initial-sid',
|
||||
senderNumber: 'initial-senderNumber',
|
||||
token: 'initial-token',
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export function ensureSMSProviderDoesntExist(api: API) {
|
||||
return ensureItemDoesntExist(
|
||||
api,
|
||||
`${api.adminBaseURL}/sms/_search`,
|
||||
(provider: any) => !!provider,
|
||||
(provider) => `${api.adminBaseURL}/sms/${provider.id}`,
|
||||
);
|
||||
}
|
32
e2e/cypress/support/api/smtp.ts
Normal file
32
e2e/cypress/support/api/smtp.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { ensureItemDoesntExist, ensureItemExists } from './ensure';
|
||||
import { API, Entity } from './types';
|
||||
|
||||
export function ensureSMTPProviderExists(api: API, providerDescription: string) {
|
||||
return ensureItemExists(
|
||||
api,
|
||||
`${api.adminBaseURL}/smtp/_search`,
|
||||
(provider: any) => {
|
||||
return provider.description === providerDescription;
|
||||
},
|
||||
`${api.adminBaseURL}/smtp`,
|
||||
{
|
||||
name: providerDescription,
|
||||
description: providerDescription,
|
||||
senderAddress: 'a@sender.com',
|
||||
senderName: 'A Sender',
|
||||
host: 'smtp.host.com:587',
|
||||
user: 'smtpuser',
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export function activateSMTPProvider(api: API, providerId: string) {
|
||||
return cy.request({
|
||||
method: 'POST',
|
||||
url: `${api.adminBaseURL}/smtp/${providerId}/_activate`,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${api.token}`,
|
||||
},
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user