-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Order payment and fulfillment with transaction flow tests (#4561)
* Create order with activated transaction flow in channel test * new assertions * Mark order as fully paid and fullfill all variants * Trigger Build * capture manual transactions test * remove not needed expect
- Loading branch information
1 parent
2948281
commit 7d59680
Showing
10 changed files
with
218 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"saleor-dashboard": minor | ||
--- | ||
|
||
Mark order as fully paid and fulfill all variants test | ||
Manual capture transactions and fulfill order test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import type { Page } from "@playwright/test"; | ||
|
||
export class ManualTransactionDialog { | ||
constructor( | ||
page: Page, | ||
readonly transactionDescriptionInput = page.getByTestId( | ||
"transactionDescription", | ||
), | ||
readonly createManualTransactionButton = page.getByTestId( | ||
"manualTransactionSubmit", | ||
), | ||
readonly transactionPspReferenceInput = page.getByTestId( | ||
"transactionPspReference", | ||
), | ||
readonly transactAmountInput = page.getByTestId("transactAmountInput"), | ||
) {} | ||
|
||
async clickCreateManualTransactionButton() { | ||
await this.createManualTransactionButton.click(); | ||
await this.createManualTransactionButton.waitFor({ state: "hidden" }); | ||
} | ||
|
||
async typeTransactionDescription(description = "partial payment") { | ||
await this.transactionDescriptionInput.fill(description); | ||
} | ||
|
||
async typeTransactionPspReference(reference = "999999999") { | ||
await this.transactionPspReferenceInput.fill(reference); | ||
} | ||
|
||
async typeTransactionAmount(amount = "100") { | ||
await this.transactAmountInput.fill(amount); | ||
} | ||
|
||
async completeManualTransactionDialogAndSave( | ||
description: string, | ||
reference: string, | ||
transactionAmount: string, | ||
) { | ||
await this.typeTransactionDescription(description); | ||
await this.typeTransactionDescription(reference); | ||
await this.typeTransactionAmount(transactionAmount); | ||
await this.clickCreateManualTransactionButton(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { Page } from "@playwright/test"; | ||
|
||
export class MarkOrderAsPaidDialog { | ||
constructor( | ||
page: Page, | ||
readonly transactionReferenceInput = page | ||
.getByTestId("transaction-reference-input") | ||
.locator("input"), | ||
readonly confirmButton = page.getByTestId("submit"), | ||
) {} | ||
|
||
async typeAndSaveOrderReference(value = "09728937896253") { | ||
await this.transactionReferenceInput.fill(value); | ||
await this.confirmButton.click(); | ||
await this.transactionReferenceInput.waitFor({ state: "hidden" }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type { Page } from "@playwright/test"; | ||
|
||
export class FulfillmentPage { | ||
readonly page: Page; | ||
constructor( | ||
page: Page, | ||
readonly fulfillButton = page.getByTestId("button-bar-confirm"), | ||
) { | ||
this.page = page; | ||
} | ||
|
||
async clickFulfillButton() { | ||
await this.fulfillButton.click(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,37 @@ | ||
import { URL_LIST } from "@data/url"; | ||
import { ManualTransactionDialog } from "@dialogs/manualTransactionDialog"; | ||
import { MarkOrderAsPaidDialog } from "@dialogs/markOrderAsPaidDialog"; | ||
import { BasePage } from "@pages/basePage"; | ||
import { AddProductsDialog } from "@pages/dialogs/addProductsDialog"; | ||
import { AddressDialog } from "@pages/dialogs/addressDialog"; | ||
import { OrderCreateDialog } from "@pages/dialogs/orderCreateDialog"; | ||
import { ShippingAddressDialog } from "@pages/dialogs/shippingMethodDialog"; | ||
import { Page } from "@playwright/test"; | ||
|
||
import { BasePage } from "./basePage"; | ||
|
||
export class OrdersPage extends BasePage { | ||
orderCreateDialog: OrderCreateDialog; | ||
markOrderAsPaidDialog: MarkOrderAsPaidDialog; | ||
addProductsDialog: AddProductsDialog; | ||
addressDialog: AddressDialog; | ||
shippingAddressDialog: ShippingAddressDialog; | ||
basePage: BasePage; | ||
manualTransactionDialog: ManualTransactionDialog; | ||
|
||
constructor( | ||
page: Page, | ||
readonly createOrderButton = page.getByTestId("create-order-button"), | ||
readonly markAsPaidButton = page.getByTestId("markAsPaidButton"), | ||
readonly manualTransactionButton = page.getByTestId( | ||
"captureManualTransactionButton", | ||
), | ||
readonly orderSummarySection = page.getByTestId("OrderSummaryCard"), | ||
readonly paymentSummarySection = page.getByTestId("payment-section"), | ||
readonly paymentStatusInfo = page.getByTestId("payment-status"), | ||
readonly fulfillButton = page.getByTestId("fulfill-button"), | ||
readonly addProducts = page.getByTestId("add-products-button"), | ||
readonly orderTransactionsList = page | ||
.getByTestId("orderTransactionsList") | ||
.locator("table"), | ||
readonly salesChannel = page.getByTestId("salesChannel"), | ||
readonly editCustomerButton = page.getByTestId("edit-customer"), | ||
readonly searchCustomerInput = page.getByTestId("select-customer"), | ||
|
@@ -35,11 +45,13 @@ export class OrdersPage extends BasePage { | |
), | ||
) { | ||
super(page); | ||
this.markOrderAsPaidDialog = new MarkOrderAsPaidDialog(page); | ||
this.orderCreateDialog = new OrderCreateDialog(page); | ||
this.basePage = new BasePage(page); | ||
this.addProductsDialog = new AddProductsDialog(page); | ||
this.addressDialog = new AddressDialog(page); | ||
this.shippingAddressDialog = new ShippingAddressDialog(page); | ||
this.manualTransactionDialog = new ManualTransactionDialog(page); | ||
} | ||
|
||
async selectCustomer(customer = "[email protected]") { | ||
|
@@ -48,6 +60,15 @@ export class OrdersPage extends BasePage { | |
async clickCreateOrderButton() { | ||
await this.createOrderButton.click(); | ||
} | ||
async clickManualTransactionButton() { | ||
await this.manualTransactionButton.click(); | ||
} | ||
async clickMarkAsPaidButton() { | ||
await this.markAsPaidButton.click(); | ||
} | ||
async clickFulfillButton() { | ||
await this.fulfillButton.click(); | ||
} | ||
async clickAddShippingCarrierButton() { | ||
await this.addShippingCarrierLink.click(); | ||
} | ||
|
@@ -70,4 +91,9 @@ export class OrdersPage extends BasePage { | |
async goToOrdersListView() { | ||
await this.page.goto(URL_LIST.orders); | ||
} | ||
async goToExistingOrderPage(orderId: string) { | ||
const orderLink = URL_LIST.orders + orderId; | ||
await console.log("Navigating to order details view: " + orderLink); | ||
await this.page.goto(orderLink); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters