/portal-tests

UI automated tests for Portal

Primary LanguageJavaScript

Portal-test

UI automated tests for Portal

test coverage can be found here

Running tests in docker

Before running tests make sure that your Portal is running on localhost:3001 and was bootstraped with (auto_test@tyk.io) admin user. Command to bootstrap:

./dev-portal -bootstrap -user=auto_test@tyk.io -pass=test123

To dockerize the framework we are using Selenium hub. This will install dependecies, run the driver and browser inside containers (no need for nodejs, npm or chrome to be installed locally). Just make sure that you have bootstraped portal and running on localhost:3001.

  1. Clone this repository
  2. Generate and export license (for Portal and dashboard) to env variables
export TYK_DB_LICENSEKEY=%license%
  1. Start dependencies. This will start Tyk stack and Selenium hub
make start-dependecies
  1. Build test framework image (this need to be done only once)
make build-framework
  1. Execute prerequisits (run only once, on clear Portal)
make execute-prerequisits
  1. Execute tests
make execute-tests

You can now edit the framework code (on your local) and just re-run execute-tests, no need of rebuilding the image. Results should be created in /result folder. To kill dockers with dependencies just run:

make stop-dependecies

Prerequisits for manual testing

If you just need a working instance of Portal connected with Tyk and Keycloak - start docker-compose (point 2 below) and make your Portal to use database saved in ci/portal.db file. Portal should now be connected to Tyk Dahsboard and be have DCR details set up.

How to run tests locally (not using Selenium hub)

Tests can be executed inside docker wdio service.

  1. Clone this repository
  2. Install framework dependencies
npm install
  1. Generate and export license (for Portal and dashboard) to env variables
export PORTAL_LICENSEKEY=%license%
export TYK_DB_LICENSEKEY=%license%
  1. Start docker-compose with Tyk stack (gateway, dashboard, redis, mongo) using single command
docker-compose -f ci/tyk_dashboard.yml up
  1. Start your Portal instance with empty database and admin user
./dev-portal  --bootstrap -user=auto_test@tyk.io -pass=test123
  1. Execute prerequisits
npm run docker-prerequisits

After this you will have Portal filled with data needed for manual testing (provider, users, catalogues, etc.). 7. Execute tests

npm run docker-test
  1. Report will be generated in results/report/index.html

Tests will also work with Portal started as docker container. Just please make sure that admin user was created. If portal

Notes

  • Tests also works with Portal started as docker container (please make sure that URL is provided and admin user was created)
  • Tests are executed on chrome browser
  • Tests are triggered as github action inside Portal repository

Configuration

We can execute test with following variables [default values]:

  • URL [http://localhost:3001/] - Portal UI url
  • TYK_PRO_URL [http://localhost:3000/] - Tyk dashboard url
  • TYK_DB_LICENSEKEY [] - Tyk dashboard license

Note: you can also use .env file to provide the variables

Tooling:

  1. Node.js
  2. Webdriverio
  3. Timeline reporter for reporting