Skip to content

Commit 113c373

Browse files
authored
use BypassComparersForSubsequentOnDifference for html (#855)
1 parent 120d8cf commit 113c373

3 files changed

Lines changed: 32 additions & 7 deletions

File tree

src/Verify.Playwright/ElementConverter.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ public static async Task<ConversionResult> ConvertPage(IPage page, IReadOnlyDict
1313
if (!context.GetScreenshotOnlyOption())
1414
{
1515
var html = await page.ContentAsync();
16-
targets.Add(new("html", html));
16+
targets.Add(
17+
new("html", html)
18+
{
19+
BypassComparersForSubsequentOnDifference = true
20+
});
1721
}
1822

1923
targets.Add(new(options.ToExtension(), new MemoryStream(await bytes)));
@@ -30,7 +34,11 @@ public static async Task<ConversionResult> ConvertElement(IElementHandle element
3034
if (!context.GetScreenshotOnlyOption())
3135
{
3236
var html = await element.InnerHTMLAsync();
33-
targets.Add(new("html", html));
37+
targets.Add(
38+
new("html", html)
39+
{
40+
BypassComparersForSubsequentOnDifference = true
41+
});
3442
}
3543

3644
targets.Add(new(options.ToExtension(), new MemoryStream(await bytes)));
@@ -47,7 +55,11 @@ public static async Task<ConversionResult> ConvertLocator(ILocator locator, IRea
4755
if (!context.GetScreenshotOnlyOption())
4856
{
4957
var html = await locator.InnerHTMLAsync();
50-
targets.Add(new("html", html));
58+
targets.Add(
59+
new("html", html)
60+
{
61+
BypassComparersForSubsequentOnDifference = true
62+
});
5163
}
5264

5365
targets.Add(new(options.ToExtension(), new MemoryStream(await bytes)));

src/Verify.Puppeteer/ElementConverter.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ public static async Task<ConversionResult> ConvertPage(Page page, IReadOnlyDicti
88
return new(
99
null,
1010
[
11-
new("html", await html),
11+
new("html", await html)
12+
{
13+
BypassComparersForSubsequentOnDifference = true
14+
},
1215
new("png", await screenshot)
1316
]
1417
);
@@ -22,7 +25,10 @@ public static async Task<ConversionResult> ConvertElement(ElementHandle element,
2225
return new(
2326
null,
2427
[
25-
new("html", await html),
28+
new("html", await html)
29+
{
30+
BypassComparersForSubsequentOnDifference = true
31+
},
2632
new("png", await screenshot)
2733
]
2834
);

src/Verify.Selenium/ElementConverter.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ public static ConversionResult ConvertElement(IWebElement target, IReadOnlyDicti
1010
var source = element.GetSource();
1111
if (source != null)
1212
{
13-
targets.Add(new("html", source));
13+
targets.Add(
14+
new("html", source)
15+
{
16+
BypassComparersForSubsequentOnDifference = true
17+
});
1418
}
1519

1620
targets.Add(new("png", new MemoryStream(bytes)));
@@ -24,7 +28,10 @@ public static ConversionResult ConvertDriver(WebDriver driver, IReadOnlyDictiona
2428
return new(
2529
null,
2630
[
27-
new("html", driver.PageSource),
31+
new("html", driver.PageSource)
32+
{
33+
BypassComparersForSubsequentOnDifference = true
34+
},
2835
new("png", new MemoryStream(bytes))
2936
]
3037
);

0 commit comments

Comments
 (0)