From e02e8ef2ac113199b4e853dab24af2d125cd2b87 Mon Sep 17 00:00:00 2001
From: Benjamin Kott <benjamin.kott@outlook.com>
Date: Thu, 8 Feb 2024 11:11:06 +0100
Subject: [PATCH] [TASK] Fix acceptence tests window size with php-webdriver
 1.15
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The configured browser capabilities (`chromeOptions`) are passed by
`codeception/module-webdriver` to `php-webdriver` as is.
php-webdriver expects the PHP constant ChromeOptions::CAPABILITY to be
used instead of hardcoding any strings. Therefore php-webdriver 1.15
changed this constants value from `chromeOptions` to
`goog:chromeOptions` [1], which means that the option `chromeOptions`
is no longer respected and the configured window size (and the headless
flag) is ignored.

We now use the newer W3C webdriver comaptible `goog:chromeOptions`
option and define window size definition via codeception's respective
option `window_size` while we are at it.

[1] https://github.com/php-webdriver/php-webdriver/commit/235c2aa07

Resolves: #103081
Releases: main, 12.4
Change-Id: Iec345b5ec0226d38b62081aa8c3a51dd3100bdb7
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82840
Tested-by: Oliver Klee <typo3-coding@oliverklee.de>
Tested-by: Benjamin Franzke <ben@bnf.dev>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Reviewed-by: Benjamin Franzke <ben@bnf.dev>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: core-ci <typo3@b13.com>
---
 .../sysext/core/Tests/Acceptance/Application.suite.yml | 10 ++++++----
 typo3/sysext/core/Tests/Acceptance/Install.suite.yml   | 10 ++++++----
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/typo3/sysext/core/Tests/Acceptance/Application.suite.yml b/typo3/sysext/core/Tests/Acceptance/Application.suite.yml
index b1b6a12f3941..716407d5e20e 100644
--- a/typo3/sysext/core/Tests/Acceptance/Application.suite.yml
+++ b/typo3/sysext/core/Tests/Acceptance/Application.suite.yml
@@ -11,9 +11,10 @@ modules:
         browser: chrome
         wait: 2
         host: chrome
+        window_size: 1280x1024
         capabilities:
-          chromeOptions:
-            args: ["--no-sandbox", "window-size=1280,1024", "--disable-gpu", "--unsafely-treat-insecure-origin-as-secure=http://web"]
+          goog:chromeOptions:
+            args: ["--no-sandbox", "--window-size=1280,1024", "--disable-gpu", "--unsafely-treat-insecure-origin-as-secure=http://web"]
     - \TYPO3\TestingFramework\Core\Acceptance\Helper\Acceptance
     - \TYPO3\TestingFramework\Core\Acceptance\Helper\Login:
         sessions:
@@ -32,9 +33,10 @@ env:
             browser: chrome
             wait: 2
             host: chrome
+            window_size: 1280x1024
             capabilities:
-              chromeOptions:
-                args: ["--headless", "--no-sandbox", "window-size=1280,1024", "--disable-gpu"]
+              goog:chromeOptions:
+                args: ["--headless", "--no-sandbox", "--window-size=1280,1024", "--disable-gpu"]
 
 extensions:
   enabled:
diff --git a/typo3/sysext/core/Tests/Acceptance/Install.suite.yml b/typo3/sysext/core/Tests/Acceptance/Install.suite.yml
index 3d9ee9d8384d..3132c9ad0d46 100644
--- a/typo3/sysext/core/Tests/Acceptance/Install.suite.yml
+++ b/typo3/sysext/core/Tests/Acceptance/Install.suite.yml
@@ -7,9 +7,10 @@ modules:
         browser: chrome
         wait: 2
         host: chrome
+        window_size: 1280x1024
         capabilities:
-          chromeOptions:
-            args: [ "--no-sandbox", "window-size=1280,1024", "--disable-gpu" ]
+          goog:chromeOptions:
+            args: [ "--no-sandbox", "--window-size=1280,1024", "--disable-gpu" ]
     - Asserts
 
 env:
@@ -21,9 +22,10 @@ env:
             browser: chrome
             wait: 2
             host: chrome
+            window_size: 1280x1024
             capabilities:
-              chromeOptions:
-                args: [ "--headless", "--no-sandbox", "window-size=1280,1024", "--disable-gpu" ]
+              goog:chromeOptions:
+                args: [ "--headless", "--no-sandbox", "--window-size=1280,1024", "--disable-gpu" ]
 
   mysql:
     extensions:
-- 
GitLab