Skip to content

Instantly share code, notes, and snippets.

@SarahElson
Created August 23, 2022 08:49
Show Gist options
  • Save SarahElson/8fe7c2055d7fd0fe90d2162c5a777eb2 to your computer and use it in GitHub Desktop.
Save SarahElson/8fe7c2055d7fd0fe90d2162c5a777eb2 to your computer and use it in GitHub Desktop.
File: typescript.spec.ts
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")
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment