|
| 1 | +import { faker } from "@faker-js/faker" |
| 2 | + |
| 3 | +import { expect, test } from "../fixtures/tokenizedPage" |
| 4 | +import { euAddress, euAddressNoBillingInfo } from "../utils/addresses" |
| 5 | + |
| 6 | +const customerEmail = faker.internet.email().toLocaleLowerCase() |
| 7 | + |
| 8 | +test.describe("with different tax calculators", () => { |
| 9 | + test.use({ |
| 10 | + defaultParams: { |
| 11 | + order: "with-items", |
| 12 | + lineItemsAttributes: [ |
| 13 | + { sku_code: "CANVASAU000000FFFFFF1824", quantity: 1 }, |
| 14 | + ], |
| 15 | + orderAttributes: { |
| 16 | + customer_email: customerEmail, |
| 17 | + }, |
| 18 | + market: "NO", |
| 19 | + }, |
| 20 | + }) |
| 21 | + |
| 22 | + test("Checkout address changing from Italy to Norway", async ({ |
| 23 | + checkoutPage, |
| 24 | + }) => { |
| 25 | + await checkoutPage.checkOrderSummary("Order Summary") |
| 26 | + |
| 27 | + let email = checkoutPage.getCustomerMail() |
| 28 | + |
| 29 | + await expect(email).toHaveValue(customerEmail) |
| 30 | + |
| 31 | + await checkoutPage.changeCustomerEmail("customer@example.com") |
| 32 | + await checkoutPage.blurCustomerEmail() |
| 33 | + email = checkoutPage.getCustomerMail() |
| 34 | + |
| 35 | + await expect(email).toHaveValue("customer@example.com") |
| 36 | + await checkoutPage.checkStep("Customer", "open") |
| 37 | + |
| 38 | + await checkoutPage.setBillingAddress(euAddressNoBillingInfo) |
| 39 | + |
| 40 | + await checkoutPage.save("Customer") |
| 41 | + await checkoutPage.checkStep("Customer", "close") |
| 42 | + |
| 43 | + await checkoutPage.checkCustomerEmail("customer@example.com") |
| 44 | + |
| 45 | + await checkoutPage.checkTaxSummary("0,00 Kr") |
| 46 | + |
| 47 | + await checkoutPage.clickStep("Customer") |
| 48 | + await checkoutPage.checkStep("Customer", "open") |
| 49 | + |
| 50 | + await checkoutPage.selectCountry("billing_address", "NO") |
| 51 | + |
| 52 | + await checkoutPage.save("Customer") |
| 53 | + |
| 54 | + await checkoutPage.checkTaxSummary("2,75 Kr") |
| 55 | + }) |
| 56 | +}) |
0 commit comments