Skip to content

Commit 6a965ad

Browse files
authored
Merge pull request #311 from QAComet/qacomet/orders-tests
Tests for orders related pages
2 parents a965623 + f05e732 commit 6a965ad

File tree

8 files changed

+426
-17
lines changed

8 files changed

+426
-17
lines changed

e2e/fixtures/account/order-page.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class OrderPage extends AccountPage {
2626

2727
constructor(page: Page) {
2828
super(page)
29-
this.container = page.getByTestId("order-complete-container")
29+
this.container = page.getByTestId("order-details-container")
3030
this.backToOverviewButton = page.getByTestId("back-to-overview-button")
3131
this.orderEmail = this.container.getByTestId("order-email")
3232
this.orderDate = this.container.getByTestId("order-date")
@@ -63,17 +63,16 @@ export class OrderPage extends AccountPage {
6363
async getProduct(title: string, variant: string) {
6464
const productRow = this.productRow
6565
.filter({
66-
has: this.productTitle.filter({ hasText: title }),
66+
hasText: title,
6767
})
6868
.filter({
69-
has: this.productVariant.filter({ hasText: variant }),
69+
hasText: `Variant: ${variant}`,
7070
})
7171
return {
7272
productRow,
73-
title: productRow.getByTestId("product-title"),
73+
name: productRow.getByTestId("product-name"),
7474
variant: productRow.getByTestId("product-variant"),
75-
deleteButton: productRow.getByTestId("delete-button"),
76-
quantitySelect: productRow.getByTestId("quantity-select"),
75+
quantity: productRow.getByTestId("product-quantity"),
7776
price: productRow.getByTestId("product-unit-price"),
7877
total: productRow.getByTestId("product-price"),
7978
}

e2e/fixtures/account/orders-page.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,14 @@ export class OrdersPage extends AccountPage {
2020
this.orderDisplayId = page.getByTestId("order-display-id")
2121
}
2222

23-
async getOrder(text: string) {
24-
const card = this.orderCard.filter({ hasText: "text" }).first()
23+
async getOrderById(orderId: string) {
24+
const orderIdLocator = this.page
25+
.getByTestId("order-display-id")
26+
.filter({
27+
hasText: orderId,
28+
})
29+
.first()
30+
const card = this.orderCard.filter({ has: orderIdLocator }).first()
2531
const items = (await card.getByTestId("order-item").all()).map(
2632
(orderItem) => {
2733
return {
@@ -35,8 +41,10 @@ export class OrdersPage extends AccountPage {
3541
card,
3642
displayId: card.getByTestId("order-display-id"),
3743
createdAt: card.getByTestId("order-created-at"),
44+
orderId: card.getByTestId("order-display-id"),
3845
amount: card.getByTestId("order-amount"),
3946
detailsLink: card.getByTestId("order-details-link"),
47+
itemsLocator: card.getByTestId("order-item"),
4048
items,
4149
}
4250
}

e2e/fixtures/checkout-page.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export class CheckoutPage extends BasePage {
4242
submitAddressButton: Locator
4343
addressErrorMessage: Locator
4444

45+
deliveryOptionsContainer: Locator
4546
deliveryOptionRadio: Locator
4647
deliveryOptionErrorMessage: Locator
4748
submitDeliveryOptionButton: Locator
@@ -166,6 +167,9 @@ export class CheckoutPage extends BasePage {
166167
"address-error-message"
167168
)
168169

170+
this.deliveryOptionsContainer = this.container.getByTestId(
171+
"delivery-options-container"
172+
)
169173
this.deliveryOptionRadio = this.container.getByTestId(
170174
"delivery-option-radio"
171175
)

0 commit comments

Comments
 (0)