From 149897d0e282a9d13e3625dc22d0d4087d16410b Mon Sep 17 00:00:00 2001 From: Jessy Gjerek <118135201+J91-cloud@users.noreply.github.com> Date: Tue, 12 Nov 2024 12:37:45 -0500 Subject: [PATCH] Product Search Bar (#1050) **JIRA:** link to jira ticket ## Context: What is the ticket about and why are we doing this change. `Search method. When typing h in the search bar, horse saddle must be showed. ` Co-authored-by: cgerard321 <57333167+cgerard321@users.noreply.github.com> --- .../tests/productspage/searchProduct.spec.ts | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 petclinic-frontend/tests/productspage/searchProduct.spec.ts diff --git a/petclinic-frontend/tests/productspage/searchProduct.spec.ts b/petclinic-frontend/tests/productspage/searchProduct.spec.ts new file mode 100644 index 000000000..635f083dc --- /dev/null +++ b/petclinic-frontend/tests/productspage/searchProduct.spec.ts @@ -0,0 +1,28 @@ +import { test, expect } from '@playwright/test'; + +test('test', async ({ page }) => { + await page.goto('http://localhost:3000/users/login'); + + await page.waitForSelector('[placeholder="Enter your email"]'); + await page.getByPlaceholder('Enter your email').click(); + await page.getByPlaceholder('Enter your email').fill('admin@admin.com'); + + await page.waitForSelector('[placeholder="Enter your password"]'); + await page.getByPlaceholder('Enter your password').click(); + await page.getByPlaceholder('Enter your password').fill('pwd'); + + await page.getByRole('button', { name: 'Login' }).click(); + + await page.waitForSelector('role=link[name="Shop"]'); + await page.getByRole('link', { name: 'Shop' }).click(); + + await page.waitForSelector('[placeholder="Search for a product..."]'); + await page.getByPlaceholder('Search for a product...').click(); + await page.getByPlaceholder('Search for a product...').fill('horse'); + + await page.waitForSelector('role=listitem >> text=Horse Saddle'); + await expect( + page.getByRole('listitem').getByText('Horse Saddle') + ).toBeVisible(); + await page.close(); +});