-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Expand file tree
/
Copy pathchrome-devtools-commands.test.ts
More file actions
70 lines (60 loc) · 1.58 KB
/
chrome-devtools-commands.test.ts
File metadata and controls
70 lines (60 loc) · 1.58 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import assert from 'node:assert';
import {describe, it, afterEach, beforeEach} from 'node:test';
import {
assertDaemonIsNotRunning,
assertDaemonIsRunning,
runCli,
} from '../utils.js';
describe('chrome-devtools', () => {
beforeEach(async () => {
await runCli(['stop']);
await assertDaemonIsNotRunning();
});
afterEach(async () => {
await runCli(['stop']);
await assertDaemonIsNotRunning();
});
it('can invoke list_pages', async () => {
await assertDaemonIsNotRunning();
const startResult = await runCli(['start']);
assert.strictEqual(
startResult.status,
0,
`start command failed: ${startResult.stderr}`,
);
const listPagesResult = await runCli(['list_pages']);
assert.strictEqual(
listPagesResult.status,
0,
`list_pages command failed: ${listPagesResult.stderr}`,
);
assert(
listPagesResult.stdout.includes('about:blank'),
'list_pages output is unexpected',
);
await assertDaemonIsRunning();
});
it('can take screenshot', async () => {
const startResult = await runCli(['start']);
assert.strictEqual(
startResult.status,
0,
`start command failed: ${startResult.stderr}`,
);
const result = await runCli(['take_screenshot']);
assert.strictEqual(
result.status,
0,
`take_screenshot command failed: ${result.stderr}`,
);
assert(
result.stdout.includes('.png'),
'take_screenshot output is unexpected',
);
});
});