File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
examples/browser-load-testing-playwright
packages/artillery/lib/platform/local Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,14 @@ export const config = {
1313 }
1414} ;
1515
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+
1624export const scenarios = [
1725 {
1826 engine : 'playwright' ,
Original file line number Diff line number Diff line change @@ -30,7 +30,10 @@ class PlatformLocal {
3030 await this . init ( ) ;
3131
3232 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 ) ;
3437 this . workerScripts = divideWork ( this . script , count ) ;
3538 this . count = this . workerScripts . length ;
3639 } else {
You can’t perform that action at this time.
0 commit comments