Skip to main content
  1. Index

Testing GoJS apps

The emit... methods of the Diagram class are useful for pretending to interact with a Diagram without actually generating any keyboard or mouse or pointer events. See the sample at Simulating Inputs.

One convenient feature of those methods such as Diagram.emitMouseDown is that they use document coordinates, so that changes in the viewport size or diagram content alignment, scroll position, or zoom level will not affect the calls.

Testing with Jest

Testing with Jest depends on installing: jest, puppeteer, and jest-puppeteer.

js
js

Testing with Jest in React

In our GoJS React samples, we have an example of using the gojs-react component with Jest: gojs-react-jest.

Testing with Cypress

js
js
js