Repository navigation
Expand file tree
/
Copy pathicon.spec.js
More file actions
54 lines (40 loc) · 1.37 KB
/
Copy pathicon.spec.js
File metadata and controls
54 lines (40 loc) · 1.37 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// @ts-check
import { test, expect } from "@playwright/test";
test("Icon search has title", async ({ page }) => {
await page.goto("/icons");
await expect(page).toHaveTitle(/Icons/);
});
test("Icon search works correctly", async ({ page }) => {
// 1. navigate to search page
await page.goto("/icons");
// 2. show no users are listed
await expect(page.locator("li")).toHaveCount(4);
// 3. type in search and check that user with the name exist and check a name doesn't exist
const input = page.locator("[name='keyword']");
await input.type("mobile");
await expect(page.locator("li")).toHaveCount(4);
});
test("Icon search page has no results when no search term used", async ({
page,
}) => {
await page.goto("/search");
const input = page.locator("[name='keyword']");
await input.type("");
await expect(page.locator("li")).toHaveCount(0);
});
test("Icon search page shows no results after typing 2 characters", async ({
page,
}) => {
await page.goto("/search");
const input = page.locator("[name='keyword']");
await input.type("ed");
await expect(page.locator("li")).toHaveCount(0);
});
test("Icon search page shows results after typing 3 characters", async ({
page,
}) => {
await page.goto("/search");
const input = page.locator("[name='keyword']");
await input.type("hand");
await expect(page.locator("li")).toContainText(["hand"]);
});