test: add applications settings tests

This commit is contained in:
Jakub P.
2024-09-10 22:00:49 +02:00
committed by Ali BARIN
parent e146793d32
commit 09b2b7350c
14 changed files with 407 additions and 31 deletions

View File

@@ -0,0 +1,59 @@
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.allowCustomConnectionsSwitch = this.page.locator('[name="allowCustomConnection"]');
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('snackbar-save-admin-apps-settings-success');
}
async allowCustomConnections() {
await expect(this.disableConnectionsSwitch).not.toBeChecked();
await this.allowCustomConnectionsSwitch.check();
await this.saveButton.click();
}
async allowSharedConnections() {
await expect(this.disableConnectionsSwitch).not.toBeChecked();
await this.allowSharedConnectionsSwitch.check();
await this.saveButton.click();
}
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();
await this.saveButton.click();
}
async expectSuccessSnackbarToBeVisible() {
await expect(this.successSnackbar).toHaveCount(1);
await this.successSnackbar.click();
await expect(this.successSnackbar).toHaveCount(0);
}
}