-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathCartPage.js
39 lines (32 loc) · 933 Bytes
/
CartPage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const { expect } = require("@playwright/test");
exports.CartPage = class CartPage {
constructor(page) {
this.page = page;
this.colorBtnLoc = page.locator("button[title='white']");
this.sizeBtnLoc = page.locator("button[aria-label='size l']");
this.addToCartBtnLoc = page.locator("//button[text()='Add To Cart']");
this.productInCartLoc = page.locator(
"(//span[text()='Special Edition T-Shirt'])[2]"
);
}
async pageTitle() {
await expect(this.page).toHaveText(
"Special Edition T-Shirt - ACME Storefront"
);
}
async selectColour() {
await this.colorBtnLoc.click();
}
async selectSize() {
await this.sizeBtnLoc.click();
}
async selectSize() {
await this.sizeBtnLoc.click();
}
async addToCart() {
await this.addToCartBtnLoc.click();
}
async productInCart() {
expect(this.productInCartLoc).toContainText("Special Edition T-Shirt");
}
};