Skip to content

Commit f16c6fe

Browse files
committed
add test
1 parent bce74c7 commit f16c6fe

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

tests/McpContext.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,30 @@ describe('McpContext', () => {
3333
});
3434
});
3535

36+
it('should include the value of an option in the text snapshot', async () => {
37+
await withBrowser(async (_response, context) => {
38+
const page = context.getSelectedPage();
39+
await page.setContent(`
40+
<!DOCTYPE html>
41+
<select>
42+
<option value="1">One</option>
43+
<option value="2">Two</option>
44+
</select>
45+
`);
46+
await context.createTextSnapshot();
47+
const snapshot = context.getTextSnapshot();
48+
assert.ok(snapshot);
49+
50+
const option1 = snapshot.root.children[0]?.children[0];
51+
assert.strictEqual(option1?.role, 'option');
52+
assert.strictEqual(option1?.value, '1');
53+
54+
const option2 = snapshot.root.children[0]?.children[1];
55+
assert.strictEqual(option2?.role, 'option');
56+
assert.strictEqual(option2?.value, '2');
57+
});
58+
});
59+
3660
it('can store and retrieve performance traces', async () => {
3761
await withBrowser(async (_response, context) => {
3862
const fakeTrace1 = {} as unknown as TraceResult;

0 commit comments

Comments
 (0)