Breeding Insight UI Test Automation Framework
- Create tests using Gherkin syntax
- Execute tests on Chrome and Firefox
- Execute multiple tests at the same time
- CI/CD integration ready
To run tests locally, you need to install the following: NodeJS Java JRE or JDK Version Control Client Visual Studio Code
Visual Studio Code Plugin | Configuration |
---|---|
Cucumber (Gherkin) Full Support | Edit settings.json file and include the following: "cucumberautocomplete.steps":["src/step_definitions/*.js"], "cucumberautocomplete.strictGherkinCompletion": true, |
Cuke Step Definition Generator | none |
Gherkin Table Formatter | none |
- Clone the repository. (https://github.com/Breeding-Insight/taf.git)
- Install dependencies required to run the tests:
npm install
- Run tests
npm run test:chrome
Files to change:
- nightwatch.conf.js (change launch_url under default to your local url)
- workspace.code-workspace (change server to local:)
Scripts to run tests are in package.json. One can add additional scripts locally to run a subset of scenarios with a particular tag, ie running all scenarios tagged as @SmokeTests:
"test:chromeSmokeTests": "mkdirp report && cucumber-js --require cucumber.conf.js --tags @SmokeTests --require src/step_definitions src/features --format @cucumber/pretty-formatter --format json:report/cucumber_report.json --world-parameters \"{\\\"browser\\\":\\\"chrome\\\"}\"; npm run report"
and then run it in terminal as
npm run test:chromeSmokeTests
Cucumber report by default will be saved to a folder and be overwritten with subsequent runs.
NOTE: If you are not using docker you may need to modify nightwatch.conf.js to change the "launch_url" in the test_settings/docker, to your local host and port. Example:
docker: {
launch_url: "http://biproxy",
},
TO
docker: {
launch_url: "http://localhost:8080",
},
The implemented scenarios assume the following data is set up on BI:
Users
Name | System Role | |
---|---|---|
Christian | [email protected] | System Administrator |
Cucumber Breeder | [email protected] | |
Cucumber Member | [email protected] | |
TrailMix Breeder | [email protected] |
Programs
Name | Species | Users (role) |
---|---|---|
Snacks | Grape | Cucumber Breeder (Program Administrator) Cucumber Member (Read Only) Christian (Program Administrator) |
Trail Mix | Grape | Cucumber Breeder (Read Only) TrailMix Breeder (Program Administrator) Christian (Program Administrator) |
Automated Database Setup
There is a script setup_local_db.sh
that will setup your bidb and brapi-server databases assuming bi-docker-stack and taf repos are at the same level in the filesystem and default docker services/ports are used.
- Entering a string in a text field use "sets"
When user sets "[email protected]" in email field
- Interacting with controls, use "selects"
When user selects "United States" in Country dropdown
When user selects "Apple, Banana, Pear" in combo box
When user selects "Yes" in 'Are you hungry' radio button box
When user selects "Here" link
When user selects "Cancel" button
- Visibility of a control, use "see" and "not see"
Then user can see "Snacks" button
Then user can not see "Cancel" link
TAF can launch browser on a Selenium docker container and run tests on bi-docker-stack.
- Docker Desktop
-
Set
API_BASE_URL
environmental variable to http://biproxy -
Set
WEB_BASE_URL
environmental variable to http://biproxy -
Set
JWT_DOMAIN
environmental variable to biproxy -
Set
REGISTERED_DOMAIN
environmental variable to biproxy -
Update the host's host file Windows : C:\Windows\System32\drivers\etc\host Unix: /etc/hosts Add the following line "127.0.0.1 biproxy"
-
Set the browser to "docker.chrome". In package.json, set browser to "docker.chrome". e.g. "--world-parameters "{\"browser\":\"docker.chrome\"}""
- For running specific branch code, make sure code is checked out in bi-docker-stack sub repo and go to the bi-docker-stack folder and execute
docker-compose -f docker-compose.yml -f docker-compose-dev.yml up -d
- For running latest development branch, go to the bi-docker-stack folder and execute
docker-compose -f docker-compose.yml -f docker-compose-qa.yml up -d
- Go to TAF folder and execute
docker-compose up -d