overleaf/services/web/cypress/support/shared/commands/index.ts
Alf Eaton 390d7ed005 Merge pull request #12176 from overleaf/ae-syntex-tests
Improve synctex Cypress tests

GitOrigin-RevId: 282d26d344d8ae08f52b18ef4c12a4c311a6b7ff
2023-03-14 09:04:14 +00:00

36 lines
1.3 KiB
TypeScript

import '@testing-library/cypress/add-commands'
import {
interceptCompile,
waitForCompile,
interceptDeferredCompile,
} from './compile'
import { interceptEvents } from './events'
import { interceptSpelling } from './spelling'
import { interceptAsync } from './intercept-async'
// eslint-disable-next-line no-unused-vars,@typescript-eslint/no-namespace
declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace,no-unused-vars
namespace Cypress {
// eslint-disable-next-line no-unused-vars
interface Chainable {
interceptAsync: typeof interceptAsync
interceptCompile: typeof interceptCompile
interceptEvents: typeof interceptEvents
interceptSpelling: typeof interceptSpelling
waitForCompile: typeof waitForCompile
interceptDeferredCompile: typeof interceptDeferredCompile
index: () => Chainable<number>
}
}
}
Cypress.Commands.add('interceptAsync', interceptAsync)
Cypress.Commands.add('interceptCompile', interceptCompile)
Cypress.Commands.add('interceptEvents', interceptEvents)
Cypress.Commands.add('interceptSpelling', interceptSpelling)
Cypress.Commands.add('waitForCompile', waitForCompile)
Cypress.Commands.add('interceptDeferredCompile', interceptDeferredCompile)
Cypress.Commands.add('index', { prevSubject: true }, subject => {
return cy.wrap(subject).invoke('index')
})