|
1 |
| -import { test, expect } from '@playwright/test'; |
| 1 | +import { test, expect } from "@playwright/test"; |
2 | 2 |
|
3 |
| -test('home page', async ({ page }) => { |
4 |
| - await page.goto('/'); |
5 |
| - await expect(page).toHaveTitle(/Search the CPAN - metacpan.org/, { timeout: 10 }); |
| 3 | +test("home page", async ({ page }) => { |
| 4 | + await page.goto("/"); |
| 5 | + await expect(page).toHaveTitle(/Search the CPAN - metacpan.org/, { |
| 6 | + timeout: 10, |
| 7 | + }); |
| 8 | +}); |
| 9 | + |
| 10 | +test("suggest is correct", async ({ page }) => { |
| 11 | + await page.goto("/"); |
| 12 | + const searchInput = page.getByPlaceholder("Search the CPAN"); |
| 13 | + await expect(searchInput).toBeVisible(); |
| 14 | + searchInput.fill("HTML:Restrict"); |
| 15 | + await searchInput.press("Enter"); |
| 16 | + |
| 17 | + await expect(page.getByRole('alert')).toContainText('Did you mean: HTML::Restrict'); |
| 18 | +}); |
| 19 | + |
| 20 | +test("suggest accounts for prefix and makes suggestion", async ({ page }) => { |
| 21 | + await page.goto("/"); |
| 22 | + const searchInput = page.getByPlaceholder("Search the CPAN"); |
| 23 | + await expect(searchInput).toBeVisible(); |
| 24 | + searchInput.fill("distribution:HTML:Restrict"); |
| 25 | + await searchInput.press("Enter"); |
| 26 | + |
| 27 | + await expect(page.getByRole('alert')).toContainText('Did you mean: distribution:HTML::Restrict'); |
| 28 | +}); |
| 29 | + |
| 30 | +test("suggest accounts for prefix but cannot make suggestion", async ({ page }) => { |
| 31 | + await page.goto("/"); |
| 32 | + const searchInput = page.getByPlaceholder("Search the CPAN"); |
| 33 | + await expect(searchInput).toBeVisible(); |
| 34 | + searchInput.fill("distribution:HTMLRestrict"); |
| 35 | + await searchInput.press("Enter"); |
| 36 | + |
| 37 | + await expect(page.getByRole('alert')).toBeHidden(); |
| 38 | +}); |
| 39 | + |
| 40 | +test("suggest ignores misspelled prefix and makes suggestion", async ({ page }) => { |
| 41 | + await page.goto("/"); |
| 42 | + const searchInput = page.getByPlaceholder("Search the CPAN"); |
| 43 | + await expect(searchInput).toBeVisible(); |
| 44 | + searchInput.fill("disstribution:HTML:Restrict"); |
| 45 | + await searchInput.press("Enter"); |
| 46 | + |
| 47 | + await expect(page.getByRole('alert')).toContainText('Did you mean: disstribution::HTML::Restrict'); |
6 | 48 | });
|
0 commit comments