This repository contains the web application code for Skill for Care's Adult Social Care Workforce Data Set (ASC-WDS) service. Currently the application is running with Angular version 17 as frontend and Express as backend.
- Run
make run
for a dev server. This will start the Angular frontend bynpm run build:watch
and also start the backend Express app usingnpm run new-start
- Navigate to
http://localhost:8080/
to view the application
Any frontend file changes will re-compile the assets and refresh the browser automatically.
First, pick a sub-directory under frontend
where we want to create the files, for example frontend/src/app/shared/components
where we store the shared component.
Then, cd
into the chosen sub-directory and run ng generate component component-name
to generate a new component.
You can also use ng generate directive|pipe|service|class|guard|interface|enum|module
to generate other Angular items.
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory. Use the --prod
flag for a production build.
Run make test-fe
to execute the unit tests for the frontend.
The test runner will watch the source files and automatically re-run all tests whenever a frontend file is modified.
To run only one or a few specific tests, open the relevant .spec.ts
file and modify the describe
block to fdescribe
. This will let the test runner to focus on the chosen tests and skip all others.
Also, after running all tests, the test runner will dump the results at frontend/TESTS.xml
.
If in case multiple tests are failing, we can check the file to find out which tests are the failed ones.
Run make test-be
to execute the unit tests for the backend.
This test runner does not watch file changes, so re-run the test manually if necessary.
To focus on specific tests, modify the describe
block to describe.only
, then run the tests again.
Run make test-bu
to execute the unit tests for bulk upload lambda.
For the moment we run our end-to-end tests with Cypress under a configuration of docker-compose
.
Refer to the confluence document "End to end (e2e) testing configuration" for the steps to set up the environments first.
After the docker configurations are set up correctly, we can run the e2e test by the below steps:
- Run
docker-compose up
to start up the necessary docker containers. Wait for both the frontend and backend to be ready. - In another terminal, run
make test-e2e
to run the whole e2e test suite in "headless" mode.
Alternatively, we can run the e2e tests in browser mode by cd frontend
and then npx cypress open
.
This will start up a test browser instance that allows us to run and debug specific tests more easily.
- After running the test, run
make stop-containers
to stop the docker containers. This will help to reduce the time needed to initiate the docker containers for the next time.
To get more help on the Angular CLI use ng help
or go check out the Angular CLI README.
Database connection parameters can be overridden using environment variables:
DB_HOST
- hostname or IP addressDB_PORT
- port numberDB_NAME
- name of databaseDB_USER
- database usernameDB_PASS
- database password
- Ensure all images have a contextual and useful
alt
tag. If no context is needed, usealt=""
. - Ensure that content follows semantic markup, for instance using definition lists, labels and fieldsets.
- Anchors with
target="_blank"
require<span class="govuk-visually-hidden"> (opens in a new window)</span>
to be placed after the text content and before the closing anchor tag. - All Angular Directives must be wrapped in square brackets
[]
. - Dialogs
h1
element should contain the idid="dialogHeading"
. - Download links must contain a valid
href
containing the filename.