From 0c36ad9f3eb477a799177972704891533af43662 Mon Sep 17 00:00:00 2001 From: alokhyland Date: Wed, 1 May 2024 16:52:23 +0530 Subject: [PATCH] group testcase --- .../features/step_definitions/group.js | 1 + packages/nuxeo-web-ui-ftest/pages/ui/group.js | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/nuxeo-web-ui-ftest/features/step_definitions/group.js b/packages/nuxeo-web-ui-ftest/features/step_definitions/group.js index f85a301aae..bafe23dd7d 100644 --- a/packages/nuxeo-web-ui-ftest/features/step_definitions/group.js +++ b/packages/nuxeo-web-ui-ftest/features/step_definitions/group.js @@ -31,6 +31,7 @@ Then(/^I can search for the following groups$/, async function(table) { const groups = await this.ui.group; await groups.searchFor(rowFirstCol); const resultEle = await groups.searchResult(rowFirstCol); + await driver.pause(5000); const visible = await resultEle.waitForVisible(); if (!visible) { throw new Error('Result not found'); diff --git a/packages/nuxeo-web-ui-ftest/pages/ui/group.js b/packages/nuxeo-web-ui-ftest/pages/ui/group.js index 1d377e73e6..8b5a635404 100644 --- a/packages/nuxeo-web-ui-ftest/pages/ui/group.js +++ b/packages/nuxeo-web-ui-ftest/pages/ui/group.js @@ -77,10 +77,17 @@ export default class Group extends BasePage { } async searchResult(searchTerm) { - const ele = await this.el; - await driver.pause(1000); - const results = await ele.elements('nuxeo-card[name="groups"] .table [name="id"]'); - const match = await results.find(async (e) => (await e.getText()) === searchTerm); - return match; + const match = async (e) => { + const currentText = await e.getText(); + return currentText === searchTerm; + }; + await driver.waitUntil(async () => { + const getElements = await this.el.elements('nuxeo-card[name="groups"] .table [name="id"]'); + const results = await getElements.some(match); + return results; + }); + + const matchElementList = await this.el.elements('nuxeo-card[name="groups"] .table [name="id"]'); + return matchElementList.find(match); } }