Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add chromeOptions only for chrome and change default Capabilities #12

Open
wants to merge 4 commits into
base: 1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/FacebookFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace SilverStripe\MinkFacebookWebDriver;

use Behat\MinkExtension\ServiceContainer\Driver\Selenium2Factory;
use Facebook\WebDriver\Remote\WebDriverBrowserType;
use Symfony\Component\DependencyInjection\Definition;

/**
Expand Down Expand Up @@ -38,11 +39,13 @@ public function buildDriver(array $config)
$extraCapabilities = $config['capabilities']['extra_capabilities'];
unset($config['capabilities']['extra_capabilities']);

// PATCH: Disable W3C mode in chromedriver until we have capacity to actively adopt it
$extraCapabilities['chromeOptions'] = array_merge(
isset($extraCapabilities['chromeOptions']) ? $extraCapabilities['chromeOptions'] : [],
['w3c' => false]
);
if ($config['browser'] === WebDriverBrowserType::CHROME && (isset($extraCapabilities['chromeOptions']) === false || isset($extraCapabilities['chromeOptions']['w3c']) === false)) {
// PATCH: Disable W3C mode in chromedriver until we have capacity to actively adopt it
$extraCapabilities['chromeOptions'] = array_merge(
isset($extraCapabilities['chromeOptions']) ? $extraCapabilities['chromeOptions'] : [],
['w3c' => false]
);
}

$capabilities = array_replace($this->guessCapabilities() ?? [], $extraCapabilities, $config['capabilities']);

Expand Down
3 changes: 0 additions & 3 deletions src/FacebookWebDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,6 @@ public static function getDefaultCapabilities()
'platform' => 'ANY',
'browser' => self::DEFAULT_BROWSER,
'name' => 'Behat Test',
'deviceOrientation' => 'portrait',
'deviceType' => 'tablet',
'selenium-version' => '3.5.3'
];
}

Expand Down