Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WEBUI-1649: Functional test cases random fixes Part-2 #2482

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 17 additions & 18 deletions packages/nuxeo-web-ui-ftest/features/step_definitions/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,24 +80,23 @@ Given(/^I have the following documents$/, async (table) => {
return tasks.reduce((current, next) => current.then(next), Promise.resolve([]));
});

Given('I have a saved search named "{word}", for the "{word}" page provider, with the following parameters', function(
searchName,
pageProvider,
table,
) {
const hashes = table.hashes();
hashes.forEach((kv) => {
kv.value = JSON.parse(kv.value);
});
// could be replaced with Object.fromEntries(...), which is only support from nodejs 12.x on
const params = hashes.reduce((obj, { key, value }) => {
obj[key] = value;
return obj;
}, {});
return fixtures.savedSearches.create(searchName, pageProvider, params).then((savedSearch) => {
this.savedSearch = savedSearch;
});
});
Given(
'I have a saved search named "{word}", for the "{word}" page provider, with the following parameters',
async function(searchName, pageProvider, table) {
const hashes = await table.hashes();
hashes.forEach((kv) => {
kv.value = JSON.parse(kv.value);
});
// could be replaced with Object.fromEntries(...), which is only support from nodejs 12.x on
const params = hashes.reduce((obj, { key, value }) => {
obj[key] = value;
return obj;
}, {});
return fixtures.savedSearches.create(searchName, pageProvider, params).then((savedSearch) => {
this.savedSearch = savedSearch;
});
},
);

Given('I have permission {word} for this saved search', function(permission) {
return fixtures.savedSearches.setPermissions(this.savedSearch, permission, this.username);
Expand Down
5 changes: 3 additions & 2 deletions packages/nuxeo-web-ui-ftest/pages/ui/admin/cloudServices.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ export default class CloudServices extends BasePage {
const deleted = await browser
.$$('nuxeo-data-table[name="table"] nuxeo-data-table-row:not([header])')
.map((img) => img.$('nuxeo-data-table-cell span[name="serviceName"]').getText());
const index = deleted.findIndex((currenTitle) => currenTitle === serviceName);
const index = await deleted.findIndex(async (currenTitle) => (await currenTitle) === serviceName);
if (index !== -1) {
const rowEle = await rows[index].$('[name="delete"]');
const row = await rows[index];
const rowEle = await row.$('[name="delete"]');
await rowEle.click();
await driver.alertAccept();
return true;
Expand Down
3 changes: 2 additions & 1 deletion packages/nuxeo-web-ui-ftest/pages/ui/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ export default class Browser extends BasePage {
await driver.pause(1000);
const rowTemp = await this.rows;
for (let i = 0; i < rowTemp.length; i++) {
const ele = await rowTemp[i].element('nuxeo-data-table-cell a.title');
const row = await rowTemp[i];
const ele = await row.element('nuxeo-data-table-cell a.title');
const eleText = await ele.getText();
if (eleText.trim() === title) {
return i;
Expand Down
3 changes: 2 additions & 1 deletion packages/nuxeo-web-ui-ftest/wdio-compat-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ module.exports = class {
async function(...args) {
let target = this;
if (typeof args[0] === 'string' && typeof target.waitForDisplayed !== 'function') {
target = this.element(args.shift());
const argShift = args.shift();
target = await this.element(argShift);
}
const [timeout, reverse = false] = args;
if (typeof target.waitForDisplayed === 'function') {
Expand Down
Loading