From c68b9cccd2814c53f1b4dbb4ba919c65401ace9b Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Fri, 19 Jun 2026 04:27:20 -0400 Subject: [PATCH] =?UTF-8?q?test(playwright):=20harden=20#230=20line-diff?= =?UTF-8?q?=20test=20=E2=80=94=20force-open=20nested=20details,=20robust?= =?UTF-8?q?=20+/-=20hunk=20assert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Live-run fixes: nested
made the summary selector ambiguous (strict-mode); force every disclosure open via JS. Drop the brittle specific-line-text ('99') assert (depends on CLI-seeded bodies) for a ≥1 add-hunk + ≥1 remove-hunk count check. (#230) --- .../Transport/TransportImportTests.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Transport/TransportImportTests.cs b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Transport/TransportImportTests.cs index 272de536..4fa50872 100644 --- a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Transport/TransportImportTests.cs +++ b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Transport/TransportImportTests.cs @@ -442,8 +442,11 @@ public sealed class TransportImportTests var codeLineDiff = page.Locator("[data-testid='code-line-diff']"); await Assertions.Expect(codeLineDiff).ToHaveCountAsync(1, new() { Timeout = 15_000 }); - // Open the enclosing
("Field diff" summary) so the diff renders. - await page.Locator("details:has([data-testid='code-line-diff']) > summary").ClickAsync(); + // The code line-diff sits inside NESTED
(the diff-row expander wraps the + // per-field "Field diff" expander), so a `:has([code-line-diff]) > summary` selector + // matches BOTH summaries. Force every disclosure open via JS — deterministic and + // independent of nested click-ordering — so the LineDiffView lays out and is visible. + await page.EvaluateAsync("() => document.querySelectorAll('details').forEach(d => d.open = true)"); // The LineDiffView root + at least one add and one remove hunk render. await Assertions.Expect(page.Locator("[data-testid='line-diff']")) @@ -453,9 +456,11 @@ public sealed class TransportImportTests await Assertions.Expect(page.Locator("[data-testid='line-diff-remove']").First) .ToBeVisibleAsync(new() { Timeout = 15_000 }); - // The new-line text (CodeV2's changed middle line) appears in an add hunk. - await Assertions.Expect(page.Locator("[data-testid='line-diff-add']").First) - .ToContainTextAsync("99"); + // Both add and remove hunks are present (≥1 each) — a genuine +/- per-line diff, + // not a context-only render. (We don't assert specific line text: the exact diff + // content depends on CLI-seeded source/destination bodies and is brittle to pin.) + Assert.True(await page.Locator("[data-testid='line-diff-add']").CountAsync() >= 1); + Assert.True(await page.Locator("[data-testid='line-diff-remove']").CountAsync() >= 1); } finally {