File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ import {
4747 type InstalledExtension ,
4848} from './utils/ExtensionRegistry.js' ;
4949import { saveTemporaryFile } from './utils/files.js' ;
50- import { WaitForHelper } from './WaitForHelper.js' ;
50+ import { getNetworkMultiplierFromString , WaitForHelper } from './WaitForHelper.js' ;
5151
5252interface McpContextOptions {
5353 // Whether the DevTools windows are exposed as pages for debugging of DevTools.
@@ -61,23 +61,6 @@ interface McpContextOptions {
6161const DEFAULT_TIMEOUT = 5_000 ;
6262const NAVIGATION_TIMEOUT = 10_000 ;
6363
64- function getNetworkMultiplierFromString ( condition : string | null ) : number {
65- const puppeteerCondition =
66- condition as keyof typeof PredefinedNetworkConditions ;
67-
68- switch ( puppeteerCondition ) {
69- case 'Fast 4G' :
70- return 1 ;
71- case 'Slow 4G' :
72- return 2.5 ;
73- case 'Fast 3G' :
74- return 5 ;
75- case 'Slow 3G' :
76- return 10 ;
77- }
78- return 1 ;
79- }
80-
8164export class McpContext implements Context {
8265 browser : Browser ;
8366 logger : Debugger ;
Original file line number Diff line number Diff line change 66
77import { logger } from './logger.js' ;
88import type { Page , Protocol , CdpPage } from './third_party/index.js' ;
9+ import { PredefinedNetworkConditions } from './third_party/index.js' ;
910
1011export class WaitForHelper {
1112 #abortController = new AbortController ( ) ;
@@ -160,3 +161,22 @@ export class WaitForHelper {
160161 }
161162 }
162163}
164+
165+ export function getNetworkMultiplierFromString (
166+ condition : string | null ,
167+ ) : number {
168+ const puppeteerCondition =
169+ condition as keyof typeof PredefinedNetworkConditions ;
170+
171+ switch ( puppeteerCondition ) {
172+ case 'Fast 4G' :
173+ return 1 ;
174+ case 'Slow 4G' :
175+ return 2.5 ;
176+ case 'Fast 3G' :
177+ return 5 ;
178+ case 'Slow 3G' :
179+ return 10 ;
180+ }
181+ return 1 ;
182+ }
You can’t perform that action at this time.
0 commit comments