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

Tests - Fix sanity on nightly #16764

Merged
merged 3 commits into from Dec 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/puppeteer/pages/BO/catalog/products/add.js
Expand Up @@ -84,7 +84,7 @@ module.exports = class AddProduct extends BOBasePage {
this.page.waitForSelector(this.growlMessageBloc, {visible: true}),
this.page.click(this.saveProductButton),
]);
return this.getTextContent(this.growlMessageBloc);
return this.getTextContent(`${this.growlMessageBloc}:last-of-type`);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/puppeteer/pages/BO/catalog/products/index.js
Expand Up @@ -249,7 +249,7 @@ module.exports = class Product extends BOBasePage {
* @return {Promise<void>}
*/
async resetFilter() {
if (await this.elementVisible(this.filterResetButton, 2000)) {
if (!(await this.elementNotVisible(this.filterResetButton, 2000))) {
await this.clickAndWaitForNavigation(this.filterResetButton);
}
}
Expand Down
14 changes: 14 additions & 0 deletions tests/puppeteer/pages/commonPage.js
Expand Up @@ -45,6 +45,20 @@ module.exports = class CommonPage {
}
}

/**
* Is element not visible
* @param selector, element to check
* @return boolean, true if visible, false if not
*/
async elementNotVisible(selector, timeout = 10) {
try {
await this.page.waitForSelector(selector, {hidden: true, timeout});
return true;
} catch (error) {
return false;
}
}

/**
* Open link in new Tab and get opened Page
* @param currentPage, current page where to click on selector
Expand Down