integration: return HTTP 404 for unmatched URLs and close remaining browser-gate gaps

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-25 18:45:28 +02:00
parent 34367181d2
commit 271df12334
8 changed files with 77 additions and 16 deletions

View File

@@ -13,11 +13,16 @@ const CHECKED = [
'/missing-route',
];
const VIEWPORTS = [320, 768, 1024, 1440] as const;
test.describe('layout and crawlability', () => {
test('does not overflow horizontally on checked routes', async ({ page }) => {
for (const path of CHECKED) {
await page.goto(path);
await expectNoOverflow(page);
for (const width of VIEWPORTS) {
await page.setViewportSize({ width, height: 900 });
for (const path of CHECKED) {
await page.goto(path);
await expectNoOverflow(page, path, width);
}
}
});
@@ -33,14 +38,17 @@ test.describe('layout and crawlability', () => {
seen.add(path);
await page.goto(path);
const urls = await page.evaluate(() => {
const { urls, baseURI } = await page.evaluate(() => {
const values = [
...Array.from(document.querySelectorAll('a[href]'), (node) => node.getAttribute('href')),
...Array.from(document.querySelectorAll('[src]'), (node) => node.getAttribute('src')),
];
return values.filter(
(value): value is string => typeof value === 'string' && value.length > 0,
);
return {
baseURI: document.baseURI,
urls: values.filter(
(value): value is string => typeof value === 'string' && value.length > 0,
),
};
});
for (const raw of urls) {
@@ -48,8 +56,8 @@ test.describe('layout and crawlability', () => {
continue;
}
const resolved = new URL(raw, page.url());
if (resolved.origin !== new URL(page.url()).origin) {
const resolved = new URL(raw, baseURI);
if (resolved.origin !== new URL(baseURI).origin) {
continue;
}