Skip to content

Commit

Permalink
Using Promise.all to get growl message
Browse files Browse the repository at this point in the history
  • Loading branch information
Boubker BRIBRI committed Dec 4, 2020
1 parent 6202920 commit 4d13693
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions tests/UI/pages/BO/catalog/products/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,11 @@ class AddProduct extends BOBasePage {
* @returns {Promise<string>}
*/
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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 4d13693

Please sign in to comment.