Questions tagged [jest-image-snapshot]

13 questions
4
votes
0 answers

canvas.getContext("webgl") returns null when testing with puppeteer and jest

I am trying to write snapshot tests for a webgl renderer I've written using jest, puppeteer and jest-image-snapshot. The way I am testing this is I have written a react TestApp which contains the canvas as below: export function TestApp(props: {…
AdM
  • 55
  • 7
3
votes
1 answer

how to ignore a region or element within the body tag when using jest-image-snapshot to compare image shots?

I walked through several issues inside the jest-image-shot and puppeteer repos. Yet, I have not able to find a proper solution for this. Basically, what I want to do is, to allow jest to run its toMatchImageSnapshot with ignore certain elements or…
ey dee ey em
  • 7,991
  • 14
  • 65
  • 121
3
votes
2 answers

How do I image snapshot test a React component using HTML5 canvas?

I'm attempting to get image snapshot testing working (i.e., not mocked) with a React component that renders an HTML5 canvas. I'm using Jest, React Testing Library, Node Canvas, Puppeteer, and Jest Image Snapshot. Given the following React…
icfantv
  • 4,523
  • 7
  • 36
  • 53
3
votes
0 answers

Is it possible to take device independent screenshots with Puppeteer?

I am using Puppeteer to do visual regression testing (specifically I am using the jest-image-snapshot library for this). Unfortunately, when I use machines with different screen characteristics, the screenshots are slightly different and the tests…
Naresh
  • 23,937
  • 33
  • 132
  • 204
2
votes
0 answers

Is it possible to render a react fragment to an image without spinning up a server

I would like to render a react fragment to an image similar to how react-test-renderer renders html, without needing to create a route for the test and spin up a complete server. So I would like to do something similar to this: test("test is…
kaan_a
  • 3,503
  • 1
  • 28
  • 52
2
votes
1 answer

puppeteer's setContent function not making network requests for static files

I am currently trying to figure out how to render my React app within the puppeteer browser so that I could take a screenshot and perform visual regression testing in the future. Most of the ways I've seen this achieved was by starting up an express…
1
vote
1 answer

How to do jest snapshots within Azure Pipelines

I am using jest snapshots, as well as jest-image-snapshots. They work locally, but when I run them in the azure pipeline I get: New snapshot was not written. The update flag must be explicitly passed to write a new snapshot. This is likely…
0
votes
0 answers

Browser not Defined error in Jest-Image-Snapshot Testing in React

I want to implement https://github.com/americanexpress/jest-image-snapshot#-api in my React application and tried writing one of the test cases but gives me an error saying the browser is not defined when trying to run a test using the command "npm…
0
votes
0 answers

Saved snapshot is only black square with plugin Cypress Image Snapshot

I tried to revive visual test in Cypress which run with help of plugin Cypress Image Snapshot. In the past this test during first run save image with desired element (image). desired_image But now test save during first run only black…
Monika
  • 1
0
votes
1 answer

TestCafe: extending 'expect' to incorporate jest-image-snapshot

I noticed that there was an option to extend Selector for TestCafe. The project I am working on needs to have Visual Image Testing. I wanted to see if I could get jest-image-snapshot working with conjunction with TestCafe...but failing to do so. …
0
votes
0 answers

how to parse a piece of info out of failureMessage string for generated result from a jest test suit run?

the string looks like this after I did JSON.stringify the whole object 'Error: Expected image to match or be a close match to snapshot but was 0.009980258828690502% different from snapshot (91 differing pixels).\n\u001b[1m\u001b[31mSee diff for…
ey dee ey em
  • 7,991
  • 14
  • 65
  • 121
0
votes
0 answers

mouse down and take a screenshot of an element

I am trying to simulate a mousedown action on an element then take a snapshot but this doesn't seem to work as the screenshot isn't what I expect. according to the api docs, this is what it does mouse.down([options]) options button…
0
votes
1 answer

Failed to launch chrome!, failed to launch chrome puppeteer in bamboo for jest image snapshot test

I am trying to run puppeteer in bamboo build run. But seems there is problem to execute it properly. The detail error below I wonder if there is stuff I have to install to get it able to run in bamboo? or I have to do other alternative. There is no…
ey dee ey em
  • 7,991
  • 14
  • 65
  • 121