nextjs-starter-medusa

Форк
0
92 строки · 3.3 Кб
1
import { Locator, Page } from "@playwright/test"
2
import { BasePage } from "./base/base-page"
3

4
export class OrderPage extends BasePage {
5
  container: Locator
6
  cartSubtotal: Locator
7
  cartDiscount: Locator
8
  cartGiftCardAmount: Locator
9
  cartShipping: Locator
10
  cartTaxes: Locator
11
  cartTotal: Locator
12
  orderEmail: Locator
13
  orderDate: Locator
14
  orderId: Locator
15
  orderStatus: Locator
16
  orderPaymentStatus: Locator
17
  shippingAddressSummary: Locator
18
  shippingContactSummary: Locator
19
  shippingMethodSummary: Locator
20
  paymentMethod: Locator
21
  paymentAmount: Locator
22
  productsTable: Locator
23
  productRow: Locator
24
  productTitle: Locator
25
  productVariant: Locator
26
  productQuantity: Locator
27
  productOriginalPrice: Locator
28
  productPrice: Locator
29
  productUnitOriginalPrice: Locator
30
  productUnitPrice: Locator
31

32
  constructor(page: Page) {
33
    super(page)
34
    this.container = page.getByTestId("order-complete-container")
35
    this.orderEmail = this.container.getByTestId("order-email")
36
    this.orderDate = this.container.getByTestId("order-date")
37
    this.orderId = this.container.getByTestId("order-id")
38
    this.orderStatus = this.container.getByTestId("order-status")
39
    this.cartSubtotal = this.container.getByTestId("cart-subtotal")
40
    this.cartDiscount = this.container.getByTestId("cart-discount")
41
    this.cartGiftCardAmount = this.container.getByTestId(
42
      "cart-gift-card-amount"
43
    )
44
    this.cartShipping = this.container.getByTestId("cart-shipping")
45
    this.cartTaxes = this.container.getByTestId("cart-taxes")
46
    this.cartTotal = this.container.getByTestId("cart-total")
47
    this.orderPaymentStatus = this.container.getByTestId("order-payment-status")
48
    this.shippingAddressSummary = this.container.getByTestId(
49
      "shipping-address-summary"
50
    )
51
    this.shippingContactSummary = this.container.getByTestId(
52
      "shipping-contact-summary"
53
    )
54
    this.shippingMethodSummary = this.container.getByTestId(
55
      "shipping-method-summary"
56
    )
57
    this.paymentMethod = this.container.getByTestId("payment-method")
58
    this.paymentAmount = this.container.getByTestId("payment-amount")
59

60
    this.productsTable = this.container.getByTestId("products-table")
61
    this.productRow = this.container.getByTestId("product-row")
62
    this.productTitle = this.container.getByTestId("product-title")
63
    this.productVariant = this.container.getByTestId("product-variant")
64
    this.productQuantity = this.container.getByTestId("product-quantity")
65
    this.productOriginalPrice = this.container.getByTestId(
66
      "product-original-price"
67
    )
68
    this.productPrice = this.container.getByTestId("product-price")
69
    this.productUnitOriginalPrice = this.container.getByTestId(
70
      "product-unit-original-price"
71
    )
72
    this.productUnitPrice = this.container.getByTestId("product-unit-price")
73
  }
74

75
  async getProduct(title: string, variant: string) {
76
    const productRow = this.productRow
77
      .filter({
78
        hasText: title,
79
      })
80
      .filter({
81
        hasText: `Variant: ${variant}`,
82
      })
83
    return {
84
      productRow,
85
      name: productRow.getByTestId("product-name"),
86
      variant: productRow.getByTestId("product-variant"),
87
      quantity: productRow.getByTestId("product-quantity"),
88
      price: productRow.getByTestId("product-unit-price"),
89
      total: productRow.getByTestId("product-price"),
90
    }
91
  }
92
}
93

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.