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

Ftest-TEST-3.0.X #2345

Open
wants to merge 2 commits into
base: maintenance-3.0.x
Choose a base branch
from
Open
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
60 changes: 32 additions & 28 deletions packages/nuxeo-web-ui-ftest/features/step_definitions/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -25,7 +25,7 @@
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();
Expand All @@ -36,20 +36,20 @@
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();
Expand All @@ -73,45 +73,45 @@
}
});

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;
Expand All @@ -121,36 +121,36 @@
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;
const addToDialog = await selectionToolEle.addToCollectionDialog;
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();
Expand All @@ -160,13 +160,13 @@
}
});

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;
Expand All @@ -176,19 +176,19 @@
}
});

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) {
throw new Error(`Expected count to be equal ${nbPublications}`);
}
});

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];
Expand All @@ -198,7 +198,7 @@
}
});

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];
Expand All @@ -221,7 +221,7 @@
}
});

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;
Expand All @@ -231,7 +231,7 @@
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;
Expand All @@ -243,21 +243,25 @@
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)

Check failure on line 246 in packages/nuxeo-web-ui-ftest/features/step_definitions/browser.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected console statement
const newCount = await page.publicationsCount;
console.log('newCountnewCount', newCount)

Check failure on line 248 in packages/nuxeo-web-ui-ftest/features/step_definitions/browser.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected console statement
let check;
const bar = await page.isVisible('#versionInfoBar');
console.log('barbarbar', bar)

Check failure on line 251 in packages/nuxeo-web-ui-ftest/features/step_definitions/browser.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected console statement
if (bar) {
check = newCount === 0;
} else {
check = override ? newCount === 1 : newCount > pubCount;
}
console.log('checkcheck', check)

Check failure on line 257 in packages/nuxeo-web-ui-ftest/features/step_definitions/browser.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected console statement
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxeo-web-ui-ftest/wdio.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'] : [],
Expand Down
Loading