index.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import '@testing-library/cypress/add-commands'
  2. import {
  3. interceptCompile,
  4. waitForCompile,
  5. interceptDeferredCompile,
  6. } from './compile'
  7. import { interceptEvents } from './events'
  8. import { interceptSpelling } from './spelling'
  9. import { interceptAsync } from './intercept-async'
  10. // eslint-disable-next-line no-unused-vars,@typescript-eslint/no-namespace
  11. declare global {
  12. // eslint-disable-next-line @typescript-eslint/no-namespace,no-unused-vars
  13. namespace Cypress {
  14. // eslint-disable-next-line no-unused-vars
  15. interface Chainable {
  16. interceptAsync: typeof interceptAsync
  17. interceptCompile: typeof interceptCompile
  18. interceptEvents: typeof interceptEvents
  19. interceptSpelling: typeof interceptSpelling
  20. waitForCompile: typeof waitForCompile
  21. interceptDeferredCompile: typeof interceptDeferredCompile
  22. index: () => Chainable<number>
  23. }
  24. }
  25. }
  26. Cypress.Commands.add('interceptAsync', interceptAsync)
  27. Cypress.Commands.add('interceptCompile', interceptCompile)
  28. Cypress.Commands.add('interceptEvents', interceptEvents)
  29. Cypress.Commands.add('interceptSpelling', interceptSpelling)
  30. Cypress.Commands.add('waitForCompile', waitForCompile)
  31. Cypress.Commands.add('interceptDeferredCompile', interceptDeferredCompile)
  32. Cypress.Commands.add('index', { prevSubject: true }, subject => {
  33. return cy.wrap(subject).invoke('index')
  34. })