shiloh_automatisch/packages/e2e-tests/fixtures/admin/application-settings-page.js
Linden Crandall 5075f5c5d8
Some checks are pending
Automatisch Backend Tests / test (push) Waiting to run
Automatisch CI / linter (push) Waiting to run
Automatisch CI / start-backend-server (push) Waiting to run
Automatisch CI / start-backend-worker (push) Waiting to run
Automatisch CI / build-web (push) Waiting to run
Automatisch UI Tests / test (push) Waiting to run
commit upstream files
2025-02-06 04:14:18 +09:00

53 lines
1.6 KiB
JavaScript

const { AuthenticatedPage } = require('../authenticated-page');
const { expect } = require('@playwright/test');
export class AdminApplicationSettingsPage extends AuthenticatedPage {
/**
* @param {import('@playwright/test').Page} page
*/
constructor(page) {
super(page);
this.useOnlyPredefinedAuthClients = page.locator(
'[name="useOnlyPredefinedAuthClients"]'
);
this.disableConnectionsSwitch = page.locator('[name="disabled"]');
this.saveButton = page.getByTestId('submit-button');
this.successSnackbar = page.getByTestId(
'snackbar-save-admin-apps-settings-success'
);
}
async allowUseOnlyPredefinedAuthClients() {
await expect(this.useOnlyPredefinedAuthClients).not.toBeChecked();
await this.useOnlyPredefinedAuthClients.check();
}
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();
}
async allowConnections() {
await expect(this.disableConnectionsSwitch).toBeChecked();
await this.disableConnectionsSwitch.uncheck();
}
async saveSettings() {
await this.saveButton.click();
}
async expectSuccessSnackbarToBeVisible() {
const snackbars = await this.successSnackbar.all();
for (const snackbar of snackbars) {
await expect(snackbar).toBeVisible();
}
}
}