diff --git a/Makefile b/Makefile index bad207c..388aef9 100644 --- a/Makefile +++ b/Makefile @@ -18,5 +18,12 @@ help: ## Start Selenium with Chrome driver start-selenium: - java -Dwebdriver.chrome.driver=./selenium/chromedriver -jar ./selenium/selenium-server-standalone-3.7.1.jar + docker-compose up -d selenium .PHONY: start-selenium + +## Run tests +run-acceptance-tests: + make start-selenium + docker-compose run --rm codeception + docker-compose down +.PHONY: run-acceptance-tests diff --git a/README.md b/README.md new file mode 100644 index 0000000..1603b24 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +[![continuousphp](https://img.shields.io/continuousphp/git-hub/continuoustest/test-in-php-project/ci/continuousphp.svg)]() + +## Test in ContinuousPHP + +View the configuration and builds of this project on ContinuousPHP + +https://app.continuousphp.com/git-hub/continuoustest/test-in-php-project + +More information about codeception at : https://continuousphp.com/documentation/testing/codeception/ + +## Test locally + +We use docker containers to simulate the environment and run tests: + +* Run acceptance tests inside a php7.0 container: `make run-acceptance-tests` + +If you want only start selenium: `make start-selenium` diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..0174171 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,16 @@ +version: "2" + +services: + selenium: + image: selenium/standalone-chrome:3.4.0-chromium + ports: + - 4444:4444 + environment: + - JAVA_ENV="-Xms1g -Xmx4g" + shm_size: 256M + + codeception: + image: php:7.0-cli + volumes: + - .:/app + command: /app/vendor/bin/codecept run acceptance -c /app/codeception.yml --xml --html --steps diff --git a/selenium/chromedriver b/selenium/chromedriver deleted file mode 100755 index ab344b0..0000000 Binary files a/selenium/chromedriver and /dev/null differ diff --git a/selenium/geckodriver b/selenium/geckodriver deleted file mode 100755 index 3ddc5cb..0000000 Binary files a/selenium/geckodriver and /dev/null differ diff --git a/selenium/selenium-server-standalone-3.7.1.jar b/selenium/selenium-server-standalone-3.7.1.jar deleted file mode 100644 index fd1f03e..0000000 Binary files a/selenium/selenium-server-standalone-3.7.1.jar and /dev/null differ diff --git a/tests/_support/AcceptanceTester.php b/tests/_support/AcceptanceTester.php index 07052a4..334e95a 100644 --- a/tests/_support/AcceptanceTester.php +++ b/tests/_support/AcceptanceTester.php @@ -30,7 +30,7 @@ class AcceptanceTester extends \Codeception\Actor */ public function iAmAnUserOfGoogle() { - $this->amOnPage('/'); + $this->amOnPage('/?hl=fr'); $this->seeElement('form#tsf'); } diff --git a/tests/acceptance.suite.yml b/tests/acceptance.suite.yml index 313b5cd..98d215c 100644 --- a/tests/acceptance.suite.yml +++ b/tests/acceptance.suite.yml @@ -7,15 +7,12 @@ actor: AcceptanceTester modules: enabled: - - WebDriver: - url: http://google.fr - browser: chrome - capabilities: - chromeOptions: - args: ["--headless"] - wait: 10 + - WebDriver - \Helper\Acceptance -#extensions: -# enabled: -# - Codeception\Extension\RunProcess: -# - java -Dwebdriver.chrome.driver=./selenium/chromedriver -jar ./selenium/selenium-server-standalone-3.7.1.jar + config: + WebDriver: + url: http://google.fr + browser: 'chrome' + host: selenium + port: 4444 + windows_size: maximize diff --git a/tests/acceptance/SearchPicturesCept.php b/tests/acceptance/SearchPicturesCept.php index 42efeec..bf0f793 100644 --- a/tests/acceptance/SearchPicturesCept.php +++ b/tests/acceptance/SearchPicturesCept.php @@ -4,7 +4,7 @@ $I->wantTo('Search pictures'); $I->lookForwardTo('See picture from a search'); -$I->amOnPage('/'); +$I->amOnPage('/?hl=fr'); $I->seeElement('form#tsf'); $I->seeElement('#lst-ib'); diff --git a/tests/acceptance/SearchPicturesCest.php b/tests/acceptance/SearchPicturesCest.php index 015f987..15a18c0 100644 --- a/tests/acceptance/SearchPicturesCest.php +++ b/tests/acceptance/SearchPicturesCest.php @@ -7,7 +7,7 @@ class SearchPicturesCest { public function _before(AcceptanceTester $I) { - $I->amOnPage('/'); + $I->amOnPage('/?hl=fr'); } public function _after(AcceptanceTester $I) diff --git a/tests/functional/.directory b/tests/functional/.directory new file mode 100644 index 0000000..e69de29 diff --git a/tests/unit/.directory b/tests/unit/.directory new file mode 100644 index 0000000..e69de29