From 041703f7202f5aa794651c5c09c6a567c3e9f49e Mon Sep 17 00:00:00 2001 From: alokhyland Date: Wed, 23 Oct 2024 16:15:37 +0530 Subject: [PATCH] resolve test case random failure --- ftest/features/publication.feature | 2 +- .../features/step_definitions/search.js | 9 ++++++--- .../nuxeo-web-ui-ftest/pages/ui/admin/cloudServices.js | 2 ++ .../pages/ui/browser/document_publications.js | 3 ++- .../pages/ui/browser/document_versions.js | 3 ++- packages/nuxeo-web-ui-ftest/pages/ui/search.js | 5 +++-- 6 files changed, 16 insertions(+), 8 deletions(-) diff --git a/ftest/features/publication.feature b/ftest/features/publication.feature index f194f0dacd..c1f7d86e98 100644 --- a/ftest/features/publication.feature +++ b/ftest/features/publication.feature @@ -156,4 +156,4 @@ Feature: Internal Publication Then I can see the document is a publication And I cannot see to publication pill And I can unpublish the document - And I can see the document has 2 children + And I can see the document has 2 children \ No newline at end of file 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 d4e3e6bfbe..3ebd75fe2e 100644 --- a/packages/nuxeo-web-ui-ftest/features/step_definitions/search.js +++ b/packages/nuxeo-web-ui-ftest/features/step_definitions/search.js @@ -199,11 +199,14 @@ Then('I edit the results columns to show {string}', async function(heading) { }); Then(/^I save my search as "(.+)"$/, async function(searchName) { - const saveAsButton = await this.ui.searchResults.saveSearchAsButton; + const searchResults = await this.ui.searchResults; + const saveAsButton = await searchResults.saveSearchAsButton; await saveAsButton.waitForVisible(); await saveAsButton.click(); - await this.ui.searchResults.enterInput(searchName); - const confirmSaveButton = await this.ui.searchResults.confirmSaveSearchButton; + await driver.pause(2000); + await searchResults.enterInput(searchName); + await driver.pause(2000); + const confirmSaveButton = await searchResults.confirmSaveSearchButton; await confirmSaveButton.click(); }); diff --git a/packages/nuxeo-web-ui-ftest/pages/ui/admin/cloudServices.js b/packages/nuxeo-web-ui-ftest/pages/ui/admin/cloudServices.js index ba7009a7f1..2addb733f2 100644 --- a/packages/nuxeo-web-ui-ftest/pages/ui/admin/cloudServices.js +++ b/packages/nuxeo-web-ui-ftest/pages/ui/admin/cloudServices.js @@ -157,6 +157,8 @@ export default class CloudServices extends BasePage { } async deleteClient(clientId) { + const dataTable = await driver.$('nuxeo-data-table nuxeo-data-table-row [name="id"]'); + await dataTable.waitForVisible(); const rows = await browser.$$('nuxeo-data-table[name="table"] nuxeo-data-table-row:not([header])'); const deleted = await browser .$$('nuxeo-data-table[name="table"] nuxeo-data-table-row:not([header])') diff --git a/packages/nuxeo-web-ui-ftest/pages/ui/browser/document_publications.js b/packages/nuxeo-web-ui-ftest/pages/ui/browser/document_publications.js index c57780bb43..9c6c0e42e8 100644 --- a/packages/nuxeo-web-ui-ftest/pages/ui/browser/document_publications.js +++ b/packages/nuxeo-web-ui-ftest/pages/ui/browser/document_publications.js @@ -31,7 +31,8 @@ export default class DocumentPublications extends BasePage { let index; for (let i = 0; i < rows.length; i++) { const row = rows[i]; - if (row.isVisible('nuxeo-data-table-cell a.path')) { + const isRowVisible = await row.isVisible('nuxeo-data-table-cell a.path'); + if (isRowVisible) { const foundPathEle = await row.$('nuxeo-data-table-cell a.path'); const foundPath = await foundPathEle.getText(); const foundPathLowerCase = await foundPath.trim().toLowerCase(); diff --git a/packages/nuxeo-web-ui-ftest/pages/ui/browser/document_versions.js b/packages/nuxeo-web-ui-ftest/pages/ui/browser/document_versions.js index 342ddcbc91..66b6ec50ad 100644 --- a/packages/nuxeo-web-ui-ftest/pages/ui/browser/document_versions.js +++ b/packages/nuxeo-web-ui-ftest/pages/ui/browser/document_versions.js @@ -95,7 +95,8 @@ export default class DocumentVersions extends BasePage { return true; } const listItems = await this.listItems; - await listItems.$('div[name="version-item"] .title').waitForVisible(); + const versionItem = await listItems.$('div[name="version-item"] .title'); + await versionItem.waitForVisible(); const listItems1 = await this.listItems.$$('div[name="version-item"]'); const itemsTitle = await browser.$$('div[name="version-item"]').map((img) => img.$('.title').getText()); const index = itemsTitle.findIndex((currenTitle) => currenTitle === label); diff --git a/packages/nuxeo-web-ui-ftest/pages/ui/search.js b/packages/nuxeo-web-ui-ftest/pages/ui/search.js index 02abf24cad..212dbfce04 100644 --- a/packages/nuxeo-web-ui-ftest/pages/ui/search.js +++ b/packages/nuxeo-web-ui-ftest/pages/ui/search.js @@ -66,8 +66,9 @@ export default class Search extends Results { return dropdownElenent; } - enterInput(text) { - return driver.keys(text); + async enterInput(text) { + const isInputEntered = await driver.keys(text); + return isInputEntered; } async getField(field) {