Giter Club home page Giter Club logo

Comments (6)

anescobar1991 avatar anescobar1991 commented on May 18, 2024 2

Yeah sorry I actually just noticed that with WebdriverIO we use saveScreenshot and don't pass it any arguments instead of screenshot:

  ...
  const screenshot = await client
    .saveScreenshot();

  expect(screenshot).toMatchImageSnapshot();

from jest-image-snapshot.

anescobar1991 avatar anescobar1991 commented on May 18, 2024

This sounds like you are not getting a png encoded buffer from Webdriver. Can you validate that it is?

from jest-image-snapshot.

KatFishSnake avatar KatFishSnake commented on May 18, 2024

@anescobar1991 I could not figure out how to validate raw bite stream but to look at the documentation of the selenium driver (everywhere says it suppose to generate a PNG) tho

  const b64 = require('base64-js')
  ...
  const buffer = await driver.takeScreenshot()
  const parsedBuffer = Buffer.from(b64.toByteArray(buffer))
  expect(parsedBuffer).toMatchImageSnapshot()

fixed it for me, tho it takes 1m to complete which is definitely not ideal

from jest-image-snapshot.

KatFishSnake avatar KatFishSnake commented on May 18, 2024

and btw sorry im blind you already have resolved an issue like that #35
thanks

from jest-image-snapshot.

anescobar1991 avatar anescobar1991 commented on May 18, 2024

@KatFishSnake I don't understand why you would need to do that, I have used it with WebdriverIO with no issues. I assume that WebdriverIO just calls selenium-webdriver?

There must be something else going on.

from jest-image-snapshot.

KatFishSnake avatar KatFishSnake commented on May 18, 2024

@anescobar1991 I assume based on what it says it returns a string <String>: screenshot The screenshot as a base64 encoded PNG.

and we need to convert that to buffer for PNG.sync.read
the same u mentioned on that #35 thread

from jest-image-snapshot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.