Skip to content

Commit 723ace1

Browse files
committed
Move the login without access step to common steps
1 parent 6c8f524 commit 723ace1

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

features/cpts_ui/select_your_role.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Feature: Role selection page renders roles properly when logged in
3838
Then I can see the roles with access cards
3939

4040
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4651
41-
Scenario: User can navigate to the your_selected_role page
41+
Scenario: User can navigate to the your selected role page
4242
Given I am logged in
4343
Then I am on the select your role page
4444
Then I can navigate to the your selected role page by clicking a card

features/steps/cpts_ui/common_steps.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# pylint: disable=no-name-in-module
22
from behave import given, then # pyright: ignore [reportAttributeAccessIssue]
33

4-
from features.environment import MOCK_CIS2_LOGIN_ID_MULTIPLE_ACCESS_ROLES
4+
from features.environment import (
5+
MOCK_CIS2_LOGIN_ID_MULTIPLE_ACCESS_ROLES,
6+
MOCK_CIS2_LOGIN_ID_NO_ACCESS_ROLE,
7+
)
58

69

710
@then("I am logged out")
@@ -44,6 +47,15 @@ def login(context):
4447
context.page.wait_for_url("**/selectyourrole.html")
4548

4649

50+
@given("I am logged in without access")
51+
def login_without_access(context):
52+
context.page.goto(context.cpts_ui_base_url + "site/auth_demo.html")
53+
context.page.get_by_role("button", name="Log in with mock CIS2").click()
54+
context.page.get_by_label("Username").fill(MOCK_CIS2_LOGIN_ID_NO_ACCESS_ROLE)
55+
context.page.get_by_role("button", name="Sign In").click()
56+
context.page.wait_for_url("**/selectyourrole.html")
57+
58+
4759
@then("I am on the login page")
4860
def i_am_on_login_page(context):
4961
# TODO: This needs to cover the .html for the broken SPA. Will need to be removed.

features/steps/cpts_ui/select_your_role_steps.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from playwright.sync_api import expect
44

55
from pages.select_your_role import SelectYourRole
6-
from features.environment import MOCK_CIS2_LOGIN_ID_NO_ACCESS_ROLE
76

87

98
@when("I go to the select your role page")
@@ -19,15 +18,6 @@ def i_am_on_select_your_role_page(context):
1918
expect(select_your_role_page.summary).to_be_visible()
2019

2120

22-
@given("I am logged in without access")
23-
def login_without_access(context):
24-
context.page.goto(context.cpts_ui_base_url + "site/auth_demo.html")
25-
context.page.get_by_role("button", name="Log in with mock CIS2").click()
26-
context.page.get_by_label("Username").fill(MOCK_CIS2_LOGIN_ID_NO_ACCESS_ROLE)
27-
context.page.get_by_role("button", name="Sign In").click()
28-
context.page.wait_for_url("**/selectyourrole.html")
29-
30-
3121
@then("I am on the select your role page")
3222
def verify_on_select_your_role_page(context):
3323
select_your_role_page = SelectYourRole(context.page)

0 commit comments

Comments
 (0)