HUB
Sign inSign up
cmc-feature-toggle-importer logo

hmcts/cmc-feature-toggle-importer

By hmcts

•Updated almost 8 years ago

CMC feature toggle importing

Image
0

500K+

hmcts/cmc-feature-toggle-importer repository overview

⁠CMC Integration tests

Standard - JavaScript Style Guide

This is the integration tests for CMC.

⁠Getting Started

⁠Prerequisites
⁠Environment variables

Relevant environment variables that will be pulled from your environment:

  • GOV_NOTIFY_API_KEY: a notify api key, you can generate your own once you get a notify account, or ask for one to be setup for you
  • GOV_PAY_AUTH_KEY_CMC: payments sandbox API key, also ask around for it
⁠Running the tests

First step is to start the environment for the tests to execute against:

$ ./bin/start-local-environment.sh

If you see the command exit with messages like "service unhealthy" it may mean that docker has exceeded the container health check verifications limit. You can try re-running the command in that case, but if those messages persist then the problem is probably elsewhere.

After that you can run the tests:

$ ./bin/run-local-tests.sh

To run specific tests you can pass an argument to the run script:

$ ./bin/run-local-tests.sh 'CCJ'

You can use anything in the 'Scenario' or 'Feature' functions to target which tests to run.

If you want to shut down the environment use:

$ docker-compose down 

This environment will not persist data between restarts, so when you start again you'll get a fresh environment.

⁠Debugging
⁠Watching the tests running

To watch the tests executing there's a debug selenium server setup which has a VNC server on it On mac run $ open vnc://localhost the password is: secret

For more information see: https://github.com/SeleniumHQ/docker-selenium#debugging⁠

⁠Starting a local development environment
⁠Ad-hoc database commection

To open an interactive terminal for working with the claimstore containerised database:

docker-compose exec shared-database psql -U postgres -d claimstore
⁠Setting up an IDAM User

The first time you will need to create a user to login with Run:

$ ./bin/create-user.sh [optional-email] [optional-firstname] [optional-lastname] [optional-usergroup]

To use the compose files defined in the project to start a local development environment, use:

$ ./bin/start-local-environment.sh

This will:

  • start all the services beside the citizen-frontend, you'll need to start that one on it's own,
  • mount database volumes, thanks to which your data will persist between environment restarts,
  • expose container ports to the host, so all the APIs and databases will be directly accessible. Use docker ps or read the compose file⁠ to see how the ports are mapped.

To stop the environment use the same script, just make sure to pass the local parameter:

$ ./bin/stop-local-environment.sh

If you want to delete the volumes as well pass the -v flag:

$ ./bin/stop-local-environment.sh -v
⁠Steps to start ccd management web

If docker's local environments are already running, then execute following

$ ./bin/start-local-ccd-web.sh

else

$ ./bin/start-local-environment.sh

$ ./bin/start-local-ccd-web.sh

create caseworker user

$ ./bin/create-case-worker.sh

Open management web page http://localhost:3451⁠ and login with user created above

⁠CCD definition
⁠Update CCD definition locally

To generate the CCD definition file from its JSON counterpart located under docker/ccd-definition-import/data/sheets and upload locally to the Dockerised CCD instance:

$ ./bin/update-ccd-definition-locally.sh

The newly generated CCD definition will be found under 'docker/ccd-definition-import/data/ccd-definition.xlsx'

⁠Upload to an environment

To upload the CCD definition file found under 'docker/ccd-definition-import/data/ccd-definition.xlsx' to the designated environment: Note: uploading to an environment requires azure-cli, jq and python3 to be installed.

$ ./bin/upload-ccd-definition-to-env.sh aat
⁠Debugging

If an error occurs try running the script with a -v flag after the script name

$ ./bin/upload-ccd-definition-to-env.sh -v aat
⁠Adding a feature toggle
⁠Locally

Update add-toggles.sh⁠

$ ./bin/upload-feature-toggles-locally.sh
⁠To an environment

Note: uploading to an environment requires azure-cli to be installed.

All environments except production are currently set with a weight of 1.0 or 100% which means that all users who opt-in to new features will receive the feature.

Choose the weight you want for production and run the following:

./bin/upload-feature-toggle-to-all-envs.sh cmc_<feature-name> 'CMC <feature-description>' 0.2

To update a feature run the above script with new parameters

⁠Debugging

If an error occurs try running the script with a -v flag after the script name

$ ./bin/upload-feature-toggles-locally.sh -v
⁠Executing cross-browser testing on Saucelabs locally

In order to run tests against different browsers in Saucelabs⁠ you'll need a slightly modified environment:

$ ./bin/cross-browser/start-environment.sh

Then to run tests:

$ ./bin/cross-browser/run-tests.sh

You'll need additional environment variables to be able to access Saucelabs, please refer to docker-compose.cross-browser.yml⁠ file for details.

⁠Developing

⁠Code style

We use TSLint⁠ and StandardJS⁠.

Running the checks:

$ yarn lint

⁠Versioning

We use SemVer⁠ for versioning.

⁠License

This project is licensed under the MIT License - see the LICENSE⁠ file for details.

Tag summary
Recent tags
Content type
Image
Digest
Size
5.6 MB
Last updated
almost 8 years ago
docker pull hmcts/cmc-feature-toggle-importer:latest