Skip to content

Commit

Permalink
Fix downloading files in tests with new Chromiums
Browse files Browse the repository at this point in the history
Newer versions of chromium apparently need these flags to download files
without prompting the user.
  • Loading branch information
pabzm committed Aug 30, 2024
1 parent e04325a commit b8df675
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/Browser/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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';

Expand Down Expand Up @@ -167,4 +169,9 @@ protected static function startWebServer()
static::$phpProcess->stop();
});
}

protected static function getServerUrl()
{
return getenv('SERVER_URL') ?: 'http://localhost:8000';
}
}

0 comments on commit b8df675

Please sign in to comment.