Skip to content

Commit 4bd8566

Browse files
authored
Merge pull request #281 from adhocteam/main
Case insensitive admin search, testing updates and manager setting of notes and report status
2 parents 17f9d7f + f327246 commit 4bd8566

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+861
-138
lines changed

.circleci/config.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ jobs:
228228
- run:
229229
name: Run cucumber
230230
command: |
231-
sleep 5
231+
sleep 10
232232
yarn cucumber:ci
233233
- store_artifacts:
234234
path: reports/
@@ -240,12 +240,12 @@ jobs:
240240
- run:
241241
name: Start up local server
242242
command: | # production style build (single BE server with static FE)
243-
docker-compose -f docker-compose-test.yml run --rm server yarn install --production=false
244-
docker-compose -f docker-compose-test.yml run --rm server yarn --cwd frontend install --production=false
245-
docker-compose -f docker-compose-test.yml run --rm server yarn build
246-
docker-compose -f docker-compose-test.yml run --rm server yarn --cwd frontend run build
247-
docker-compose -f docker-compose-test.yml up -d
248-
docker-compose -f docker-compose-test.yml exec server yarn db:migrate:ci
243+
docker-compose -f docker-compose.dss.yml run --rm server yarn install --production=false
244+
docker-compose -f docker-compose.dss.yml run --rm server yarn --cwd frontend install --production=false
245+
docker-compose -f docker-compose.dss.yml run --rm server yarn build
246+
docker-compose -f docker-compose.dss.yml run --rm server yarn --cwd frontend run build
247+
docker-compose -f docker-compose.dss.yml up -d
248+
docker-compose -f docker-compose.dss.yml exec server yarn db:migrate:ci
249249
- run:
250250
name: Pull OWASP ZAP docker image
251251
command: docker pull owasp/zap2docker-weekly

bin/run-tests

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/bin/bash
2+
3+
declare -a options=(frontend backend)
4+
declare lr=">>>>>>>>"
5+
declare -i exit_code=0
6+
7+
log() {
8+
echo "$lr $*"
9+
}
10+
11+
check_exit() {
12+
if [[ "$1" -ne 0 ]]; then
13+
echo "$lr last docker-compose command failed"
14+
((exit_code++))
15+
fi
16+
}
17+
18+
main() {
19+
local opt=""
20+
21+
for o in "${options[@]}"; do
22+
if [[ "${1}" == "$o" ]]; then
23+
opt="$o";
24+
fi
25+
done
26+
27+
log "Running tests in using test config 'docker-compose.test.yml'"
28+
# Start containers
29+
docker-compose -f 'docker-compose.test.yml' up -d
30+
check_exit "$?"
31+
32+
# Let postgres initialize
33+
echo
34+
log "Giving postgres a few seconds to start up..."
35+
sleep 5
36+
37+
# Migrate and seed db
38+
echo
39+
log "Migrating & seeding db"
40+
docker exec test-backend bash -c "yarn db:migrate"
41+
check_exit "$?"
42+
docker exec test-backend bash -c "yarn db:seed;"
43+
check_exit "$?"
44+
45+
if [[ "$opt" == "backend" || -z "$opt" ]]; then
46+
# Test backend
47+
echo
48+
log "Running backend tests"
49+
docker exec test-backend bash -c "yarn test:ci"
50+
check_exit "$?"
51+
fi
52+
53+
if [[ "$opt" == "frontend" || -z "$opt" ]]; then
54+
# Test frontend
55+
echo
56+
log "Running frontend tests"
57+
docker exec test-frontend bash -c "yarn --cwd frontend run test:ci"
58+
check_exit "$?"
59+
fi
60+
61+
# Cleanup
62+
echo
63+
log "Cleaning up test containers"
64+
docker-compose \
65+
-f 'docker-compose.test.yml' \
66+
down --volumes
67+
check_exit "$?"
68+
69+
if [[ $exit_code -ne 0 ]]; then
70+
echo
71+
log "Errors occurred during script execution"
72+
fi
73+
74+
exit "$exit_code"
75+
}
76+
77+
main "$@"
File renamed without changes.

docker-compose.test.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
version: "3.5"
2+
services:
3+
test-backend:
4+
build:
5+
context: .
6+
container_name: test-backend
7+
command: yarn server
8+
user: ${CURRENT_USER:-root}
9+
depends_on:
10+
- test-db
11+
environment:
12+
- POSTGRES_HOST=test-db
13+
volumes:
14+
- ".:/app:rw"
15+
networks:
16+
- ttadp-test
17+
test-frontend:
18+
build:
19+
context: .
20+
container_name: test-frontend
21+
command: yarn start
22+
user: ${CURRENT_USER:-root}
23+
stdin_open: true
24+
volumes:
25+
- "./frontend:/app:rw"
26+
- "./scripts:/app/scripts"
27+
environment:
28+
- BACKEND_PROXY=http://test-backend:8080
29+
networks:
30+
- ttadp-test
31+
test-db:
32+
image: postgres:12.4
33+
container_name: test-db
34+
env_file: .env
35+
networks:
36+
- ttadp-test
37+
# Use non-default network so we don't conflict with the developer environment
38+
networks:
39+
ttadp-test:

docs/logical_data_model.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Logical Data Model
22
==================
33

4-
<img src="http://www.plantuml.com/plantuml/png/nLVRRkCs47tNL_2jRO0OHOkYm29Ox6xgBV9GDqYo7p2M9Z9RYiCEHzaQSVwzffWAeYnd6QkNbmGwSpyyrCZll01BsvZ2bs1GVRluyOUY-4h10-bAEQQrmSQhpres2cnji58bqsUlxX6byBzhwu2XKKPRbAr3HImRAehIWFVgaqTMZuLIPqfNwetILh3UGnSNDLfa4ApUljsRDnvzyBqAJbvOstgFMcXm-EmsP77LDcla8Noci05jXf1eCVX6eMsRa9qQlC5QaxqQDF7rzzzzeswM7vStozNbybQvTcrqkOYEVg6hBdN96BfyB_j0qGrwWSPrbjPL4vQdlqUFUNA6FniDsgUuBSdXAHcKgj2Nh9reiZqwQvnhv4PxdprIwv4ps0w7tdFD9vwH3pnbX7Ly_XCd-qUBNfRCn3w73NBXGPCTdb3BUlZOe6meKJ_7CX-esgQmTsGz7iClgS8UdpaecIdvlIJPEtAwp8_foyIuB6KncPp33bdxivQG_ghwKapNnNo1_4nWyZXGoWj8wuT8I7ZF8pVjFp8rjmsm-0sYt0bS6mY2MXCP13klusxmbzgkzxOCqaEA_ujq1YkOgTVvbOxM6Q-dazzgTHmeX_Ne6GCF1TLj-9z0S3GeskeGdKrCa436HJvbm9IQtBWOTPA6Pt2n8XkxFcM1polzlXJze6LxWuvOSiepUcgvxBx1aXq4LQN3uWAp8i54LL7elzvV0uikjGjC9tUXGgCVaBU_76osgktNOOMbRi0aQWp39RBj8UWdsnVKQELkwt1YPuw_3m_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DHokN-39NSGL9KMJHRCYWGJLKMX_tf_3Iowr2umdUo52er-GDx-Sd2pLMr_7LPOwWPCeiOmN2BR7e9-igwWHYjtMuSJT-RuVNYu9nnJpT24-803CsmleZKG8i0roZMvrkmxdV9X14zsmk0IHiRcU2nE6WJYF0UMagpWdv8C03NUIcJdDq-sWngm7SZfIfty63FWvLCKseVjl_oIUmwRB_c16FEs7IHx9QFXT7F5nbzr7CKGsnyF6N6htdasKMdxbsGCh8b1YFyhlbuho10otNx-LJEtxHDkaEUsmmHgjpkdHnMb7f4dEZ_VFGv-L1NnjzuX7gEc36Hw__qJgeXlwAVT7Wez554rlLj_FnVXpm4QKouMAlmVf9o6Oj4-smY9XSFaVOddKL8ivJaaEQxGIDsBBb_Cb_Hxp1Gf79cJjHoPqi_49pcJ8Y_1FcqUF1gE-hn3MxMD-Gi0">
55

66
UML Source
77
----------
@@ -150,6 +150,7 @@ class ActivityReport {
150150
ttaType : array<string>
151151
context : string
152152
pageState : json
153+
managerNotes : string
153154
* userId : integer(32) REFERENCES public.Users.id
154155
* lastUpdatedById : integer(32) REFERENCES public.Users.id
155156
* regionId : integer(32) REFERENCES public.Region.id
@@ -208,7 +209,7 @@ NonGrantee ||-{ ActivityParticipant
208209
Instructions
209210
------------
210211

211-
1. [Edit this diagram with plantuml.com](http://www.plantuml.com/plantuml/uml/nLVRRkCs47tNL_2jRO0OHOkYm29Ox6xgBV9GDqYo7p2M9Z9RYiCEHzaQSVwzffWAeYnd6QkNbmGwSpyyrCZll01BsvZ2bs1GVRluyOUY-4h10-bAEQQrmSQhpres2cnji58bqsUlxX6byBzhwu2XKKPRbAr3HImRAehIWFVgaqTMZuLIPqfNwetILh3UGnSNDLfa4ApUljsRDnvzyBqAJbvOstgFMcXm-EmsP77LDcla8Noci05jXf1eCVX6eMsRa9qQlC5QaxqQDF7rzzzzeswM7vStozNbybQvTcrqkOYEVg6hBdN96BfyB_j0qGrwWSPrbjPL4vQdlqUFUNA6FniDsgUuBSdXAHcKg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sGqYq67oZqBPDo4uDtc2joLuDclZw----KJVBZykRvUfoUQjSkpQwN4H7lz3LFdN96BfyBrsWw0QzGEFsbjPL4vQdlqUFUNA6FniDsgUuBSdXAHcKgj2Nh9reiZqwQvnhv4PxdprIwv4ps0wBtdFD9wwH3pnbXEtv_2TMze-smvRCn3w73NBXGvCThb3BUlZPe6meKJ_7CX-esgQmTsGz7iClgS8UdpaecIdvlIJPEtAwp8_foyIuB6KncPp53bdxjPQG_ghwKio-Y_a2-Pd0v76Wb1UGrW-HaF2UHsxQVsHgRXjWyHj4kHEuDX04jIOo27PMnt7PNcgxxcmPf8SK_nVf35OmKw_pAnsjCxwUJZxLwZXG3klHCmQE11KHbfz0S3GeskeGdKrCa43EHZvXm9IQtBWOTPA6Pt2n8XkxFkK2drVwVIdwGSls1Xsnv9HdzDHokN-39NSGL9KMJHRCYWGJLKMX_tf_3Iowr2umdUo52er-GDx-Sd2pLMr_7LPOwWPCeiOmN2BR7e9-igwWHYjtMuSJT-RuVNYu9nnJpT24-803CsmleZKG8i0roZMvrkmxdV9X14zsmk0IHiRcU2nE6WJYF0UMagpWdv8C03NUIcJdDq-sWngm7SZfIfty63FWvLCKseVjl_oIUmwRB_c16FEs7IHx9QFXT7F5nbzr7CKGsnyF6N6htdasKMdxbsGCh8b1YFyhlbuho10otNx-LJEtxHDkaEUsmmHgjpkdHnMb7f4dEZ_VFGv-L1NnjzuX7gEc36Hw__qJgeXlwAVT7Wez554rlLj_FnVXpm4QKouMAlmVf9o6Oj4-smY9XSFaVOddKL8ivJaaEQxGIDsBBb_Cb_Hxp1Gf79cJjHoPqi_49pcJ8Y_1FcqUF1gE-hn3MxMD-Gi0)
212213
2. Copy and paste the final UML into the UML Source section
213214
3. Update the img src and edit link target to the current values
214215

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
put:
2+
tags:
3+
- activity-reports
4+
summary: Review an activity report
5+
description: >
6+
An approving manager reviews an activity report to determine if it requires
7+
any additional updates. If the report needs updates the manager sets the status to
8+
'Needs Action', otherwise to 'Approved'
9+
requestBody:
10+
description: The status and any manager notes
11+
required: true
12+
content:
13+
application/json:
14+
schema:
15+
type: object
16+
properties:
17+
status:
18+
type: string
19+
description: The status of the report after review
20+
enum:
21+
- Approved
22+
- Needs Action
23+
managerNotes:
24+
type: string
25+
description: Any notes the manager needs to relay to the author/collaborators of the report
26+
parameters:
27+
- in: path
28+
name: activityReportId
29+
required: true
30+
schema:
31+
type: number
32+
responses:
33+
200:
34+
description: The new status of the activity report
35+
content:
36+
application/json:
37+
schema:
38+
type: object
39+
properties:
40+
status:
41+
type: string
42+
enum:
43+
- Approved
44+
- Needs Action
45+
managerNotes:
46+
type: string

docs/openapi/paths/collaborators.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ get:
2020
schema:
2121
type: array
2222
items:
23-
$ref: '../../index.yaml#/components/schemas/selectableUser'
23+
$ref: '../index.yaml#/components/schemas/selectableUser'

docs/openapi/paths/index.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,7 @@
2222
$ref: './activity-reports/activity-reports-id.yaml'
2323
'/activity-reports/{activityReportId}/submit':
2424
$ref: './activity-reports/submit.yaml'
25+
'/activity-reports/{activityReportId}/review':
26+
$ref: './activity-reports/review.yaml'
2527
'/files':
2628
$ref: './files.yaml'

docs/testing.md

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Testing
2+
3+
## Tips and Caveats when writing tests
4+
5+
6+
### Handling async/promises
7+
8+
When writing tests that rely on asynchronous operations, such as writing to the database, take care to make sure that those operations are resolved before any tests that rely on them run. If you need to create database records in a setup function such as `beforeAll`, you will want to make sure all async/promise operations resolve before subsequent tests run. You can make sure multiple await (promise) operations resolve by using [`Promise.all()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all) (which takes an iterable of promises).
9+
10+
Here's how that might look:
11+
12+
```
13+
let a = someAsyncFun();
14+
let b = anotherAsyncFun();
15+
16+
return Promise.all([a, b]);
17+
```
18+
19+
### Creating/deleting database records
20+
21+
Some tests will require interactions with the database, but at present all tests run using the same instance of the database. That means that any records you create or delete can potentially affect tests elsewhere. On top of that, tests run in parallel, so database operations may run in an unexpected order. That can mean tests may pass various times only to fail due to missing or unexpected records in the database when your tests run.
22+
23+
To mitigate issues with missing or unexpected records causing failing tests, you can try a few approaches. One approach is to avoid using the database if your test doesn't actually require it. You may be able to use mock models or responses rather than interact with the database. If your test does require the database, you should create the records you need before your tests run and delete the records you created (and no others) when your tests finish. If you `Model.create`, make sure you `Model.destroy()` the records you created.
24+
25+
When writing tests that create database records, it might also help to use a `try...catch` to catch errors in database transactions and log meaningful output. Sequelize error messages can be vague, and it might help others to see more informative messages.
26+
27+
## Testing in Docker
28+
29+
### Using `./bin/run-tests`
30+
31+
To simplify running tests in Docker, there is a bash script, `./bin/run-tests` that will run the appropriate commands to start `test-` variations of the services used in tests. You should be able to run tests using that command while your development Docker environment is running. The script uses a separate `docker-compose.test.yml` which does not create a user-accessible network and cleans up after itself once tests have run.
32+
33+
This script is written such that it will log errors, but won't exit if a docker command fails. It will count the number of errors and the number of errors will be the exit code (`$?`) for the script. So if three docker commands fail, the exit code would be 3.
34+
35+
By default, `./bin/run-tests` will run both backend and frontend tests. If you want to run only one set of tests, supply 'frontend' or 'backend' as a parameter. So to run only the backend tests, you'd run `./bin/run-tests backend`.
36+
37+
### Running tests in your development Docker environment
38+
39+
When running tests in Docker, be aware that there are tests that will modify/delete database records. For tests to run, the 'db' service needs to exist and `db:migrate` and `db:seed` need to have been run (to create the tables and populate certain records).
40+
41+
In the `docker-compose.yml` configuration, the database is set up to persist to a volume, "dbdata", so database records will persist between runs of the 'db' service, unless you remove that volume explicitly (e.g. `docker volume rm` or `docker-compose down --volumes`).
42+
43+
44+
### Notes on docker-compose and multiple configurations
45+
46+
`docker-compose` has a feature for providing multiple `docker-compose.*.yml` files where subsequent files can override settings in previous files, which sounds like it would suit the use case of running docker for local development and for testing. However, the ability to [override configurations](https://docs.docker.com/compose/extends/#adding-and-overriding-configuration) is limited. While experimenting with overrides, it became clear that doing so would require a minimum of three docker-compose.yml files: one "base", one for local development, one for running tests. Trying to compose docker-compose.yml files would be complicated.
47+
48+
In addition, while experimenting with multiple configuration files, it became clear that docker was unable to differentiate between different versions of the same service. Trying to override the 'db' service for testing would not work as expected: if the local/dev 'db' service had already been created, that one would be used when tests were run.

frontend/src/App.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ function App() {
7575
/>
7676
<Route
7777
path="/activity-reports/:activityReportId/:currentPage?"
78-
render={({ match }) => (
79-
<ActivityReport match={match} />
78+
render={({ match, location }) => (
79+
<ActivityReport location={location} match={match} user={user} />
8080
)}
8181
/>
8282
{admin

frontend/src/Constants.js

+2
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,5 @@ export const REGIONS = [
6464
11,
6565
12,
6666
];
67+
68+
export const DECIMAL_BASE = 10;

frontend/src/components/Navigator/__tests__/index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const pages = [
4242
label: 'review page',
4343
path: 'review',
4444
review: true,
45-
render: (hookForm, allComplete, formData, submitted, onSubmit) => (
45+
render: (hookForm, allComplete, formData, onSubmit) => (
4646
<div>
4747
<button type="button" data-testid="review" onClick={onSubmit}>Continue</button>
4848
</div>
@@ -59,6 +59,9 @@ describe('Navigator', () => {
5959
<Navigator
6060
submitted={false}
6161
initialData={initialData}
62+
status="draft"
63+
onReview={() => {}}
64+
approvingManager={false}
6265
defaultValues={{ first: '', second: '' }}
6366
pages={pages}
6467
currentPage={currentPage}

frontend/src/components/Navigator/components/SideNav.css

+6-1
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,13 @@
4949
color: #f8f8f8;
5050
}
5151

52+
.smart-hub--tag-needs-action {
53+
background-color: #f9e0e4;
54+
color: #d42240;
55+
}
56+
5257
.smart-hub--tag {
53-
width: 84px;
58+
width: 94px;
5459
text-align: center;
5560
font-weight: normal;
5661
display: inline-block;

frontend/src/components/Navigator/components/SideNav.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import moment from 'moment';
1313
import Container from '../../Container';
1414
import './SideNav.css';
1515
import {
16-
NOT_STARTED, IN_PROGRESS, COMPLETE, SUBMITTED,
16+
NOT_STARTED, IN_PROGRESS, COMPLETE, SUBMITTED, APPROVED, NEEDS_ACTION,
1717
} from '../constants';
1818

1919
const tagClass = (state) => {
@@ -26,6 +26,10 @@ const tagClass = (state) => {
2626
return 'smart-hub--tag-complete';
2727
case SUBMITTED:
2828
return 'smart-hub--tag-submitted';
29+
case APPROVED:
30+
return 'smart-hub--tag-submitted';
31+
case NEEDS_ACTION:
32+
return 'smart-hub--tag-needs-action';
2933
default:
3034
return '';
3135
}
@@ -46,7 +50,7 @@ function SideNav({
4650
>
4751
<span className="margin-left-2">{page.label}</span>
4852
<span className="margin-left-auto margin-right-2">
49-
{page.state
53+
{page.state !== 'draft'
5054
&& (
5155
<Tag className={`smart-hub--tag ${tagClass(page.state)}`}>
5256
{page.state}

frontend/src/components/Navigator/constants.js

+2
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ export const NOT_STARTED = 'Not started';
22
export const IN_PROGRESS = 'In progress';
33
export const COMPLETE = 'Complete';
44
export const SUBMITTED = 'Submitted';
5+
export const APPROVED = 'Approved';
6+
export const NEEDS_ACTION = 'Needs Action';

0 commit comments

Comments
 (0)