File tree Expand file tree Collapse file tree 4 files changed +12
-6
lines changed
browser/src/client/tester Expand file tree Collapse file tree 4 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -186,7 +186,9 @@ export class CommandsManager {
186186 }
187187}
188188
189- const now = Date . now
189+ const now = globalThis . performance
190+ ? globalThis . performance . now . bind ( globalThis . performance )
191+ : Date . now
190192
191193export function processTimeoutOptions < T extends { timeout ?: number } > ( options_ : T | undefined ) : T | undefined {
192194 if (
@@ -212,7 +214,7 @@ export function processTimeoutOptions<T extends { timeout?: number }>(options_:
212214 options_ = options_ || { } as T
213215 const currentTime = now ( )
214216 const endTime = startTime + timeout
215- const remainingTime = endTime - currentTime
217+ const remainingTime = Math . floor ( endTime - currentTime )
216218 if ( remainingTime <= 0 ) {
217219 return options_
218220 }
Original file line number Diff line number Diff line change @@ -14,7 +14,9 @@ import { PendingError } from './errors'
1414import { finishSendTasksUpdate } from './run'
1515import { getRunner } from './suite'
1616
17- const now = Date . now
17+ const now = globalThis . performance
18+ ? globalThis . performance . now . bind ( globalThis . performance )
19+ : Date . now
1820
1921export const collectorContext : RuntimeContext = {
2022 tasks : [ ] ,
Original file line number Diff line number Diff line change @@ -26,5 +26,5 @@ Some test suites don't support running it remotely (`fixtures/inspect` and `fixt
2626pnpm docker up -d
2727
2828# Run tests with BROWSER_WS_ENDPOINT
29- BROWSER_WS_ENDPOINT=ws://127.0.0.1:6677/ pnpm run test:playwright
29+ BROWSER_WS_ENDPOINT=true pnpm run test:playwright
3030```
Original file line number Diff line number Diff line change @@ -5,12 +5,14 @@ import { webdriverio } from '@vitest/browser-webdriverio'
55
66const providerName = ( process . env . PROVIDER || 'playwright' ) as 'playwright' | 'webdriverio' | 'preview'
77
8+ const wsEndpoint = process . env . BROWSER_WS_ENDPOINT === 'true' ? 'ws://127.0.0.1:6677/' : process . env . BROWSER_WS_ENDPOINT
9+
810export const providers = {
9- playwright : ( options ?: Parameters < typeof playwright > [ 0 ] ) => playwright ( process . env . BROWSER_WS_ENDPOINT
11+ playwright : ( options ?: Parameters < typeof playwright > [ 0 ] ) => playwright ( wsEndpoint
1012 ? {
1113 ...options ,
1214 connectOptions : {
13- wsEndpoint : process . env . BROWSER_WS_ENDPOINT ,
15+ wsEndpoint,
1416 exposeNetwork : '<loopback>' ,
1517 } ,
1618 }
You can’t perform that action at this time.
0 commit comments