@@ -51,29 +51,41 @@ def go_to_bureau_page(self) -> None:
5151 """Clicks the 'Bureau' link."""
5252 self .click (self .bureau_page )
5353
54- class OrganisationNotSelectedError (Exception ):
55- """Raised when no organisation is selected on the organisation switch page."""
56- pass
57-
5854class OrganisationSwitchPage :
59- """Organisation Switch Page locators and reusable interactions """
55+ """Page Object Model for interacting with the Organisation Switch page. """
6056
6157 SELECT_ORG_LINK_TEXT = "Select Org"
6258
6359 def __init__ (self , page : Page ):
64- self .page = page
60+ """
61+ Initializes the OrganisationSwitchPage with locators for key elements.
6562
66- # Locators initialized using Playwright's locator API
63+ Args:
64+ page (Page): The Playwright Page object representing the browser page.
65+ """
66+ self .page = page
6767 self .radio_buttons = self .page .locator ("input[type='radio']" )
6868 self .selected_radio = self .page .locator ("input[name='organisation']:checked" )
6969 self .continue_button = self .page .get_by_role ("button" , name = "Continue" )
7070 self .select_org_link = self .page .get_by_role ("link" , name = self .SELECT_ORG_LINK_TEXT )
7171 self .login_info = self .page .locator ("td.loginInfo" )
7272
7373 def click (self , locator ) -> None :
74+ """
75+ Clicks the given locator element.
76+
77+ Args:
78+ locator: A Playwright Locator object to be clicked.
79+ """
7480 locator .click ()
7581
7682 def get_available_organisation_ids (self ) -> List [str ]:
83+ """
84+ Retrieves the list of available organisation IDs from the radio buttons on the page.
85+
86+ Returns:
87+ List[str]: A list of organisation ID strings.
88+ """
7789 org_ids = []
7890 count = self .radio_buttons .count ()
7991 for element in range (count ):
@@ -83,15 +95,33 @@ def get_available_organisation_ids(self) -> List[str]:
8395 return org_ids
8496
8597 def select_organisation_by_id (self , org_id : str ) -> None :
98+ """
99+ Selects an organisation radio button by its ID.
100+
101+ Args:
102+ org_id (str): The ID of the organisation to select.
103+ """
86104 self .click (self .page .locator (f"#{ org_id } " ))
87105
88106 def click_continue (self ) -> None :
107+ """
108+ Clicks the 'Continue' button on the page.
109+ """
89110 self .click (self .continue_button )
90111
91112 def click_select_org_link (self ) -> None :
113+ """
114+ Clicks the 'Select Org' link to return to the organisation selection page.
115+ """
92116 self .click (self .select_org_link )
93117
94118 def get_logged_in_text (self ) -> str :
119+ """
120+ Retrieves the logged-in user information from the login info section.
121+
122+ Returns:
123+ str: The text indicating the logged-in user's role or name.
124+ """
95125 return self .login_info .inner_text ()
96126
97127
0 commit comments