Skip to content

Commit b508d63

Browse files
committed
extend timeout
1 parent 8e8e83e commit b508d63

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

src/McpContext.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ export class McpContext implements Context {
481481
page.networkConditions,
482482
);
483483
page.pptrPage.setDefaultNavigationTimeout(
484-
NAVIGATION_TIMEOUT * networkMultiplier,
484+
NAVIGATION_TIMEOUT * networkMultiplier * cpuMultiplier,
485485
);
486486
}
487487

tests/tools/emulation.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,29 @@ describe('emulation', () => {
209209
});
210210
});
211211

212+
it('scales the default navigation timeout with cpu throttling rate', async () => {
213+
await withMcpContext(async (response, context) => {
214+
const page = context.getSelectedMcpPage();
215+
let lastNavTimeout: number | undefined;
216+
page.pptrPage.setDefaultNavigationTimeout = (timeout: number) => {
217+
lastNavTimeout = timeout;
218+
};
219+
220+
await emulate.handler(
221+
{
222+
params: {
223+
cpuThrottlingRate: 4,
224+
},
225+
page,
226+
},
227+
response,
228+
context,
229+
);
230+
231+
assert.strictEqual(lastNavTimeout, 40000);
232+
});
233+
});
234+
212235
it('disables cpu throttling', async () => {
213236
await withMcpContext(async (response, context) => {
214237
await context.emulate({

0 commit comments

Comments
 (0)