mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-24 21:12:38 -04:00
988fc57574
[web] Add cypress tests for figure modal GitOrigin-RevId: 4debae1c665a68fd7bfa9f0dcfc150bec38a7c64
18 lines
570 B
TypeScript
18 lines
570 B
TypeScript
import { HttpRequestInterceptor } from 'cypress/types/net-stubbing'
|
|
|
|
export const interceptFileUpload = () => {
|
|
cy.intercept(
|
|
{ method: 'POST', url: /\/project\/.*\/upload/ },
|
|
cy
|
|
.spy((req: Parameters<HttpRequestInterceptor>[0]) => {
|
|
const folderMatch = req.url.match(
|
|
/project\/.*\/upload\?folder_id=[a-f0-9]{24}/
|
|
)
|
|
if (!folderMatch) {
|
|
req.reply({ statusCode: 500, body: { success: false } })
|
|
}
|
|
req.reply({ statusCode: 200, body: { success: true } })
|
|
})
|
|
.as('uploadRequest')
|
|
)
|
|
}
|