Skip to content

Commit

Permalink
revert file
Browse files Browse the repository at this point in the history
  • Loading branch information
alokhyland committed Oct 24, 2024
1 parent 7c3c511 commit ed98cce
Showing 1 changed file with 57 additions and 48 deletions.
105 changes: 57 additions & 48 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 @@ 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();
Expand All @@ -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();
Expand All @@ -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;
Expand All @@ -121,36 +121,36 @@ 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;
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 @@ 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;
Expand All @@ -176,19 +176,19 @@ 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) {
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 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];
Expand All @@ -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;
Expand All @@ -231,33 +231,42 @@ Then('I can publish selection to {string}', async function(target) {
await driver.pause(1000);
});

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;
pubCount.should.not.be.NaN;
const rows = table.hashes();
for (let i = 0; i < rows.length; i++) {
const { target, rendition, version, override } = rows[i];
const dialog = await this.ui.browser.publishDialog;
const isdocumentPublished = await dialog.publish(target, rendition, version, override);
isdocumentPublished.should.be.true;
page = await this.ui.browser.documentPage(this.doc.type);
const newCount = await page.publicationsCount;
let check;
const bar = await page.isVisible('#versionInfoBar');
if (bar) {
check = newCount === 0;
} else {
check = override ? newCount === 1 : newCount > pubCount;
}
if (check) {
pubCount = page.publicationsCount;
Then(/^I can perform the following publications$/, async function (table) {

try {
let page = await this.ui.browser.documentPage(this.doc.type);
await page.waitForVisible();
let pubCount = await page.publicationsCount;
pubCount.should.not.be.NaN;
const rows = table.hashes();
console.log('tabletabletabletabletabletable', table)

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

View workflow job for this annotation

GitHub Actions / lint

Unexpected console statement
for (let i = 0; i < rows.length; i++) {
const { target, rendition, version, override } = rows[i];
const dialog = await this.ui.browser.publishDialog;
const isdocumentPublished = await dialog.publish(target, rendition, version, override);
console.log('isdocumentPublishedisdocumentPublishedisdocumentPublished', isdocumentPublished)

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

View workflow job for this annotation

GitHub Actions / lint

Unexpected console statement
isdocumentPublished.should.be.true;
page = await this.ui.browser.documentPage(this.doc.type);
const newCount = await page.publicationsCount;
let check;
const bar = await page.isVisible('#versionInfoBar');
if (bar) {
check = newCount === 0;
} else {
check = override ? newCount === 1 : newCount > pubCount;
}
if (check) {
pubCount = page.publicationsCount;
}
}
}
catch (err) {
console.log('catchError', err)

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

View workflow job for this annotation

GitHub Actions / lint

Unexpected console statement
}

});

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

0 comments on commit ed98cce

Please sign in to comment.