generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_send.py
47 lines (43 loc) · 1.59 KB
/
test_send.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from playwright.sync_api import Page, expect
import pytest
child_in_care_heading = "Find problems covered by legal aid"
legaild_aid_available_heading = "Legal aid is available for this type of problem"
ROUTING = [
{
"link_text": "Help with a child or young person's SEND",
"next_page_heading": child_in_care_heading,
},
{
"link_text": "SEND tribunals",
"next_page_heading": child_in_care_heading,
},
{
"link_text": "Child treated unfairly at school, discrimination",
"next_page_heading": legaild_aid_available_heading,
},
{
"link_text": "Other problems with schools",
"next_page_heading": legaild_aid_available_heading,
},
{
"link_text": "Care needs for disability (social care)",
"next_page_heading": child_in_care_heading,
},
{"link_text": "Next steps to get help", "next_page_heading": "Referral page"},
]
@pytest.mark.usefixtures("live_server")
class TestSendLandingPage:
@pytest.mark.parametrize("routing", ROUTING)
def test_onward_routing(self, page: Page, routing: dict):
page.get_by_role(
"link", name="Special educational needs and disability (SEND)"
).click()
page.get_by_role("link", name=routing["link_text"]).click()
next_page_heading = routing["next_page_heading"]
next_page_heading = (
next_page_heading
if isinstance(next_page_heading, list)
else [next_page_heading]
)
for page_heading in next_page_heading:
expect(page.get_by_text(page_heading)).to_be_visible()