Skip to content

Commit

Permalink
e2e order for non-existing customer
Browse files Browse the repository at this point in the history
  • Loading branch information
szczecha committed Oct 8, 2024
1 parent 2f1d721 commit a21c63d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
6 changes: 6 additions & 0 deletions playwright/pages/pageElements/rightSideDetailsSection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,12 @@ 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();
await this.waitForDOMToFullyLoad();
}

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");
});

0 comments on commit a21c63d

Please sign in to comment.