generated from nginx/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathsearch.spec.ts
30 lines (25 loc) · 1.3 KB
/
search.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { test, expect} from '@playwright/test';
import { handleConsentPopup, waitFor } from '../tests/utils/commonUtils.ts'
test.describe("Testing search page", () => {
test('Searchbar is visible', async ({ page }) => {
await page.goto('/');
await waitFor(() => handleConsentPopup(page));
const searchBox = page.locator('.CoveoSearchbox').first();
const searchButton = page.locator('.CoveoSearchButton');
const searchValue = "proxy";
expect(searchBox).toBeVisible();
await searchBox.click();
await page.keyboard.insertText(searchValue);
await searchButton.click();
await page.waitForURL(`/search.html#q=${searchValue}&sort=relevancy`);
expect(await page.locator('div h1').innerHTML()).toBe('Search Results');
});
test('Search page returns results without error', async ({ page }) => {
await page.goto("/search.html#q=proxy&sort=relevancy");
await waitFor(() => handleConsentPopup(page));
await page.waitForSelector('div.coveo-result-list-container');
const coveoErrorReport = page.locator('div.CoveoErrorReport');
const errorReportDisplay = await coveoErrorReport.evaluate(e => window.getComputedStyle(e).display);
expect(errorReportDisplay).toBe('none');
});
})