diff --git a/features/cpts_ui/change_role_one_with_access_multiple_witthout.feature b/features/cpts_ui/change_role_one_with_access_multiple_witthout.feature new file mode 100644 index 00000000..d5ee79a0 --- /dev/null +++ b/features/cpts_ui/change_role_one_with_access_multiple_witthout.feature @@ -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 diff --git a/features/environment.py b/features/environment.py index bfa42da9..715c0374 100644 --- a/features/environment.py +++ b/features/environment.py @@ -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", diff --git a/features/steps/cpts_ui/change_role_steps.py b/features/steps/cpts_ui/change_role_steps.py index a1b7d47b..0ebf41a0 100644 --- a/features/steps/cpts_ui/change_role_steps.py +++ b/features/steps/cpts_ui/change_role_steps.py @@ -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 ############################################################################ @@ -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 diff --git a/features/steps/cpts_ui/common_steps.py b/features/steps/cpts_ui/common_steps.py index a282f033..3c6ddbdc 100644 --- a/features/steps/cpts_ui/common_steps.py +++ b/features/steps/cpts_ui/common_steps.py @@ -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 @@ -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") diff --git a/features/steps/cpts_ui/select_your_role_steps.py b/features/steps/cpts_ui/select_your_role_steps.py index 93e9b06e..d6067ea6 100644 --- a/features/steps/cpts_ui/select_your_role_steps.py +++ b/features/steps/cpts_ui/select_your_role_steps.py @@ -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)