Skip to content

Commit 6d9ee60

Browse files
authored
Merge pull request #49 from NHSDigital/8998-testing-improvements
8998 Testing improvements
2 parents 1abbd51 + e89ef03 commit 6d9ee60

4 files changed

Lines changed: 9 additions & 6 deletions

File tree

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
include scripts/shared.mk
42

53
clean:: _clean-docker # Clean-up project resources (main) @Operations
@@ -19,6 +17,7 @@ dependencies: # Install dependencies needed to build and test the project @Pipel
1917

2018
assets: # Compile assets @Pipeline
2119
npm run compile
20+
poetry run playwright install
2221

2322
build: # Build the project artefact @Pipeline
2423
docker build -t "app:$$(git rev-parse HEAD)" .

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ To run all the tests:
4242
make test
4343
```
4444

45+
Running `make config` beforehand will ensure you have necessary dependencies installed, including the browser needed by playwright for system tests.
46+
4547
### Dependency management
4648
Python dependencies are managed via [poetry](https://python-poetry.org/docs/basic-usage/).
4749

manage_breast_screening/config/system_test_setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
22
import os
3-
from playwright.sync_api import sync_playwright, expect
3+
from playwright.sync_api import sync_playwright
44

55
class SystemTestCase(StaticLiveServerTestCase):
66
@classmethod
@@ -18,6 +18,7 @@ def tearDownClass(cls):
1818

1919
def setUp(self):
2020
self.page = self.browser.new_page()
21+
self.page.set_default_timeout(5000)
2122

2223
def tearDown(self):
2324
self.page.close()

manage_breast_screening/record_a_mammogram/tests/system/test_user_submits_cannot_go_ahead_form.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import re
2+
import pytest
23
from django.urls import reverse
34
from playwright.sync_api import expect
45

@@ -7,9 +8,9 @@
78
from manage_breast_screening.participants.tests.factories import ParticipantFactory
89
from manage_breast_screening.clinics.models import Appointment
910

10-
class UserSubmitsCannotGoAheadForm(SystemTestCase):
11-
def setUp(self):
12-
super().setUp()
11+
class TestUserSubmitsCannotGoAheadForm(SystemTestCase):
12+
@pytest.fixture(autouse=True)
13+
def before(self):
1314
self.participant = ParticipantFactory()
1415
self.screening_episode = ScreeningEpisodeFactory(participant=self.participant)
1516
self.appointment = AppointmentFactory(screening_episode=self.screening_episode)

0 commit comments

Comments
 (0)