tacoss / testcafe-blink-diff

Visual regression for Testcafé
65 stars 15 forks source link

Blockout multiple selectors - how does it work? #38

Closed Gjodim closed 2 years ago

Gjodim commented 2 years ago

Hello. I am in a bit of a pickle and perhaps am doing something wrong.

I am trying to blockout multiple selectors on a page in a single test.

What i try is the following:

await takeSnapshot(t, {label:${j}position${i}px, blockOut: [Selector('.eventlist'), Selector('.newslist')], timeout: 1000}); but it does not seem to work. My question / issue is - is there any other syntax i should use for blocking multiple selectors?

pateketrueke commented 2 years ago

Hi, according the test we did to cover this feature that is the correct syntax.

Just to confirm, during your tests a file blockOut.json should be written in the same place where the base.png screenshots are stored, can you confirm it is created as well?

That should contain all the coordinates on the DOM that will be blocked-out, if the file is present and stilll is not working, probably is due the blink-diff dependency, may be we just need to upgrade, etc.

Gjodim commented 2 years ago

Yes, a blockout.json is created with seemingly the correct coordinates. I will try to take the snapshots again with some other selector combination which should yield the same result.

If this doesn't work is there something else (workaround or something) you recommend i try?

Gjodim commented 2 years ago

Checked again but it still does the comparison - blockout.json is generated but it doesn't seem to consider the blockedOut areas.

pateketrueke commented 2 years ago

it doesn't seem to consider the blockedOut areas.

Well, in the actual tests we did for it, the resulting images will no have such areas deleted, or filled, or anything. They'll remain as the original screenshot, but they're just ignored during image comparison.

Did you ran a quick test to confirm that?

Gjodim commented 2 years ago

Yes. Here is an image of the results

image

And here is from the folder structure of the failing images - base and actual + blockOut.json

image
pateketrueke commented 2 years ago

Open the diff of the images that did no pass, the actual blocked-out areas should remain, without the red indicator.

Gjodim commented 2 years ago

base

image

actual

image

blockOut.json [{"left":0,"right":1200,"top":160,"bottom":729,"width":1200,"height":569}]

pateketrueke commented 2 years ago

I mean, when you get the dashboard, click on the "Open diff" action, to see the actual difference.

Gjodim commented 2 years ago

Sorry i am not sure i understand. Perhaps this:

image
pateketrueke commented 2 years ago

Yeah, that screen! And sadly is not working... I've been testing the blockOut feature (blink-diff provides it) but without luck, I think we should start consider alternatives for the visual diffing library. 🤔

pateketrueke commented 2 years ago

Update: I replaced blink-diff with native-image-diffand node-libpng — It seems to be working great, but I am reworking the UI a bit due changes on the generated images.

Said that, I think testcafe-blink-diff is not longer an accurate name... we should rename the module to a be more neutral? 💭

Gjodim commented 2 years ago

Hello @pateketrueke . Should i install some other package if this is fixed, or?

pateketrueke commented 2 years ago

Justa upgrade, from the user side nothing else is needed.