Merge branch 'main' into AUT-1372

This commit is contained in:
Jakub P.
2025-01-25 20:44:30 +01:00
240 changed files with 7212 additions and 1234 deletions

View File

@@ -166,6 +166,7 @@ test.describe('Role management page', () => {
);
await expect(snackbar.variant).toBe('success');
});
await test.step('Create a new user with the "Delete Role" role', async () => {
await adminUsersPage.navigateTo();
await adminUsersPage.createUserButton.click();
@@ -181,22 +182,18 @@ test.describe('Role management page', () => {
await adminCreateUserPage.invitationEmailInfoAlert.waitFor({
state: 'attached',
});
const snackbar = await adminUsersPage.getSnackbarData(
'snackbar-create-user-success'
);
await expect(snackbar.variant).toBe('success');
await adminCreateUserPage.expectCreateUserSuccessAlertToBeVisible();
});
await test.step('Try to delete "Delete Role" role when new user has it', async () => {
await adminRolesPage.navigateTo();
const row = await adminRolesPage.getRoleRowByName('Delete Role');
const modal = await adminRolesPage.clickDeleteRole(row);
await modal.deleteButton.click();
const snackbar = await adminRolesPage.getSnackbarData(
'snackbar-delete-role-error'
);
await expect(snackbar.variant).toBe('error');
await expect(modal.deleteAlert).toHaveCount(1);
await modal.close();
});
await test.step('Change the role the user has', async () => {
await adminUsersPage.navigateTo();
await adminUsersPage.usersLoader.waitFor({
@@ -263,11 +260,9 @@ test.describe('Role management page', () => {
await adminCreateUserPage.invitationEmailInfoAlert.waitFor({
state: 'attached',
});
const snackbar = await adminCreateUserPage.getSnackbarData(
'snackbar-create-user-success'
);
await expect(snackbar.variant).toBe('success');
await adminCreateUserPage.expectCreateUserSuccessAlertToBeVisible();
});
await test.step('Delete this user', async () => {
await adminUsersPage.navigateTo();
const row = await adminUsersPage.findUserPageWithEmail(
@@ -285,16 +280,8 @@ test.describe('Role management page', () => {
const row = await adminRolesPage.getRoleRowByName('Cannot Delete Role');
const modal = await adminRolesPage.clickDeleteRole(row);
await modal.deleteButton.click();
const snackbar = await adminRolesPage.getSnackbarData(
'snackbar-delete-role-error'
);
await expect(snackbar.variant).toBe('error');
/*
* TODO: await snackbar - make assertions based on product
* decisions
const snackbar = await adminRolesPage.getSnackbarData();
await expect(snackbar.variant).toBe('...');
*/
await expect(modal.deleteAlert).toHaveCount(1);
await adminRolesPage.closeSnackbar();
});
});
});
@@ -335,10 +322,7 @@ test('Accessibility of role management page', async ({
await adminCreateUserPage.invitationEmailInfoAlert.waitFor({
state: 'attached',
});
const snackbar = await adminCreateUserPage.getSnackbarData(
'snackbar-create-user-success'
);
await expect(snackbar.variant).toBe('success');
await adminCreateUserPage.expectCreateUserSuccessAlertToBeVisible();
});
await test.step('Logout and login to the basic role user', async () => {

View File

@@ -36,11 +36,7 @@ test.describe('User management page', () => {
await adminCreateUserPage.invitationEmailInfoAlert.waitFor({
state: 'attached',
});
const snackbar = await adminUsersPage.getSnackbarData(
'snackbar-create-user-success'
);
await expect(snackbar.variant).toBe('success');
await adminCreateUserPage.expectCreateUserSuccessAlertToBeVisible();
await adminUsersPage.navigateTo();
});
await test.step('Check the user exists with the expected properties', async () => {
@@ -65,6 +61,7 @@ test.describe('User management page', () => {
'snackbar-edit-user-success'
);
await expect(snackbar.variant).toBe('success');
await adminUsersPage.closeSnackbar();
await adminUsersPage.findUserPageWithEmail(user.email);
userRow = await adminUsersPage.getUserRowByEmail(user.email);
@@ -82,6 +79,7 @@ test.describe('User management page', () => {
'snackbar-delete-user-success'
);
await expect(snackbar.variant).toBe('success');
await adminUsersPage.closeSnackbar();
await expect(userRow).not.toBeVisible(false);
});
});
@@ -92,7 +90,6 @@ test.describe('User management page', () => {
}) => {
adminCreateUserPage.seed(9100);
const testUser = adminCreateUserPage.generateUser();
await test.step('Create the test user', async () => {
await adminUsersPage.navigateTo();
await adminUsersPage.createUserButton.click();
@@ -103,10 +100,7 @@ test.describe('User management page', () => {
.getByRole('option', { name: 'Admin' })
.click();
await adminCreateUserPage.createButton.click();
const snackbar = await adminUsersPage.getSnackbarData(
'snackbar-create-user-success'
);
await expect(snackbar.variant).toBe('success');
await adminCreateUserPage.expectCreateUserSuccessAlertToBeVisible();
});
await test.step('Delete the created user', async () => {
@@ -121,6 +115,7 @@ test.describe('User management page', () => {
);
await expect(snackbar).not.toBeNull();
await expect(snackbar.variant).toBe('success');
await adminUsersPage.closeSnackbar();
await expect(userRow).not.toBeVisible(false);
});
@@ -133,8 +128,7 @@ test.describe('User management page', () => {
.getByRole('option', { name: 'Admin' })
.click();
await adminCreateUserPage.createButton.click();
const snackbar = await adminUsersPage.getSnackbarData('snackbar-error');
await expect(snackbar.variant).toBe('error');
await expect(adminCreateUserPage.fieldError).toHaveCount(1);
});
});
@@ -155,10 +149,7 @@ test.describe('User management page', () => {
.getByRole('option', { name: 'Admin' })
.click();
await adminCreateUserPage.createButton.click();
const snackbar = await adminUsersPage.getSnackbarData(
'snackbar-create-user-success'
);
await expect(snackbar.variant).toBe('success');
await adminCreateUserPage.expectCreateUserSuccessAlertToBeVisible();
});
await test.step('Create the user again', async () => {
@@ -174,8 +165,7 @@ test.describe('User management page', () => {
await adminCreateUserPage.createButton.click();
await expect(page.url()).toBe(createUserPageUrl);
const snackbar = await adminUsersPage.getSnackbarData('snackbar-error');
await expect(snackbar.variant).toBe('error');
await expect(adminCreateUserPage.fieldError).toHaveCount(1);
});
});
@@ -198,11 +188,7 @@ test.describe('User management page', () => {
.getByRole('option', { name: 'Admin' })
.click();
await adminCreateUserPage.createButton.click();
const snackbar = await adminUsersPage.getSnackbarData(
'snackbar-create-user-success'
);
await expect(snackbar.variant).toBe('success');
await adminUsersPage.closeAllSnackbars();
await adminCreateUserPage.expectCreateUserSuccessAlertToBeVisible();
});
await test.step('Create the second user', async () => {
@@ -215,10 +201,7 @@ test.describe('User management page', () => {
.getByRole('option', { name: 'Admin' })
.click();
await adminCreateUserPage.createButton.click();
const snackbar = await adminUsersPage.getSnackbarData(
'snackbar-create-user-success'
);
await expect(snackbar.variant).toBe('success');
await adminCreateUserPage.expectCreateUserSuccessAlertToBeVisible();
});
await test.step('Try editing the second user to have the email of the first user', async () => {
@@ -231,8 +214,7 @@ test.describe('User management page', () => {
const editPageUrl = page.url();
await adminEditUserPage.updateButton.click();
const snackbar = await adminUsersPage.getSnackbarData('snackbar-error');
await expect(snackbar.variant).toBe('error');
await expect(adminEditUserPage.fieldError).toHaveCount(1);
await expect(page.url()).toBe(editPageUrl);
});
});

View File

@@ -7,198 +7,191 @@ test('Ensure creating a new flow works', async ({ page }) => {
);
});
test(
'Create a new flow with a Scheduler step then an Ntfy step',
async ({ flowEditorPage, page }) => {
await test.step('create flow', async () => {
await test.step('navigate to new flow page', async () => {
await page.getByTestId('create-flow-button').click();
await page.waitForURL(
/\/editor\/[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}/
);
test('Create a new flow with a Scheduler step then an Ntfy step', async ({
flowEditorPage,
page,
}) => {
await test.step('create flow', async () => {
await test.step('navigate to new flow page', async () => {
await page.getByTestId('create-flow-button').click();
await page.waitForURL(
/\/editor\/[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}/
);
});
await test.step('has two steps by default', async () => {
await expect(page.getByTestId('flow-step')).toHaveCount(2);
});
});
await test.step('setup Scheduler trigger', async () => {
await test.step('choose app and event substep', async () => {
await test.step('choose application', async () => {
await flowEditorPage.appAutocomplete.click();
await page.getByRole('option', { name: 'Scheduler' }).click();
});
await test.step('has two steps by default', async () => {
await expect(page.getByTestId('flow-step')).toHaveCount(2);
await test.step('choose and event', async () => {
await expect(flowEditorPage.eventAutocomplete).toBeVisible();
await flowEditorPage.eventAutocomplete.click();
await page.getByRole('option', { name: 'Every hour' }).click();
});
await test.step('continue to next step', async () => {
await flowEditorPage.continueButton.click();
});
await test.step('collapses the substep', async () => {
await expect(flowEditorPage.appAutocomplete).not.toBeVisible();
await expect(flowEditorPage.eventAutocomplete).not.toBeVisible();
});
});
await test.step('setup Scheduler trigger', async () => {
await test.step('choose app and event substep', async () => {
await test.step('choose application', async () => {
await flowEditorPage.appAutocomplete.click();
await page
.getByRole('option', { name: 'Scheduler' })
.click();
});
await test.step('choose and event', async () => {
await expect(flowEditorPage.eventAutocomplete).toBeVisible();
await flowEditorPage.eventAutocomplete.click();
await page
.getByRole('option', { name: 'Every hour' })
.click();
});
await test.step('continue to next step', async () => {
await flowEditorPage.continueButton.click();
});
await test.step('collapses the substep', async () => {
await expect(flowEditorPage.appAutocomplete).not.toBeVisible();
await expect(flowEditorPage.eventAutocomplete).not.toBeVisible();
});
await test.step('set up a trigger', async () => {
await test.step('choose "yes" in "trigger on weekends?"', async () => {
await expect(flowEditorPage.trigger).toBeVisible();
await flowEditorPage.trigger.click();
await page.getByRole('option', { name: 'Yes' }).click();
});
await test.step('set up a trigger', async () => {
await test.step('choose "yes" in "trigger on weekends?"', async () => {
await expect(flowEditorPage.trigger).toBeVisible();
await flowEditorPage.trigger.click();
await page.getByRole('option', { name: 'Yes' }).click();
});
await test.step('continue to next step', async () => {
await flowEditorPage.continueButton.click();
});
await test.step('collapses the substep', async () => {
await expect(flowEditorPage.trigger).not.toBeVisible();
});
await test.step('continue to next step', async () => {
await flowEditorPage.continueButton.click();
});
await test.step('test trigger', async () => {
await test.step('show sample output', async () => {
await expect(flowEditorPage.testOutput).not.toBeVisible();
await flowEditorPage.continueButton.click();
await expect(flowEditorPage.testOutput).toBeVisible();
await flowEditorPage.screenshot({
path: 'Scheduler trigger test output.png',
});
await flowEditorPage.continueButton.click();
});
await test.step('collapses the substep', async () => {
await expect(flowEditorPage.trigger).not.toBeVisible();
});
});
await test.step('arrange Ntfy action', async () => {
await test.step('choose app and event substep', async () => {
await test.step('choose application', async () => {
await flowEditorPage.appAutocomplete.click();
await page.getByRole('option', { name: 'Ntfy' }).click();
});
await test.step('choose an event', async () => {
await expect(flowEditorPage.eventAutocomplete).toBeVisible();
await flowEditorPage.eventAutocomplete.click();
await page
.getByRole('option', { name: 'Send message' })
.click();
});
await test.step('continue to next step', async () => {
await flowEditorPage.continueButton.click();
});
await test.step('collapses the substep', async () => {
await expect(flowEditorPage.appAutocomplete).not.toBeVisible();
await expect(flowEditorPage.eventAutocomplete).not.toBeVisible();
});
});
await test.step('choose connection substep', async () => {
await test.step('choose connection list item', async () => {
await flowEditorPage.connectionAutocomplete.click();
await page.getByRole('option').first().click();
});
await test.step('continue to next step', async () => {
await flowEditorPage.continueButton.click();
});
await test.step('collapses the substep', async () => {
await expect(flowEditorPage.connectionAutocomplete).not.toBeVisible();
});
});
await test.step('set up action substep', async () => {
await test.step('fill topic and message body', async () => {
await page
.getByTestId('parameters.topic-power-input')
.locator('[contenteditable]')
.fill('Topic');
await page
.getByTestId('parameters.message-power-input')
.locator('[contenteditable]')
.fill('Message body');
});
await test.step('continue to next step', async () => {
await flowEditorPage.continueButton.click();
});
await test.step('collapses the substep', async () => {
await expect(flowEditorPage.connectionAutocomplete).not.toBeVisible();
});
});
await test.step('test trigger substep', async () => {
await test.step('show sample output', async () => {
await expect(flowEditorPage.testOutput).not.toBeVisible();
await page
.getByTestId('flow-substep-continue-button')
.first()
.click();
await expect(flowEditorPage.testOutput).toBeVisible();
await flowEditorPage.screenshot({
path: 'Ntfy action test output.png',
});
await flowEditorPage.continueButton.click();
});
});
});
await test.step('publish and unpublish', async () => {
await test.step('publish flow', async () => {
await expect(flowEditorPage.unpublishFlowButton).not.toBeVisible();
await expect(flowEditorPage.publishFlowButton).toBeVisible();
await flowEditorPage.publishFlowButton.click();
await expect(flowEditorPage.publishFlowButton).not.toBeVisible();
});
await test.step('shows read-only sticky snackbar', async () => {
await expect(flowEditorPage.infoSnackbar).toBeVisible();
await test.step('test trigger', async () => {
await test.step('show sample output', async () => {
await expect(flowEditorPage.testOutput).not.toBeVisible();
await flowEditorPage.continueButton.click();
await expect(flowEditorPage.testOutput).toBeVisible();
await flowEditorPage.screenshot({
path: 'Published flow.png',
path: 'Scheduler trigger test output.png',
});
await flowEditorPage.continueButton.click();
});
await test.step('unpublish from snackbar', async () => {
});
});
await test.step('arrange Ntfy action', async () => {
await test.step('choose app and event substep', async () => {
await test.step('choose application', async () => {
await flowEditorPage.appAutocomplete.click();
await page.getByRole('option', { name: 'Ntfy' }).click();
});
await test.step('choose an event', async () => {
await expect(flowEditorPage.eventAutocomplete).toBeVisible();
await flowEditorPage.eventAutocomplete.click();
await page.getByRole('option', { name: 'Send message' }).click();
});
await test.step('continue to next step', async () => {
await flowEditorPage.continueButton.click();
});
await test.step('collapses the substep', async () => {
await expect(flowEditorPage.appAutocomplete).not.toBeVisible();
await expect(flowEditorPage.eventAutocomplete).not.toBeVisible();
});
});
await test.step('choose connection substep', async () => {
await test.step('choose connection list item', async () => {
await flowEditorPage.connectionAutocomplete.click();
await page
.getByTestId('unpublish-flow-from-snackbar')
.getByRole('option')
.filter({ hasText: 'Add new connection' })
.click();
await expect(flowEditorPage.infoSnackbar).not.toBeVisible();
});
await test.step('publish once again', async () => {
await expect(flowEditorPage.publishFlowButton).toBeVisible();
await flowEditorPage.publishFlowButton.click();
await expect(flowEditorPage.publishFlowButton).not.toBeVisible();
await test.step('continue to next step', async () => {
await page.getByTestId('create-connection-button').click();
});
await test.step('unpublish from layout top bar', async () => {
await expect(flowEditorPage.unpublishFlowButton).toBeVisible();
await flowEditorPage.unpublishFlowButton.click();
await expect(flowEditorPage.unpublishFlowButton).not.toBeVisible();
await test.step('collapses the substep', async () => {
await flowEditorPage.continueButton.click();
await expect(flowEditorPage.connectionAutocomplete).not.toBeVisible();
});
});
await test.step('set up action substep', async () => {
await test.step('fill topic and message body', async () => {
await page
.getByTestId('parameters.topic-power-input')
.locator('[contenteditable]')
.fill('Topic');
await page
.getByTestId('parameters.message-power-input')
.locator('[contenteditable]')
.fill('Message body');
});
await test.step('continue to next step', async () => {
await flowEditorPage.continueButton.click();
});
await test.step('collapses the substep', async () => {
await expect(flowEditorPage.connectionAutocomplete).not.toBeVisible();
});
});
await test.step('test trigger substep', async () => {
await test.step('show sample output', async () => {
await expect(flowEditorPage.testOutput).not.toBeVisible();
await page.getByTestId('flow-substep-continue-button').first().click();
await expect(flowEditorPage.testOutput).toBeVisible();
await flowEditorPage.screenshot({
path: 'Unpublished flow.png',
path: 'Ntfy action test output.png',
});
await flowEditorPage.continueButton.click();
});
});
await test.step('in layout', async () => {
await test.step('can go back to flows page', async () => {
await page.getByTestId('editor-go-back-button').click();
await expect(page).toHaveURL('/flows');
});
await test.step('publish and unpublish', async () => {
await test.step('publish flow', async () => {
await expect(flowEditorPage.unpublishFlowButton).not.toBeVisible();
await expect(flowEditorPage.publishFlowButton).toBeVisible();
await flowEditorPage.publishFlowButton.click();
await expect(flowEditorPage.publishFlowButton).not.toBeVisible();
});
await test.step('shows read-only sticky snackbar', async () => {
await expect(flowEditorPage.infoSnackbar).toBeVisible();
await flowEditorPage.screenshot({
path: 'Published flow.png',
});
});
}
);
await test.step('unpublish from snackbar', async () => {
await page.getByTestId('unpublish-flow-from-snackbar').click();
await expect(flowEditorPage.infoSnackbar).not.toBeVisible();
});
await test.step('publish once again', async () => {
await expect(flowEditorPage.publishFlowButton).toBeVisible();
await flowEditorPage.publishFlowButton.click();
await expect(flowEditorPage.publishFlowButton).not.toBeVisible();
});
await test.step('unpublish from layout top bar', async () => {
await expect(flowEditorPage.unpublishFlowButton).toBeVisible();
await flowEditorPage.unpublishFlowButton.click();
await expect(flowEditorPage.unpublishFlowButton).not.toBeVisible();
await flowEditorPage.screenshot({
path: 'Unpublished flow.png',
});
});
});
await test.step('in layout', async () => {
await test.step('can go back to flows page', async () => {
await page.getByTestId('editor-go-back-button').click();
await expect(page).toHaveURL('/flows');
});
});
});

View File

@@ -8,40 +8,41 @@ const { getToken } = require('../../helpers/auth-api-helper');
publicTest.describe('My Profile', () => {
let testUser;
publicTest.beforeEach(
async ({ adminCreateUserPage, loginPage, page }) => {
let addUserResponse;
const apiRequest = await request.newContext();
publicTest.beforeEach(async ({ adminCreateUserPage, loginPage, page }) => {
let addUserResponse;
const apiRequest = await request.newContext();
adminCreateUserPage.seed(
Math.ceil(Math.random() * Number.MAX_SAFE_INTEGER)
adminCreateUserPage.seed(
Math.ceil(Math.random() * Number.MAX_SAFE_INTEGER)
);
testUser = adminCreateUserPage.generateUser();
await publicTest.step('create new user', async () => {
const tokenJsonResponse = await getToken(apiRequest);
addUserResponse = await addUser(
apiRequest,
tokenJsonResponse.data.token,
{
fullName: testUser.fullName,
email: testUser.email,
}
);
testUser = adminCreateUserPage.generateUser();
});
await publicTest.step('create new user', async () => {
const tokenJsonResponse = await getToken(apiRequest);
addUserResponse = await addUser(
apiRequest,
tokenJsonResponse.data.token,
{
fullName: testUser.fullName,
email: testUser.email,
}
);
await publicTest.step('accept invitation', async () => {
let acceptToken = addUserResponse.data.acceptInvitationUrl.split('=')[1];
await acceptInvitation(apiRequest, {
token: acceptToken,
password: LoginPage.defaultPassword,
});
});
await publicTest.step('accept invitation', async () => {
let acceptToken = addUserResponse.data.acceptInvitationUrl.split('=')[1];
await acceptInvitation(apiRequest, {token:acceptToken, password:LoginPage.defaultPassword});
});
await publicTest.step('login as new Admin', async () => {
await loginPage.login(testUser.email, LoginPage.defaultPassword);
await expect(loginPage.loginButton).not.toBeVisible();
await expect(page).toHaveURL('/flows');
});
}
);
await publicTest.step('login as new Admin', async () => {
await loginPage.login(testUser.email, LoginPage.defaultPassword);
await expect(loginPage.loginButton).not.toBeVisible();
await expect(page).toHaveURL('/flows');
});
});
publicTest('user should be able to change own data', async ({ page }) => {
const myProfilePage = new MyProfilePage(page);