From ce4dbec7a0f5a1233c02cb5dc0ca97e165a52d06 Mon Sep 17 00:00:00 2001 From: Ellen Kraffmiller Date: Mon, 11 Dec 2023 16:16:57 -0500 Subject: [PATCH] Add alias to Cypress query to avoid asynchronous page update errors --- .../e2e/sections/dataset/Dataset.spec.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/e2e-integration/e2e/sections/dataset/Dataset.spec.tsx b/tests/e2e-integration/e2e/sections/dataset/Dataset.spec.tsx index 46d3f9a3d..c6043455d 100644 --- a/tests/e2e-integration/e2e/sections/dataset/Dataset.spec.tsx +++ b/tests/e2e-integration/e2e/sections/dataset/Dataset.spec.tsx @@ -277,11 +277,14 @@ describe('Dataset', () => { cy.findByText('Restricted File Icon').should('not.exist') cy.findByText('Restricted with access Icon').should('exist') - - cy.findByRole('button', { name: 'Access File' }).should('exist').click() + cy.findByRole('button', { name: 'Access File' }).as('accessButton') + cy.get('@accessButton').should('exist') + cy.get('@accessButton').click() cy.findByText('Restricted with Access Granted').should('exist') - cy.findByRole('button', { name: 'File Options' }).should('exist').click() + cy.findByRole('button', { name: 'File Options' }).as('fileOptions') + cy.get('@fileOptions').should('exist') + cy.get('@fileOptions').click() cy.findByText('Unrestrict').should('exist') }) }) @@ -361,7 +364,9 @@ describe('Dataset', () => { cy.findByText('Edit Files').should('exist') - cy.findByRole('button', { name: 'Access File' }).should('exist').click() + cy.findByRole('button', { name: 'Access File' }).as('accessButton') + cy.get('@accessButton').should('exist') + cy.get('@accessButton').click() cy.findByText('Embargoed').should('exist') }) })