Jest Puppeteer Demo
To start the demo and run the integration tests:
Go to the demo's directory
Start the demo: Run
npm run start-test.
Run the integration tests:
npm run test:integration.
The demo starts with an empty graph, but graph items can be created interactively. The integration tests test this functionality by simulating node, edge and port creation gestures and verifying that the graph instance actually contains the newly created graph items.
The tests run in a puppeteer environment instead of the default jsdom environment, because yFiles for HTML needs a fully HTML5 compliant browser environment, which jsdom does not provide (in particular, jsdom lacks a complete SVG DOM implementation).
With puppeteer, the tests can run in a full Chrome headless environment instead.
In order to obtain access to the yFiles API, in particular for access to the GraphComponent instance through CanvasComponent#getComponent, this sample introduces an environment variable that causes the application code to expose the yFiles API to the global scope.