From 8a96a79972f839c240a8e751121d6a2a9a6c0913 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Wed, 30 Mar 2022 12:31:57 +0200 Subject: [PATCH 1/2] Fix the config structure for chrome prefs This is a map node, not a list node. --- .../ServiceContainer/Driver/Selenium2Factory.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Behat/MinkExtension/ServiceContainer/Driver/Selenium2Factory.php b/src/Behat/MinkExtension/ServiceContainer/Driver/Selenium2Factory.php index c5d28e6..c651085 100644 --- a/src/Behat/MinkExtension/ServiceContainer/Driver/Selenium2Factory.php +++ b/src/Behat/MinkExtension/ServiceContainer/Driver/Selenium2Factory.php @@ -146,7 +146,11 @@ class Selenium2Factory implements DriverFactory ->arrayNode('switches')->prototype('scalar')->end()->end() ->scalarNode('binary')->end() ->arrayNode('extensions')->prototype('scalar')->end()->end() - ->arrayNode('prefs')->prototype('variable')->end()->end() + ->arrayNode('prefs') + ->normalizeKeys(false) + ->useAttributeAsKey('name') + ->prototype('variable')->end() + ->end() ->end() ->end() ->arrayNode('extra_capabilities') From 015dcafdbdd56bc0ead82019169a8a8369c93885 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Wed, 30 Mar 2022 12:32:29 +0200 Subject: [PATCH 2/2] Remove empty chrome prefs from the capabilities --- .../ServiceContainer/Driver/Selenium2Factory.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Behat/MinkExtension/ServiceContainer/Driver/Selenium2Factory.php b/src/Behat/MinkExtension/ServiceContainer/Driver/Selenium2Factory.php index c651085..0da0564 100644 --- a/src/Behat/MinkExtension/ServiceContainer/Driver/Selenium2Factory.php +++ b/src/Behat/MinkExtension/ServiceContainer/Driver/Selenium2Factory.php @@ -152,6 +152,15 @@ class Selenium2Factory implements DriverFactory ->prototype('variable')->end() ->end() ->end() + ->validate() + ->ifTrue(function ($v) { + return empty($v['prefs']); + }) + ->then(function ($v) { + unset($v['prefs']); + return $v; + }) + ->end() ->end() ->arrayNode('extra_capabilities') ->info('Custom capabilities merged with the known ones')