mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
Merge pull request #26637 from overleaf/bg-clsi-fix-process-group-for-local-compiles
fix "stop compile" option for local command runner in CE/SP GitOrigin-RevId: 7986b505362aaf33ac6e161b3b54458baba1e2e6
This commit is contained in:
@@ -9,6 +9,14 @@ export function throttledRecompile() {
|
||||
return recompile
|
||||
}
|
||||
|
||||
export function stopCompile(options: { delay?: number } = {}) {
|
||||
const { delay = 0 } = options
|
||||
cy.wait(delay)
|
||||
cy.log('Stop compile')
|
||||
cy.findByRole('button', { name: 'Toggle compile options menu' }).click()
|
||||
cy.findByRole('menuitem', { name: 'Stop compilation' }).click()
|
||||
}
|
||||
|
||||
export function prepareWaitForNextCompileSlot() {
|
||||
let lastCompile = 0
|
||||
function queueReset() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ensureUserExists, login } from './helpers/login'
|
||||
import { createProject } from './helpers/project'
|
||||
import { isExcludedBySharding, startWith } from './helpers/config'
|
||||
import { throttledRecompile } from './helpers/compile'
|
||||
import { throttledRecompile, stopCompile } from './helpers/compile'
|
||||
import { v4 as uuid } from 'uuid'
|
||||
import { waitUntilScrollingFinished } from './helpers/waitUntilScrollingFinished'
|
||||
import { beforeWithReRunOnTestRetry } from './helpers/beforeWithReRunOnTestRetry'
|
||||
@@ -56,8 +56,40 @@ describe('SandboxedCompiles', function () {
|
||||
checkSyncTeX()
|
||||
checkXeTeX()
|
||||
checkRecompilesAfterErrors()
|
||||
checkStopCompile()
|
||||
})
|
||||
|
||||
function checkStopCompile() {
|
||||
it('users can stop a running compile', function () {
|
||||
login('user@example.com')
|
||||
createProject('test-project')
|
||||
// create an infinite loop in the main document
|
||||
// this will cause the compile to run indefinitely
|
||||
cy.findByText('\\maketitle').parent().click()
|
||||
cy.findByText('\\maketitle')
|
||||
.parent()
|
||||
.type('\n\\def\\x{{}Hello!\\par\\x}\\x')
|
||||
cy.log('Start compile')
|
||||
// We need to start the compile manually because we do not want to wait for it to finish
|
||||
cy.findByText('Recompile').click()
|
||||
// Now stop the compile and kill the latex process
|
||||
stopCompile({ delay: 1000 })
|
||||
cy.get('.logs-pane')
|
||||
.invoke('text')
|
||||
.should('match', /PDF Rendering Error|Compilation cancelled/)
|
||||
// Check that the previous compile is not running in the background by
|
||||
// disabling the infinite loop and recompiling
|
||||
cy.findByText('\\def').parent().click()
|
||||
cy.findByText('\\def').parent().type('{home}disabled loop% ')
|
||||
cy.findByText('Recompile').click()
|
||||
cy.get('.pdf-viewer').should('contain.text', 'disabled loop')
|
||||
cy.get('.logs-pane').should(
|
||||
'not.contain.text',
|
||||
'A previous compile is still running'
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
function checkSyncTeX() {
|
||||
// TODO(25342): re-enable
|
||||
// eslint-disable-next-line mocha/no-skipped-tests
|
||||
@@ -227,6 +259,7 @@ describe('SandboxedCompiles', function () {
|
||||
checkSyncTeX()
|
||||
checkXeTeX()
|
||||
checkRecompilesAfterErrors()
|
||||
checkStopCompile()
|
||||
})
|
||||
|
||||
describe.skip('unavailable in CE', function () {
|
||||
@@ -241,5 +274,6 @@ describe('SandboxedCompiles', function () {
|
||||
checkSyncTeX()
|
||||
checkXeTeX()
|
||||
checkRecompilesAfterErrors()
|
||||
checkStopCompile()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user