Skip to content

Commit 306cf86

Browse files
committed
Add a11y tests for Metadata pages.
1 parent 7f808ff commit 306cf86

File tree

4 files changed

+71
-0
lines changed

4 files changed

+71
-0
lines changed

pages/project.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ class MyProjectsPage(OSFBasePage):
6868
project_created_modal = ComponentLocator(ProjectCreatedModal)
6969

7070

71+
class MetadataPage(GuidBasePage):
72+
base_url = settings.OSF_HOME + '/{guid}/metadata/'
73+
74+
identity = Locator(By.CSS_SELECTOR, 'div[data-analytics-scope="Node"]')
75+
loading_indicator = Locator(By.CSS_SELECTOR, '.ball-pulse')
76+
77+
7178
class AnalyticsPage(GuidBasePage):
7279
base_url = settings.OSF_HOME + '/{guid}/analytics/'
7380

pages/registries.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ class RegistrationResourcesPage(BaseSubmittedRegistrationPage):
9797
identity = Locator(By.CSS_SELECTOR, '[data-test-add-resource-section]')
9898

9999

100+
class RegistrationMetadataPage(BaseSubmittedRegistrationPage):
101+
url_addition = 'metadata'
102+
identity = Locator(By.CSS_SELECTOR, '[data-test-edit-resource-metadata-button]')
103+
loading_indicator = Locator(By.CSS_SELECTOR, '.ball-scale')
104+
105+
100106
class RegistrationAddNewPage(BaseRegistriesPage):
101107
url_addition = 'new'
102108
identity = Locator(

tests/test_a11y_project.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
FilesPage,
1414
FileViewPage,
1515
ForksPage,
16+
MetadataPage,
1617
ProjectPage,
1718
RegistrationsPage,
1819
RequestAccessPage,
@@ -51,6 +52,34 @@ def test_accessibility(
5152
)
5253

5354

55+
@markers.ember_page
56+
class TestMetadataPage:
57+
def test_accessibility(
58+
self,
59+
driver,
60+
session,
61+
default_project,
62+
write_files,
63+
exclude_best_practice,
64+
must_be_logged_in,
65+
):
66+
"""For the Project Metadata page test we are creating a new dummy test project
67+
and then deleting it after we have finished unless we are running in Production,
68+
then we are using a Preferred Node from the environment settings file.
69+
"""
70+
metadata_page = MetadataPage(driver, guid=default_project.id)
71+
metadata_page.goto()
72+
assert MetadataPage(driver, verify=True)
73+
metadata_page.loading_indicator.here_then_gone()
74+
a11y.run_axe(
75+
driver,
76+
session,
77+
'prjMeta',
78+
write_files=write_files,
79+
exclude_best_practice=exclude_best_practice,
80+
)
81+
82+
5483
@markers.ember_page
5584
class TestFilesPage:
5685
def test_accessibility(

tests/test_a11y_registries.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
RegistrationDetailPage,
1919
RegistrationFileDetailPage,
2020
RegistrationFileListPage,
21+
RegistrationMetadataPage,
2122
RegistrationResourcesPage,
2223
RegistriesDiscoverPage,
2324
RegistriesLandingPage,
@@ -306,6 +307,34 @@ def test_accessibility_resources_page(
306307
exclude_best_practice=exclude_best_practice,
307308
)
308309

310+
@markers.ember_page
311+
def test_accessibility_metadata_page(
312+
self, driver, session, write_files, exclude_best_practice, my_registrations_page
313+
):
314+
"""This test is for checking the accessibility of the Registration Metadata
315+
Page of a submitted registration. First search through the registration cards
316+
on the Submitted tab of the My Registration Page for a specific registration
317+
(searching by registration title). When you find the desired registration get
318+
the registration node id from its link and then use the node id to navigate to
319+
the Meatadata page for this registration.
320+
"""
321+
registration_node = my_registrations_page.get_node_id_by_title(
322+
'Registration With Files for A11y Testing'
323+
)
324+
registration_metadata_page = RegistrationMetadataPage(
325+
driver, guid=registration_node
326+
)
327+
registration_metadata_page.goto()
328+
assert RegistrationMetadataPage(driver, verify=True)
329+
registration_metadata_page.loading_indicator.here_then_gone()
330+
a11y.run_axe(
331+
driver,
332+
session,
333+
'regmeta',
334+
write_files=write_files,
335+
exclude_best_practice=exclude_best_practice,
336+
)
337+
309338

310339
# User with registrations is not setup in production
311340
@markers.dont_run_on_prod

0 commit comments

Comments
 (0)