diff --git a/packages/nuxeo-web-ui-ftest/features/step_definitions/search.js b/packages/nuxeo-web-ui-ftest/features/step_definitions/search.js index 3ebd75fe2e..a2ad950670 100644 --- a/packages/nuxeo-web-ui-ftest/features/step_definitions/search.js +++ b/packages/nuxeo-web-ui-ftest/features/step_definitions/search.js @@ -168,6 +168,7 @@ Then(/^I can see (\d+) search results$/, async function(numberOfResults) { Then(/^I can see more than (\d+) search results$/, async function(minNumberOfResults) { await driver.pause(1000); const results = await this.ui.results; + await driver.pause(2000); const displayMode = await results.displayMode; const output = await results.resultsCount(displayMode); if (output > minNumberOfResults) { diff --git a/packages/nuxeo-web-ui-ftest/features/step_definitions/ui.js b/packages/nuxeo-web-ui-ftest/features/step_definitions/ui.js index 3d0572cb9e..0b7c7bd589 100644 --- a/packages/nuxeo-web-ui-ftest/features/step_definitions/ui.js +++ b/packages/nuxeo-web-ui-ftest/features/step_definitions/ui.js @@ -4,8 +4,8 @@ import { Then, When } from '@cucumber/cucumber'; When('I click the {string} button', async function(button) { await driver.pause(1000); const drawer = await this.ui.drawer; - const buttonToclick = await drawer.open(button); - return buttonToclick; + const output = await drawer.open(button); + output.should.be.true; }); When('I select {string} from the View menu', async function(option) { @@ -31,4 +31,5 @@ Then('I click the blob download button', async function() { const page = await this.ui.browser.documentPage(this.doc.type); const button = await page.downloadButton; await button.click(); + await driver.pause(2000); }); diff --git a/packages/nuxeo-web-ui-ftest/features/step_definitions/user_settings.js b/packages/nuxeo-web-ui-ftest/features/step_definitions/user_settings.js index 33f0027056..ea607cdfea 100644 --- a/packages/nuxeo-web-ui-ftest/features/step_definitions/user_settings.js +++ b/packages/nuxeo-web-ui-ftest/features/step_definitions/user_settings.js @@ -85,7 +85,7 @@ Then(/^I can revoke access for "(.+)" application$/, async function(appName) { const appRevoke = await authPage.getApps(appName); appRevoke.length.should.equal(1); const app = await appRevoke[0]; - const revokeButton = await app.revokeButton(); + const revokeButton = await authPage.revokeButton(app, appName); await revokeButton.waitForVisible(); await revokeButton.click(); await driver.alertAccept(); diff --git a/packages/nuxeo-web-ui-ftest/pages/ui/drawer.js b/packages/nuxeo-web-ui-ftest/pages/ui/drawer.js index ba44254ed9..b7472190aa 100644 --- a/packages/nuxeo-web-ui-ftest/pages/ui/drawer.js +++ b/packages/nuxeo-web-ui-ftest/pages/ui/drawer.js @@ -68,16 +68,18 @@ export default class Drawer extends BasePage { } async open(name) { - const currentMenu = await this.menu; - await currentMenu.waitForVisible(); - const section = await this._section(name); - const isVisible = await section.isVisible(); - if (!isVisible) { - const menu = await this.menu; + const menu = await this.menu; + let isDrawerVisible = await this.isDrawerOpened(menu); + if (isDrawerVisible) { const buttonToclick = await menu.$(`nuxeo-menu-icon[name='${name}']`); await buttonToclick.click(); + isDrawerVisible = await this.isDrawerOpened(menu); } - return section; + return isDrawerVisible; + } + + async isDrawerOpened(menu) { + return Boolean(await menu.$(`paper-listbox[id='menu']`).getAttribute('aria-expanded')); } async _section(name) { diff --git a/packages/nuxeo-web-ui-ftest/pages/ui/oauth2/user_authorized_apps.js b/packages/nuxeo-web-ui-ftest/pages/ui/oauth2/user_authorized_apps.js index a1c389c09f..fda23d0763 100644 --- a/packages/nuxeo-web-ui-ftest/pages/ui/oauth2/user_authorized_apps.js +++ b/packages/nuxeo-web-ui-ftest/pages/ui/oauth2/user_authorized_apps.js @@ -1,50 +1,23 @@ /* eslint-disable no-await-in-loop */ import BasePage from '../../base'; -class AuthorizedApp { - constructor(element) { - this.el = element; - } - - get name() { - return (async () => { - const eles = await this.el.elements('nuxeo-data-table-cell'); - const ele = await eles[0]; - const eleText = await ele.getText(); - return eleText; - })(); - } - - get authorizationDate() { - return this.el.elements('nuxeo-data-table-cell')[1].getText(); - } - - async revokeButton() { - return (async () => { - const ele = await this.el.element('paper-icon-button[name="revoke"]'); - return ele; - })(); - } -} - export default class UserAuthorizedApps extends BasePage { async getApps(appName) { + await driver.pause(2000); const elEx = await this.el; await elEx.waitForVisible('nuxeo-data-table nuxeo-data-table-row'); - const appsNew = await this.el - .$$('nuxeo-data-table nuxeo-data-table-row:not([header])') - .map((el) => new AuthorizedApp(el)); + const rows = await this.el.$$('nuxeo-data-table nuxeo-data-table-row:not([header])'); + const cells = await this.el.$$('nuxeo-data-table nuxeo-data-table-row:not([header]) nuxeo-data-table-cell'); + const cellsPerRow = cells.length / rows.length; const filterAppNames = []; const filterApps = []; - const apps = await appsNew.filter(async (app) => !!(await app.name).trim()); - for (let i = 0; i < apps.length; i++) { - const app = await apps[i]; - const appText = await app.el.$('nuxeo-data-table-cell').getText(); + for (let i = 0; i < rows.length; i++) { + const appText = await cells[cellsPerRow * i].getText(); if (appText.trim() !== '') { - filterAppNames.push(app); + filterAppNames.push(rows[i]); } if (appName === appText) { - filterApps.push(app); + filterApps.push(rows[i]); } } if (appName) { @@ -52,4 +25,21 @@ export default class UserAuthorizedApps extends BasePage { } return filterAppNames; } + + async revokeButton(app, appName) { + return (async () => { + const rows = await app.$$('nuxeo-data-table nuxeo-data-table-row:not([header])'); + const cells = await app.$$('nuxeo-data-table nuxeo-data-table-row:not([header]) nuxeo-data-table-cell'); + const cellsPerRow = cells.length / rows.length; + const revokeButtons = await app.$$( + 'nuxeo-data-table nuxeo-data-table-row:not([header]) paper-icon-button[name="revoke"]', + ); + for (let i = 0; i < rows.length; i++) { + const appText = await cells[cellsPerRow * i].getText(); + if (appName === appText) { + return revokeButtons[i]; + } + } + })(); + } } diff --git a/packages/nuxeo-web-ui-ftest/wdio.conf.js b/packages/nuxeo-web-ui-ftest/wdio.conf.js index 269288e3e3..bb50e5ed11 100644 --- a/packages/nuxeo-web-ui-ftest/wdio.conf.js +++ b/packages/nuxeo-web-ui-ftest/wdio.conf.js @@ -27,7 +27,7 @@ const capability = { maxInstances: 1, browserName: process.env.BROWSER, acceptInsecureCerts: true, - browserVersion: '130.0.6723.116', + browserVersion: 'stable', }; const options = {};