File tree 2 files changed +12
-1
lines changed
examples/browser-load-testing-playwright
packages/artillery/lib/platform/local
2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,14 @@ export const config = {
13
13
}
14
14
} ;
15
15
16
+ export const before = {
17
+ engine : 'playwright' ,
18
+ testFunction : async function beforeFunctionHook ( _page , userContext , _events ) {
19
+ // Any scenario variables we add via userContext.vars in this before hook will be available in every VU
20
+ userContext . vars . testStartTime = new Date ( ) ;
21
+ }
22
+ } ;
23
+
16
24
export const scenarios = [
17
25
{
18
26
engine : 'playwright' ,
Original file line number Diff line number Diff line change @@ -30,7 +30,10 @@ class PlatformLocal {
30
30
await this . init ( ) ;
31
31
32
32
if ( this . platformOpts . mode === 'distribute' ) {
33
- const count = Math . max ( 1 , os . cpus ( ) . length - 1 ) ;
33
+ // Disable worker threads for Playwright-based load tests
34
+ const count = this . script . config . engines ?. playwright
35
+ ? 1
36
+ : Math . max ( 1 , os . cpus ( ) . length - 1 ) ;
34
37
this . workerScripts = divideWork ( this . script , count ) ;
35
38
this . count = this . workerScripts . length ;
36
39
} else {
You can’t perform that action at this time.
0 commit comments