Skip to content

e2e: accept site JSON-LD alongside WebApplication block - #278

Merged
manav4u merged 2 commits into
mainfrom
fix/landing-jsonld-e2e
Nov 7, 2026
Merged

manav4u merged 2 commits into
mainfrom
fix/landing-jsonld-e2e

Conversation

@manav4u

@manav4u manav4u commented Nov 7, 2026

Copy link
Copy Markdown
Owner

What

Updates one e2e expectation in e2e/landing.spec.ts ("ships WebApplication JSON-LD"). Test-only change; no app, landing, or workflow code touched.

Why

PR #275 (5 Nov) intentionally added a site-wide @graph JSON-LD block to the prerendered landing, so the page now ships two application/ld+json scripts: the original WebApplication block and the new site graph. This test still expected exactly one, and has failed in CI since (PR checks run 174 on #275 failed the same way; every main build since carries both blocks).

Evidence, reproduced locally against the production build (npm run build + npm run preview):

The WebApplication block itself is unchanged and still present; this only stops the test from rejecting the intentional second block.

PR #275 added a second site-wide @graph JSON-LD block to the prerendered landing, but this test still expected exactly one ld+json script. It has failed in CI since (run 174). The test now parses all ld+json blocks and asserts one of them is WebApplication. Verified locally: old test fails with Expected 1 / Received 2 against the production build; the updated test passes.
Strengthen instead of just relaxing: all ld+json blocks must parse (malformed JSON fails), exactly one WebApplication block is required (duplicates fail), and @context, name, https url and applicationCategory must be present. Verified locally against the production build: passes on current output, fails on a duplicated WebApplication block, fails on malformed JSON.
@manav4u

manav4u commented Nov 7, 2026

Copy link
Copy Markdown
Owner Author

Amended to strengthen the assertions rather than only relax them. The test now requires:

  • every application/ld+json block to be valid JSON (a malformed block fails via JSON.parse);
  • exactly one WebApplication block (a duplicate fails);
  • @context = https://schema.org, a truthy name, an https:// url, and a truthy applicationCategory.

Verified locally against the production build (npm run build + preview, system Chrome, mobile + desktop projects): all 6 landing tests pass. Negative checks: with a duplicated WebApplication block the test fails ("landing ships exactly one WebApplication JSON-LD block"); with a truncated JSON block it fails (SyntaxError). The pre-amend failure mode (Expected 1 / Received 2 on current main output) still reproduces with the old test.

@manav4u
manav4u marked this pull request as ready for review November 7, 2026 17:51
@manav4u
manav4u merged commit 8ac04e1 into main Nov 7, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant