Skip to content

Commit e648d1f

Browse files
committed
test(e2e): wait for tabs to render before a11y scan on item-edit page
Cherry-picks upstream DSpace fix (commit 3dca9d9) that addresses random aria-required-children violations when the accessibility scan runs before the Edit Item tabs have finished rendering. Adds an explicit wait on ul[role='tablist'] a[role='tab'] visibility before each testA11y call. Fixes failing E2E test: Edit Item > Edit Metadata tab > should pass accessibility tests
1 parent ce0eb72 commit e648d1f

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

cypress/e2e/item-edit.cy.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ describe('Edit Item > Edit Metadata tab', () => {
2626
// Wait for any loading spinners to disappear
2727
cy.get('ds-edit-item-page ds-loading').should('not.exist');
2828

29+
// wait for all the tabs to be rendered on this page
30+
cy.get('ds-edit-item-page ul[role="tablist"]').each(($row: HTMLUListElement) => {
31+
cy.wrap($row).find('a[role="tab"]').should('be.visible');
32+
});
33+
2934
// wait for all the ds-dso-edit-metadata-value components to be rendered
3035
cy.get('ds-dso-edit-metadata-value div[role="row"]').each(($row: HTMLDivElement) => {
3136
cy.wrap($row).find('div[role="cell"]').should('be.visible');
@@ -49,6 +54,11 @@ describe('Edit Item > Status tab', () => {
4954
// <ds-item-status> tag must be loaded
5055
cy.get('ds-item-status').should('be.visible');
5156

57+
// wait for all the tabs to be rendered on this page
58+
cy.get('ds-edit-item-page ul[role="tablist"]').each(($row: HTMLUListElement) => {
59+
cy.wrap($row).find('a[role="tab"]').should('be.visible');
60+
});
61+
5262
// Analyze for accessibility issues
5363
testA11y('ds-item-status');
5464
});
@@ -67,6 +77,11 @@ describe('Edit Item > Bitstreams tab', () => {
6777
// <ds-item-bitstreams> tag must be loaded
6878
cy.get('ds-item-bitstreams').should('be.visible');
6979

80+
// wait for all the tabs to be rendered on this page
81+
cy.get('ds-edit-item-page ul[role="tablist"]').each(($row: HTMLUListElement) => {
82+
cy.wrap($row).find('a[role="tab"]').should('be.visible');
83+
});
84+
7085
// Table of item bitstreams must also be loaded
7186
cy.get('div.item-bitstreams').should('be.visible');
7287

@@ -96,6 +111,11 @@ describe('Edit Item > Curate tab', () => {
96111
// <ds-item-curate> tag must be loaded
97112
cy.get('ds-item-curate').should('be.visible');
98113

114+
// wait for all the tabs to be rendered on this page
115+
cy.get('ds-edit-item-page ul[role="tablist"]').each(($row: HTMLUListElement) => {
116+
cy.wrap($row).find('a[role="tab"]').should('be.visible');
117+
});
118+
99119
// Analyze for accessibility issues
100120
testA11y('ds-item-curate');
101121
});
@@ -114,6 +134,11 @@ describe('Edit Item > Relationships tab', () => {
114134
// <ds-item-relationships> tag must be loaded
115135
cy.get('ds-item-relationships').should('be.visible');
116136

137+
// wait for all the tabs to be rendered on this page
138+
cy.get('ds-edit-item-page ul[role="tablist"]').each(($row: HTMLUListElement) => {
139+
cy.wrap($row).find('a[role="tab"]').should('be.visible');
140+
});
141+
117142
// Analyze for accessibility issues
118143
testA11y('ds-item-relationships');
119144
});
@@ -132,6 +157,11 @@ describe('Edit Item > Version History tab', () => {
132157
// <ds-item-version-history> tag must be loaded
133158
cy.get('ds-item-version-history').should('be.visible');
134159

160+
// wait for all the tabs to be rendered on this page
161+
cy.get('ds-edit-item-page ul[role="tablist"]').each(($row: HTMLUListElement) => {
162+
cy.wrap($row).find('a[role="tab"]').should('be.visible');
163+
});
164+
135165
// Analyze for accessibility issues
136166
testA11y('ds-item-version-history');
137167
});
@@ -150,6 +180,11 @@ describe('Edit Item > Access Control tab', () => {
150180
// <ds-item-access-control> tag must be loaded
151181
cy.get('ds-item-access-control').should('be.visible');
152182

183+
// wait for all the tabs to be rendered on this page
184+
cy.get('ds-edit-item-page ul[role="tablist"]').each(($row: HTMLUListElement) => {
185+
cy.wrap($row).find('a[role="tab"]').should('be.visible');
186+
});
187+
153188
// Analyze for accessibility issues
154189
testA11y('ds-item-access-control');
155190
});
@@ -168,6 +203,11 @@ describe('Edit Item > Collection Mapper tab', () => {
168203
// <ds-item-collection-mapper> tag must be loaded
169204
cy.get('ds-item-collection-mapper').should('be.visible');
170205

206+
// wait for all the tabs to be rendered on this page
207+
cy.get('ds-edit-item-page ul[role="tablist"]').each(($row: HTMLUListElement) => {
208+
cy.wrap($row).find('a[role="tab"]').should('be.visible');
209+
});
210+
171211
// Analyze entire page for accessibility issues
172212
testA11y('ds-item-collection-mapper');
173213

0 commit comments

Comments
 (0)