From 5275f8d13fa3944a7fca9858a7cd7099174ad363 Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Fri, 18 Oct 2024 14:01:19 -0500 Subject: [PATCH] Fix flakey Item page accessibility tests by waiting for pages to fully load. --- cypress/e2e/item-edit.cy.ts | 5 +++++ cypress/e2e/item-page.cy.ts | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/cypress/e2e/item-edit.cy.ts b/cypress/e2e/item-edit.cy.ts index 60e1b924eed..25c63bea81c 100644 --- a/cypress/e2e/item-edit.cy.ts +++ b/cypress/e2e/item-edit.cy.ts @@ -18,6 +18,11 @@ describe('Edit Item > Edit Metadata tab', () => { // 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'); diff --git a/cypress/e2e/item-page.cy.ts b/cypress/e2e/item-page.cy.ts index a7fac6e387e..7d42126b828 100644 --- a/cypress/e2e/item-page.cy.ts +++ b/cypress/e2e/item-page.cy.ts @@ -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 tag is fully loaded, as the tag is contained within it. + cy.wait('@viewevent'); + // tag must be loaded cy.get('ds-item-page').should('be.visible'); @@ -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 tag is fully loaded, as the tag is contained within it. + cy.wait('@viewevent'); + // tag must be loaded cy.get('ds-full-item-page').should('be.visible');