MDL-64967 Behat: Mobile app testing does not load CSS files

Some files cannot be loaded due to CORS restrictions.
This commit is contained in:
sam marshall 2019-02-27 14:56:03 +00:00
parent 07203d34f1
commit 7514557426

View File

@ -634,6 +634,8 @@ class behat_config_util {
// Automatically add Chrome command line option to skip the prompt about allowing file
// storage - needed for mobile app testing (won't hurt for everything else either).
// We also need to disable web security, otherwise it can't make CSS requests to the server
// on localhost due to CORS restrictions.
if (!empty($values['browser']) && $values['browser'] === 'chrome') {
if (!isset($values['capabilities'])) {
$values['capabilities'] = [];
@ -645,6 +647,7 @@ class behat_config_util {
$values['capabilities']['chrome']['switches'] = [];
}
$values['capabilities']['chrome']['switches'][] = '--unlimited-storage';
$values['capabilities']['chrome']['switches'][] = '--disable-web-security';
// If the mobile app is enabled, check its version and add appropriate tags.
if ($mobiletags = $this->get_mobile_version_tags()) {