diff --git a/lib/testing/src/lib/protractor/core/pages/data-table-component.page.ts b/lib/testing/src/lib/protractor/core/pages/data-table-component.page.ts index 0b18daf765e..a6e8c0d820f 100644 --- a/lib/testing/src/lib/protractor/core/pages/data-table-component.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/data-table-component.page.ts @@ -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 { await BrowserActions.click(this.selectAll); - await BrowserVisibility.waitUntilElementIsVisible(this.selectAll.$('input[aria-checked="true"]')); + await BrowserVisibility.waitUntilElementIsVisible(this.selectAllChecked); } async uncheckAllRows(): Promise { 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 { @@ -80,18 +82,23 @@ export class DataTableComponentPage { } async checkRowIsNotChecked(columnName: string, columnValue: string): Promise { - 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 { - 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 { await BrowserVisibility.waitUntilElementIsNotVisible(this.selectedRowNumber); } diff --git a/lib/testing/src/lib/protractor/core/pages/material/checkbox.page.ts b/lib/testing/src/lib/protractor/core/pages/material/checkbox.page.ts index 1d32f24ae98..e1f9192e60d 100644 --- a/lib/testing/src/lib/protractor/core/pages/material/checkbox.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/material/checkbox.page.ts @@ -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); } } diff --git a/lib/testing/src/lib/protractor/core/pages/material/toggle.page.ts b/lib/testing/src/lib/protractor/core/pages/material/toggle.page.ts index 28c6f6861fc..7d0fe1436be 100644 --- a/lib/testing/src/lib/protractor/core/pages/material/toggle.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/material/toggle.page.ts @@ -22,7 +22,7 @@ export class TogglePage { async enableToggle(toggle: ElementFinder): Promise { 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 { 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); } diff --git a/lib/testing/src/lib/protractor/core/pages/settings.page.ts b/lib/testing/src/lib/protractor/core/pages/settings.page.ts index cbc6e6938d2..ae813c8edb9 100644 --- a/lib/testing/src/lib/protractor/core/pages/settings.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/settings.page.ts @@ -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); } } }