Skip to content

Commit 284a1f7

Browse files
committed
Add a system test for the happy path of recording a mammogram
This can be fleshed out as we implement the remaining pages.
1 parent e914f16 commit 284a1f7

1 file changed

Lines changed: 80 additions & 0 deletions

File tree

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import re
2+
3+
import pytest
4+
from django.urls import reverse
5+
from playwright.sync_api import expect
6+
7+
from manage_breast_screening.clinics.tests.factories import (
8+
AppointmentFactory,
9+
ScreeningEpisodeFactory,
10+
)
11+
from manage_breast_screening.config.system_test_setup import SystemTestCase
12+
from manage_breast_screening.participants.tests.factories import ParticipantFactory
13+
14+
15+
class TestRecordingAMammogram(SystemTestCase):
16+
@pytest.fixture(autouse=True)
17+
def before(self):
18+
self.participant = ParticipantFactory(first_name="Janet", last_name="Williams")
19+
self.screening_episode = ScreeningEpisodeFactory(participant=self.participant)
20+
self.appointment = AppointmentFactory(screening_episode=self.screening_episode)
21+
22+
def test_recording_a_mammogram_without_capturing_medical_information(self):
23+
self.given_i_am_on_the_start_screening_page()
24+
self.then_i_should_see_the_demographic_banner()
25+
self.and_i_should_see_the_participant_details()
26+
27+
self.when_i_check_the_participants_identity_and_confirm_the_last_mammogram_date()
28+
self.then_i_should_be_on_the_medical_information_page()
29+
self.and_i_should_be_prompted_to_ask_about_relevant_medical_information()
30+
31+
self.when_the_participant_shares_no_relevant_medical_information()
32+
self.then_the_screen_should_show_that_it_is_awaiting_images_from_the_PACS()
33+
34+
def given_i_am_on_the_start_screening_page(self):
35+
self.page.goto(
36+
self.live_server_url
37+
+ reverse(
38+
"record_a_mammogram:start_screening",
39+
kwargs={"id": self.appointment.pk},
40+
)
41+
)
42+
43+
def then_i_should_see_the_demographic_banner(self):
44+
expect(self.page.get_by_text("NHS Number")).to_be_visible()
45+
46+
def and_i_should_see_the_participant_details(self):
47+
expect(
48+
self.page.locator(".nhsuk-summary-list__row", has_text="Full name")
49+
).to_contain_text("Janet Williams")
50+
51+
def when_i_check_the_participants_identity_and_confirm_the_last_mammogram_date(
52+
self,
53+
):
54+
self.page.get_by_label("Yes, go to medical information").check()
55+
self.page.get_by_role("button", name="Continue").click()
56+
57+
def then_i_should_be_on_the_medical_information_page(self):
58+
path = reverse(
59+
"record_a_mammogram:ask_for_medical_information",
60+
kwargs={"id": self.appointment.pk},
61+
)
62+
expect(self.page).to_have_url(re.compile(path))
63+
64+
def and_i_should_be_prompted_to_ask_about_relevant_medical_information(self):
65+
expect(
66+
self.page.get_by_text(
67+
"Has the participant shared any relevant medical information?"
68+
)
69+
).to_be_visible()
70+
71+
def when_the_participant_shares_no_relevant_medical_information(self):
72+
self.page.get_by_label("No - proceed to imaging").check()
73+
self.page.get_by_role("button", name="Continue").click()
74+
75+
def then_the_screen_should_show_that_it_is_awaiting_images_from_the_PACS(self):
76+
path = reverse(
77+
"record_a_mammogram:awaiting_images",
78+
kwargs={"id": self.appointment.pk},
79+
)
80+
expect(self.page).to_have_url(re.compile(path))

0 commit comments

Comments
 (0)