Skip to content

Commit

Permalink
[QA] Removing skips from Playwright tests (#4840)
Browse files Browse the repository at this point in the history
* Removing skips from Playwright tests

* fixing flaky test
  • Loading branch information
yellowee authored May 7, 2024
1 parent e02050a commit a6ed457
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 30 deletions.
5 changes: 5 additions & 0 deletions .changeset/shy-spoons-explain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": minor
---

Removing skips from e2e tests
14 changes: 8 additions & 6 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import dotenv from "dotenv";
import { defineConfig, devices } from "@playwright/test";
import dotenv from "dotenv";

dotenv.config();

const env = process.env;
const DEFAULT_RETRIES = '1';
const DEFAULT_WORKERS = '2';
const DEFAULT_RETRIES = "1";
const DEFAULT_WORKERS = "2";

export default defineConfig({
testDir: "playwright/tests",
fullyParallel: true,
forbidOnly: !!env.CI,
retries: parseInt(env.RETRIES || DEFAULT_RETRIES),
workers: parseInt(env.WORKERS || DEFAULT_WORKERS),
reporter: process.env.CI
reporter: process.env.CI
? [
["blob"],
["github"],
Expand All @@ -33,7 +35,7 @@ export default defineConfig({
maxFailures: 5,
timeout: env.CI ? 45000 : 60000,
use: {
baseURL: env.BASE_URL || '',
baseURL: env.BASE_URL || "",
trace: env.CI ? "on-all-retries" : "on",
screenshot: "only-on-failure",
testIdAttribute: "data-test-id",
Expand All @@ -43,7 +45,7 @@ export default defineConfig({
projects: [
{
name: "setup",
testMatch: /.*\.setup\.ts/
testMatch: /.*\.setup\.ts/,
},
{
name: "chromium",
Expand Down
2 changes: 1 addition & 1 deletion playwright/api/mailpit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class MailpitService {
{
message: `Message with subject: ${mailSubject} was not found`,
intervals: [2000, 3000, 5000, 5000],
timeout: 15000,
timeout: 30000,
},
)
.toBe(true);
Expand Down
12 changes: 11 additions & 1 deletion playwright/pages/dialogs/exportProductsDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ export class ExportProductsDialog {
readonly channelsAccordion = page.getByTestId("channel-expand-button"),
readonly nextButton = page.getByTestId("next"),
readonly submitButton = page.getByTestId("submit"),
readonly exportSearchedProductsRadioButton = page.locator("input[value='FILTER']"),
readonly exportSearchedProductsRadioButton = page.getByTestId("FILTER"),
readonly exportSelectedProductsRadioButton = page.getByTestId("IDS"),
readonly exportAllProductsRadioButton = page.getByTestId("ALL"),
) {
this.page = page;
}
Expand All @@ -29,6 +31,14 @@ export class ExportProductsDialog {
await this.exportSearchedProductsRadioButton.click();
}

async clickExportSelectedProductsRadioButton() {
await this.exportSelectedProductsRadioButton.click();
}

async clickExportAllProductsRadioButton() {
await this.exportAllProductsRadioButton.click();
}

async checkChannelCheckbox(channel = "PLN") {
await this.page.locator(`[name="Channel-${channel}"]`).click();
}
Expand Down
4 changes: 1 addition & 3 deletions playwright/pages/dialogs/shippingMethodDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ export class ShippingAddressDialog extends BasePage {
}

async pickAndConfirmFirstShippingMethod() {
await this.waitForNetworkIdle(async () => {
await this.selectShippingMethodInput.click();
});
await this.selectShippingMethodInput.click();
await this.shippingMethodOption.first().click();
await this.confirmButton.click();
await expect(this.selectShippingMethodInput).not.toBeVisible();
Expand Down
1 change: 1 addition & 0 deletions playwright/pages/draftOrdersPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export class DraftOrdersPage extends BasePage {

async clickAddShippingCarrierButton() {
await this.addShippingCarrierLink.click();
await this.waitForDOMToFullyLoad();
}

async clickFinalizeButton() {
Expand Down
24 changes: 11 additions & 13 deletions playwright/tests/giftCards.spec.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// import { MailpitService } from "@api/mailpit";
import { MailpitService } from "@api/mailpit";
import { GIFT_CARDS } from "@data/e2eTestData";
import { GiftCardsPage } from "@pages/giftCardsPage";
import { expect, test } from "@playwright/test";

test.use({ storageState: "./playwright/.auth/admin.json" });

let giftCardsPage: GiftCardsPage;
// let mailpitService: MailpitService;
let mailpitService: MailpitService;

test.beforeEach(async ({ page, request }) => {
giftCardsPage = new GiftCardsPage(page);
// mailpitService = new MailpitService(request);
mailpitService = new MailpitService(request);
await giftCardsPage.gotoGiftCardsListView();
await giftCardsPage.waitForDOMToFullyLoad();
});
Expand Down Expand Up @@ -122,11 +122,10 @@ test("TC: SALEOR_182 Export gift card codes in XLSX file @e2e @gift", async () =
state: "hidden",
timeout: 30000,
});
// To be uncommented https://linear.app/saleor/issue/QAG-94/remove-skip-from-app-tests
// await mailpitService.checkDoesUserReceivedExportedData(
// process.env.E2E_USER_NAME!,
// "Your exported gift cards data is ready",
// );
await mailpitService.checkDoesUserReceivedExportedData(
process.env.E2E_USER_NAME!,
"Your exported gift cards data is ready",
);
});
test("TC: SALEOR_183 Export gift card codes in CSV file @e2e @gift", async () => {
await giftCardsPage.clickShowMoreMenu();
Expand All @@ -136,9 +135,8 @@ test("TC: SALEOR_183 Export gift card codes in CSV file @e2e @gift", async () =>
state: "hidden",
timeout: 30000,
});
// To be uncommented https://linear.app/saleor/issue/QAG-94/remove-skip-from-app-tests
// await mailpitService.checkDoesUserReceivedExportedData(
// process.env.E2E_USER_NAME!,
// "Your exported gift cards data is ready",
// );
await mailpitService.checkDoesUserReceivedExportedData(
process.env.E2E_USER_NAME!,
"Your exported gift cards data is ready",
);
});
2 changes: 1 addition & 1 deletion playwright/tests/navigation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ test("TC: SALEOR_194 Should create a new menu navigation with menu item @navigat
await expect(navigationDetailsPage.menuItemList).toContainText(menuItemName);
});
// TODO: To be updated after https://linear.app/saleor/issue/MERX-307 is fixed
test("TC: SALEOR_198 Should update existing menu @navigation @e2e", async () => {
test.skip("TC: SALEOR_198 Should update existing menu @navigation @e2e", async () => {
await navigationDetailsPage.goToExistingMenuView(NAVIGATION_ITEMS.navigationMenuToBeUpdated.id);

const menuItemToBeUpdated = NAVIGATION_ITEMS.navigationMenuToBeUpdated.menuItems[0];
Expand Down
5 changes: 2 additions & 3 deletions playwright/tests/product.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,15 @@ test("TC: SALEOR_46 As an admin, I should be able to update a product by uploadi
"Newly added single image should be present",
).toEqual(1);
});
// blocked by bug https://github.com/saleor/saleor-dashboard/issues/4368
test.skip("TC: SALEOR_56 As an admin, I should be able to export products from single channel as CSV file @basic-regression @product @e2e", async () => {
test("TC: SALEOR_56 As an admin, I should be able to export products from single channel as CSV file @basic-regression @product @e2e", async () => {
await productPage.gotoProductListPage();
await productPage.waitForDOMToFullyLoad();
await productPage.clickCogShowMoreButtonButton();
await productPage.clickExportButton();
await productPage.exportProductsDialog.clickChannelsAccordion();
await productPage.exportProductsDialog.checkChannelCheckbox("PLN");
await productPage.exportProductsDialog.clickNextButton();
await productPage.exportProductsDialog.clickExportSearchedProductsRadioButton();
await productPage.exportProductsDialog.clickExportAllProductsRadioButton();
await productPage.exportProductsDialog.clickSubmitButton();
await productPage.expectInfoBanner();
await mailpitService.checkDoesUserReceivedExportedData(
Expand Down
3 changes: 1 addition & 2 deletions playwright/tests/vouchers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,7 @@ test("TC: SALEOR_93 Bulk delete voucher @vouchers @e2e", async () => {
`Given vouchers: ${VOUCHERS.vouchers.voucherToBeBulkDeleted.names} should be deleted from the list`,
).toEqual([]);
});
// TODO: https://github.com/saleor/saleor-dashboard/issues/4590
test.skip("TC: SALEOR_94 Edit voucher - assign voucher to specific category @vouchers @e2e", async () => {
test("TC: SALEOR_94 Edit voucher - assign voucher to specific category @vouchers @e2e", async () => {
const categoryToBeAssigned = "Accessories";

await vouchersPage.gotoExistingVoucherPage(
Expand Down

0 comments on commit a6ed457

Please sign in to comment.