-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2348711
commit bee2095
Showing
5 changed files
with
97 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const { expect } = require('@playwright/test'); | ||
|
||
class OrderDetailsPage{ | ||
|
||
constructor(page){ | ||
this.page = page; | ||
this.rows = page.locator("tbody tr"); | ||
this.details = page.locator(".col-text"); | ||
} | ||
|
||
async selectingOrderDetails(orderId){ | ||
await this.rows; | ||
for (let i = 0; i < await this.rows.count(); ++i) { | ||
const rowOrderId = await this.rows.nth(i).locator("th").textContent(); | ||
console.log(rowOrderId); | ||
if (orderId.includes(rowOrderId)) { | ||
await this.rows.nth(i).locator("button").first().click(); | ||
break; | ||
} | ||
} | ||
|
||
} | ||
|
||
async validatingOrderDetails(orderId){ | ||
const orderIdDetails = await this.details.textContent(); | ||
expect(orderId.includes(orderIdDetails)).toBeTruthy(); | ||
} | ||
} | ||
module.exports = {OrderDetailsPage}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,33 @@ | ||
const { expect } = require('@playwright/test'); | ||
|
||
class PaymentPage{ | ||
|
||
constructor(page){ | ||
this.page = page; | ||
this.country = page.locator("[placeholder*='Country']"); | ||
this.dropdown = page.locator(".ta-results"); | ||
this.buttons = this.dropdown.locator("button"); | ||
this.emailIdPresent = page.locator(".user__name [type='text']"); | ||
this.submitBtn = page.locator(".action__submit"); | ||
} | ||
|
||
async selectCountry(){ | ||
await this.country.pressSequentially("ind"); | ||
await this.dropdown.waitFor(); | ||
const optionsCount = await this.buttons.count(); | ||
for (let i = 0; i < optionsCount; ++i) { | ||
const text = await this.buttons.nth(i).textContent(); | ||
if (text === " India") { | ||
await this.buttons.nth(i).click(); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
async validatingEmail(email){ | ||
await expect(this.emailIdPresent.first()).toHaveText(email); | ||
await this.submitBtn.click(); | ||
|
||
} | ||
} | ||
module.exports = {PaymentPage}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const { expect } = require('@playwright/test'); | ||
|
||
class ThankyouPage{ | ||
|
||
constructor(page){ | ||
this.page = page; | ||
this.thanksText = page.locator(".hero-primary"); | ||
this.orderIdPresent = page.locator(".em-spacer-1 .ng-star-inserted"); | ||
this.myOrderBtn = page.locator("button[routerlink*='myorders']"); | ||
this.element = page.locator("tbody"); | ||
} | ||
|
||
async validateOrderId(){ | ||
await expect(this.thanksText).toHaveText(" Thankyou for the order. "); | ||
return await this.orderIdPresent.textContent(); | ||
|
||
} | ||
|
||
async myOrder(){ | ||
await this.myOrderBtn.click(); | ||
await this.element.waitFor(); | ||
} | ||
} | ||
module.exports = {ThankyouPage}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters