Cypress
Integrating with Cypress is simple with @xstate/test
.
js
import { createTestMachine, createTestModel } from '@xstate/test';const machine = createTestMachine({// machine config});describe('My app', () => {createTestModel(machine).getPaths().forEach((path) => {it(path.description, () => {path.testSync({states: {},events: {},});});});});
js
import { createTestMachine, createTestModel } from '@xstate/test';const machine = createTestMachine({// machine config});describe('My app', () => {createTestModel(machine).getPaths().forEach((path) => {it(path.description, () => {path.testSync({states: {},events: {},});});});});
You must use path.testSync
as Cypress doesn’t work well with promises.