allure-js icon indicating copy to clipboard operation
allure-js copied to clipboard

Multiple screen diff sections

Open grybykm opened this issue 3 years ago • 7 comments

Is your feature request related to a problem? Please describe. I'd like to compare screenshots of multiple areas in the page within the same test.

At the moment only it should be only one diff per test otherwise screen diff section is not shown

image

Describe the solution you'd like I'd like to see multiple collapsible screen diff entries ideally with the screenshot name

image

Describe alternatives you've considered any other options to see multiple screen diffs per test

grybykm avatar Jan 24 '22 13:01 grybykm

BTW multiple image diffs are supported by Allure for a while https://github.com/allure-framework/allure2/pull/1145

baev avatar Jan 26 '22 10:01 baev

For some reason it doesn't work for me with "@playwright/test": "^1.18.0" and "allure-playwright": "^2.0.0-beta.15"

grybykm avatar Jan 26 '22 11:01 grybykm

that's because playwright by default doesn't support soft assertions. So we expect only one diff per test. It could (and probably will) be changed at some point, but for now I can only suggest crafting your own image diff attachments:

testInfo.attach('Image Diff', {
  body: Buffer.from(JSON.stringify({
    actual: 'data:image/png;base64,' + actual.toString("base64"),
    expected: 'data:image/png;base64,' + expected.toString("base64"),
    diff: 'data:image/png;base64,' + diff.toString("base64")
  })),
  contentType: 'application/vnd.allure.image.diff'
})

baev avatar Jan 26 '22 14:01 baev

Thanks for the tip, let me try. I'd really like to have it working out of the box!

grybykm avatar Jan 26 '22 17:01 grybykm

Just as a heads up, Soft assertions are coming with Playwright 1.19 https://github.com/microsoft/playwright/issues/7819

mxschmitt avatar Feb 03 '22 09:02 mxschmitt

@mxschmitt when do we expect to have this release

amrsa1 avatar Feb 03 '22 15:02 amrsa1

@mxschmitt when do we expect to have this release

We release every month, so probably in 2 weeks it's stable.

mxschmitt avatar Feb 03 '22 15:02 mxschmitt