mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 04:32:42 +00:00
Assert the settings heading that the width actually shows
The shell renders the heading pair twice under distinct ids, one column hidden below the medium breakpoint and one hidden above it, so exactly one is ever on screen. The spec asserted the desktop id alone: green on the wide project, red on the narrow one against a heading that is hidden by design. It now follows whichever of the two the viewport reveals, and asserts that exactly one is visible, so a real duplicate would still fail.
This commit is contained in:
1 parent
b85a348891
commit
5424ab0b60
1 file changed
+14
-3
@@ -101,10 +101,21 @@ test.describe("Settings → Health Score", () => {
|
||||
await settleBeforeMeasure(page, card);
|
||||
|
||||
// The heading + subheading pair the settings IA requires, owned by the
|
||||
// shell and not re-declared inside the card.
|
||||
await expect(page.locator("#settings-section-score-title")).toBeVisible();
|
||||
// shell and not re-declared inside the card. The shell renders the pair
|
||||
// twice under distinct ids — `…-title` inside a `hidden md:block` column
|
||||
// and `…-title-mobile` inside an `md:hidden` one — so exactly one of them
|
||||
// is on screen at any width. Asserting the desktop id alone passed on the
|
||||
// wide project and failed on the narrow one against a heading that is
|
||||
// hidden by design.
|
||||
const heading = page
|
||||
.locator(
|
||||
"#settings-section-score-title, #settings-section-score-title-mobile",
|
||||
)
|
||||
.filter({ has: page.locator(":scope:visible") });
|
||||
await expect(heading).toHaveCount(1);
|
||||
await expect(heading.first()).toBeVisible();
|
||||
await expect(
|
||||
page.locator("#settings-section-score-title + p"),
|
||||
heading.first().locator("xpath=following-sibling::p[1]"),
|
||||
).toBeVisible();
|
||||
|
||||
// One concept, one card. A second card beside it would be the
|
||||
|
||||
Reference in new issue
Block a user