Merge branch 'main' into AUT-1379
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { BasePage } from "./base-page";
|
||||
import { BasePage } from './base-page';
|
||||
const { faker } = require('@faker-js/faker');
|
||||
const { expect } = require('@playwright/test');
|
||||
|
||||
@@ -6,16 +6,18 @@ export class AdminSetupPage extends BasePage {
|
||||
path = '/installation';
|
||||
|
||||
/**
|
||||
* @param {import('@playwright/test').Page} page
|
||||
*/
|
||||
* @param {import('@playwright/test').Page} page
|
||||
*/
|
||||
constructor(page) {
|
||||
super(page);
|
||||
|
||||
this.fullNameTextField = this.page.getByTestId('fullName-text-field');
|
||||
this.emailTextField = this.page.getByTestId('email-text-field');
|
||||
this.passwordTextField = this.page.getByTestId('password-text-field');
|
||||
this.repeatPasswordTextField = this.page.getByTestId('repeat-password-text-field');
|
||||
this.createAdminButton = this.page.getByTestId('signUp-button');
|
||||
this.repeatPasswordTextField = this.page.getByTestId(
|
||||
'repeat-password-text-field'
|
||||
);
|
||||
this.createAdminButton = this.page.getByTestId('installation-button');
|
||||
this.invalidFields = this.page.locator('p.Mui-error');
|
||||
this.successAlert = this.page.getByTestId('success-alert');
|
||||
}
|
||||
@@ -46,7 +48,7 @@ export class AdminSetupPage extends BasePage {
|
||||
await this.repeatPasswordTextField.fill(testUser.wronglyRepeatedPassword);
|
||||
}
|
||||
|
||||
async submitAdminForm() {
|
||||
async submitAdminForm() {
|
||||
await this.createAdminButton.click();
|
||||
}
|
||||
|
||||
@@ -59,7 +61,10 @@ export class AdminSetupPage extends BasePage {
|
||||
}
|
||||
|
||||
async expectSuccessMessageToContainLoginLink() {
|
||||
await expect(await this.successAlert.locator('a')).toHaveAttribute('href', '/login');
|
||||
await expect(await this.successAlert.locator('a')).toHaveAttribute(
|
||||
'href',
|
||||
'/login'
|
||||
);
|
||||
}
|
||||
|
||||
generateUser() {
|
||||
@@ -69,7 +74,7 @@ export class AdminSetupPage extends BasePage {
|
||||
fullName: faker.person.fullName(),
|
||||
email: faker.internet.email(),
|
||||
password: faker.internet.password(),
|
||||
wronglyRepeatedPassword: faker.internet.password()
|
||||
wronglyRepeatedPassword: faker.internet.password(),
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,19 +2,25 @@ import { expect } from '@playwright/test';
|
||||
|
||||
const { AuthenticatedPage } = require('../authenticated-page');
|
||||
|
||||
export class AdminApplicationAuthClientsPage extends AuthenticatedPage {
|
||||
export class AdminApplicationOAuthClientsPage extends AuthenticatedPage {
|
||||
/**
|
||||
* @param {import('@playwright/test').Page} page
|
||||
*/
|
||||
constructor(page) {
|
||||
super(page);
|
||||
|
||||
this.authClientsTab = this.page.getByText('AUTH CLIENTS');
|
||||
this.authClientsTab = this.page.getByTestId('oauth-clients-tab');
|
||||
this.saveButton = this.page.getByTestId('submitButton');
|
||||
this.successSnackbar = this.page.getByTestId('snackbar-save-admin-apps-settings-success');
|
||||
this.successSnackbar = this.page.getByTestId(
|
||||
'snackbar-save-admin-apps-settings-success'
|
||||
);
|
||||
this.createFirstAuthClientButton = this.page.getByTestId('no-results');
|
||||
this.createAuthClientButton = this.page.getByTestId('create-auth-client-button');
|
||||
this.submitAuthClientFormButton = this.page.getByTestId('submit-auth-client-form');
|
||||
this.createAuthClientButton = this.page.getByTestId(
|
||||
'create-auth-client-button'
|
||||
);
|
||||
this.submitAuthClientFormButton = this.page.getByTestId(
|
||||
'submit-auth-client-form'
|
||||
);
|
||||
this.authClientEntry = this.page.getByTestId('auth-client');
|
||||
}
|
||||
|
||||
@@ -35,6 +41,8 @@ export class AdminApplicationAuthClientsPage extends AuthenticatedPage {
|
||||
}
|
||||
|
||||
async authClientShouldBeVisible(authClientName) {
|
||||
await expect(this.authClientEntry.filter({ hasText: authClientName })).toBeVisible();
|
||||
await expect(
|
||||
this.authClientEntry.filter({ hasText: authClientName })
|
||||
).toBeVisible();
|
||||
}
|
||||
}
|
||||
@@ -8,56 +8,45 @@ export class AdminApplicationSettingsPage extends AuthenticatedPage {
|
||||
constructor(page) {
|
||||
super(page);
|
||||
|
||||
this.allowCustomConnectionsSwitch = this.page.locator(
|
||||
'[name="customConnectionAllowed"]'
|
||||
this.useOnlyPredefinedAuthClients = page.locator(
|
||||
'[name="useOnlyPredefinedAuthClients"]'
|
||||
);
|
||||
this.allowSharedConnectionsSwitch = this.page.locator('[name="shared"]');
|
||||
this.disableConnectionsSwitch = this.page.locator('[name="disabled"]');
|
||||
this.saveButton = this.page.getByTestId('submit-button');
|
||||
this.successSnackbar = this.page.getByTestId(
|
||||
this.disableConnectionsSwitch = page.locator('[name="disabled"]');
|
||||
this.saveButton = page.getByTestId('submit-button');
|
||||
this.successSnackbar = page.getByTestId(
|
||||
'snackbar-save-admin-apps-settings-success'
|
||||
);
|
||||
}
|
||||
|
||||
async allowCustomConnections() {
|
||||
await expect(this.disableConnectionsSwitch).not.toBeChecked();
|
||||
await this.allowCustomConnectionsSwitch.check();
|
||||
await this.saveButton.click();
|
||||
async allowUseOnlyPredefinedAuthClients() {
|
||||
await expect(this.useOnlyPredefinedAuthClients).not.toBeChecked();
|
||||
await this.useOnlyPredefinedAuthClients.check();
|
||||
}
|
||||
|
||||
async allowSharedConnections() {
|
||||
await expect(this.disableConnectionsSwitch).not.toBeChecked();
|
||||
await this.allowSharedConnectionsSwitch.check();
|
||||
await this.saveButton.click();
|
||||
async disallowUseOnlyPredefinedAuthClients() {
|
||||
await expect(this.useOnlyPredefinedAuthClients).toBeChecked();
|
||||
await this.useOnlyPredefinedAuthClients.uncheck();
|
||||
await expect(this.useOnlyPredefinedAuthClients).not.toBeChecked();
|
||||
}
|
||||
|
||||
async disallowConnections() {
|
||||
await expect(this.disableConnectionsSwitch).not.toBeChecked();
|
||||
await this.disableConnectionsSwitch.check();
|
||||
await this.saveButton.click();
|
||||
}
|
||||
|
||||
async disallowCustomConnections() {
|
||||
await expect(this.disableConnectionsSwitch).toBeChecked();
|
||||
await this.allowCustomConnectionsSwitch.uncheck();
|
||||
await this.saveButton.click();
|
||||
}
|
||||
|
||||
async disallowSharedConnections() {
|
||||
await expect(this.disableConnectionsSwitch).toBeChecked();
|
||||
await this.allowSharedConnectionsSwitch.uncheck();
|
||||
await this.saveButton.click();
|
||||
}
|
||||
|
||||
async allowConnections() {
|
||||
await expect(this.disableConnectionsSwitch).toBeChecked();
|
||||
await this.disableConnectionsSwitch.uncheck();
|
||||
}
|
||||
|
||||
async saveSettings() {
|
||||
await this.saveButton.click();
|
||||
}
|
||||
|
||||
async expectSuccessSnackbarToBeVisible() {
|
||||
await expect(this.successSnackbar).toHaveCount(1);
|
||||
await this.successSnackbar.click();
|
||||
await expect(this.successSnackbar).toHaveCount(0);
|
||||
const snackbars = await this.successSnackbar.all();
|
||||
for (const snackbar of snackbars) {
|
||||
await expect(snackbar).toBeVisible();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
const { expect } = require('@playwright/test');
|
||||
|
||||
const { faker } = require('@faker-js/faker');
|
||||
const { AuthenticatedPage } = require('../authenticated-page');
|
||||
|
||||
@@ -11,11 +13,17 @@ export class AdminCreateUserPage extends AuthenticatedPage {
|
||||
super(page);
|
||||
this.fullNameInput = page.getByTestId('full-name-input');
|
||||
this.emailInput = page.getByTestId('email-input');
|
||||
this.roleInput = page.getByTestId('role.id-autocomplete');
|
||||
this.roleInput = page.getByTestId('roleId-autocomplete');
|
||||
this.createButton = page.getByTestId('create-button');
|
||||
this.pageTitle = page.getByTestId('create-user-title');
|
||||
this.invitationEmailInfoAlert = page.getByTestId('invitation-email-info-alert');
|
||||
this.acceptInvitationLink = page.getByTestId('invitation-email-info-alert').getByRole('link');
|
||||
this.invitationEmailInfoAlert = page.getByTestId(
|
||||
'invitation-email-info-alert'
|
||||
);
|
||||
this.acceptInvitationLink = page
|
||||
.getByTestId('invitation-email-info-alert')
|
||||
.getByRole('link');
|
||||
this.createUserSuccessAlert = page.getByTestId('create-user-success-alert');
|
||||
this.fieldError = page.locator('p[id$="-helper-text"]');
|
||||
}
|
||||
|
||||
seed(seed) {
|
||||
@@ -28,4 +36,8 @@ export class AdminCreateUserPage extends AuthenticatedPage {
|
||||
email: faker.internet.email().toLowerCase(),
|
||||
};
|
||||
}
|
||||
|
||||
async expectCreateUserSuccessAlertToBeVisible() {
|
||||
await expect(this.createUserSuccessAlert).toBeVisible();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,9 @@ const { AdminEditRolePage } = require('./edit-role-page');
|
||||
|
||||
const { AdminApplicationsPage } = require('./applications-page');
|
||||
const { AdminApplicationSettingsPage } = require('./application-settings-page');
|
||||
const { AdminApplicationAuthClientsPage } = require('./application-auth-clients-page');
|
||||
const {
|
||||
AdminApplicationOAuthClientsPage,
|
||||
} = require('./application-oauth-clients-page');
|
||||
|
||||
export const adminFixtures = {
|
||||
adminUsersPage: async ({ page }, use) => {
|
||||
@@ -35,8 +37,7 @@ export const adminFixtures = {
|
||||
adminApplicationSettingsPage: async ({ page }, use) => {
|
||||
await use(new AdminApplicationSettingsPage(page));
|
||||
},
|
||||
adminApplicationAuthClientsPage: async ({ page }, use) => {
|
||||
await use(new AdminApplicationAuthClientsPage(page));
|
||||
}
|
||||
adminApplicationOAuthClientsPage: async ({ page }, use) => {
|
||||
await use(new AdminApplicationOAuthClientsPage(page));
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user