hmcts / civil-ccd-definition

MIT License
3 stars 10 forks source link
jenkins-cft jenkins-cft-a-c

civil-ccd-definition

Civil CCD Definition and E2E tests

Contents:

Building and deploying the application

Dependencies

The project is dependent on other Civil repositories:

To set up complete local environment for Civil check civil-sdk

Preview environment

Preview environment will be created when opening new PR. Camunda BPMN definitions will be pulled from the latest GitHub release. Service instance will be running the latest image version deployed to ACR.

To access XUI visit url (make sure that it starts with https, otherwise IDAM won't let you log in):

To access Camunda visit url (login and password are both admin):

The below labels are options to get the different services running on the PR


  "enable_keep_helm" label to retain helm release on preview

  "pr-values:enableNotifyEmails" label to be able to send live notifications on the PR

  "pr-values:elasticsearch" label to have elastic search running - needed for scheduler testing

  "pr-values:enableWA" label to verify work allocation task

  "pr-values:enableHmc" label to enable the HMC integration with services running in AAT.

Note: enabling HMC, will create a custom CaseType in definitions and import it to AAT. Please delete the same after use by running:

curl -v -k -X DELETE \
  'http://ccd-definition-store-api-aat.service.core-compute-aat.internal/api/testing-support/cleanup-case-type/{PR_NUMBER}/?caseTypeIds=CIVIL'

Running Crossbrowser tests:

Install saucelabs on local machine

$ yarn test:crossbrowser

Testing

The repo uses codeceptjs framework for e2e tests.

To install dependencies enter yarn install.

To run e2e tests enter yarn test in the command line.

Optional configuration

To run tests with browser window open set SHOW_BROWSER_WINDOW=true. By default, the browser window is hidden.

Smoke test

To run smoke tests enter yarn test:smoke.

Functional tests

To run functional tests enter yarn test:functional.

For running UI tests, set CCD_UI_TESTS=true

API test

Before running API tests, you will need the SENDGRID_API_KEY environment variable setup and to be running the service locally along with all containers.

To run API tests enter yarn test:api. set CCD_UI_TESTS=false

Testing in IntelliJ (Ultimate Edition)

1) Running a test_name.js

2) Running a test from package.json

Adding Git Conventions

Include the git conventions.

If you violate a convention, the git error message will report clearly the convention you should follow and provide additional information where necessary.

Optional:

In case of problems

  1. Get in touch with your Technical Lead so that they can get you unblocked
  2. If the rare eventuality that the above is not possible, you can disable enforcement of conventions using the following command

    git config --local --unset core.hooksPath

    Still, you shouldn't be doing it so make sure you get in touch with a Technical Lead soon afterwards.

Development / Debugging Environment - Preview with Mirrord

As an alternative for a development environment there is a procedure in place where after running the command below the required services for Civil are created in Preview under the developer's name, so these will be exclusively for the named developer use.

While connected to the VPN simply run one of the below commands from your project's (civil-ccd-definition) folder: Note: be sure to have Docker running

npx @hmcts/dev-env@latest && ./bin/setup-devuser-preview-env.sh

You can optionally specify a branch for CCD definitions and Camunda definitions like below or leave it blank to use master.

npx @hmcts/dev-env@latest && ./bin/setup-devuser-preview-env.sh camundaBranch dmnBranch waStandaloneBranch

Once the pods are up and running you can connect to them using a plugin called Mirrord on Intellij. https://mirrord.dev

If you want to clean up the environment just run:

npx @hmcts/dev-env@latest --delete

To run the specialised charts, where you can get Work Allocation for instance, run:

npx @hmcts/dev-env@latest --template values.enableWA.preview.template.yaml && ./bin/setup-devuser-preview-env.sh

Note: enabling HMC, will create a custom CaseType in definitions and import it to AAT. Please delete the same after use by running:

./bin/delete-dev-preview-definition-from-aat.sh

Hearings Development - Preview

For now any Hearings related PRs, i.e. that requires HMC/ILA must undergo some manual setup.

1 - Execute the commands below replacing ${PR_NUMBER} accordingly to create the topic subscription required

    az servicebus topic subscription create --resource-group hmc-shared-aat --namespace-name hmc-servicebus-aat \
      --topic-name hmc-to-cft-aat --subscription DCD-CNP-DEV --name hmc-to-civil-subscription-pr-${PR_NUMBER} \
      --subscription DCD-CNP-DEV && \
    az servicebus topic subscription rule create --resource-group hmc-shared-aat --subscription DCD-CNP-DEV\
      --namespace-name hmc-servicebus-aat --topic-name hmc-to-cft-aat \
      --subscription-name hmc-to-civil-subscription-pr-${PR_NUMBER} \
      --name hmc-servicebus-aat-subscription-rule-civil --subscription DCD-CNP-DEV\
      --filter-sql-expression "hmctsServiceId IN ('AAA7','AAA6')"

(Remember to delete this once finished with the PR using "az servicebus topic subscription delete")

2 - Add the label pr-values:enableHmc on your GitHub PR

3 - When in XUI/CUI the case type will have an extension to your PR number added to it.

License

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