Skip to content

Commit

Permalink
Improve success banner checks (#5258)
Browse files Browse the repository at this point in the history
* improve success banner checks and modernize array syntax in shipping tests

* remove empty success baner

* empty commit

* empty commit
  • Loading branch information
michalina-graczyk authored and poulch committed Nov 19, 2024
1 parent f4466d9 commit 747030e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/mighty-nails-fry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---

Enhanced success banner verification in basePage.ts by adding network idle state check and parallel assertions, while modernizing array operations in shipping methods tests using spread syntax instead of .concat()
7 changes: 5 additions & 2 deletions playwright/pages/basePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,11 @@ export class BasePage {
}

async expectSuccessBanner() {
await this.successBanner.first().waitFor({ state: "visible", timeout: 15000 });
await expect(this.errorBanner, "No error banner should be visible").not.toBeVisible();
await this.page.waitForLoadState("networkidle");
await Promise.all([
this.successBanner.first().waitFor({ state: "visible", timeout: 15000 }),
expect(this.errorBanner, "No error banner should be visible").not.toBeVisible(),
]);
}

async expectInfoBanner() {
Expand Down
12 changes: 6 additions & 6 deletions playwright/tests/shippingMethods.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,10 @@ test("TC: SALEOR_36 Delete shipping zones in bulk @shipping-method @e2e", async
});
test("TC: SALEOR_37 Update a shipping method @shipping-method @e2e", async () => {
const channelSection = shippingMethodsPage.rightSideDetailsPage.channelSection;
const warehouseSection = shippingMethodsPage.rightSideDetailsPage.warehouseSection;
const alreadyAssignedChannels = [CHANNELS.channelUSD.name];
const channelsToBeAssigned = [CHANNELS.channelPLN.name];

const warehouseSection = shippingMethodsPage.rightSideDetailsPage.warehouseSection;
const alreadyAssignedWarehouses = [
WAREHOUSES.warehouseOceania.name,
WAREHOUSES.warehouseAfrica.name,
Expand All @@ -147,27 +148,26 @@ test("TC: SALEOR_37 Update a shipping method @shipping-method @e2e", async () =>
);
await shippingMethodsPage.rightSideDetailsPage.clickChannelsSelectShippingPage();
await shippingMethodsPage.rightSideDetailsPage.selectSingleChannelShippingPage();

await shippingMethodsPage.rightSideDetailsPage.expectOptionsSelected(
warehouseSection,
alreadyAssignedWarehouses,
);

await shippingMethodsPage.rightSideDetailsPage.clickWarehouseSelectShippingPage();
await shippingMethodsPage.rightSideDetailsPage.typeAndSelectMultipleWarehousesShippingPage(
warehousesToBeAssigned,
);

await shippingMethodsPage.saveShippingZone();
await shippingMethodsPage.expectSuccessBanner();

const updatedChannelsList = alreadyAssignedChannels.concat(channelsToBeAssigned);
const updatedChannelsList = [...alreadyAssignedChannels, ...channelsToBeAssigned];
const updatedWarehousesList = [...alreadyAssignedWarehouses, ...warehousesToBeAssigned];

await shippingMethodsPage.rightSideDetailsPage.expectOptionsSelected(
channelSection,
updatedChannelsList,
);

const updatedWarehousesList = alreadyAssignedWarehouses.concat(warehousesToBeAssigned);

await shippingMethodsPage.rightSideDetailsPage.expectOptionsSelected(
warehouseSection,
updatedWarehousesList,
Expand Down

0 comments on commit 747030e

Please sign in to comment.