|
16 | 16 | DraftRegistrationReviewPage,
|
17 | 17 | RegistrationAddNewPage,
|
18 | 18 | RegistrationDetailPage,
|
| 19 | + RegistrationFileDetailPage, |
| 20 | + RegistrationFileListPage, |
19 | 21 | RegistriesDiscoverPage,
|
20 | 22 | RegistriesLandingPage,
|
21 | 23 | RegistriesModerationModeratorsPage,
|
@@ -155,6 +157,111 @@ def log_in_as_user_with_draft_registrations(driver):
|
155 | 157 | )
|
156 | 158 |
|
157 | 159 |
|
| 160 | +# User with registrations is not setup in production |
| 161 | +@markers.dont_run_on_prod |
| 162 | +class TestSubmittedRegistrationPages: |
| 163 | + @pytest.fixture() |
| 164 | + def my_registrations_page(self, driver, log_in_as_user_with_draft_registrations): |
| 165 | + """Fixture that logs in as a user that already has submitted registrations |
| 166 | + and navigates to the My Registrations page from which the desired registration |
| 167 | + can be selected. |
| 168 | + """ |
| 169 | + my_registrations_page = MyRegistrationsPage(driver) |
| 170 | + my_registrations_page.goto() |
| 171 | + # Wait for registration cards to load on page |
| 172 | + WebDriverWait(driver, 5).until( |
| 173 | + EC.presence_of_element_located((By.CSS_SELECTOR, '[data-test-node-card]')) |
| 174 | + ) |
| 175 | + registration_cards = my_registrations_page.registration_cards |
| 176 | + assert registration_cards |
| 177 | + return my_registrations_page |
| 178 | + |
| 179 | + @markers.ember_page |
| 180 | + def test_accessibility_files_list_page( |
| 181 | + self, driver, session, write_files, exclude_best_practice, my_registrations_page |
| 182 | + ): |
| 183 | + """This test is for checking the accessibility of the Registration File List |
| 184 | + Page of a submitted registration. First search through the registration cards |
| 185 | + on the Submitted tab of the My Registration Page for the registration that has |
| 186 | + files (searching by registration title). When you find the desired registration |
| 187 | + get the registration node id from its link and then use the node id to navigate |
| 188 | + to the Files List page for this registration. |
| 189 | + """ |
| 190 | + registration_node = my_registrations_page.get_node_id_by_title( |
| 191 | + 'Registration With Files for A11y Testing' |
| 192 | + ) |
| 193 | + registration_file_list_page = RegistrationFileListPage( |
| 194 | + driver, guid=registration_node |
| 195 | + ) |
| 196 | + registration_file_list_page.goto() |
| 197 | + assert RegistrationFileListPage(driver, verify=True) |
| 198 | + # Click the 'Archive of OSF Storage' button to expand the list of files |
| 199 | + registration_file_list_page.file_list_button.click() |
| 200 | + # Wait for file list items to load on page |
| 201 | + WebDriverWait(driver, 5).until( |
| 202 | + EC.presence_of_element_located( |
| 203 | + (By.CSS_SELECTOR, '[data-test-file-list-item]') |
| 204 | + ) |
| 205 | + ) |
| 206 | + a11y.run_axe( |
| 207 | + driver, |
| 208 | + session, |
| 209 | + 'regfilelist', |
| 210 | + write_files=write_files, |
| 211 | + exclude_best_practice=exclude_best_practice, |
| 212 | + ) |
| 213 | + |
| 214 | + @markers.ember_page |
| 215 | + def test_accessibility_file_detail_page( |
| 216 | + self, driver, session, write_files, exclude_best_practice, my_registrations_page |
| 217 | + ): |
| 218 | + """This test is for checking the accessibility of the Registration File Detail |
| 219 | + Page of a submitted registration. First search through the registration cards |
| 220 | + on the Submitted tab of the My Registration Page for the registration that has |
| 221 | + files (searching by registration title). When you find the desired registration |
| 222 | + get the registration node id from its link and then use the node id to navigate |
| 223 | + to the Files List page for this registration. Then click the first file link |
| 224 | + to open the File Detail page for that file. |
| 225 | + """ |
| 226 | + registration_node = my_registrations_page.get_node_id_by_title( |
| 227 | + 'Registration With Files for A11y Testing' |
| 228 | + ) |
| 229 | + registration_file_list_page = RegistrationFileListPage( |
| 230 | + driver, guid=registration_node |
| 231 | + ) |
| 232 | + registration_file_list_page.goto() |
| 233 | + assert RegistrationFileListPage(driver, verify=True) |
| 234 | + # Click the 'Archive of OSF Storage' button to expand the list of files |
| 235 | + registration_file_list_page.file_list_button.click() |
| 236 | + # Wait for file list items to load on page |
| 237 | + WebDriverWait(driver, 5).until( |
| 238 | + EC.presence_of_element_located( |
| 239 | + (By.CSS_SELECTOR, '[data-test-file-list-item]') |
| 240 | + ) |
| 241 | + ) |
| 242 | + # Click the first file from the list to open the File Detail page in a new tab |
| 243 | + registration_file_list_page.scroll_into_view( |
| 244 | + registration_file_list_page.first_file_link.element |
| 245 | + ) |
| 246 | + registration_file_list_page.first_file_link.click() |
| 247 | + # Wait for the new tab to open - window count should then = 2 |
| 248 | + WebDriverWait(driver, 5).until(EC.number_of_windows_to_be(2)) |
| 249 | + # Switch focus to the new tab |
| 250 | + driver.switch_to.window(driver.window_handles[1]) |
| 251 | + assert RegistrationFileDetailPage(driver) |
| 252 | + # Wait for File Renderer to load |
| 253 | + WebDriverWait(driver, 5).until( |
| 254 | + EC.visibility_of_element_located((By.CSS_SELECTOR, 'iframe')) |
| 255 | + ) |
| 256 | + a11y.run_axe( |
| 257 | + driver, |
| 258 | + session, |
| 259 | + 'regfiledet', |
| 260 | + write_files=write_files, |
| 261 | + exclude_best_practice=exclude_best_practice, |
| 262 | + ) |
| 263 | + |
| 264 | + |
158 | 265 | # User with registrations is not setup in production
|
159 | 266 | @markers.dont_run_on_prod
|
160 | 267 | class TestDraftRegistrationPages:
|
|
0 commit comments