-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathno-networkidle.test.ts
61 lines (57 loc) · 1.95 KB
/
no-networkidle.test.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import rule from '../../src/rules/no-networkidle.js'
import { runRuleTester } from '../utils/rule-tester.js'
const messageId = 'noNetworkidle'
runRuleTester('no-networkidle', rule, {
invalid: [
{
code: 'page.waitForLoadState("networkidle")',
errors: [{ column: 23, endColumn: 36, line: 1, messageId }],
},
{
code: 'page.waitForURL(url, { waitUntil: "networkidle" })',
errors: [{ column: 35, endColumn: 48, line: 1, messageId }],
},
{
code: 'page["waitForURL"](url, { waitUntil: "networkidle" })',
errors: [{ column: 38, endColumn: 51, line: 1, messageId }],
},
{
code: 'page[`waitForURL`](url, { waitUntil: "networkidle" })',
errors: [{ column: 38, endColumn: 51, line: 1, messageId }],
},
{
code: 'page.goto(url, { waitUntil: "networkidle" })',
errors: [{ column: 29, endColumn: 42, line: 1, messageId }],
},
{
code: 'page.reload(url, { waitUntil: "networkidle" })',
errors: [{ column: 31, endColumn: 44, line: 1, messageId }],
},
{
code: 'page.setContent(url, { waitUntil: "networkidle" })',
errors: [{ column: 35, endColumn: 48, line: 1, messageId }],
},
{
code: 'page.goBack(url, { waitUntil: "networkidle" })',
errors: [{ column: 31, endColumn: 44, line: 1, messageId }],
},
{
code: 'page.goForward(url, { waitUntil: "networkidle" })',
errors: [{ column: 34, endColumn: 47, line: 1, messageId }],
},
],
valid: [
'foo("networkidle")',
'foo(url, { waitUntil: "networkidle" })',
'foo.bar("networkidle")',
'foo.bar(url, { waitUntil: "networkidle" })',
'page.hi("networkidle")',
'page.hi(url, { waitUntil: "networkidle" })',
'frame.hi("networkidle")',
'frame.hi(url, { waitUntil: "networkidle" })',
// Other options are valid
'this.page.waitForLoadState()',
'page.waitForLoadState({ waitUntil: "load" })',
'page.waitForURL(url, { waitUntil: "load" })',
],
})