-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Expand file tree
/
Copy pathMcpContext.test.ts
More file actions
31 lines (29 loc) · 906 Bytes
/
McpContext.test.ts
File metadata and controls
31 lines (29 loc) · 906 Bytes
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
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {describe, it} from 'node:test';
import assert from 'assert';
import {withBrowser} from './utils.js';
describe('McpResponse', () => {
it('list pages', async () => {
await withBrowser(async (response, context) => {
const page = context.getSelectedPage();
await page.setContent(`<!DOCTYPE html>
<button>Click me</button><input type="text" value="Input">`);
await context.createTextSnapshot();
assert.ok(await context.getElementByUid('1_1'));
await context.createTextSnapshot();
try {
await context.getElementByUid('1_1');
assert.fail('not reached');
} catch (err) {
assert.strict(
err.message,
'This uid is coming from a stale snapshot. Call take_snapshot to get a fresh snapshot',
);
}
});
});
});