Skip to content

Commit

Permalink
WEBUI-1649: Functional test cases random fixes Part-2
Browse files Browse the repository at this point in the history
  • Loading branch information
rahuljain-dev committed Feb 24, 2025
1 parent fad9786 commit 99ff4a1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 21 deletions.
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/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

0 comments on commit 99ff4a1

Please sign in to comment.