Skip to content

Commit b52c9b1

Browse files
jaidhyaniJai
authored andcommitted
test: add tests for --skipUnresponsiveTabs flag
- CLI test: verify the flag is parsed correctly and defaults to false - McpContext test: verify page enumeration works with the flag enabled - Update withMcpContext test helper to accept the new option
1 parent c29e1e6 commit b52c9b1

3 files changed

Lines changed: 26 additions & 0 deletions

File tree

tests/McpContext.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@ describe('McpContext', () => {
3737
});
3838
});
3939

40+
it('list pages with skipUnresponsiveTabs enabled', async () => {
41+
await withMcpContext(
42+
async (_response, context) => {
43+
const page = context.getSelectedMcpPage();
44+
assert.ok(page, 'Should have a selected page');
45+
assert.ok(page.pptrPage.url(), 'Page should have a URL');
46+
},
47+
{skipUnresponsiveTabs: true},
48+
);
49+
});
50+
4051
it('can store and retrieve the latest performance trace', async () => {
4152
await withMcpContext(async (_response, context) => {
4253
const fakeTrace1 = {} as unknown as TraceResult;

tests/cli.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ describe('cli args parsing', () => {
2323
performanceCrux: true,
2424
'usage-statistics': true,
2525
usageStatistics: true,
26+
'skip-unresponsive-tabs': false,
27+
skipUnresponsiveTabs: false,
2628
};
2729

2830
it('parses with default args', async () => {
@@ -54,6 +56,17 @@ describe('cli args parsing', () => {
5456
});
5557
});
5658

59+
it('parses --skipUnresponsiveTabs', async () => {
60+
const args = parseArguments('1.0.0', [
61+
'node',
62+
'main.js',
63+
'--browserUrl',
64+
'http://localhost:9222',
65+
'--skipUnresponsiveTabs',
66+
]);
67+
assert.strictEqual(args.skipUnresponsiveTabs, true);
68+
});
69+
5770
it('parses with user data dir', async () => {
5871
const args = parseArguments('1.0.0', [
5972
'node',

tests/utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ export async function withMcpContext(
103103
debug?: boolean;
104104
autoOpenDevTools?: boolean;
105105
performanceCrux?: boolean;
106+
skipUnresponsiveTabs?: boolean;
106107
executablePath?: string;
107108
} = {},
108109
args: ParsedArguments = {} as ParsedArguments,
@@ -118,6 +119,7 @@ export async function withMcpContext(
118119
{
119120
experimentalDevToolsDebugging: false,
120121
performanceCrux: options.performanceCrux ?? true,
122+
skipUnresponsiveTabs: options.skipUnresponsiveTabs,
121123
},
122124
Locator,
123125
);

0 commit comments

Comments
 (0)