Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion Error #22

Closed
ruxiang05 opened this issue Oct 25, 2017 · 9 comments
Closed

Assertion Error #22

ruxiang05 opened this issue Oct 25, 2017 · 9 comments

Comments

@ruxiang05
Copy link

ruxiang05 commented Oct 25, 2017

I am getting an error when running the test for the second time:

AssertionError [ERR_ASSERTION]: zlib binding closed uitk-react-example: uitk-react-example: at Object.<anonymous>.test (test/visual.spec.js:30:23) uitk-react-example: at <anonymous> uitk-react-example: at process._tickCallback (internal/process/next_tick.js:169:7)

This is the test:

test('visual regression', async () => {
  const selector = 'a[href*="?selectedKind=Buttons&selectedStory="]';
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  await page.goto('http://localhost:8080');

let iframe = await page.evaluate(() => {
  const iframe = document.getElementById('storybook-preview-iframe');
  return iframe.getBoundingClientRect();
});

// console.log(iframe);
let storyLinks = await page.evaluate(() => {
  const stories = Array.from(document.querySelectorAll('a[href*="?selectedKind=Example&selectedStory="]'));
  const links = stories.map(story => {
    let name = story.text.replace(/,*\s+/g, "-");
    return {href: story.href, name: name};
  });
  return links;
});

for(let i = 0; i < storyLinks.length; i++){

 await page.goto(storyLinks[i].href);
 const screen = await page.screenshot({clip: {x:iframe.x, y: iframe.y, width: iframe.width, height: iframe.height}});
 await expect(screen).toMatchImageSnapshot({customSnapshotIdentifier: storyLinks[i].name});
}

 await browser.close();

I believe it has something to do with this project. It come from this line :
await expect(screen).toMatchImageSnapshot({customSnapshotIdentifier: storyLinks[i].name});

@phawxby
Copy link
Contributor

phawxby commented Oct 25, 2017

What version of jest-image-snapshot?

@anescobar1991
Copy link
Member

Probably not the issue but await is not needed for the line using toMatchImageSnapshot() assertion.

@ruxiang05
Copy link
Author

@phawxby 2.0.0

@phawxby
Copy link
Contributor

phawxby commented Oct 25, 2017

Can you create a little sample to recreate the issue? I'm using puppeteer on Windows and I'm having no issues.

@ruxiang05
Copy link
Author

ruxiang05 commented Oct 26, 2017

I can't, but I tried version 1.0.1 and it worked. Is it maybe from the custom config that pixelmatch doesn't work with but blink diff did?

@anescobar1991
Copy link
Member

@ruxiang05 I will try playing with it today and see if I can find anything but I am unable to replicate as well.

@phawxby
Copy link
Contributor

phawxby commented Oct 26, 2017

I wonder if it could be system specific. What node/jest/OS version are you using?

@ruxiang05
Copy link
Author

Node 8, Jest 21.2.1, Mac OS Sierra 10.12.6

@phawxby
Copy link
Contributor

phawxby commented Oct 27, 2017

The only Mac I have access to is running High Sierra 10.13. Using Jest 21.2.1 and Node 8.6.0 no issues. Hmmmmm, the plot thickens.

anescobar1991 added a commit that referenced this issue May 18, 2018
…re-not-runnable to master

* commit '0a0affd56b48c252bdfa38956edf87fdd750cd00':
  fix(examples): make runnable without requiring root package to be installed
goverdhan07 pushed a commit to goverdhan07/jest-image-snapshot that referenced this issue Jul 23, 2023
… fix/examples-are-not-runnable to master

* commit '0a0affd56b48c252bdfa38956edf87fdd750cd00':
  fix(examples): make runnable without requiring root package to be installed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants