From a552dafb51bc56f83d10cd0069eb2e4176cd2ab2 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Thu, 19 Nov 2026 10:38:51 -0800 Subject: [PATCH] fix(seo): parse headings in the live landing check --- apps/sim/scripts/test-landing-seo-e2e.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/sim/scripts/test-landing-seo-e2e.ts b/apps/sim/scripts/test-landing-seo-e2e.ts index 23c7fe58d1b..8ed5598a459 100644 --- a/apps/sim/scripts/test-landing-seo-e2e.ts +++ b/apps/sim/scripts/test-landing-seo-e2e.ts @@ -9,6 +9,7 @@ import integrationsJson from '@sim/deployment-config/integrations.json' import { createLogger } from '@sim/logger' import { getErrorMessage } from '@sim/utils/errors' import { SIM_SITE_URL } from '@sim/utils/site' +import { load } from 'cheerio' import matter from 'gray-matter' import { dustProfile, @@ -191,9 +192,11 @@ async function run() { for (const directive of [...robotsDirectives(body), headers.get('x-robots-tag') ?? '']) { assert.doesNotMatch(directive, /\b(?:noindex|none)\b/i) } - const headings = [...body.matchAll(/]*>(.*?)<\/h1>/gs)] + const $ = load(body) + $('template').remove() + const headings = $('h1') assert.equal(headings.length, 1, 'HTML does not have exactly one H1') - assert(headings[0]?.[1].replace(/<[^>]*>/g, '').trim(), 'H1 has no text') + assert(headings.prop('innerText')?.trim(), 'H1 has no text') }) } return