Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@cpts_ui @change_role @single_access_multiple_without @regression @blocker @smoke @ui
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4974
Feature: Users are able to change their roles, if they have one role with access and multiple roles without access.

Background:
Given I am logged in with a single access role and multiple without access

############################################################################
# Successfully changing role scenarios
############################################################################
Scenario: User can change their role and see the correct message on the change role page
And I click a change role role card
When I click the change link next to the role text
Then I am on the change role page
And I can see the role that has been pre selected
And I cannot see the no access message
And I cannot see any change role roles with access cards

Scenario: User can see roles with access cards
Then I see the change role roles with access cards
And I can see one change role roles with access card

############################################################################
# Expanding/collapsing the summary
############################################################################
Scenario: Change role roles without access table body is not visible by default
Then the change role roles without access table body is not visible

Scenario: User can expand the change role 'Roles without access' to see table contents
When I click on the change role summary expander
Then I see the change role roles without access table

Scenario: User can collapse the change role 'Roles without access' to hide table contents
Given the summary table body is displayed
When I click on the change role summary expander
Then The change role roles without access table body is not visible
11 changes: 9 additions & 2 deletions features/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,18 @@
"dispenser": {"user_id": "555260695103", "role_id": "555265434108"},
}
LOGIN_USERS = {"user_id": "9449304130"}
# Roles with Access: multiple | Roles without Access: multiple | Selected Role: No
MOCK_CIS2_LOGIN_ID_MULTIPLE_ACCESS_ROLES = "555043308597"
MOCK_CIS2_LOGIN_ID_NO_ACCESS_ROLE = "555083343101"
# Roles with Access: multiple | Roles without Access: multiple | Selected Role: Yes
MOCK_CIS2_LOGIN_ID_MULTIPLE_ACCESS_ROLES_WITH_SELECTED_ROLE = "555043304334"
# Roles with Access: 1 | Roles without Access: 0 | Selected Role: No
MOCK_CIS2_LOGIN_ID_SINGLE_ACCESS_ROLE = "555043300081"
# Roles with Access: 1 | Roles without Access: multiple | Selected Role: No
MOCK_CIS2_LOGIN_ID_SINGLE_ROLE_WITH_ACCESS_MULTIPLE_WITHOUT = "555043303526"
# Roles with Access: 0 | Roles without Access: multiple | Selected Role: No
MOCK_CIS2_LOGIN_ID_NO_ACCESS_ROLE = "555083343101"
# Roles with Access: 0 | Roles without Access: 0 | Selected Role: No
MOCK_CIS2_LOGIN_ID_NO_ROLES = "555073103101"
MOCK_CIS2_LOGIN_ID_MULTIPLE_ACCESS_ROLES_WITH_SELECTED_ROLE = "555043304334"

REPOS = {
"CPTS-UI": "https://github.com/NHSDigital/eps-prescription-tracker-ui",
Expand Down
11 changes: 9 additions & 2 deletions features/steps/cpts_ui/change_role_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ def given_i_am_on_your_selected_role_page(context):
expect(change_role_page.select_role_header).to_be_visible()


@given("I click a change role role card")
def given_i_click_a_role_card(context):
change_role_page = ChangeRole(context.page)
expect(change_role_page.first_role_card).to_be_visible()
change_role_page.first_role_card.click()


############################################################################
# WHEN STEPS
############################################################################
Expand Down Expand Up @@ -111,8 +118,8 @@ def then_i_see_multiple_change_role_roles_with_access_cards(context):
assert change_role_page.roles_with_access_cards.count() > 1


@then("I can see one change role roles with access cards")
def then_i_see_one_change_role_roles_with_access_cards(context):
@then("I can see one change role roles with access card")
def then_i_see_one_change_role_roles_with_access_card(context):
change_role_page = ChangeRole(context.page)
assert change_role_page.roles_with_access_cards.count() == 1

Expand Down
16 changes: 14 additions & 2 deletions features/steps/cpts_ui/common_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

from features.environment import (
MOCK_CIS2_LOGIN_ID_MULTIPLE_ACCESS_ROLES,
MOCK_CIS2_LOGIN_ID_NO_ACCESS_ROLE,
MOCK_CIS2_LOGIN_ID_SINGLE_ACCESS_ROLE,
MOCK_CIS2_LOGIN_ID_MULTIPLE_ACCESS_ROLES_WITH_SELECTED_ROLE,
MOCK_CIS2_LOGIN_ID_SINGLE_ACCESS_ROLE,
MOCK_CIS2_LOGIN_ID_SINGLE_ROLE_WITH_ACCESS_MULTIPLE_WITHOUT,
MOCK_CIS2_LOGIN_ID_NO_ACCESS_ROLE,
)

from pages.select_your_role import SelectYourRole
Expand Down Expand Up @@ -66,6 +67,17 @@ def login_single_role(context):
context.page.get_by_role("button", name="Sign In").click()


@given("I am logged in with a single access role and multiple without access")
def login_single_role_with_access_multiple_without(context):
context.execute_steps("given I am on the login page")

context.page.get_by_role("button", name="Log in with mock CIS2").click()
context.page.get_by_label("Username").fill(
MOCK_CIS2_LOGIN_ID_SINGLE_ROLE_WITH_ACCESS_MULTIPLE_WITHOUT
)
context.page.get_by_role("button", name="Sign In").click()


@given("I am logged in as a user with a pre selected role")
def login_pre_role_selected(context):
context.execute_steps("given I am on the login page")
Expand Down
6 changes: 6 additions & 0 deletions features/steps/cpts_ui/select_your_role_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ def i_can_see_the_no_access_message(context):
expect(select_your_role_page.no_access_message).to_be_visible()


@then("I cannot see the no access message")
def i_can_not_see_the_no_access_message(context):
select_your_role_page = SelectYourRole(context.page)
expect(select_your_role_page.no_access_message).not_to_be_visible()


@then("I can see the no access table body has data")
def i_can_see_the_no_access_table_body_data(context):
select_your_role_page = SelectYourRole(context.page)
Expand Down