Skip to content

Commit

Permalink
Shipping method E2E test wait to content load (#5094)
Browse files Browse the repository at this point in the history
* Update tests

* Wait for first element onl

* Add changeset
  • Loading branch information
poulch authored and Cloud11PL committed Aug 5, 2024
1 parent cf2eb13 commit d29c3f8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changeset/dull-pens-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---

Tests for shipping methods now wait to content load to start test
1 change: 1 addition & 0 deletions playwright/data/e2eTestData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ export const SHIPPING_METHODS = {
shippingMethodWithoutRates: {
id: "U2hpcHBpbmdab25lOjIzOTA%3D",
info: "Shipping method that is used to add rates",
name: "Shipping method that is used to add rates",
},
shippingMethodToBeUpdated: {
id: "U2hpcHBpbmdab25lOjIzOTI=",
Expand Down
17 changes: 5 additions & 12 deletions playwright/pages/shippingMethodsPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,15 @@ export class ShippingMethodsPage extends BasePage {
});
}

async gotoExistingShippingMethod(shippingMethodId: string) {
async gotoExistingShippingMethod(shippingMethodId: string, shippingMethodName: string) {
const existingShippingMethodUrl = `${URL_LIST.shippingMethods}${shippingMethodId}`;

await console.log(`Navigates to existing shipping method page: ${existingShippingMethodUrl}`);
await this.page.goto(existingShippingMethodUrl);

const channels = await this.rightSideDetailsPage.channelSection
.locator('[data-test-id*="selected-option-"]')
.all();

for (const channel of channels) {
await channel.waitFor({
state: "visible",
timeout: 60000,
});
}
await this.page.getByText(shippingMethodName).first().waitFor({
state: "visible",
timeout: 60000,
});
}

async gotoExistingShippingRate(shippingMethodId: string, shippingRateId: string) {
Expand Down
5 changes: 5 additions & 0 deletions playwright/tests/shippingMethods.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ test("TC: SALEOR_31 Create basic shipping method @shipping-method @e2e", async (
test("TC: SALEOR_32 Add price rate to shipping method - with excluded zip codes and excluded product @shipping-method @e2e", async () => {
await shippingMethodsPage.gotoExistingShippingMethod(
SHIPPING_METHODS.shippingMethodWithoutRates.id,
SHIPPING_METHODS.shippingMethodWithoutRates.name,
);
await shippingMethodsPage.clickAddPriceRateButton();
await shippingMethodsPage.rightSideDetailsPage.selectTaxIndex(1);
Expand All @@ -53,6 +54,7 @@ test("TC: SALEOR_32 Add price rate to shipping method - with excluded zip codes
test("TC: SALEOR_33 Add weight rate to shipping method - with included zip codes and excluded product @shipping-method @e2e", async () => {
await shippingMethodsPage.gotoExistingShippingMethod(
SHIPPING_METHODS.shippingMethodWithoutRates.id,
SHIPPING_METHODS.shippingMethodWithoutRates.name,
);
await shippingMethodsPage.clickAddWeightRateButton();
await shippingMethodsPage.rightSideDetailsPage.selectTaxIndex(1);
Expand All @@ -74,6 +76,7 @@ test("TC: SALEOR_33 Add weight rate to shipping method - with included zip codes
test("TC: SALEOR_34 Delete a single shipping rate from the shipping zone details page @shipping-method @e2e", async () => {
await shippingMethodsPage.gotoExistingShippingMethod(
SHIPPING_METHODS.shippingMethodWithRatesToBeDeleted.id,
SHIPPING_METHODS.shippingMethodWithRatesToBeDeleted.name,
);
await expect(shippingMethodsPage.pageHeader).toBeVisible();

Expand Down Expand Up @@ -134,7 +137,9 @@ test("TC: SALEOR_37 Update a shipping method @shipping-method @e2e", async () =>

await shippingMethodsPage.gotoExistingShippingMethod(
SHIPPING_METHODS.shippingMethodToBeUpdated.id,
SHIPPING_METHODS.shippingMethodToBeUpdated.name,
);

await shippingMethodsPage.rightSideDetailsPage.clickChannelsSelectShippingPage();
await shippingMethodsPage.rightSideDetailsPage.selectSingleChannelShippingPage();
await shippingMethodsPage.rightSideDetailsPage.clickWarehouseSelectShippingPage();
Expand Down

0 comments on commit d29c3f8

Please sign in to comment.