From b8df67543fac0bc384bb4454565adaf54d9c3349 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 22 Jul 2024 21:35:21 +0200 Subject: [PATCH] Fix downloading files in tests with new Chromiums Newer versions of chromium apparently need these flags to download files without prompting the user. --- tests/Browser/TestCase.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/Browser/TestCase.php b/tests/Browser/TestCase.php index d60f91c7ad3..6a12c1ff4c6 100644 --- a/tests/Browser/TestCase.php +++ b/tests/Browser/TestCase.php @@ -56,6 +56,8 @@ protected function driver() '--disable-gpu', '--headless', '--no-sandbox', + '--disable-features=InsecureDownloadWarnings', + '--unsafely-treat-insecure-origin-as-secure=' . self::getServerUrl(), ]); // For file download handling @@ -110,7 +112,7 @@ protected function setUp(): void $this->app = \rcmail::get_instance(); - Browser::$baseUrl = getenv('SERVER_URL') ?: 'http://localhost:8000'; + Browser::$baseUrl = self::getServerUrl(); Browser::$storeScreenshotsAt = TESTS_DIR . 'screenshots'; Browser::$storeConsoleLogAt = TESTS_DIR . 'console'; @@ -167,4 +169,9 @@ protected static function startWebServer() static::$phpProcess->stop(); }); } + + protected static function getServerUrl() + { + return getenv('SERVER_URL') ?: 'http://localhost:8000'; + } }