From 4d136937a2def2b3da1058cdb8bcee47f7ef30d6 Mon Sep 17 00:00:00 2001 From: Boubker BRIBRI Date: Fri, 20 Nov 2020 20:29:54 +0100 Subject: [PATCH] Using Promise.all to get growl message --- tests/UI/pages/BO/catalog/products/add.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/UI/pages/BO/catalog/products/add.js b/tests/UI/pages/BO/catalog/products/add.js index 99ada90eb13f8..b5e44cc262948 100644 --- a/tests/UI/pages/BO/catalog/products/add.js +++ b/tests/UI/pages/BO/catalog/products/add.js @@ -125,8 +125,11 @@ class AddProduct extends BOBasePage { * @returns {Promise} */ async saveProduct(page) { - await page.click(this.saveProductButton); - const growlTextMessage = await this.getGrowlMessageContent(page); + const [growlTextMessage] = await Promise.all([ + this.getGrowlMessageContent(page), + page.click(this.saveProductButton), + ]); + await this.closeGrowlMessage(page); return growlTextMessage; @@ -395,12 +398,14 @@ class AddProduct extends BOBasePage { await this.setValue(page, this.startingAtInput, specificPriceData.startingAt.toString()); await this.setValue(page, this.applyDiscountOfInput, specificPriceData.discount.toString()); await this.selectByVisibleText(page, this.reductionType, specificPriceData.reductionType); + // Apply specific price - await Promise.all([ - this.scrollTo(page, this.applyButton), + await this.scrollTo(page, this.applyButton); + const [growlMessageText] = await Promise.all([ + this.getGrowlMessageContent(page), page.click(this.applyButton), ]); - const growlMessageText = await this.getGrowlMessageContent(page); + await this.closeGrowlMessage(page); await this.goToFormStep(page, 1); return growlMessageText;