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;
|
selectedRowNumber: ElementFinder;
|
||||||
allSelectedRows: ElementArrayFinder;
|
allSelectedRows: ElementArrayFinder;
|
||||||
selectAll: ElementFinder;
|
selectAll: ElementFinder;
|
||||||
|
selectAllChecked: ElementFinder;
|
||||||
emptyList: ElementFinder;
|
emptyList: ElementFinder;
|
||||||
emptyListTitle: ElementFinder;
|
emptyListTitle: ElementFinder;
|
||||||
emptyListSubtitle: 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.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.allSelectedRows = this.rootElement.$$(`adf-datatable-row[class*='is-selected']`);
|
||||||
this.selectAll = this.rootElement.$(`div[class*='adf-datatable-header'] mat-checkbox`);
|
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.emptyList = this.rootElement.$(`adf-empty-content`);
|
||||||
this.emptyListTitle = this.rootElement.$(`.adf-empty-content__title`);
|
this.emptyListTitle = this.rootElement.$(`.adf-empty-content__title`);
|
||||||
this.emptyListSubtitle = this.rootElement.$(`.adf-empty-content__subtitle`);
|
this.emptyListSubtitle = this.rootElement.$(`.adf-empty-content__subtitle`);
|
||||||
@@ -66,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> {
|
||||||
@@ -80,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).$('mat-checkbox');
|
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> {
|
async checkNoRowIsSelected(): Promise<void> {
|
||||||
await BrowserVisibility.waitUntilElementIsNotVisible(this.selectedRowNumber);
|
await BrowserVisibility.waitUntilElementIsNotVisible(this.selectedRowNumber);
|
||||||
}
|
}
|
||||||
|
@@ -22,14 +22,14 @@ export class CheckboxPage {
|
|||||||
|
|
||||||
static async uncheck(el: ElementFinder) {
|
static async uncheck(el: ElementFinder) {
|
||||||
const classList = await BrowserActions.getAttribute(el, 'class');
|
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);
|
await BrowserActions.click(el);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static async check(el: ElementFinder) {
|
static async check(el: ElementFinder) {
|
||||||
const classList = await BrowserActions.getAttribute(el, 'class');
|
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);
|
await BrowserActions.click(el);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,7 @@ export class TogglePage {
|
|||||||
|
|
||||||
async enableToggle(toggle: ElementFinder): Promise<void> {
|
async enableToggle(toggle: ElementFinder): Promise<void> {
|
||||||
const check = await BrowserActions.getAttribute(toggle, 'class');
|
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();
|
const elem = toggle.$$('input').first();
|
||||||
await BrowserActions.clickScript(elem);
|
await BrowserActions.clickScript(elem);
|
||||||
}
|
}
|
||||||
@@ -30,7 +30,7 @@ export class TogglePage {
|
|||||||
|
|
||||||
async disableToggle(toggle: ElementFinder): Promise<void> {
|
async disableToggle(toggle: ElementFinder): Promise<void> {
|
||||||
const check = await BrowserActions.getAttribute(toggle, 'class');
|
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();
|
const elem = toggle.$$('input').first();
|
||||||
await BrowserActions.clickScript(elem);
|
await BrowserActions.clickScript(elem);
|
||||||
}
|
}
|
||||||
|
@@ -28,10 +28,9 @@ export class SettingsPage {
|
|||||||
logoutUrlText = $('input[id="logout-url"]');
|
logoutUrlText = $('input[id="logout-url"]');
|
||||||
identityHostText = $('input[id="identityHost"]');
|
identityHostText = $('input[id="identityHost"]');
|
||||||
ssoRadioButton = element(by.cssContainingText('[id*="mat-radio"]', 'SSO'));
|
ssoRadioButton = element(by.cssContainingText('[id*="mat-radio"]', 'SSO'));
|
||||||
silentLoginToggleLabel = $('mat-slide-toggle[formcontrolname="silentLogin"] label');
|
silentLoginToggleButton = $('button[name="silentLogin"]');
|
||||||
silentLoginToggleElement = $('mat-slide-toggle[formcontrolname="silentLogin"]');
|
implicitFlowButton = $('button[name="implicitFlow"]');
|
||||||
implicitFlowLabel = $('mat-slide-toggle[formcontrolname="implicitFlow"] label');
|
codeFlowButton = $('button[name="codeFlow"]');
|
||||||
implicitFlowElement = $('mat-slide-toggle[formcontrolname="implicitFlow"]');
|
|
||||||
applyButton = $('button[data-automation-id="settings-apply-button"]');
|
applyButton = $('button[data-automation-id="settings-apply-button"]');
|
||||||
providerDropdown = new DropdownPage($('mat-select[id="adf-provider-selector"]'));
|
providerDropdown = new DropdownPage($('mat-select[id="adf-provider-selector"]'));
|
||||||
|
|
||||||
@@ -67,6 +66,7 @@ export class SettingsPage {
|
|||||||
await this.setIdentityHost(identityHost);
|
await this.setIdentityHost(identityHost);
|
||||||
await this.setSilentLogin(silentLogin);
|
await this.setSilentLogin(silentLogin);
|
||||||
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();
|
||||||
@@ -99,22 +99,32 @@ 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('mat-checked');
|
const isChecked = (await BrowserActions.getAttribute(this.silentLoginToggleButton, 'aria-checked')) === 'true';
|
||||||
|
|
||||||
if (isChecked && !enableToggle || !isChecked && enableToggle) {
|
if (isChecked && !enableToggle || !isChecked && enableToggle) {
|
||||||
await BrowserActions.click(this.silentLoginToggleLabel);
|
await BrowserActions.click(this.silentLoginToggleButton);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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('mat-checked');
|
const isChecked = (await BrowserActions.getAttribute(this.implicitFlowButton, 'aria-checked')) === 'true';;
|
||||||
|
|
||||||
if (isChecked && !enableToggle || !isChecked && enableToggle) {
|
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