This file contains hidden or 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
test('Should add item to cart', async({page})=>{ | |
const Url = 'https://ecommerce-playground.lambdatest.io/index.php/'; await page.goto(Url); | |
const response =await page.request.post(Url, { | |
params:{ | |
route: "checkout/cart/add" | |
}, | |
form: { | |
product_id: 28, | |
quantity: 1 | |
} |
This file contains hidden or 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
await page.goto(`${Url}?route=checkout/cart`) |
This file contains hidden or 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
test('Should add item to cart', async({page})=>{ | |
const Url = 'https://ecommerce-playground.lambdatest.io/index.php/'; | |
await page.goto(Url); | |
const response =await page.request.post(Url, { | |
params:{ | |
route: "checkout/cart/add" | |
}, | |
form: { | |
product_id: 28, | |
quantity: 1 |
This file contains hidden or 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
const capabilities = { | |
browserName: "Chrome", // Browsers allowed: `Chrome`, `MicrosoftEdge`, `pw-chromium`, `pw-firefox` and `pw-webkit` | |
browserVersion: "latest", | |
"LT:Options": { | |
platform: "Windows 10", | |
build: "Playwright Build", | |
name: "Playwright Test", | |
user: "your-user", | |
accessKey: "your-key", | |
}, }; |
This file contains hidden or 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
const browser = await chromium.connect(`wss://cdp.lambdatest.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`) | |
const page = await browser.newPage() | |
await page.goto('https://ecommerce-playground.lambdatest.io/') |
This file contains hidden or 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
const capabilities = { | |
browserName: "Chrome", // Browsers allowed: `Chrome`, `MicrosoftEdge`, `pw-chromium`, `pw-firefox` and `pw-webkit` | |
browserVersion: "latest", | |
"LT:Options": { | |
platform: "Windows 10", | |
build: "Playwright Build", | |
name: "Playwright Test", | |
user: "your-user", | |
accessKey: "your-key", | |
}, |
This file contains hidden or 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
test('Should add item to cart', async({page})=>{ | |
await page.goto('https://ecommerce-playground.lambdatest.io/'); | |
await page.locator("span.title", {hasText: 'Mega Menu' }).hover() | |
await page.locator("a[title=Desktop]").click(); | |
await page.locator("div.carousel-item.active > img[title='HTC Touch HD']").click() | |
await page.locator("#container button[title='Add to Cart']").click(); | |
await page.locator("a.btn.btn-primary.btn-block",{hasText: 'View Cart'}).click() | |
await expect(page.locator("td.text-left", {hasText: 'HTC Touch HD'})).toBeVisible() | |
await expect(page.locator("div[class$='flex-nowrap'] > input")).toHaveValue("1") | |
}); |
This file contains hidden or 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
await page.locator("a.btn.btn-primary.btn-block",{hasText: 'View Cart'}).click() | |
await expect(page.locator("td.text-left", {hasText: 'HTC Touch HD'})).toBeVisible() | |
await expect(page.locator("div[class$='flex-nowrap'] > input")).toHaveValue("1") |
This file contains hidden or 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
await page.locator("div.carousel-item.active > img[title='HTC Touch HD']").click() | |
await page.locator("#container button[title='Add to Cart']").click(); |
This file contains hidden or 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
await page.locator("span.title", {hasText: 'Mega Menu' }).hover() | |
await page.locator("a[title=Desktop]").click(); |
NewerOlder