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

[E2E] Add test for draft orders #5194

Merged
merged 3 commits into from
Oct 8, 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/brave-teachers-burn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---

Add e2e for managing products on draft order. Add e2e for placing draft order for non-existing customer.
5 changes: 5 additions & 0 deletions playwright/pages/pageElements/rightSideDetailsSection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ export class RightSideDetailsPage extends BasePage {
await this.waitForDOMToFullyLoad();
}

async typeAndSelectCustomerEmail(customerEmail = "[email protected]") {
await this.searchCustomerInput.fill(customerEmail);
await this.selectCustomerOption.locator(`text=${customerEmail}`).click();
}

async selectOneChannelAsAvailableWhenMoreSelected(channel: string) {
await this.manageChannelsButton.click();
await this.channelSelectDialog.clickAllChannelsCheckbox();
Expand Down
26 changes: 26 additions & 0 deletions playwright/tests/orders.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { FulfillmentPage } from "@pages/fulfillmentPage";
import { OrdersPage } from "@pages/ordersPage";
import { RefundPage } from "@pages/refundPage";
import { expect, test } from "@playwright/test";
import * as faker from "faker";

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

Expand Down Expand Up @@ -444,3 +445,28 @@ test(`TC: SALEOR_216 Order type discount is applied to a draft order @draft @dis

expect(finalTotalPrice.slice(3)).toContain(discountedOrderSubTotal.toString());
});

test("TC: SALEOR_217 Complete basic order for non existing customer @e2e @order", async () => {
const nonExistingEmail = `customer-${faker.datatype.number()}@example.com`;
const newAddress = ADDRESS.addressPL;

await ordersPage.goToOrdersListView();
await ordersPage.clickCreateOrderButton();
await ordersPage.orderCreateDialog.completeOrderCreateDialogWithFirstChannel();
await ordersPage.clickAddProductsButton();
await draftOrdersPage.addProductsDialog.selectVariantBySKU(variantSKU);
await draftOrdersPage.addProductsDialog.clickConfirmButton();
await ordersPage.rightSideDetailsPage.clickEditCustomerButton();
await ordersPage.rightSideDetailsPage.clickSearchCustomerInput();
await ordersPage.rightSideDetailsPage.typeAndSelectCustomerEmail(nonExistingEmail);
await addressForm.completeBasicInfoAddressForm(newAddress);
await addressForm.typeCompanyName(newAddress.companyName);
await addressForm.typePhone(newAddress.phone);
await addressForm.typeAddressLine2(newAddress.addressLine2);
await addressDialog.clickConfirmButton();
await ordersPage.expectSuccessBanner();
await ordersPage.clickAddShippingCarrierButton();
await ordersPage.shippingAddressDialog.pickAndConfirmFirstShippingMethod();
await ordersPage.clickFinalizeButton();
await draftOrdersPage.expectSuccessBannerMessage("finalized");
});
Loading