Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shipping method E2E test wait to content load #5094

Merged
merged 3 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading