Skip to content

Commit 8fbce99

Browse files
committed
Add regression tests for confirm role page
1 parent 800b280 commit 8fbce99

File tree

5 files changed

+112
-3
lines changed

5 files changed

+112
-3
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
@cpts_ui @confirm_role @regression @blocker @smoke @ui
2+
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4537
3+
Feature: When the user selects a role, they see a confirmation page
4+
5+
Background:
6+
Given I am logged in
7+
8+
Scenario:
9+
Given I go to the select your role page
10+
And I have a selected role
11+
Then I see the 'confirm your role' page
12+
13+
Scenario:
14+
Given I am on the change your role page
15+
When I click a change role role card
16+
Then I see the 'confirm your role' page
17+
18+
Scenario:
19+
Given I am on the confirm your role page
20+
When I click the change link next to the role text
21+
Then I am on the change role page
22+
23+
Scenario:
24+
Given I am on the confirm your role page
25+
When I click the change link next to the org text
26+
Then I am on the change role page
27+
28+
Scenario:
29+
Given I am on the confirm your role page
30+
When I click the confirm and continue button on the confirm role page
31+
Then I am on the search for a prescription page

features/steps/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
from cpts_ui.change_role_steps import * # noqa: F403,F401
66
from cpts_ui.logout_steps import * # noqa: F403,F401
77
from cpts_ui.header_steps import * # noqa: F403,F401
8+
from cpts_ui.confirm_role_steps import * # noqa: F403,F401

features/steps/cpts_ui/change_role_steps.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
@given("I am on the change your role page")
2020
def given_i_am_on_the_change_role_page(context):
2121
context.execute_steps("when I go to change my role")
22-
change_role_page = ChangeRole(context.page)
23-
24-
expect(change_role_page.change_role_title).to_be_visible(timeout=60000)
22+
context.execute_steps("then I am on the change role page")
2523

2624

2725
@given("the summary table body is displayed")
@@ -85,6 +83,12 @@ def i_go_to_change_my_role(context):
8583
############################################################################
8684

8785

86+
@then("I am on the change role page")
87+
def i_am_on_the_change_role_page(context):
88+
change_role_page = ChangeRole(context.page)
89+
expect(change_role_page.change_role_title).to_be_visible(timeout=60000)
90+
91+
8892
@then("I see the change role roles without access table")
8993
def then_i_see_the_roles_without_access_table(context):
9094
change_role_page = ChangeRole(context.page)
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# pylint: disable=no-name-in-module
2+
from behave import given, when, then # pyright: ignore [reportAttributeAccessIssue]
3+
from playwright.sync_api import expect
4+
5+
from pages.confirm_role import ConfirmRole
6+
7+
8+
############################################################################
9+
# GIVEN STEPS
10+
############################################################################
11+
12+
13+
@given("I am on the confirm your role page")
14+
def i_am_on_the_confirm_your_role_page(context):
15+
context.execute_steps("given I go to the select your role page")
16+
context.execute_steps("given I have a selected role")
17+
context.execute_steps("then I see the 'confirm your role' page")
18+
19+
20+
############################################################################
21+
# WHEN STEPS
22+
############################################################################
23+
24+
25+
@when("I click the change link next to the role text")
26+
def i_click_the_change_link_next_to_the_role_text(context):
27+
confirm_role_page = ConfirmRole(context.page)
28+
confirm_role_page.role_change_role.click()
29+
30+
31+
@when("I click the change link next to the org text")
32+
def i_click_the_change_link_next_to_the_org_text(context):
33+
confirm_role_page = ConfirmRole(context.page)
34+
confirm_role_page.org_change_role.click()
35+
36+
37+
@when("I click the confirm and continue button on the confirm role page")
38+
def i_click_the_confirm_and_continue_button_on_the_confirm_role_page(context):
39+
confirm_role_page = ConfirmRole(context.page)
40+
confirm_role_page.confirm_button.click()
41+
42+
43+
############################################################################
44+
# THEN STEPS
45+
############################################################################
46+
47+
48+
@then("I see the 'confirm your role' page")
49+
def i_see_the_confirm_your_role_page(context):
50+
confirm_role_page = ConfirmRole(context.page)
51+
52+
expect(confirm_role_page.header).to_be_visible()
53+
expect(confirm_role_page.role_label_cell).to_be_visible()
54+
expect(confirm_role_page.org_label_cell).to_be_visible()
55+
expect(confirm_role_page.org_text_cell).to_be_visible()
56+
expect(confirm_role_page.role_text_cell).to_be_visible()
57+
expect(confirm_role_page.role_change_role).to_be_visible()
58+
expect(confirm_role_page.org_change_role).to_be_visible()

pages/confirm_role.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from playwright.sync_api import Page
2+
3+
4+
class ConfirmRole:
5+
def __init__(self, page: Page):
6+
self.page = page
7+
8+
self.header = page.get_by_test_id("eps_header_yourSelectedRole")
9+
self.role_label_cell = page.get_by_test_id("role-label")
10+
self.org_label_cell = page.get_by_test_id("org-label")
11+
self.org_text_cell = page.get_by_test_id("org-text")
12+
self.role_text_cell = page.get_by_test_id("role-text")
13+
self.role_change_role = page.get_by_test_id("role-change-role-cell")
14+
self.org_change_role = page.get_by_test_id("org-change-role-cell")
15+
self.confirm_button = page.get_by_test_id("confirm-and-continue")

0 commit comments

Comments
 (0)