Cerberus frontend service for cerberus-api
- npm 6.9.0
- node v8.10.0
- Getting started
- Native development
- Development with docker
- Tests in native development
- Linter in native development
- E2E tests in native development
1. Clone this repo
2. Install dependencies
$ npm install
3. Add environment variables (you don't need to use export
on OSX)
$ export KEYCLOAK_AUTH_URL=https://your.sso.com/auth
$ export KEYCLOAK_CLIENT_ID=your-client-id
$ export KEYCLOAK_REALM=realm
$ export FORM_API_URL=https://form-api.example.com/
$ export REFDATA_API_URL=https://refdata-api.example.com/
$ export CERBERUS_API_URL=https://cerberus-api.example.com/
4. Build development bundle (optional)
$ npm run build:dev
5. Start the application (optional)
$ npm start
2. Build the application Docker container
docker build -t cerberus-service .
3. Run the resulting Docker container
docker run --name cerberus-service -p 8080:8080 \
--env KEYCLOAK_AUTH_URL=https://your.sso.com/auth \
--env KEYCLOAK_CLIENT_ID=your-client-id \
--env KEYCLOAK_REALM=realm \
--env FORM_API_URL=https://form-api.example.com \
--env REFDATA_API_URL=https://refdata-api.example.com \
--env CERBERUS_API_URL=https://cerberus-api.example.com \
cerberus-service
Setup your environment as described in Native development
3. Running jest tests
npm test
Setup your environment as described in Native development
3. Running linter
npm run lint -- <directory>
Set up your environment as described in Native development
run script ./scripts/env-setup.sh to generate users credentials
There are two ways to run cypress tests, using the cypress test runner or running cypress tests using the command line.
By default, tests run against local environment.
NOTE: You will need, the cerberus-service application, to be running before triggering Cypress.
create a file called cypress.env.json on a root folder and include the following key-value pair when running the tests locally, (These values would be automatically fetched from secret manager and would be set when tests running inside drone server / kube)
{
"auth_base_url": "xxxx",
"auth_realm": "xxx",
"auth_client_id": "xxx",
"cerberusServiceUrl": "xxx",
}
Running all tests
npm run cypress:runner
Running all tests using environment settings from a configuration file
npm run cypress:runner -- --env configFile=dev
Once TestRunner launched, click on the interested spec inside folder cypress/integration/cerberus
Running all tests on local Environment, (It executes tests headless mode on Electron Browser)
npm run cypress:test:local
Running all tests on Development Environment, (It executes tests headless mode on Electron Browser)
npm run cypress:test:dev
Running a specific test
npm run cypress:test:local -- --spec cypress/integration/cerberus/tasks.spec.js
Running specific test with chrome browser
npm run cypress:test:local -- --browser chrome --spec cypress/integration/cerberus/task-management.spec.js
Running All tests and generating mochawesome html report with screenshots
npm run cypress:test:report -- -b chrome -c ${CERBERUS_WORKFLOW_SERVICE_URL} -e dev
Running specific test and generating mochawesome html report with screenshots
npm run cypress:test:report -- -b chrome -s cypress/integration/cerberus/login.spec.js
Running all tests and generating mochawesome html report with screenshots using script export CERBERUS_WORKFLOW_SERVICE_URL=xxxxx
./scripts/run_tests.sh