overleaf/services/web/cypress/support/shared/commands/compile.ts
Alf Eaton 716f186fed Upgrade Cypress to v10 (#8322)
GitOrigin-RevId: 856c523a4ca34f8ccdc38067cef6fcd8a5c20250
2022-06-08 08:03:35 +00:00

68 lines
1.4 KiB
TypeScript

import { v4 as uuid } from 'uuid'
const outputFiles = () => {
const build = uuid()
return [
{
path: 'output.pdf',
build,
url: `/build/${build}/output.pdf`,
type: 'pdf',
},
{
path: 'output.bbl',
build,
url: `/build/${build}/output.bbl`,
type: 'bbl',
},
{
path: 'output.bib',
build,
url: `/build/${build}/output.bib`,
type: 'bib',
},
{
path: 'example.txt',
build,
url: `/build/${build}/example.txt`,
type: 'txt',
},
{
path: 'output.log',
build,
url: `/build/${build}/output.log`,
type: 'log',
},
{
path: 'output.blg',
build,
url: `/build/${build}/output.blg`,
type: 'blg',
},
]
}
export const interceptCompile = (prefix = 'compile') => {
cy.intercept('POST', '/project/*/compile*', {
body: {
status: 'success',
clsiServerId: 'foo',
compileGroup: 'priority',
pdfDownloadDomain: 'https://clsi.test-overleaf.com',
outputFiles: outputFiles(),
},
}).as(`${prefix}`)
cy.intercept('/build/*/output.pdf*', {
fixture: 'build/output.pdf,null',
}).as(`${prefix}-pdf`)
cy.intercept('/build/*/output.log*', {
fixture: 'build/output.log',
}).as(`${prefix}-log`)
cy.intercept('/build/*/output.blg*', {
fixture: 'build/output.blg',
}).as(`${prefix}-blg`)
}