diff --git a/.travis.yml b/.travis.yml index b4a70db..5762c4f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,10 @@ language: php +dist: xenial + +jdk: + - openjdk8 + addons: chrome: stable @@ -10,8 +15,8 @@ cache: env: global: - DISPLAY=:99.0 - - CHROME_DRIVER_VERSION=2.36 - - SELENIUM_VERSION=3.6.0 + - CHROME_DRIVER_VERSION=89.0.4389.23 + - SELENIUM_VERSION=3.141.59 matrix: - DEPS="" PROFILE=default # - DEPS="--prefer-lowest" PROFILE=default @@ -19,7 +24,6 @@ env: # - DEPS="--prefer-lowest" PROFILE=symfony2 php: - - 7.0 - 7.1 - 7.2 - nightly @@ -34,7 +38,7 @@ before_script: - wget "https://chromedriver.storage.googleapis.com/${CHROME_DRIVER_VERSION}/chromedriver_linux64.zip" - unzip chromedriver_linux64.zip - - wget "https://selenium-release.storage.googleapis.com/${SELENIUM_VERSION%%.[[:digit:]]}/selenium-server-standalone-${SELENIUM_VERSION}.jar" -O selenium.jar + - wget "https://selenium-release.storage.googleapis.com/${SELENIUM_VERSION%.*}/selenium-server-standalone-${SELENIUM_VERSION}.jar" -O selenium.jar - java -jar -Dwebdriver.chrome.driver=./chromedriver selenium.jar &> /dev/null & - echo "memory_limit = 2G" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini diff --git a/behat.yml.dist b/behat.yml.dist index 8e7c31b..8c127c0 100644 --- a/behat.yml.dist +++ b/behat.yml.dist @@ -26,7 +26,14 @@ default: base_url: 'http://localhost:8080' files_path: 'tests/fixtures/files' goutte: ~ - selenium2: ~ + selenium2: + capabilities: + chrome: + switches: + - "--headless" + - "--disable-gpu" + - "--no-sandbox" + javascript_session: selenium2 browser_name: 'chrome' sessions: default: diff --git a/composer.json b/composer.json index 22d2b9f..67b2bfd 100644 --- a/composer.json +++ b/composer.json @@ -5,25 +5,25 @@ "type": "library", "homepage": "https://github.com/IntegralService/BehatContext", "license": "MIT", - "minimum-stability": "dev", + "minimum-stability": "stable", "require": { "php": ">=5.6", - "behat/behat": "^3.5.0", - "behat/mink-extension": "^2.3.1", - "behat/symfony2-extension": "^2.1.5", - "symfony/security": "^3.4", + "behat/behat": "^3.6", + "behat/mink-extension": "^2.3", + "behat/symfony2-extension": "^2.1", + "symfony/security": "^4.0", "symfony/dom-crawler": "^2.4|^3.0|^4.0", - "symfony/translation": "^3.4", - "symfony/config": "^3.4", - "symfony/dependency-injection": "^3.4", - "phpunit/php-code-coverage": "^5", - "phpunit/phpunit": "^6" + "symfony/translation": "^4.0", + "symfony/config": "^4.0", + "symfony/dependency-injection": "^4.0", + "phpunit/php-code-coverage": ">=6.1", + "phpunit/phpunit": ">=7.5" }, "require-dev": { - "behat/mink-goutte-driver": "^1.1", - "fabpot/goutte": "^3.2", + "behat/mink-goutte-driver": "^1.2", + "fabpot/goutte": "^3.3", "guzzlehttp/guzzle": "^6.3", "behat/mink-selenium2-driver": "^1.3" }, @@ -33,7 +33,7 @@ "IntegralService\\": "src/" } }, - + "config": { "bin-dir": "bin/" } diff --git a/src/BehatContext/WebContext.php b/src/BehatContext/WebContext.php index cb3a9f0..ee424e4 100644 --- a/src/BehatContext/WebContext.php +++ b/src/BehatContext/WebContext.php @@ -356,4 +356,20 @@ protected function fixStepArgument($argument) { return str_replace('\\"', '"', $argument); } + + /** + * @Then I fill in wysiwyg field :locator with :value + */ + public function iFillInWysiwygOnFieldWith($locator, $value) { + $el = $this->getSession()->getPage()->findField($locator); + if (empty($el)) { + throw new \Exception('Could not find WYSIWYG with locator: ' . $locator); + } + $fieldId = $el->getAttribute('id'); + if (empty($fieldId)) { + throw new \Exception('Could not find an id for field with locator: ' . $locator); + } + $this->getSession() + ->executeScript("CKEDITOR.instances[\"$fieldId\"].setData(\"$value\");"); + } }