mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Fixing e2e - changing toggles
This commit is contained in:
@@ -32,6 +32,7 @@ export class DataTableComponentPage {
|
||||
selectedRowNumber: ElementFinder;
|
||||
allSelectedRows: ElementArrayFinder;
|
||||
selectAll: ElementFinder;
|
||||
selectAllChecked: ElementFinder;
|
||||
emptyList: ElementFinder;
|
||||
emptyListTitle: ElementFinder;
|
||||
emptyListSubtitle: ElementFinder;
|
||||
@@ -50,6 +51,7 @@ export class DataTableComponentPage {
|
||||
this.selectedRowNumber = this.rootElement.$(`adf-datatable-row[class*='is-selected'] div[data-automation-id*='text_']`);
|
||||
this.allSelectedRows = this.rootElement.$$(`adf-datatable-row[class*='is-selected']`);
|
||||
this.selectAll = this.rootElement.$(`div[class*='adf-datatable-header'] mat-checkbox`);
|
||||
this.selectAllChecked = this.rootElement.$(`div[class*='adf-datatable-header'] mat-checkbox.mat-mdc-checkbox-checked`);
|
||||
this.emptyList = this.rootElement.$(`adf-empty-content`);
|
||||
this.emptyListTitle = this.rootElement.$(`.adf-empty-content__title`);
|
||||
this.emptyListSubtitle = this.rootElement.$(`.adf-empty-content__subtitle`);
|
||||
@@ -66,12 +68,12 @@ export class DataTableComponentPage {
|
||||
|
||||
async checkAllRows(): Promise<void> {
|
||||
await BrowserActions.click(this.selectAll);
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.selectAll.$('input[aria-checked="true"]'));
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.selectAllChecked);
|
||||
}
|
||||
|
||||
async uncheckAllRows(): Promise<void> {
|
||||
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> {
|
||||
@@ -80,18 +82,23 @@ export class DataTableComponentPage {
|
||||
}
|
||||
|
||||
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> {
|
||||
const rowCheckbox = this.getRowCheckbox(columnName, columnValue);
|
||||
await BrowserVisibility.waitUntilElementIsVisible(rowCheckbox.$('input[aria-checked="true"]'));
|
||||
const rowCheckbox = this.getRowCheckboxChecked(columnName, columnValue);
|
||||
await BrowserVisibility.waitUntilElementIsVisible(rowCheckbox);
|
||||
}
|
||||
|
||||
getRowCheckbox(columnName: string, columnValue: string): ElementFinder {
|
||||
return this.getRow(columnName, columnValue).$('mat-checkbox');
|
||||
}
|
||||
|
||||
getRowCheckboxChecked(columnName: string, columnValue: string): ElementFinder {
|
||||
return this.getRow(columnName, columnValue).$('mat-checkbox.mat-mdc-checkbox-checked');
|
||||
}
|
||||
|
||||
async checkNoRowIsSelected(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(this.selectedRowNumber);
|
||||
}
|
||||
|
@@ -22,14 +22,14 @@ export class CheckboxPage {
|
||||
|
||||
static async uncheck(el: ElementFinder) {
|
||||
const classList = await BrowserActions.getAttribute(el, 'class');
|
||||
if (classList && classList.indexOf('mat-checked') > -1) {
|
||||
if (classList && classList.indexOf('mdc-checkbox--selected') > -1) {
|
||||
await BrowserActions.click(el);
|
||||
}
|
||||
}
|
||||
|
||||
static async check(el: ElementFinder) {
|
||||
const classList = await BrowserActions.getAttribute(el, 'class');
|
||||
if (classList && classList.indexOf('mat-checked') === -1) {
|
||||
if (classList && classList.indexOf('mdc-checkbox--selected') === -1) {
|
||||
await BrowserActions.click(el);
|
||||
}
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@ export class TogglePage {
|
||||
|
||||
async enableToggle(toggle: ElementFinder): Promise<void> {
|
||||
const check = await BrowserActions.getAttribute(toggle, 'class');
|
||||
if (check.indexOf('mat-checked') < 0) {
|
||||
if (check.indexOf('mdc-switch--checked') < 0) {
|
||||
const elem = toggle.$$('input').first();
|
||||
await BrowserActions.clickScript(elem);
|
||||
}
|
||||
@@ -30,7 +30,7 @@ export class TogglePage {
|
||||
|
||||
async disableToggle(toggle: ElementFinder): Promise<void> {
|
||||
const check = await BrowserActions.getAttribute(toggle, 'class');
|
||||
if (check.indexOf('mat-checked') >= 0) {
|
||||
if (check.indexOf('mdc-switch--checked') >= 0) {
|
||||
const elem = toggle.$$('input').first();
|
||||
await BrowserActions.clickScript(elem);
|
||||
}
|
||||
|
@@ -28,10 +28,9 @@ export class SettingsPage {
|
||||
logoutUrlText = $('input[id="logout-url"]');
|
||||
identityHostText = $('input[id="identityHost"]');
|
||||
ssoRadioButton = element(by.cssContainingText('[id*="mat-radio"]', 'SSO'));
|
||||
silentLoginToggleLabel = $('mat-slide-toggle[formcontrolname="silentLogin"] label');
|
||||
silentLoginToggleElement = $('mat-slide-toggle[formcontrolname="silentLogin"]');
|
||||
implicitFlowLabel = $('mat-slide-toggle[formcontrolname="implicitFlow"] label');
|
||||
implicitFlowElement = $('mat-slide-toggle[formcontrolname="implicitFlow"]');
|
||||
silentLoginToggleButton = $('button[name="silentLogin"]');
|
||||
implicitFlowButton = $('button[name="implicitFlow"]');
|
||||
codeFlowButton = $('button[name="codeFlow"]');
|
||||
applyButton = $('button[data-automation-id="settings-apply-button"]');
|
||||
providerDropdown = new DropdownPage($('mat-select[id="adf-provider-selector"]'));
|
||||
|
||||
@@ -67,6 +66,7 @@ export class SettingsPage {
|
||||
await this.setIdentityHost(identityHost);
|
||||
await this.setSilentLogin(silentLogin);
|
||||
await this.setImplicitFlow(implicitFlow);
|
||||
await this.setCodeFlow(true);
|
||||
await this.setClientId(clientId);
|
||||
await this.setLogoutUrl(logoutUrl);
|
||||
await this.clickApply();
|
||||
@@ -99,22 +99,32 @@ export class SettingsPage {
|
||||
}
|
||||
|
||||
async setSilentLogin(enableToggle) {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.silentLoginToggleElement);
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.silentLoginToggleButton);
|
||||
|
||||
const isChecked = (await BrowserActions.getAttribute(this.silentLoginToggleElement, 'class')).includes('mat-checked');
|
||||
const isChecked = (await BrowserActions.getAttribute(this.silentLoginToggleButton, 'aria-checked')) === 'true';
|
||||
|
||||
if (isChecked && !enableToggle || !isChecked && enableToggle) {
|
||||
await BrowserActions.click(this.silentLoginToggleLabel);
|
||||
await BrowserActions.click(this.silentLoginToggleButton);
|
||||
}
|
||||
}
|
||||
|
||||
async setImplicitFlow(enableToggle) {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.implicitFlowElement);
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.implicitFlowButton);
|
||||
|
||||
const isChecked = (await BrowserActions.getAttribute(this.implicitFlowElement, 'class')).includes('mat-checked');
|
||||
const isChecked = (await BrowserActions.getAttribute(this.implicitFlowButton, 'aria-checked')) === 'true';;
|
||||
|
||||
if (isChecked && !enableToggle || !isChecked && enableToggle) {
|
||||
await BrowserActions.click(this.implicitFlowLabel);
|
||||
await BrowserActions.click(this.implicitFlowButton);
|
||||
}
|
||||
}
|
||||
|
||||
async setCodeFlow(enableToggle) {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.codeFlowButton);
|
||||
|
||||
const isChecked = (await BrowserActions.getAttribute(this.codeFlowButton, 'aria-checked')) === 'true';
|
||||
|
||||
if (isChecked && !enableToggle || !isChecked && enableToggle) {
|
||||
await BrowserActions.click(this.codeFlowButton);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user