From 041f4507b41beb02002bc36addac06992f767937 Mon Sep 17 00:00:00 2001 From: alokhyland Date: Mon, 28 Oct 2024 13:09:16 +0530 Subject: [PATCH 1/2] test case resolve-1 --- .../features/step_definitions/browser.js | 59 ++++++++++--------- .../pages/ui/browser/document_page.js | 5 +- packages/nuxeo-web-ui-ftest/wdio.conf.js | 2 +- 3 files changed, 34 insertions(+), 32 deletions(-) diff --git a/packages/nuxeo-web-ui-ftest/features/step_definitions/browser.js b/packages/nuxeo-web-ui-ftest/features/step_definitions/browser.js index 2a7c06a268..434875aaf4 100644 --- a/packages/nuxeo-web-ui-ftest/features/step_definitions/browser.js +++ b/packages/nuxeo-web-ui-ftest/features/step_definitions/browser.js @@ -2,14 +2,14 @@ // eslint-disable-next-line import/no-extraneous-dependencies import { Then, When } from '@cucumber/cucumber'; -Then('I can see the {word} tree', async function(tab) { +Then('I can see the {word} tree', async function (tab) { const drawer = await this.ui.drawer; await drawer._section(tab); const isVisible = await drawer.waitForVisible(); isVisible.should.be.true; }); -Then('I can see the {string} {word} tree node', async function(title, tab) { +Then('I can see the {string} {word} tree node', async function (title, tab) { const drawer = await this.ui.drawer; const sectionTab = await drawer._section(tab); await sectionTab.waitForVisible(); @@ -25,7 +25,7 @@ Then('I can see the {string} {word} tree node', async function(title, tab) { throw new Error(`Expected text to be ${title} but not found`); }); -Then('I can navigate to {word} pill', async function(pill) { +Then('I can navigate to {word} pill', async function (pill) { await driver.pause(1000); const browser = await this.ui.browser; await browser.waitForVisible(); @@ -36,20 +36,20 @@ Then('I can navigate to {word} pill', async function(pill) { await driver.pause(1000); }); -Then('I cannot see to {word} pill', async function(pill) { +Then('I cannot see to {word} pill', async function (pill) { const browser = await this.ui.browser; await browser.waitForVisible(); const outElement = await browser.waitForNotVisible(`nuxeo-page-item[name='${pill.toLowerCase()}']`); outElement.should.be.true; }); -Then('I am on the {word} pill', async function(pill) { +Then('I am on the {word} pill', async function (pill) { await this.ui.browser.waitForVisible(); const currentPageEle = await this.ui.browser.currentPageName; currentPageEle.should.equal(pill); }); -When('I click {string} in the {word} tree', async function(title, tab) { +When('I click {string} in the {word} tree', async function (title, tab) { const drawer = await this.ui.drawer; const sectionTab = await drawer._section(tab); await sectionTab.waitForVisible(); @@ -73,45 +73,45 @@ When('I click {string} in the {word} tree', async function(title, tab) { } }); -Then('I can see the {string} document', async function(title) { +Then('I can see the {string} document', async function (title) { const browser = await this.ui.browser; await browser.waitForVisible(); const browserTitle = await browser.hasTitle(title); browserTitle.should.be.true; }); -Then('I select all child documents', async function() { +Then('I select all child documents', async function () { const browser = await this.ui.browser; await browser.waitForVisible(); await browser.selectAllChildDocuments(); }); -Then('I select all the documents', async function() { +Then('I select all the documents', async function () { const browser = await this.ui.browser; await browser.waitForVisible(); await browser.selectAllDocuments(); }); -Then('I deselect the {string} document', async function(title) { +Then('I deselect the {string} document', async function (title) { const browser = await this.ui.browser; await browser.waitForVisible(); await browser.deselectChildDocument(title); }); -Then('I select the {string} document', async function(title) { +Then('I select the {string} document', async function (title) { const browser = await this.ui.browser; await browser.waitForVisible(); await browser.selectChildDocument(title); }); -Then('I can see the selection toolbar', async function() { +Then('I can see the selection toolbar', async function () { const browser = await this.ui.browser; await browser.waitForVisible(); const toolbar = await browser.selectionToolbar; await toolbar.waitForVisible(); }); -When('I cannot see the display selection link', async function() { +When('I cannot see the display selection link', async function () { const browser = await this.ui.browser; await browser.waitForVisible(); const selectionToolbarElem = await browser.selectionToolbar; @@ -121,7 +121,7 @@ When('I cannot see the display selection link', async function() { selectionLinkVisible.should.be.true; }); -Then('I can add selection to the {string} collection', async function(collectionName) { +Then('I can add selection to the {string} collection', async function (collectionName) { const browserEle = await this.ui.browser; await browserEle.waitForVisible(); const selectionToolEle = await browserEle.selectionToolbar; @@ -129,28 +129,28 @@ Then('I can add selection to the {string} collection', async function(collection await addToDialog.addToCollection(collectionName); }); -Then('I can add selection to clipboard', async function() { +Then('I can add selection to clipboard', async function () { const browser = await this.ui.browser; await browser.waitForVisible(); const toolbar = await browser.selectionToolbar; await toolbar.addToClipboard(); }); -Then('I can move selection down', async function() { +Then('I can move selection down', async function () { const browser = await this.ui.browser; await browser.waitForVisible(); const selectionToolbar = await browser.selectionToolbar; await selectionToolbar.moveDown(); }); -Then('I can move selection up', async function() { +Then('I can move selection up', async function () { const browser = await this.ui.browser; await browser.waitForVisible(); const selectionToolbar = await browser.selectionToolbar; await selectionToolbar.moveUp(); }); -Then('I can see the {string} child document is at position {int}', async function(title, pos) { +Then('I can see the {string} child document is at position {int}', async function (title, pos) { await driver.pause(1000); const browser = await this.ui.browser; await browser.waitForVisible(); @@ -160,13 +160,13 @@ Then('I can see the {string} child document is at position {int}', async functio } }); -When('I sort the content by {string} in {string} order', async function(field, order) { +When('I sort the content by {string} in {string} order', async function (field, order) { const browser = await this.ui.browser; await browser.waitForVisible(); await browser.sortContent(field, order); }); -Then('I can see {int} document(s)', async function(numberOfResults) { +Then('I can see {int} document(s)', async function (numberOfResults) { const browser = await this.ui.browser; const uiResult = await browser.results; const displayMode = await uiResult.displayMode; @@ -176,11 +176,11 @@ Then('I can see {int} document(s)', async function(numberOfResults) { } }); -Then(/^I can see the permissions page$/, async function() { +Then(/^I can see the permissions page$/, async function () { await this.ui.browser.permissionsView.waitForVisible(); }); -Then(/^I can see the document has (\d+) publications$/, async function(nbPublications) { +Then(/^I can see the document has (\d+) publications$/, async function (nbPublications) { const browser = await this.ui.browser; const count = await browser.publicationView.count; if ((await count) !== nbPublications) { @@ -188,7 +188,7 @@ Then(/^I can see the document has (\d+) publications$/, async function(nbPublica } }); -Then(/^I can see the document has the following publication$/, async function(table) { +Then(/^I can see the document has the following publication$/, async function (table) { const rows = table.rows(); for (let i = 0; i < rows.length; i++) { const row = rows[i]; @@ -198,7 +198,7 @@ Then(/^I can see the document has the following publication$/, async function(ta } }); -Then(/^I can republish the following publication$/, async function(table) { +Then(/^I can republish the following publication$/, async function (table) { const rows = table.hashes(); for (let i = 0; i < rows.length; i++) { const { path, rendition, version } = rows[i]; @@ -221,7 +221,7 @@ Then(/^I can republish the following publication$/, async function(table) { } }); -Then('I can publish selection to {string}', async function(target) { +Then('I can publish selection to {string}', async function (target) { const browser = await this.ui.browser; await browser.waitForVisible(); const selectionToolBar = await browser.selectionToolbar; @@ -231,7 +231,7 @@ Then('I can publish selection to {string}', async function(target) { await driver.pause(1000); }); -Then(/^I can perform the following publications$/, async function(table) { +Then(/^I can perform the following publications$/, async function (table) { let page = await this.ui.browser.documentPage(this.doc.type); await page.waitForVisible(); let pubCount = await page.publicationsCount; @@ -243,21 +243,24 @@ Then(/^I can perform the following publications$/, async function(table) { const isdocumentPublished = await dialog.publish(target, rendition, version, override); isdocumentPublished.should.be.true; page = await this.ui.browser.documentPage(this.doc.type); + console.log('pagepagepage', page) const newCount = await page.publicationsCount; + console.log('newCountnewCount', newCount) let check; const bar = await page.isVisible('#versionInfoBar'); + console.log('barbarbar', bar) if (bar) { check = newCount === 0; } else { check = override ? newCount === 1 : newCount > pubCount; } if (check) { - pubCount = page.publicationsCount; + pubCount = await page.publicationsCount; } } }); -Then('I can delete all the documents from the {string} collection', async function(name) { +Then('I can delete all the documents from the {string} collection', async function (name) { const browser = await this.ui.browser; await browser.removeSelectionFromCollection(name); // HACK - because the delete all is async diff --git a/packages/nuxeo-web-ui-ftest/pages/ui/browser/document_page.js b/packages/nuxeo-web-ui-ftest/pages/ui/browser/document_page.js index 253d823e37..70ceb39086 100644 --- a/packages/nuxeo-web-ui-ftest/pages/ui/browser/document_page.js +++ b/packages/nuxeo-web-ui-ftest/pages/ui/browser/document_page.js @@ -88,10 +88,9 @@ export default class DocumentPage extends BasePage { } } if (pub) { + const pubText = await pub.$('div').getText(); return parseInt( - pub - .$('div') - .getText() + pubText .trim(), 10, ); diff --git a/packages/nuxeo-web-ui-ftest/wdio.conf.js b/packages/nuxeo-web-ui-ftest/wdio.conf.js index bb50e5ed11..4bf6bf37ed 100644 --- a/packages/nuxeo-web-ui-ftest/wdio.conf.js +++ b/packages/nuxeo-web-ui-ftest/wdio.conf.js @@ -101,7 +101,7 @@ exports.config = { // WebdriverIO allows it to run your tests in arbitrary locations (e.g. locally or // on a remote machine). runner: 'local', - specs: [path.join(process.cwd(), './features/*.feature')], + specs: [path.join(process.cwd(), './features/publication.feature')], // check http://webdriver.io/guide/testrunner/debugging.html for more info on debugging with wdio debug: process.env.DEBUG, execArgv: process.env.DEBUG ? ['--inspect'] : [], From 25a18d6a85598e971a2005eca74f925214fee88e Mon Sep 17 00:00:00 2001 From: alokhyland Date: Mon, 28 Oct 2024 15:01:05 +0530 Subject: [PATCH 2/2] test case resolve-2 --- packages/nuxeo-web-ui-ftest/features/step_definitions/browser.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/nuxeo-web-ui-ftest/features/step_definitions/browser.js b/packages/nuxeo-web-ui-ftest/features/step_definitions/browser.js index 434875aaf4..898cc6d568 100644 --- a/packages/nuxeo-web-ui-ftest/features/step_definitions/browser.js +++ b/packages/nuxeo-web-ui-ftest/features/step_definitions/browser.js @@ -254,6 +254,7 @@ Then(/^I can perform the following publications$/, async function (table) { } else { check = override ? newCount === 1 : newCount > pubCount; } + console.log('checkcheck', check) if (check) { pubCount = await page.publicationsCount; }