Closed myspivey closed 5 years ago
CC: @prateekbh
+1 and happy to answer questions! :)
Hi @myspivey I checked out applitools and it looks good 👍 We currently have pixel to pixel matching using puppeteer but it not the most amazing thing that we like to maintain.
So any replacement needs to have following things
Does those get covered by your suggested setup?
P.S. Please keep all your work based on next
branch instead of master, as that's where we are developing code for our next major release
Also can we add support for doing interactions on screen and comparing results post that?
E.g. Load page => do a swipe => compare screenshot to check if the sidebar opened
Cross browser testing on already chrome and Firefox (edge would be good to have)
Edge (Trident) will be chromium soon anyway leaving Blink and Gecko the only mature engines (besides Webkit, but that's buggy like hell)
P.S. Please keep all your work based on
next
branch instead of master, as that's where we are developing code for our next major release
The branch is called 2.0
not next
@prateekbh Pixel to pixel is quite frail which is one of the advantages of Applitools.
Let me know if there are anymore questions!
- For interactions, this would be E2E testing so a proposed solution of Cypress tied to Applitools would be ideal for this. With Cypress you can interact with your UI as you would expect, and then take a screenshot at any point during to determine if the UI looks as though you would expect. You can of course do this solely in Cypress as well by determining if the dom elements are present after the click, it is at your discretion if you want to have a visual result test or simply know it worked.
At Applitools it is also stated that selenium works
If Cyprus can do the job cross browser I'd like it to, instead of selenium. Cyprus definitely seems nicer, one dependency that can do a bunch 🙂
I just had a quick look at it and I think we should discuss this later when we have tried some things
Like?
I am kinda super eager to get this in because as we add components in 2.0, I don't want to keep uploading images to my PR. That too when we are getting an external contributor to do just this. Also, this gives us stuff which we don't have right now.
I honestly think I'd want to land this PR as soon we can after it is submitted.
I think we should land this first and then think about Cypress vs. Selenium and co.
Oh ok fair enough
@myspivey we'd just like screenshot tests without Cypress for now, and we'll add whatever we need later on.
@prateekbh understood, however I would advise this will make it substantially harder and even potentially lose a bunch of the advanced value you can get out of Applitools. Without an E2E runner to help pluck the dom elements, you are using the pure image comparison approach which could lead to false positives/negatives. When instead of sending images, you send dom elements to Applitools, they will ensure they get rendered in a consistent manner so that you do not get differences between different contributor machines. If you do not end up with that runner, the only choices will be the CLI or pure JS libraries that deal simply in images. You would continue to have to ensure that something takes accurate photos per browser, and then deal with upload. You can find documentation on those solutions here (https://applitools.com/tutorials/screenshots-javascript.html#run-your-first-test) and here (https://applitools.com/tutorials/screenshots-cli.html#steps-for-running-tests)
@myspivey I mean if we start with Cypress change it in the end (if we really want) right?
@cromefire yes, it is a very lightweight approach. You can see an example of adding Cypress together with Applitools here (https://github.com/auth0/lock/pull/1597/files)
Well then I don't think there's anything speaking against it
This is now implemented
Hey Folks, my name is James Spivey. I work with This Dot and we have teamed up with Applitools to offer free visual testing to great open source projects such as this one. Even better, they want to support helping women juniors through an apprenticeship program to do this work. This Dot would handle the pull request for this issue through the Apprenticeship program.
If you're not familiar with visual regression testing there's a pretty good summary in the Storybook docs (most of the page is unrelated to Storybook) but the tl;dr it involves rendering components individually in the DOM and taking a snapshot of the pixels and doing comparisons of it against baselines.
Most solutions do normal 1:1 pixel comparing, but this often results in false positives because the exact pixels can vary. e.g. different GPUs render things differently, so your local tests will fail against baselines created on another computer, or if the CI changes its GPU or there's a browser update, etc, etc, etc. Applitools on the other hand tries to visually compare like a human would, ignoring differences that a human wouldn't perceive or care about. The whole AI thing and such.
Maintaining a separate set of visual tests can could be a pain so what I am thinking instead was take advantage of the wonderful existing docs setup this project has. Since this project already has the ability to render the component examples all by themselves e.g.https://material.preactjs.com/component/button/ this could make rendering and testing the components easy.
My suggested solution would be to integrate Cypress and Applitools to load the docs, render the examples, and snapshot test the dom elements created from the docs.
Looking forward to talking further about this idea and the value it could add to Preact Material!