Skip to content

Instantly share code, notes, and snippets.

@kaileeagray
Created July 24, 2025 19:43
Show Gist options
  • Save kaileeagray/57aafb18c00c1016c25a32d5c49f24ac to your computer and use it in GitHub Desktop.
Save kaileeagray/57aafb18c00c1016c25a32d5c49f24ac to your computer and use it in GitHub Desktop.
// ISSUE: Price and Availability Check for Long Nose Pliers
// This test checks the price and availability of Long Nose Pliers on the Practice Software Testing website
import { test, expect } from '@playwright/test';
test('Checking Price and Availability of Long Nose Pliers', async ({ page }) => {
// 1. Navigate to https://practicesoftwaretesting.com
await page.goto('https://practicesoftwaretesting.com/');
// 2. Search for pliers
await page.locator('[data-test="search-query"]').click();
await page.locator('[data-test="search-query"]').fill('pliers');
await page.locator('[data-test="search-submit"]').click();
// 3. Sort by price, high to low
const sortDropdown = page.locator('[data-test="sort"]');
await expect(sortDropdown).toBeVisible();
await sortDropdown.selectOption('price,desc');
// 4. Assert price for Long Nose Pliers
const longNosePliers = page.locator('[data-test="product-01K0YWXDSWXG1YN95P3N9A60R2"]');
await expect(longNosePliers.locator('[data-test="product-price"]')).toContainText('$14.24');
// 5. Assert out-of-stock label
await expect(longNosePliers.locator('[data-test="out-of-stock"]')).toHaveText('Out of stock');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment