This is intended to be a basic automation project that integrates Cucumber-JS, WebdriverIO and Allure report with a basic page object model.
- Nodejs >=8 to run tests on your machine
- Docker with node:8
docker pull node:8
- Clone the repo
- To run tests on your machine:
yarn install
ornpm install
- To run tests inside a docker:
docker run -v $(PWD):/test -w /test node:8 yarn install
Before you run any test, have a look at the conf
folder. It contains a master.conf.js
file with many settings option that you may want to adjust. The local.conf.js
overrides some properties to run the tests on the local computer while the ci.conf.js
is meant to run the tests against a remote selenium grid. In that case, do not forget to set host
parameter to point to the right hostname/ip.
Run all features on your machine
yarn test:local
Run all feature inside Docker pointing to a selenium grid
docker run -v $(PWD):/test -w /test node:8 yarn test:ci
Sometimes it's useful to execute only a single feature file (expecially when you are debugging) and in that case run:
yarn test:local --spec src/features/login.feature
Tests are written in Gherkin syntax and all features files (tests) are located in ./src/features/*
. You will already find some examples that demonstrate how use this framework.
Generally, to create a new test you have to:
- Create a new feature file and describe the scenario(s) you want to test.
- Implement the specified steps in an existing or new steps file inside the
src/steps
folder (glue code). - If necessary, create a new page object model or update an existing one inside the
src/model
folder.
Now you are ready to run and debug your new feature's scenario(s). Easy, right?
- To start your own selenium grid you could use zalenium + selenium dockers:
docker pull elgalu/selenium
docker pull dosel/zalenium
you can start it with docker-compose
docker-compose up
and to stop, type:
docker-compose down
or run it with the following docker command:
docker run --rm -ti --name zalenium -p 4444:4444 -p 5555:5555 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /tmp/videos:/home/seluser/videos \
dosel/zalenium start