Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@csouchet
Created March 24, 2021 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csouchet/e9b12947f592bf13b3763e0d87b9ced8 to your computer and use it in GitHub Desktop.
Save csouchet/e9b12947f592bf13b3763e0d87b9ced8 to your computer and use it in GitHub Desktop.
Order the snapshots with Jest-image-snapshot 3
import { gotoPageWithBPMNContainer, getConfig } from './helpers/visu-utils';
it(`no visual regression for drag & drop with the mouse of the BPMN content in the container`, async () => {
const bpmnContainerElement = await gotoPageWithBPMNContainer();
const bounding_box = await bpmnContainerElement.boundingBox();
// Move the mouse pointer to the center of the BPMN Container
const containerCenterX = bounding_box.x + bounding_box.width / 2;
const containerCenterY = bounding_box.y + bounding_box.height / 2;
await page.mouse.move(containerCenterX, containerCenterY);
// Drag & Drop the BPMN content in the BPMN Container
await page.mouse.down();
await page.mouse.move(containerCenterX + 150, containerCenterY + 40);
await page.mouse.up();
// Take the screenshot of the page with puppeteer
const image = await page.screenshot({ fullPage: true });
// Compare the taken screenshot with the baseline screenshot (if exists), or create it (else)
const config = getConfig('__image_snapshots__/navigation');
expect(image).toMatchImageSnapshot(config);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment