Skip to content

Commit 9703a8d

Browse files
authored
Merge branch 'master' into adopt-semver
2 parents 51387f8 + 0956acf commit 9703a8d

File tree

2 files changed

+90
-10
lines changed

2 files changed

+90
-10
lines changed

README.md

Lines changed: 87 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -192,49 +192,70 @@ The functional tests use a set of selectors that are generated from each of the
192192

193193
To run the functional tests first runner needs to be spin up with:
194194

195-
`RUNNER_ENV_FILE=.functional-tests.env make run`
195+
``` shell
196+
RUNNER_ENV_FILE=.functional-tests.env make run
197+
```
196198

197199
This will set the correct environment variables for running the functional tests.
198200

199201
Then you can run:
200202

201-
`make test-functional`
203+
``` shell
204+
make test-functional
205+
```
202206

203207
This will delete the `tests/functional/generated_pages` directory and regenerate all the files in it from the schemas.
204208

205209
You can also individually run the `generate_pages` and `test_functional` yarn scripts:
206210

207-
`yarn generate_pages; yarn test_functional`
211+
``` shell
212+
yarn generate_pages
213+
yarn test_functional
214+
```
215+
208216

209217
To generate the pages manually you can run the `generate_pages` scripts with the schema directory. Run it from the `tests/functional` directory as follows:
210218

211-
`./generate_pages.py ../../schemas/test/en/ ./generated_pages -r "../../base_pages"`
219+
``` shell
220+
./generate_pages.py ../../schemas/test/en/ ./generated_pages -r "../../base_pages"
221+
```
212222

213223
To generate a spec file with the imports included, you can use the `generate_pages.py` script on a single schema with the `-s` argument.
214224

215-
`./generate_pages.py ../../schemas/test/en/test_multiple_piping.json ./temp_directory -r "../../base_pages" -s spec/test_multiple_piping.spec.js`
225+
``` shell
226+
./generate_pages.py ../../schemas/test/en/test_multiple_piping.json ./temp_directory -r "../../base_pages" -s spec/test_multiple_piping.spec.js
227+
```
216228

217229
If you have already built the generated pages, then the functional tests can be executed with:
218230

219-
`yarn test_functional`
231+
``` shell
232+
yarn test_functional
233+
```
220234

221235
This can be limited to a single spec using:
222236

223-
`yarn test_functional --spec save_sign_out.spec.js`
237+
``` shell
238+
yarn test_functional --spec save_sign_out.spec.js
239+
```
224240

225241
To run a single test, add `.only` into the name of any `describe` or `it` function:
226242

227243
`describe.only('Skip Conditions', function() {...}` or
244+
228245
`it.only('Given this is a test', function() {...}`
229246

230247
Test suites are configured in the `wdio.conf.js` file.
231248
An individual test suite can be run using:
232249

233-
`yarn test_functional --suite <suite>`
250+
``` shell
251+
yarn test_functional --suite <suite>
252+
```
234253

235254
To run the tests against a remote deployment you will need to specify the environment variable of EQ_FUNCTIONAL_TEST_ENV eg:
236255

237-
`EQ_FUNCTIONAL_TEST_ENV=https://staging-new-surveys.dev.eq.ons.digital/ yarn test_functional`
256+
``` shell
257+
EQ_FUNCTIONAL_TEST_ENV=https://staging-new-surveys.dev.eq.ons.digital/ yarn test_functional
258+
```
238259

239260
---
240261

@@ -410,8 +431,65 @@ python token_generator.py
410431

411432
Refer to our [profiling document](doc/profiling.md).
412433

434+
---
435+
413436
## Updating / Installing dependencies
414437

438+
### Python
415439
To add a new dependency, use `pipenv install [package-name]`, which not only installs the package but Pipenv will also go to the trouble of updating the Pipfile as well.
416440

417441
NB: both the Pipfile and Pipfile.lock files are required in source control to accurately pin dependencies.
442+
443+
### JavaScript
444+
To add a new dependency, use `yarn add [package-name]` and `yarn` to install all the packages locally.
445+
446+
---
447+
448+
## Testing Design System changes (locally) without pushing to actual CDN
449+
450+
### On [Design System](https://github.com/ONSdigital/design-system) Repo
451+
Checkout branch with new changes on
452+
453+
You will need to install the Design System dependencies to do this so run `yarn` in the terminal if you haven't
454+
You will also need to install gulp
455+
456+
Then in the terminal run:
457+
458+
``` shell
459+
yarn cdn-bundle
460+
cd build
461+
browser-sync start --cwd -s --http --port 5678
462+
```
463+
464+
You should now see output indicating that files are being served from `localhost:5678`. So main.css for example will now be served on `http://localhost:5678//css/main.css`
465+
466+
Now switch to the eQ Questionnaire Runner Repo
467+
468+
### On eQ Questionnaire Runner Repo
469+
In a separate terminal window/tab:
470+
Checkout the runner branch you want to test on
471+
472+
Edit your .development.env with following:
473+
474+
``` shell
475+
CDN_URL=http://localhost:5678
476+
CDN_ASSETS_PATH=
477+
```
478+
479+
Edit the Makefile to remove `load-design-system-templates` from the build command. Should now look like this:
480+
481+
``` shell
482+
build: load-schemas translate
483+
```
484+
485+
Run `make load-design-system-templates` in the terminal to make sure you have the Design System templates loaded
486+
487+
Then edit the first line in the `templates/layout/_template.njk` file to remove the version number. Should now look like this:
488+
489+
``` shell
490+
{% set release_version = "" %}
491+
```
492+
493+
Then spin up launcher and runner with `make dev-compose-up` and `make run`
494+
495+
Now when navigating to localhost:8000 and launching a schema, this will now be using the local cdn with the changes from the Design System branch

app/views/contexts/thank_you_context.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ def build_view_submitted_response_context(schema, submitted_at):
5454
expired = has_view_submitted_response_expired(submitted_at)
5555
view_submitted_response.update(
5656
expired=expired,
57-
expires_at=get_view_submitted_response_expiration_time(submitted_at),
57+
expires_at=get_view_submitted_response_expiration_time(
58+
submitted_at
59+
).isoformat(),
5860
)
5961
if not expired:
6062
view_submitted_response["url"] = url_for(

0 commit comments

Comments
 (0)