Skip to content

Instantly share code, notes, and snippets.

@imartinflores
Created July 30, 2023 19:17
Show Gist options
  • Save imartinflores/165f00a1054b0392b54e4f0c89143b37 to your computer and use it in GitHub Desktop.
Save imartinflores/165f00a1054b0392b54e4f0c89143b37 to your computer and use it in GitHub Desktop.
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
}
})
await page.goto(`${Url}?route=checkout/cart`)
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