Merge branch 'main' into AUT-1372

This commit is contained in:
Jakub P.
2024-12-21 20:10:42 +01:00
173 changed files with 2933 additions and 2674 deletions

View File

@@ -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();
}
}

View File

@@ -8,66 +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.allowCustomConnectionsSwitch).not.toBeChecked();
await this.allowCustomConnectionsSwitch.check();
await expect(this.allowCustomConnectionsSwitch).toBeChecked();
await this.saveButton.click();
async allowUseOnlyPredefinedAuthClients() {
await expect(this.useOnlyPredefinedAuthClients).not.toBeChecked();
await this.useOnlyPredefinedAuthClients.check();
}
async allowSharedConnections() {
await expect(this.allowSharedConnectionsSwitch).not.toBeChecked();
await this.allowSharedConnectionsSwitch.check();
await expect(this.allowSharedConnectionsSwitch).toBeChecked();
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 expect(this.disableConnectionsSwitch).toBeChecked();
await this.saveButton.click();
}
async disallowCustomConnections() {
await expect(this.allowCustomConnectionsSwitch).toBeChecked();
await this.allowCustomConnectionsSwitch.uncheck();
await expect(this.allowCustomConnectionsSwitch).not.toBeChecked();
await this.saveButton.click();
}
async disallowSharedConnections() {
await expect(this.allowSharedConnectionsSwitch).toBeChecked();
await this.allowSharedConnectionsSwitch.uncheck();
await expect(this.allowSharedConnectionsSwitch).not.toBeChecked();
await this.saveButton.click();
}
async allowConnections() {
await expect(this.disableConnectionsSwitch).toBeChecked();
await this.disableConnectionsSwitch.uncheck();
await expect(this.disableConnectionsSwitch).not.toBeChecked();
}
async saveSettings() {
await this.saveButton.click();
}
async expectSuccessSnackbarToBeVisible() {
const snackbars = await this.successSnackbar.all();
for (const snackbar of snackbars) {
await expect(await snackbar.getAttribute('data-snackbar-variant')).toBe(
'success'
);
// await snackbar.click();
await expect(snackbar).toBeVisible();
}
}
}

View File

@@ -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));
},
};