File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed
Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,26 @@ if ('HTTP_PROXY' in process.env && process.env.HTTP_PROXY !== '') {
8282 proxy,
8383 ignoreHTTPSErrors : true ,
8484 } ;
85+
86+ // Merge proxy settings into each project's contextOptions as well.
87+ // Playwright resolves project config by merging project-level `use` over
88+ // root-level `use`. If a project defines its own `use.contextOptions`
89+ // (e.g. { reducedMotion: 'reduce' }), it completely replaces the
90+ // root-level contextOptions — which would lose the SC tunnel proxy
91+ // settings and cause requests to fail with ENOTFOUND.
92+ // By merging proxy settings directly into each project's contextOptions,
93+ // both the user's project-level options and the proxy coexist.
94+ if ( Array . isArray ( userConfig . projects ) ) {
95+ for ( const project of userConfig . projects ) {
96+ if ( project . use ?. contextOptions ) {
97+ project . use . contextOptions = {
98+ ...project . use . contextOptions ,
99+ proxy,
100+ ignoreHTTPSErrors : true ,
101+ } ;
102+ }
103+ }
104+ }
85105}
86106
87107function arrMerger ( objValue , srcValue ) {
Original file line number Diff line number Diff line change @@ -82,6 +82,26 @@ if ('HTTP_PROXY' in process.env && process.env.HTTP_PROXY !== '') {
8282 proxy,
8383 ignoreHTTPSErrors : true ,
8484 } ;
85+
86+ // Merge proxy settings into each project's contextOptions as well.
87+ // Playwright resolves project config by merging project-level `use` over
88+ // root-level `use`. If a project defines its own `use.contextOptions`
89+ // (e.g. { reducedMotion: 'reduce' }), it completely replaces the
90+ // root-level contextOptions — which would lose the SC tunnel proxy
91+ // settings and cause requests to fail with ENOTFOUND.
92+ // By merging proxy settings directly into each project's contextOptions,
93+ // both the user's project-level options and the proxy coexist.
94+ if ( Array . isArray ( userConfig . projects ) ) {
95+ for ( const project of userConfig . projects ) {
96+ if ( project . use ?. contextOptions ) {
97+ project . use . contextOptions = {
98+ ...project . use . contextOptions ,
99+ proxy,
100+ ignoreHTTPSErrors : true ,
101+ } ;
102+ }
103+ }
104+ }
85105}
86106
87107function arrMerger ( objValue , srcValue ) {
You can’t perform that action at this time.
0 commit comments