-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New: [AEA-4653] - [AEA-4651] - Combined PR for Select your Role page …
…features (#203) ## Summary - ✨ New Feature ### Details This is a single PR for the `Roles with access` and `Roles without access` features, since there is some degree of code overlap. Old PR for Roles With Access: #199 That will be closed, and only this PR will need review. --------- Signed-off-by: Jim Wild <[email protected]> Co-authored-by: Kris Szlapa <[email protected]> Co-authored-by: MatthewPopat-NHS <[email protected]> Co-authored-by: Anthony Brown <[email protected]>
- Loading branch information
1 parent
6a48e60
commit 591fc98
Showing
12 changed files
with
248 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
env | ||
env_* | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
./__pycache__/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
@cpts_ui @select_your_role @regression @blocker @smoke @ui | ||
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4653 | ||
Feature: Role selection page renders roles properly when logged in | ||
|
||
Background: | ||
Given I am logged in | ||
And I am on the select_your_role page | ||
|
||
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4653 | ||
Scenario: User can navigate to the select_your_role page | ||
Then I am on the select_your_role page | ||
|
||
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4653 | ||
Scenario: User can see the summary container, but not the table contents by default | ||
Then I can see the summary container | ||
And I cannot see the summary table body | ||
|
||
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4653 | ||
Scenario: User can expand the summary table to see the contents. Clicking again hides it | ||
When I click on the summary expander | ||
Then I can see the summary table body | ||
And I can see the table body has a header row | ||
And I can see the table body has data | ||
When I click on the summary expander | ||
Then I can see the summary container | ||
And I cannot see the summary table body | ||
|
||
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4651 | ||
Scenario: User can see roles with access cards | ||
Then I can see the roles with access cards | ||
|
||
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4651 | ||
Scenario: User can navigate to the your_selected_role page | ||
Then I can navigate to the your_selected_role page by clicking a card |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from cpts_ui.search_for_a_prescription_steps import * # noqa: F403,F401 | ||
from cpts_ui.home_steps import * # noqa: F403,F401 | ||
from cpts_ui.select_your_role_steps import * # noqa: F403,F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# pylint: disable=no-name-in-module | ||
from behave import given, when, then # pyright: ignore [reportAttributeAccessIssue] | ||
from playwright.sync_api import expect | ||
|
||
from pages.select_your_role import SelectYourRole | ||
|
||
|
||
@when("I go to the select_your_role page") | ||
def i_go_to_the_select_your_role_page(context): | ||
context.page.goto(context.cpts_ui_base_url + "site/selectyourrole.html") | ||
|
||
|
||
@given("I am on the select_your_role page") | ||
def i_am_on_select_your_role_page(context): | ||
i_go_to_the_select_your_role_page(context) | ||
select_your_role_page = SelectYourRole(context.page) | ||
expect(select_your_role_page.summary).to_be_visible() | ||
|
||
|
||
@then("I am on the select_your_role page") | ||
def verify_on_select_your_role_page(context): | ||
select_your_role_page = SelectYourRole(context.page) | ||
expect(select_your_role_page.summary).to_be_visible() | ||
|
||
|
||
@given("I am logged in") | ||
def login(context): | ||
context.page.goto(context.cpts_ui_base_url + "site/auth_demo.html") | ||
context.page.get_by_role("button", name="Log in with mock CIS2").click() | ||
context.page.get_by_label("Username").fill("555073103100") | ||
context.page.get_by_role("button", name="Sign In").click() | ||
context.page.wait_for_url("**/auth_demo.html") | ||
|
||
|
||
@then("I can see the summary container") | ||
def i_can_see_the_summary_container(context): | ||
select_your_role_page = SelectYourRole(context.page) | ||
expect(select_your_role_page.summary).to_be_visible() | ||
|
||
|
||
@then("I cannot see the summary table body") | ||
def i_cannot_see_the_summary_table_body(context): | ||
select_your_role_page = SelectYourRole(context.page) | ||
expect(select_your_role_page.roles_without_access_table_body).to_be_visible( | ||
visible=False | ||
) | ||
|
||
|
||
@then("I can see the summary table body") | ||
def i_can_see_the_summary_table_body(context): | ||
select_your_role_page = SelectYourRole(context.page) | ||
expect(select_your_role_page.roles_without_access_table_body).to_be_visible() | ||
|
||
|
||
@then("I can see the table body has a header row") | ||
def i_can_see_the_table_body_header(context): | ||
select_your_role_page = SelectYourRole(context.page) | ||
expect(select_your_role_page.organisation_column_header).to_be_visible() | ||
expect(select_your_role_page.role_column_header).to_be_visible() | ||
|
||
|
||
@then("I can see the table body has data") | ||
def i_can_see_the_table_body_data(context): | ||
select_your_role_page = SelectYourRole(context.page) | ||
expect(select_your_role_page.first_row_org_name).to_be_visible() | ||
expect(select_your_role_page.first_row_role_name).to_be_visible() | ||
|
||
|
||
@when("I click on the summary expander") | ||
def click_on_summary_expander(context): | ||
select_your_role_page = SelectYourRole(context.page) | ||
select_your_role_page.summary.click() | ||
|
||
|
||
@then("I can see the roles with access cards") | ||
def i_can_see_the_roles_with_access_cards(context): | ||
select_your_role_page = SelectYourRole(context.page) | ||
try: | ||
expect(select_your_role_page.first_role_card).to_be_visible(timeout=5000) | ||
print("Verified that at least one role card is displayed.") | ||
except Exception as e: | ||
print("Error verifying roles with access cards:", str(e)) | ||
print("Page content during error:") | ||
print(context.page.content()) | ||
raise | ||
|
||
|
||
@then("I can navigate to the your_selected_role page by clicking a card") | ||
def i_can_navigate_to_the_your_selected_role_page(context): | ||
select_your_role_page = SelectYourRole(context.page) | ||
try: | ||
expect(select_your_role_page.first_role_card).to_be_visible(timeout=5000) | ||
select_your_role_page.first_role_card.click() | ||
context.page.wait_for_url(select_your_role_page.selected_role_url) | ||
print( | ||
"Navigation to your_selected_role page successful. Current URL:", | ||
context.page.url, | ||
) | ||
except Exception as e: | ||
print("Error navigating to your_selected_role page:", str(e)) | ||
print("Page content during error:") | ||
print(context.page.content()) | ||
raise |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
"semantic-release": "^24.2.0" | ||
}, | ||
"dependencies": { | ||
"@playwright/test": "^1.49.1", | ||
"npm": "^10.9.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from playwright.sync_api import Page | ||
|
||
|
||
class SelectYourRole: | ||
def __init__(self, page: Page): | ||
self.page = page | ||
|
||
self.slr_title = "Select your role" | ||
self.summary = page.locator("summary") | ||
self.organisation_column_header = page.get_by_role( | ||
"columnheader", name="Organisation" | ||
) | ||
self.role_column_header = page.get_by_role("columnheader", name="Role") | ||
self.roles_without_access_table_body = page.get_by_role("group").locator("div") | ||
self.first_row_org_name = page.get_by_role( | ||
"cell", name="No Org Name (ODS: X09)" | ||
).first | ||
self.first_row_role_name = page.get_by_role( | ||
"cell", name="Registration Authority Agent" | ||
).first | ||
|
||
self.roles_with_access_cards = page.locator(".nhsuk-card--clickable") | ||
self.first_role_card = self.roles_with_access_cards.first | ||
self.role_card_headings = page.locator(".nhsuk-card__heading") | ||
self.role_card_descriptions = page.locator(".eps-card__roleName") | ||
self.selected_role_url = "**/site/yourselectedrole" | ||
|
||
self.header = "[id='eps_header']" | ||
self.footer = "[id='eps_footer']" |