Skip to content

Commit

Permalink
Fix flakey Item page accessibility tests by waiting for pages to full…
Browse files Browse the repository at this point in the history
…y load.
  • Loading branch information
tdonohue committed Oct 18, 2024
1 parent c3eaf8b commit 5275f8d
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 5275f8d

Please sign in to comment.