Skip to content

Commit a552daf

Browse files
committed
fix(seo): parse headings in the live landing check
1 parent 57fa18e commit a552daf

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎apps/sim/scripts/test-landing-seo-e2e.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import integrationsJson from '@sim/deployment-config/integrations.json'
99
import { createLogger } from '@sim/logger'
1010
import { getErrorMessage } from '@sim/utils/errors'
1111
import { SIM_SITE_URL } from '@sim/utils/site'
12+
import { load } from 'cheerio'
1213
import matter from 'gray-matter'
1314
import {
1415
dustProfile,
@@ -191,9 +192,11 @@ async function run() {
191192
for (const directive of [...robotsDirectives(body), headers.get('x-robots-tag') ?? '']) {
192193
assert.doesNotMatch(directive, /\b(?:noindex|none)\b/i)
193194
}
194-
const headings = [...body.matchAll(/<h1\b[^>]*>(.*?)<\/h1>/gs)]
195+
const $ = load(body)
196+
$('template').remove()
197+
const headings = $('h1')
195198
assert.equal(headings.length, 1, 'HTML does not have exactly one H1')
196-
assert(headings[0]?.[1].replace(/<[^>]*>/g, '').trim(), 'H1 has no text')
199+
assert(headings.prop('innerText')?.trim(), 'H1 has no text')
197200
})
198201
}
199202
return

0 commit comments

Comments
 (0)