Skip to content

Commit

Permalink
Merge pull request #3471 from tdonohue/flakey_item_page_tests
Browse files Browse the repository at this point in the history
[dspace-7_x] Fix flakey Item page accessibility tests by waiting for pages to fuly load
  • Loading branch information
tdonohue authored Oct 18, 2024
2 parents c3eaf8b + 5275f8d commit 1244f23
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cypress/e2e/item-edit.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ describe('Edit Item > Edit Metadata tab', () => {
// <ds-edit-item-page> tag must be loaded
cy.get('ds-edit-item-page').should('be.visible');

// wait for all the Edit Item tabs to be rendered
cy.get('ds-edit-item-page ul[role="tablist"]').each(($row: HTMLDivElement) => {
cy.wrap($row).find('li[role="presentation"]').should('be.visible');
});

// wait for all the ds-dso-edit-metadata-value components to be rendered
cy.get('ds-dso-edit-metadata-value div[role="row"]').each(($row: HTMLDivElement) => {
cy.wrap($row).find('div[role="cell"]').should('be.visible');
Expand Down
12 changes: 12 additions & 0 deletions cypress/e2e/item-page.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@ describe('Item Page', () => {
});

it('should pass accessibility tests', () => {
cy.intercept('POST', '/server/api/statistics/viewevents').as('viewevent');

cy.visit(ENTITYPAGE);

// Wait for the "viewevent" to trigger on the Item page.
// This ensures our <ds-item-page> tag is fully loaded, as the <ds-view-event> tag is contained within it.
cy.wait('@viewevent');

// <ds-item-page> tag must be loaded
cy.get('ds-item-page').should('be.visible');

Expand All @@ -22,8 +28,14 @@ describe('Item Page', () => {
});

it('should pass accessibility tests on full item page', () => {
cy.intercept('POST', '/server/api/statistics/viewevents').as('viewevent');

cy.visit(ENTITYPAGE + '/full');

// Wait for the "viewevent" to trigger on the Item page.
// This ensures our <ds-item-page> tag is fully loaded, as the <ds-view-event> tag is contained within it.
cy.wait('@viewevent');

// <ds-full-item-page> tag must be loaded
cy.get('ds-full-item-page').should('be.visible');

Expand Down

0 comments on commit 1244f23

Please sign in to comment.