From 4646b29774589f2575802b599c2e6bb4ba55fd73 Mon Sep 17 00:00:00 2001 From: Boubker BRIBRI Date: Wed, 11 Dec 2019 10:37:04 +0100 Subject: [PATCH 1/3] Add function element not visible --- tests/puppeteer/pages/commonPage.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/puppeteer/pages/commonPage.js b/tests/puppeteer/pages/commonPage.js index 3bb76c3e2438e..bec27d34a471f 100755 --- a/tests/puppeteer/pages/commonPage.js +++ b/tests/puppeteer/pages/commonPage.js @@ -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 From 7552f1b0baf7262f118eecc829edeb33a50ad14c Mon Sep 17 00:00:00 2001 From: Boubker BRIBRI Date: Wed, 11 Dec 2019 10:38:42 +0100 Subject: [PATCH 2/3] Use element not visible in reset function --- tests/puppeteer/pages/BO/catalog/products/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/puppeteer/pages/BO/catalog/products/index.js b/tests/puppeteer/pages/BO/catalog/products/index.js index 17bd0e089f8c5..ea7b84c19469c 100644 --- a/tests/puppeteer/pages/BO/catalog/products/index.js +++ b/tests/puppeteer/pages/BO/catalog/products/index.js @@ -249,7 +249,7 @@ module.exports = class Product extends BOBasePage { * @return {Promise} */ async resetFilter() { - if (await this.elementVisible(this.filterResetButton, 2000)) { + if (!(await this.elementNotVisible(this.filterResetButton, 2000))) { await this.clickAndWaitForNavigation(this.filterResetButton); } } From ee4d25c2e7ab958ba9f8437c51a7d0297e9626a8 Mon Sep 17 00:00:00 2001 From: Boubker BRIBRI Date: Wed, 11 Dec 2019 10:39:38 +0100 Subject: [PATCH 3/3] Get last element message in add/edit product --- tests/puppeteer/pages/BO/catalog/products/add.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/puppeteer/pages/BO/catalog/products/add.js b/tests/puppeteer/pages/BO/catalog/products/add.js index 25709a8ce8f1d..a4817e1318d10 100644 --- a/tests/puppeteer/pages/BO/catalog/products/add.js +++ b/tests/puppeteer/pages/BO/catalog/products/add.js @@ -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`); } /**