Skip to content
This repository was archived by the owner on Apr 11, 2022. It is now read-only.
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
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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`
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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
Binary file removed selenium/chromedriver
Binary file not shown.
Binary file removed selenium/geckodriver
Binary file not shown.
Binary file removed selenium/selenium-server-standalone-3.7.1.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/_support/AcceptanceTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AcceptanceTester extends \Codeception\Actor
*/
public function iAmAnUserOfGoogle()
{
$this->amOnPage('/');
$this->amOnPage('/?hl=fr');
$this->seeElement('form#tsf');
}

Expand Down
19 changes: 8 additions & 11 deletions tests/acceptance.suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion tests/acceptance/SearchPicturesCept.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/SearchPicturesCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class SearchPicturesCest
{
public function _before(AcceptanceTester $I)
{
$I->amOnPage('/');
$I->amOnPage('/?hl=fr');
}

public function _after(AcceptanceTester $I)
Expand Down
Empty file added tests/functional/.directory
Empty file.
Empty file added tests/unit/.directory
Empty file.