diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c83092e..da85b53 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,6 +5,8 @@ on: branches: [ development, master ] pull_request: branches: [ development, master ] + schedule: + - cron: 0 3 * * 1,3,5 workflow_dispatch: jobs: diff --git a/composer.json b/composer.json index e22225f..a9c5775 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "ext-json": "*", "composer-plugin-api": "^2", "codeception/codeception": "^4.1.22", - "codeception/module-webdriver": "^1.2", + "codeception/module-webdriver": "^2.0", "composer/package-versions-deprecated": "^1.11.99", "eloquent/composer-npm-bridge": "^5.0", "ramsey/uuid": "^4.1", @@ -28,8 +28,8 @@ }, "require-dev": { "adamwojs/php-cs-fixer-phpdoc-force-fqcn": "^2.0", - "codeception/module-asserts": "^1.3", - "codeception/module-phpbrowser": "^1.0", + "codeception/module-asserts": "^2.0", + "codeception/module-phpbrowser": "^2.0", "friendsofphp/php-cs-fixer": "^3.8", "phpstan/phpstan": "^0.12.90", "rector/rector": "^0.11.35", diff --git a/src/Codeception/Module/Percy.php b/src/Codeception/Module/Percy.php index dd02417..677c603 100644 --- a/src/Codeception/Module/Percy.php +++ b/src/Codeception/Module/Percy.php @@ -92,6 +92,11 @@ public function takeAPercySnapshot( return; } + // If remote web driver has not been set, return + if (null === $this->webDriver->webDriver) { + return; + } + // Add Percy CLI JS to page $this->webDriver->executeJS($this->percyCliJs); @@ -106,7 +111,7 @@ public function takeAPercySnapshot( ) )) ->withClientInfo(InfoProvider::getClientInfo()) - ->withEnvironmentInfo(InfoProvider::getEnvironmentInfo($this->webDriver)) + ->withEnvironmentInfo(InfoProvider::getEnvironmentInfo($this->webDriver->webDriver)) ); } diff --git a/src/Codeception/Module/Percy/InfoProvider.php b/src/Codeception/Module/Percy/InfoProvider.php index 487689d..a775471 100644 --- a/src/Codeception/Module/Percy/InfoProvider.php +++ b/src/Codeception/Module/Percy/InfoProvider.php @@ -4,7 +4,7 @@ namespace Codeception\Module\Percy; -use Codeception\Module\WebDriver; +use Facebook\WebDriver\Remote\RemoteWebDriver; use PackageVersions\Versions; final class InfoProvider @@ -18,16 +18,16 @@ final class InfoProvider /** * Get environment info * - * @param \Codeception\Module\WebDriver $webDriver + * @param \Facebook\WebDriver\Remote\RemoteWebDriver $webDriver * @return string */ - public static function getEnvironmentInfo(WebDriver $webDriver): string + public static function getEnvironmentInfo(RemoteWebDriver $webDriver): string { if (null !== self::$environmentInfo) { return self::$environmentInfo; } - $webDriverCapabilities = $webDriver->webDriver->getCapabilities(); + $webDriverCapabilities = $webDriver->getCapabilities(); return self::$environmentInfo = sprintf( 'codeception-php; %s; %s/%s',