projects > play_right.ts
1
Play Right[github]
1
2
Play the right test- and user-oriented way with Playwright ;)
3
4
It is also a port of Selenide, Selene, NSelene, SelenideJS from
5
selenium webdriver world.
6
7
[Node.js][Playwright][TypeScript]
8
10
11
export const visible =
12
Condition.failIfNot('is visible', async (element: Element) => {
13
const handle = await element.handle();
14
const box = await handle.boundingBox();
15
return box !== null;
16
});
17
18
export const text = (expected: string | number | RegExp) =>
19
Condition.failIfNotActual(
20
`has text: ${expected}`,
21
query.text,
22
typeof expected === 'string'
23
? predicate.includes(expected)
24
: predicate.matches(expected),
25
);
26
27
export const exactText = (expected: string | number | RegExp) =>
28
Condition.failIfNotActual(
29
`has exact text: ${expected}`,
30
query.text,
31
typeof expected === 'string'
32
? predicate.equals(expected)
33
: predicate.matches(expected),
34
);
35
36
37
38
39
40
41
42
NORMAL~/oleksandr/projects/play_right.ts.../projects/play_right.tsmainutf-8
Enter to open · :q to quit
keys
j / kmove the cursor line, or the tree cursor
hfocus the tree; in the tree, fold or go to the parent
l / Enterin the tree, unfold or open the file
gg / Gfirst / last line
clickput the cursor on a line; on README.sh, run the session again
:qquit to the shell
:help ?this table
q / Escclose this