Fixing e2e - changing toggles

This commit is contained in:
Vito Albano
2023-12-08 13:43:55 +00:00
committed by VitoAlbano
parent 7b930876a9
commit b4636bc7c2
2 changed files with 14 additions and 7 deletions

View File

@@ -33,6 +33,7 @@ export class DataTableComponentPage {
selectedRowNumber: ElementFinder; selectedRowNumber: ElementFinder;
allSelectedRows: ElementArrayFinder; allSelectedRows: ElementArrayFinder;
selectAll: ElementFinder; selectAll: ElementFinder;
selectAllChecked: ElementFinder;
emptyList: ElementFinder; emptyList: ElementFinder;
emptyListTitle: ElementFinder; emptyListTitle: ElementFinder;
emptyListSubtitle: ElementFinder; emptyListSubtitle: ElementFinder;
@@ -67,12 +68,12 @@ export class DataTableComponentPage {
async checkAllRows(): Promise<void> { async checkAllRows(): Promise<void> {
await BrowserActions.click(this.selectAll); await BrowserActions.click(this.selectAll);
await BrowserVisibility.waitUntilElementIsVisible(this.selectAll.$('input[aria-checked="true"]')); await BrowserVisibility.waitUntilElementIsVisible(this.selectAllChecked);
} }
async uncheckAllRows(): Promise<void> { async uncheckAllRows(): Promise<void> {
await BrowserActions.click(this.selectAll); await BrowserActions.click(this.selectAll);
await BrowserVisibility.waitUntilElementIsNotVisible(this.selectAll.$('input[aria-checked="true"]')); await BrowserVisibility.waitUntilElementIsNotVisible(this.selectAll.$('.mat-mdc-checkbox-checked'));
} }
async clickCheckbox(columnName: string, columnValue: string): Promise<void> { async clickCheckbox(columnName: string, columnValue: string): Promise<void> {
@@ -81,18 +82,23 @@ export class DataTableComponentPage {
} }
async checkRowIsNotChecked(columnName: string, columnValue: string): Promise<void> { async checkRowIsNotChecked(columnName: string, columnValue: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.getRowCheckbox(columnName, columnValue).$('input[aria-checked="true"]')); const rowSelector = this.getRowCheckboxChecked(columnName, columnValue);
await BrowserVisibility.waitUntilElementIsNotVisible(rowSelector);
} }
async checkRowIsChecked(columnName: string, columnValue: string): Promise<void> { async checkRowIsChecked(columnName: string, columnValue: string): Promise<void> {
const rowCheckbox = this.getRowCheckbox(columnName, columnValue); const rowCheckbox = this.getRowCheckboxChecked(columnName, columnValue);
await BrowserVisibility.waitUntilElementIsVisible(rowCheckbox.$('input[aria-checked="true"]')); await BrowserVisibility.waitUntilElementIsVisible(rowCheckbox);
} }
getRowCheckbox(columnName: string, columnValue: string): ElementFinder { getRowCheckbox(columnName: string, columnValue: string): ElementFinder {
return this.getRow(columnName, columnValue).$(materialLocators.Checkbox.root); return this.getRow(columnName, columnValue).$(materialLocators.Checkbox.root);
} }
getRowCheckboxChecked(columnName: string, columnValue: string): ElementFinder {
return this.getRow(columnName, columnValue).$('mat-checkbox.mat-mdc-checkbox-checked');
}
async checkNoRowIsSelected(): Promise<void> { async checkNoRowIsSelected(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.selectedRowNumber); await BrowserVisibility.waitUntilElementIsNotVisible(this.selectedRowNumber);
} }

View File

@@ -100,6 +100,7 @@ export class SettingsPage {
await this.setSilentLogin(silentLogin); await this.setSilentLogin(silentLogin);
await this.setCodeFlow(false); await this.setCodeFlow(false);
await this.setImplicitFlow(implicitFlow); await this.setImplicitFlow(implicitFlow);
await this.setCodeFlow(true);
await this.setClientId(clientId); await this.setClientId(clientId);
await this.setLogoutUrl(logoutUrl); await this.setLogoutUrl(logoutUrl);
await this.clickApply(); await this.clickApply();
@@ -132,7 +133,7 @@ export class SettingsPage {
} }
async setSilentLogin(enableToggle) { async setSilentLogin(enableToggle) {
await BrowserVisibility.waitUntilElementIsVisible(this.silentLoginToggleElement); await BrowserVisibility.waitUntilElementIsVisible(this.silentLoginToggleButton);
const isChecked = (await BrowserActions.getAttribute(this.silentLoginToggleElement, 'class')).includes(materialLocators.Checked.root); const isChecked = (await BrowserActions.getAttribute(this.silentLoginToggleElement, 'class')).includes(materialLocators.Checked.root);
@@ -142,7 +143,7 @@ export class SettingsPage {
} }
async setImplicitFlow(enableToggle) { async setImplicitFlow(enableToggle) {
await BrowserVisibility.waitUntilElementIsVisible(this.implicitFlowElement); await BrowserVisibility.waitUntilElementIsVisible(this.implicitFlowButton);
const isChecked = (await BrowserActions.getAttribute(this.implicitFlowElement, 'class')).includes(materialLocators.Checked.root); const isChecked = (await BrowserActions.getAttribute(this.implicitFlowElement, 'class')).includes(materialLocators.Checked.root);