From d395d614b990269d6564a1037180029ede05b157 Mon Sep 17 00:00:00 2001 From: Ben Thorner Date: Tue, 11 May 2021 17:53:36 +0100 Subject: [PATCH 1/3] Use ID for row to avoid guessing position This makes it easier to add / test other rows in future. --- app/templates/views/user-profile.html | 2 +- tests/app/main/views/test_user_profile.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/templates/views/user-profile.html b/app/templates/views/user-profile.html index a39853c32..edc0b7315 100644 --- a/app/templates/views/user-profile.html +++ b/app/templates/views/user-profile.html @@ -46,7 +46,7 @@ {% endcall %} {% if current_user.platform_admin or session.get('disable_platform_admin_view') %} - {% call row() %} + {% call row(id='disable-platform-admin') %} {{ text_field('Use platform admin view') }} {{ text_field('Yes' if not session.get('disable_platform_admin_view') else 'No') }} {{ edit_field('Change', url_for('.user_profile_disable_platform_admin_view')) }} diff --git a/tests/app/main/views/test_user_profile.py b/tests/app/main/views/test_user_profile.py index ba1b862ea..b1539a2d9 100644 --- a/tests/app/main/views/test_user_profile.py +++ b/tests/app/main/views/test_user_profile.py @@ -23,7 +23,7 @@ def test_overview_page_shows_disable_for_platform_admin( client_request.login(platform_admin_user) page = client_request.get(('main.user_profile')) assert page.select_one('h1').text.strip() == 'Your profile' - disable_platform_admin_row = page.select('tr')[-1] + disable_platform_admin_row = page.select_one('#disable-platform-admin') assert ' '.join(disable_platform_admin_row.text.split()) == 'Use platform admin view Yes Change' From d15143606e1dfd8e4651865d14e50d75db828734 Mon Sep 17 00:00:00 2001 From: Ben Thorner Date: Tue, 11 May 2021 18:20:40 +0100 Subject: [PATCH 2/3] Rewrite and expand docs on auto-JS scripts This adds a note about automatically re-running JavaScript tests. I've moved and rewritten the old content about re-building JS code to match the new style. --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 90b9e7ae2..c59d3d2de 100644 --- a/README.md +++ b/README.md @@ -55,29 +55,29 @@ make run-flask Then visit [localhost:6012](http://localhost:6012). +Any Python code changes you make should be picked up automatically in development. If you're developing JavaScript code, run `npm run watch` to achieve the same. + ## To test the application ``` # install dependencies, etc. make bootstrap +# run all the tests make test + +# continuously run js tests +npm run test-watch ``` +To run a specific JavaScript test, you'll need to copy the full command from `package.json`. + ## Common tasks ### Updating application dependencies `requirements.txt` is generated from the `requirements.in` in order to pin versions of all nested dependencies. If `requirements.in` has been changed, run `make freeze-requirements` to regenerate it. -### Automatically rebuild the frontend assets - -If you want the front end assets to re-compile on changes, leave this running in a separate terminal from the app - -```shell - npm run watch -``` - ## Further docs - [Working with static assets](docs/static-assets.md) From 9f9751adbf56bf9475f773fc1ec1758f0fc68c7b Mon Sep 17 00:00:00 2001 From: Ben Thorner Date: Tue, 11 May 2021 18:22:11 +0100 Subject: [PATCH 3/3] Tweak layout for dependencies section This matches what we have in other repos [1][2]. [1]: https://github.com/alphagov/notifications-antivirus#to-update-application-dependencies [2]: https://github.com/alphagov/notifications-api#to-update-application-dependencies --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index c59d3d2de..340752ca7 100644 --- a/README.md +++ b/README.md @@ -72,9 +72,7 @@ npm run test-watch To run a specific JavaScript test, you'll need to copy the full command from `package.json`. -## Common tasks - -### Updating application dependencies +## To update application dependencies `requirements.txt` is generated from the `requirements.in` in order to pin versions of all nested dependencies. If `requirements.in` has been changed, run `make freeze-requirements` to regenerate it.