Skip to content

Commit

Permalink
Merge branch 'main' into merx-1280-missing-apps-footer
Browse files Browse the repository at this point in the history
  • Loading branch information
andrzejewsky authored Nov 25, 2024
2 parents 5cb9440 + 7290aca commit 6c8d644
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 35 deletions.
5 changes: 5 additions & 0 deletions .changeset/breezy-forks-share.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---

Removed unnecessary expect that was waiting for the success banner, as it was causing delays on CI. Instead, the test rely on other assertions to verify that changes have been applied
5 changes: 5 additions & 0 deletions .changeset/eighty-apricots-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---

Merged expectSuccessBannerMessage and expectSuccessBanner into a single method, removed the redundant method, and updated tests to use the new unified method.
5 changes: 5 additions & 0 deletions .changeset/purple-pumpkins-drive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---

Removed waitForNetworkIdleAfterAction and replaced it with a direct navigation call.Added blur actions on metadataKeyInput and metadataValueInput to ensure input stability before saving in scope of SALEOR_128
21 changes: 11 additions & 10 deletions playwright/pages/basePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,21 @@ export class BasePage {
await this.saveButton.click();
}

async expectSuccessBannerMessage(msg: string) {
await this.successBanner.locator(`text=${msg}`).waitFor({ state: "visible", timeout: 10000 });
await expect(this.errorBanner, "No error banner should be visible").not.toBeVisible();
}

async expectErrorBannerMessage(msg: string) {
await this.errorBanner.locator(`text=${msg}`).waitFor({ state: "visible", timeout: 10000 });
}

async expectSuccessBanner(timeout = SUCCESS_BANNER_TIMEOUT) {
await this.successBanner.first().waitFor({
state: "visible",
timeout,
});
async expectSuccessBanner(
options: { message?: string; timeout?: number } = { timeout: SUCCESS_BANNER_TIMEOUT },
) {
if (options.message) {
await this.successBanner
.locator(`text=${options.message}`)
.waitFor({ state: "visible", timeout: options.timeout });
} else {
await this.successBanner.first().waitFor({ state: "visible", timeout: options.timeout });
}

await expect(this.errorBanner, "No error banner should be visible").not.toBeVisible();
}

Expand Down
4 changes: 2 additions & 2 deletions playwright/tests/apps.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ test("TC: SALEOR_119 User should be able to install and configure app from manif
);
await installationPage.installAppButton.click();

await expect(appsPage.successBanner).toBeVisible({ timeout: INSTALLATION_PENDING_TIMEOUT });
await appsPage.expectSuccessBanner({ timeout: INSTALLATION_PENDING_TIMEOUT });
await expect(appsPage.installedAppRow.first()).toBeVisible();
await expect(appsPage.installationPendingLabel).not.toBeVisible();

Expand All @@ -54,7 +54,7 @@ test("TC: SALEOR_119 User should be able to install and configure app from manif
});
await iframeLocator.getByLabel("PUBLIC_TOKEN").fill("test_token");
await iframeLocator.getByText("Save").click();
await appsPage.expectSuccessBanner();
await appsPage.expectSuccessBanner({ timeout: INSTALLATION_PENDING_TIMEOUT });
});
test("TC: SALEOR_120 User should be able to delete thirdparty app @e2e", async () => {
await appPage.waitForNetworkIdleAfterAction(() =>
Expand Down
8 changes: 3 additions & 5 deletions playwright/tests/attributes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,22 +163,20 @@ for (const attribute of attributesWithValuesToBeUpdated) {

for (const attr of ATTRIBUTES.attributesToBeUpdated) {
test(`TC: SALEOR_128 User should be able to edit existing ${attr.name} attribute @e2e @attributes`, async () => {
await attributesPage.waitForNetworkIdleAfterAction(() =>
attributesPage.gotoExistingAttributePage(attr.id, attr.name),
);
await attributesPage.gotoExistingAttributePage(attr.id, attr.name);
await attributesPage.attributeDefaultLabelInput.waitFor({ state: "visible" });
await attributesPage.attributeDefaultLabelInput.clear();
await attributesPage.typeAttributeDefaultLabel(`updated ${attr.name}`);
await attributesPage.expandMetadataSection();
await attributesPage.metadataAddFieldButton.click();

await attributesPage.metadataKeyInput.waitFor({ state: "visible" });
await attributesPage.metadataValueInput.waitFor({ state: "visible" });
await attributesPage.fillMetadataFields("new key", "new value");
await attributesPage.metadataValueInput.blur();
await attributesPage.clickSaveButton();
await attributesPage.expectSuccessBanner();
await attributesPage.expectElementIsHidden(attributesPage.successBanner);
await attributesPage.attributeSelect.waitFor({ state: "visible" });

await expect(attributesPage.attributeSelect).toHaveAttribute("aria-disabled", "true");
await expect(attributesPage.metadataKeyInput).toHaveValue("new key");
await expect(attributesPage.metadataValueInput).toHaveValue("new value");
Expand Down
2 changes: 1 addition & 1 deletion playwright/tests/customers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ test("TC: SALEOR_207 Issue a new gift card for the customer @e2e @customer", asy
await giftCardsPage.expectSuccessBanner();
await giftCardsPage.issueGiftCardDialog.clickOkButton();
await giftCardsPage.expectElementIsHidden(giftCardsPage.giftCardDialog);
await giftCardsPage.expectSuccessBannerMessage("Successfully created gift card");
await giftCardsPage.expectSuccessBanner({ message: "Successfully created gift card" });
await giftCardsPage.gotoGiftCardsListView();
await giftCardsPage.waitForCanvasContainsText(`Code ending with ${code}`);
});
4 changes: 2 additions & 2 deletions playwright/tests/giftCards.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ test("TC: SALEOR_105 Issue gift card @e2e @gift", async () => {
await giftCardsPage.expectSuccessBanner();
await giftCardsPage.issueGiftCardDialog.clickOkButton();
await giftCardsPage.giftCardDialog.waitFor({ state: "hidden" });
await giftCardsPage.expectSuccessBannerMessage("Successfully created gift card");
await giftCardsPage.expectSuccessBanner({ message: "Successfully created gift card" });
await giftCardsPage.gotoGiftCardsListView();
await giftCardsPage.gridCanvas
.getByText(`Code ending with ${code}`)
Expand All @@ -49,7 +49,7 @@ test("TC: SALEOR_106 Issue gift card with specific customer and expiry date @e2e

await giftCardsPage.issueGiftCardDialog.clickOkButton();
await giftCardsPage.giftCardDialog.waitFor({ state: "hidden" });
await giftCardsPage.expectSuccessBannerMessage("Successfully created gift card");
await giftCardsPage.expectSuccessBanner({ message: "Successfully created gift card" });
await giftCardsPage.gotoGiftCardsListView();
await giftCardsPage.searchAndFindRowIndexes(fullCode);
expect(
Expand Down
26 changes: 13 additions & 13 deletions playwright/tests/orders.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ test("TC: SALEOR_28 Create basic order @e2e @order", async () => {
await ordersPage.clickAddShippingCarrierButton();
await ordersPage.shippingAddressDialog.pickAndConfirmFirstShippingMethod();
await ordersPage.clickFinalizeButton();
await draftOrdersPage.expectSuccessBannerMessage("finalized");
await draftOrdersPage.expectSuccessBanner({ message: "finalized" });
});

test("TC: SALEOR_76 Create order with transaction flow activated @e2e @order", async () => {
Expand All @@ -65,7 +65,7 @@ test("TC: SALEOR_76 Create order with transaction flow activated @e2e @order", a
await ordersPage.clickAddShippingCarrierButton();
await ordersPage.shippingAddressDialog.pickAndConfirmFirstShippingMethod();
await ordersPage.clickFinalizeButton();
await draftOrdersPage.expectSuccessBannerMessage("finalized");
await draftOrdersPage.expectSuccessBanner({ message: "finalized" });
});

test("TC: SALEOR_77 Mark order as paid and fulfill it with transaction flow activated @e2e @order", async () => {
Expand All @@ -74,15 +74,15 @@ test("TC: SALEOR_77 Mark order as paid and fulfill it with transaction flow acti
);
await ordersPage.clickMarkAsPaidButton();
await ordersPage.markOrderAsPaidDialog.typeAndSaveOrderReference();
await ordersPage.expectSuccessBannerMessage("paid");
await ordersPage.expectSuccessBanner({ message: "paid" });

const transactionsMadeRows = await ordersPage.orderTransactionsList.locator("tr");

expect(await transactionsMadeRows.count()).toEqual(1);
await expect(transactionsMadeRows).toContainText("Success");
await ordersPage.clickFulfillButton();
await fulfillmentPage.clickFulfillButton();
await ordersPage.expectSuccessBannerMessage("fulfilled");
await ordersPage.expectSuccessBanner({ message: "fulfilled" });
expect(await ordersPage.pageHeaderStatusInfo).toContainText("Fulfilled");
});

Expand Down Expand Up @@ -140,7 +140,7 @@ test("TC: SALEOR_78 Capture partial amounts by manual transactions and fulfill o
);
await ordersPage.clickFulfillButton();
await fulfillmentPage.clickFulfillButton();
await ordersPage.expectSuccessBannerMessage("fulfilled");
await ordersPage.expectSuccessBanner({ message: "fulfilled" });
expect(await ordersPage.pageHeaderStatusInfo, "Order should be yet fulfilled").toContainText(
"Fulfilled",
);
Expand All @@ -150,15 +150,15 @@ test("TC: SALEOR_79 Mark order as paid and fulfill it with regular flow @e2e @or
await ordersPage.goToExistingOrderPage(ORDERS.orderToMarkAsPaidAndFulfill.id);
await ordersPage.clickMarkAsPaidButton();
await ordersPage.markOrderAsPaidDialog.typeAndSaveOrderReference();
await ordersPage.expectSuccessBannerMessage("paid");
await ordersPage.expectSuccessBanner({ message: "paid" });
await expect(ordersPage.balanceStatusInfo).toHaveText("Settled");
expect(await ordersPage.paymentStatusInfo, "Order should be fully paid").toContainText(
"Fully paid",
);

await ordersPage.clickFulfillButton();
await fulfillmentPage.clickFulfillButton();
await ordersPage.expectSuccessBannerMessage("fulfilled");
await ordersPage.expectSuccessBanner({ message: "fulfilled" });
expect(await ordersPage.pageHeaderStatusInfo).toContainText("Fulfilled");
});

Expand All @@ -168,7 +168,7 @@ test("TC: SALEOR_80 Add tracking to order @e2e @order", async () => {
await ordersPage.goToExistingOrderPage(ORDERS.orderToAddTrackingNumberTo.id);
await ordersPage.clickAddTrackingButton();
await ordersPage.addTrackingDialog.typeTrackingNumberAndSave(trackingNumber);
await ordersPage.expectSuccessBannerMessage("updated");
await ordersPage.expectSuccessBanner({ message: "updated" });
await expect(ordersPage.setTrackingNumber).toContainText(trackingNumber);
});

Expand Down Expand Up @@ -253,9 +253,9 @@ test("TC: SALEOR_84 Create draft order @e2e @draft", async () => {
await draftOrdersPage.expectSuccessBanner();
await draftOrdersPage.clickAddShippingCarrierButton();
await draftOrdersPage.shippingAddressDialog.pickAndConfirmFirstShippingMethod();
await draftOrdersPage.expectSuccessBanner();
//await draftOrdersPage.expectSuccessBanner();
await draftOrdersPage.clickFinalizeButton();
await draftOrdersPage.expectSuccessBannerMessage("finalized");
await draftOrdersPage.expectSuccessBanner({ message: "finalized" });
});

test("TC: SALEOR_191 Refund products from the fully paid order @e2e @refunds", async () => {
Expand Down Expand Up @@ -293,7 +293,7 @@ test("TC: SALEOR_191 Refund products from the fully paid order @e2e @refunds", a
await ordersPage.clickEditRefundButton(refundReason);
await refundPage.waitForDOMToFullyLoad();
await refundPage.transferFunds();
await refundPage.expectSuccessBannerMessage("Refund has been sent");
await refundPage.expectSuccessBanner({ message: "Refund has been sent" });
});

test("TC: SALEOR_192 Should create a manual refund with a custom amount @e2e @refunds", async () => {
Expand All @@ -313,7 +313,7 @@ test("TC: SALEOR_192 Should create a manual refund with a custom amount @e2e @re
);
await refundPage.provideRefundAmount("10");
await refundPage.transferFunds();
await refundPage.expectSuccessBannerMessage("Transaction action requested successfully");
await refundPage.expectSuccessBanner({ message: "Transaction action requested successfully" });
await ordersPage.goToExistingOrderPage(order.id);
await ordersPage.orderRefundSection.waitFor({ state: "visible" });
await ordersPage.assertRefundOnList("Manual refund");
Expand Down Expand Up @@ -475,5 +475,5 @@ test("TC: SALEOR_217 Complete basic order for non existing customer @e2e @order"
await ordersPage.clickAddShippingCarrierButton();
await ordersPage.shippingAddressDialog.pickAndConfirmFirstShippingMethod();
await ordersPage.clickFinalizeButton();
await draftOrdersPage.expectSuccessBannerMessage("finalized");
await ordersPage.expectSuccessBanner({ message: "finalized" });
});
2 changes: 1 addition & 1 deletion playwright/tests/product.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ test("TC: SALEOR_45 As an admin I should be able to delete a single products @ba
);
await productPage.clickDeleteProductButton();
await productPage.deleteProductDialog.clickDeleteButton();
await productPage.expectSuccessBannerMessage("Product Removed");
await productPage.expectSuccessBanner({ message: "Product Removed" });
await productPage.waitForGrid();
await productPage.searchforProduct(PRODUCTS.productWithOneVariantToBeDeletedFromDetails.name);
await expect(
Expand Down
1 change: 0 additions & 1 deletion playwright/tests/staffMembers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ test("TC: SALEOR_211 Create a staff member @e2e @staff-members", async () => {
await staffMembersPage.assignUserToPermissionGroup("Channels Management");

await staffMembersPage.clickSaveButton();
await staffMembersPage.expectSuccessBanner();

await staffMembersPage.verifyAssignedPermission("Customer Support");
await staffMembersPage.verifyAssignedPermission("Channels Management");
Expand Down

0 comments on commit 6c8d644

Please sign in to comment.