diff --git a/.github/actions/prepare-tests-variables/action.yml b/.github/actions/prepare-tests-variables/action.yml index 07c04044619..f9982ec6a03 100644 --- a/.github/actions/prepare-tests-variables/action.yml +++ b/.github/actions/prepare-tests-variables/action.yml @@ -79,5 +79,4 @@ runs: echo "::notice title=POOL_INSTANCE::${POOL_INSTANCE}" echo "::notice title=BACKUP_NAMESPACE::${BACKUP_NAMESPACE}" echo "::notice title=SNAPSHOT::backup_id=${BACKUP_ID}, version=${BACKUP_VER}, name=${BACKUP_NAME}" - echo "::notice title=SALEOR_CLOUD_SERVICE::${SALEOR_CLOUD_SERVICE}" diff --git a/playwright/pages/ordersPage.ts b/playwright/pages/ordersPage.ts index f98dc35fa8c..2f1365bbf4d 100644 --- a/playwright/pages/ordersPage.ts +++ b/playwright/pages/ordersPage.ts @@ -54,6 +54,9 @@ export class OrdersPage extends BasePage { readonly addRefundButton = page.getByTestId("add-new-refund-button"), readonly customerEmail = page.getByTestId("customer-email"), readonly orderRefundModal = page.getByTestId("order-refund-dialog"), + readonly orderRefundSection = page.getByTestId("order-refund-section"), + readonly orderRefundList = page.getByTestId("refund-list"), + readonly editRefundButton = page.getByTestId("edit-refund-button"), ) { super(page); this.markOrderAsPaidDialog = new MarkOrderAsPaidDialog(page); @@ -117,4 +120,16 @@ export class OrdersPage extends BasePage { await this.addRefundButton.click(); await this.orderRefundModal.waitFor({ state: "visible" }); } + + async clickEditRefundButton(refundInfo: string) { + const refund = await this.orderRefundList.locator("tr").filter({ hasText: refundInfo }); + + await refund.locator(this.editRefundButton).click(); + } + + async assertRefundOnList(refundInfo: string) { + const refund = await this.orderRefundList.locator("tr").filter({ hasText: refundInfo }); + + await refund.waitFor({ state: "visible" }); + } } diff --git a/playwright/pages/refundPage.ts b/playwright/pages/refundPage.ts index 853a6a148a1..a5274887fcb 100644 --- a/playwright/pages/refundPage.ts +++ b/playwright/pages/refundPage.ts @@ -75,4 +75,10 @@ export class RefundPage extends OrdersPage { await this.clickSaveButton(); await this.waitForDOMToFullyLoad(); } + + async transferFunds() { + await expect(this.saveButton).toHaveText("Transfer funds"); + await this.clickSaveButton(); + await this.waitForDOMToFullyLoad(); + } } diff --git a/playwright/tests/orders.spec.ts b/playwright/tests/orders.spec.ts index 92a2d8f26f0..efe39e16625 100644 --- a/playwright/tests/orders.spec.ts +++ b/playwright/tests/orders.spec.ts @@ -272,10 +272,19 @@ test("TC: SALEOR_191 Refund products from the fully paid order @e2e @refunds", a order.lineItems[0].quantity, ); + const refundReason = "Expectations not met"; + await refundPage.inputProductLineQuantity(order.lineItems[1].name, "1"); await refundPage.clickLineRefundReasonButton(order.lineItems[0].name); await refundPage.addLineRefundReasonDialog.provideLineRefundReason("Item is damaged"); await refundPage.addLineRefundReasonDialog.submitLineRefundReason(); - await refundPage.provideRefundReason("Expectations not met"); + await refundPage.provideRefundReason(refundReason); await refundPage.saveDraft(); + await refundPage.expectSuccessBanner(); + await ordersPage.goToExistingOrderPage(order.id); + await ordersPage.orderRefundSection.waitFor({ state: "visible" }); + await ordersPage.assertRefundOnList(refundReason); + await ordersPage.clickEditRefundButton(refundReason); + await refundPage.transferFunds(); + await refundPage.expectSuccessBannerMessage("Refund has been sent"); }); diff --git a/src/orders/components/OrderDetailsRefundTable/OrderDetailsRefundLine.tsx b/src/orders/components/OrderDetailsRefundTable/OrderDetailsRefundLine.tsx index ffb84a4b4a7..11ed287a69e 100644 --- a/src/orders/components/OrderDetailsRefundTable/OrderDetailsRefundLine.tsx +++ b/src/orders/components/OrderDetailsRefundTable/OrderDetailsRefundLine.tsx @@ -81,7 +81,7 @@ export const OrderDetailsRefundLine: React.FC = ({ {isEditable ? ( -