Planet4 is the NEW Greenpeace web platform
This repository contains a docker image to set up a docker container that contains planet4-selenium-tests and the needed tools to run these tests. The image is based on elgalu/selenium
Requirements for running this testing environment:
Optionally
Assuming a Planet4 docker-compose environment is accessible at http://www.planet4.test
:
# Clone this repo
git clone https://github.com/greenpeace/planet4-docker-selenium-tests
cd planet4-docker-selenium-tests
# Start Selenium grid
make
# Execute tests
make exec
make src
make build
# Defaults
make run
See docker-compose.yml
for customisations. For example, to change the host, username and password for authenticating
P4_DOMAIN=k8s.p4.greenpeace.org P4_USER=test P4_PASS=test_pass make run
Run tests using the provided make exec
command:
# Run all tests
make exec
# or
docker exec p4_selenium_1 vendor/bin/phpunit -c tests
# Run only a single test
make exec EXEC="vendor/bin/phpunit -c tests/phpunit.xml tests/p4/Articles.php"
# or
docker exec p4_selenium_1 vendor/bin/phpunit tests/p4/Articles.php
# or
docker-compose exec selenium vendor/bin/phpunit tests/p4/Articles.php
Or using gulp to monitor the src/ folder and automatically rerun tests every time a file changes (NodeJS required):
gulp
There are some variables that can be configured on container start:
VAR | DEFAULT | DESC |
---|---|---|
P4_DOMAIN | www.planet4.test | The domain which is running P4 Wordpress |
P4_PROTO | https | Protocol to connect |
P4_USER | dev | Wordpress administration user |
P4_PASS | u3vsREsvjwo | Wordpress administration user |
EMAIL_USER | tester.greenwire@gmail.com | |
EMAIL_PASS | u3vsREsvjwo |
If some tests fail, then the browser could remain open and intefere with running any additional test. You can run clean to close all open browser windows.
$ clean
Note this repository has not yet been tested on windows platforms yet, any feedback will be welcome!