test: adapt apps tests to new logic

This commit is contained in:
Jakub P.
2024-12-16 09:15:44 +01:00
committed by Ali BARIN
parent c78646ed8e
commit a8ed13da33
5 changed files with 319 additions and 116 deletions

View File

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