Skip to content
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
26 changes: 9 additions & 17 deletions src/VisualCeption.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
class VisualCeption extends \Codeception\Module
{
private $maximumDeviation = 0;
private $webDriverClass = 'WebDriver';

/**
* @var \RemoteWebDriver
Expand All @@ -35,29 +36,20 @@ class VisualCeption extends \Codeception\Module
*/
private $storageStrategy;

/**
* Create an object from VisualCeption Class
*
* @param array $config
* @return result
*/
public function __construct($config)
{
$result = parent::__construct($config);
$this->init();
return $result;
}

/**
* Initialize the module and read the config.
*
* @throws \RuntimeException
*/
private function init()
private function _initialize()
{
if (array_key_exists('maximumDeviation', $this->config)) {
$this->maximumDeviation = $this->config["maximumDeviation"];
}

if (array_key_exists('webdriver', $this->config)) {
$this->webDriverClass = $this->config["webdriver"];
}

$this->storageStrategy = Factory::getStorage($this->config);
}
Expand All @@ -70,10 +62,10 @@ private function init()
*/
public function _before(\Codeception\TestCase $test)
{
if (!$this->hasModule("WebDriver")) {
throw new \Exception("VisualCeption uses the WebDriver. Please be sure that this module is activated.");
if (!$this->hasModule($this->webDriverClass)) {
throw new \Exception("VisualCeption uses the " . $this->webDriverClass . ". Please be sure that this module is activated.");
}
$this->webDriver = $this->getModule("WebDriver")->webDriver;
$this->webDriver = $this->getModule($this->webDriverClass)->webDriver;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/VisualCeption/Html/Manipulation.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Manipulation
{
private $webDriver;

public function __construct(\RemoteWebDriver $webDriver)
public function __construct(\Facebook\WebDriver\Remote\RemoteWebDriver $webDriver)
{
$this->webDriver = $webDriver;
$this->injectJQuery();
Expand Down
2 changes: 1 addition & 1 deletion src/VisualCeption/Html/Screenshot.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Screenshot
{
private $webDriver;

public function __construct(\RemoteWebDriver $webDriver)
public function __construct(\Facebook\WebDriver\Remote\RemoteWebDriver $webDriver)
{
$this->webDriver = $webDriver;
}
Expand Down