From faf2fd2287772f82db4d9dffda5edd5d10a35366 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Wed, 22 Apr 2026 11:12:15 +0100 Subject: [PATCH] Merge pull request #32996 from overleaf/copilot/fix-race-condition-in-stopcompile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stabilize stopCompile Cypress helper by waiting for enabled “Stop compilation” action GitOrigin-RevId: 16997aaccd8d65d5ff0a0a1af73a0bf5d6803832 --- server-ce/test/helpers/compile.ts | 5 ++++- server-ce/test/sandboxed-compiles.spec.ts | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/server-ce/test/helpers/compile.ts b/server-ce/test/helpers/compile.ts index ada71f03ec..3ceb14e320 100644 --- a/server-ce/test/helpers/compile.ts +++ b/server-ce/test/helpers/compile.ts @@ -9,7 +9,10 @@ export function stopCompile(options: { delay?: number } = {}) { cy.wait(delay) cy.log('Stop compile') cy.findByRole('button', { name: 'Toggle compile options menu' }).click() - cy.findByRole('menuitem', { name: 'Stop compilation' }).click() + cy.findByRole('menuitem', { name: 'Stop compilation' }) + .should('not.have.class', 'disabled') + .and('not.have.attr', 'aria-disabled', 'true') + .click() } export function prepareWaitForNextCompileSlot() { diff --git a/server-ce/test/sandboxed-compiles.spec.ts b/server-ce/test/sandboxed-compiles.spec.ts index 75313819ad..67baa1d9a1 100644 --- a/server-ce/test/sandboxed-compiles.spec.ts +++ b/server-ce/test/sandboxed-compiles.spec.ts @@ -83,7 +83,11 @@ describe('SandboxedCompiles', function () { cy.findByText('\\maketitle').parent().click() cy.findByText('\\maketitle') .parent() - .type('\n\\def\\x{{}Hello!\\par\\x}\\x') + .type( + '\nFirst page\\clearpage' + + '\nSecond page' + + '\\def\\loop{{}\\let\\next\\loop\\next}\\loop' + ) waitForCompileRateLimitCoolOff() cy.log('Start compile') // We need to start the compile manually because we do not want to wait for it to finish