@@ -457,47 +457,6 @@ def synchronize(seconds = nil, errors: nil)
457
457
end
458
458
end
459
459
460
- driver_options = {
461
- browser_type : :chromium ,
462
- channel : :chromium ,
463
- headless : ( ENV [ "PLAYWRIGHT_HEADLESS" ] . presence || ENV [ "SELENIUM_HEADLESS" ] . presence ) != "0" ,
464
- args : apply_base_chrome_args ,
465
- acceptDownloads : true ,
466
- downloadsPath : Downloads ::FOLDER ,
467
- slowMo : ENV [ "PLAYWRIGHT_SLOW_MO_MS" ] . to_i , # https://playwright.dev/docs/api/class-browsertype#browser-type-launch-option-slow-mo
468
- playwright_cli_executable_path : "./node_modules/.bin/playwright" ,
469
- logger : Logger . new ( IO ::NULL ) ,
470
- }
471
-
472
- if ENV [ "CAPYBARA_REMOTE_DRIVER_URL" ] . present?
473
- driver_options [ :browser ] = :remote
474
- driver_options [ :url ] = ENV [ "CAPYBARA_REMOTE_DRIVER_URL" ]
475
- end
476
-
477
- Capybara . register_driver ( :playwright_chrome ) do |app |
478
- Capybara ::Playwright ::Driver . new (
479
- app ,
480
- **driver_options ,
481
- viewport : ENV [ "PLAYWRIGHT_NO_VIEWPORT" ] == "1" ? nil : { width : 1400 , height : 1400 } ,
482
- )
483
- end
484
-
485
- Capybara . register_driver ( :playwright_mobile_chrome ) do |app |
486
- Capybara ::Playwright ::Driver . new (
487
- app ,
488
- **driver_options ,
489
- deviceScaleFactor : 3 ,
490
- isMobile : true ,
491
- hasTouch : true ,
492
- userAgent :
493
- "Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.4 Mobile/15E148 Safari/604.1" ,
494
- defaultBrowserType : "webkit" ,
495
- viewport : ENV [ "PLAYWRIGHT_NO_VIEWPORT" ] == "1" ? nil : { width : 390 , height : 664 } ,
496
- )
497
- end
498
-
499
- Capybara . default_driver = :playwright_chrome
500
-
501
460
[
502
461
[ PostAction , :post_action_type_id ] ,
503
462
[ Reviewable , :target_id ] ,
@@ -682,6 +641,49 @@ def using_session_with_localhost_resolution(name, &block)
682
641
system_tests_initialized = true
683
642
end
684
643
644
+ driver_options = {
645
+ browser_type : :chromium ,
646
+ channel : :chromium ,
647
+ headless : ( ENV [ "PLAYWRIGHT_HEADLESS" ] . presence || ENV [ "SELENIUM_HEADLESS" ] . presence ) != "0" ,
648
+ args : apply_base_chrome_args ,
649
+ acceptDownloads : true ,
650
+ downloadsPath : Downloads ::FOLDER ,
651
+ slowMo : ENV [ "PLAYWRIGHT_SLOW_MO_MS" ] . to_i , # https://playwright.dev/docs/api/class-browsertype#browser-type-launch-option-slow-mo
652
+ playwright_cli_executable_path : "./node_modules/.bin/playwright" ,
653
+ logger : Logger . new ( IO ::NULL ) ,
654
+ timezoneId : example . metadata [ :timezone ] ,
655
+ colorScheme : example . metadata [ :color_scheme ] ,
656
+ }
657
+
658
+ if ENV [ "CAPYBARA_REMOTE_DRIVER_URL" ] . present?
659
+ driver_options [ :browser ] = :remote
660
+ driver_options [ :url ] = ENV [ "CAPYBARA_REMOTE_DRIVER_URL" ]
661
+ end
662
+
663
+ Capybara . register_driver ( :playwright_mobile_chrome ) do |app |
664
+ Capybara ::Playwright ::Driver . new (
665
+ app ,
666
+ **driver_options ,
667
+ deviceScaleFactor : 3 ,
668
+ isMobile : true ,
669
+ hasTouch : true ,
670
+ userAgent :
671
+ "Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.4 Mobile/15E148 Safari/604.1" ,
672
+ defaultBrowserType : "webkit" ,
673
+ viewport : ENV [ "PLAYWRIGHT_NO_VIEWPORT" ] == "1" ? nil : { width : 390 , height : 664 } ,
674
+ )
675
+ end
676
+
677
+ Capybara . register_driver ( :playwright_chrome ) do |app |
678
+ Capybara ::Playwright ::Driver . new (
679
+ app ,
680
+ **driver_options ,
681
+ viewport : ENV [ "PLAYWRIGHT_NO_VIEWPORT" ] == "1" ? nil : { width : 1400 , height : 1400 } ,
682
+ )
683
+ end
684
+
685
+ Capybara . default_driver = :playwright_chrome
686
+
685
687
driver = [ :playwright ]
686
688
driver << :mobile if example . metadata [ :mobile ]
687
689
driver << :chrome
0 commit comments