File tree Expand file tree Collapse file tree 1 file changed +10
-18
lines changed
Expand file tree Collapse file tree 1 file changed +10
-18
lines changed Original file line number Diff line number Diff line change @@ -9,26 +9,18 @@ public static class BrowserFactory
99 private static IBrowser ? _browser ;
1010
1111 public static async Task < IPage > CreatePageAsync ( )
12- {
13- // Initialize Playwright once
14- if ( _playwright == null )
15- _playwright = await Playwright . CreateAsync ( ) ;
12+ {
13+ var playwright = await Playwright . CreateAsync ( ) ;
1614
17- // Launch browser only once
18- if ( _browser == null )
19- {
20- _browser = await _playwright . Chromium . LaunchAsync ( new ( )
21- {
22- Headless = false , // set to false if you want to see it
23- SlowMo = 50
24- } ) ;
25- }
15+ var browser = await playwright . Chromium . LaunchAsync ( new ( )
16+ {
17+ Headless = true , // ✅ CI requires headless mode
18+ Args = new [ ] { "--no-sandbox" , "--disable-dev-shm-usage" }
19+ } ) ;
2620
27- // Each test gets a fresh page
28- var context = await _browser . NewContextAsync ( ) ;
29- var page = await context . NewPageAsync ( ) ;
30- return page ;
31- }
21+ var context = await browser . NewContextAsync ( ) ;
22+ return await context . NewPageAsync ( ) ;
23+ }
3224
3325 public static async Task CloseAsync ( )
3426 {
You can’t perform that action at this time.
0 commit comments