From 98bd09c31d4019dd8be4100d2fe8fc8448b04cef Mon Sep 17 00:00:00 2001 From: Mathias Jakobsen Date: Tue, 2 Jun 2026 10:45:27 +0100 Subject: [PATCH] Merge pull request #34189 from overleaf/mj-fix-flaky-review-panel-tests [web] Fix flaky Cypress tests GitOrigin-RevId: b34dc9a0ca53da5a282513e8fb92297e4b2f702a --- .../features/review-panel/review-panel.spec.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/services/web/test/frontend/features/review-panel/review-panel.spec.tsx b/services/web/test/frontend/features/review-panel/review-panel.spec.tsx index bae6d0bd90..6dbb068acd 100644 --- a/services/web/test/frontend/features/review-panel/review-panel.spec.tsx +++ b/services/web/test/frontend/features/review-panel/review-panel.spec.tsx @@ -205,6 +205,9 @@ describe('', function () { ) + // Wait for the editor to be ready before interacting with it + cy.get('.cm-content').should('have.css', 'opacity', '1') + // Open the review panel with keyboard shortcut cy.findByText('contentLine 0').type('{command}j', { scrollBehavior: false }) cy.findByText('contentLine 1').type('{ctrl}j', { scrollBehavior: false }) @@ -726,7 +729,7 @@ describe(' in mini mode', function () { }, ]) - cy.intercept('GET', '/project/*/threads', threads) + cy.intercept('GET', '/project/*/threads', threads).as('loadThreads') cy.intercept('POST', `/project/*/doc/${docId}/metadata`, {}) @@ -745,6 +748,10 @@ describe(' in mini mode', function () { // Wait for editor cy.get('.cm-content').should('have.css', 'opacity', '1') + // Wait for the threads to load, since mini mode renders conditionally on + // the threads/ranges data being present + cy.wait('@loadThreads') + // Toggle the review panel twice to ensure data is loaded cy.findByText('contentLine 0').type('{command}jj', { scrollBehavior: false, @@ -882,6 +889,9 @@ describe(' for free users', function () { ) + // Wait for the editor to be ready before interacting with it + cy.get('.cm-content').should('have.css', 'opacity', '1') + cy.findByLabelText('Editing').click() cy.findByRole('menu').within(() => { cy.findByText(/Reviewing/).click()