Merge pull request 'Fixes a race in the 404 hydration test' (#15) from fix/404-hydration-h1 into master
Reviewed-on: #15
This commit was merged in pull request #15.
This commit is contained in:
@@ -44,10 +44,18 @@ describe.each(widths)('hydratatie op %i px', (width) => {
|
|||||||
expect(opened.violations).toEqual([]);
|
expect(opened.violations).toEqual([]);
|
||||||
|
|
||||||
// Na de hydratatie nog steeds één titel en hoogstens één robots (V11)
|
// Na de hydratatie nog steeds één titel en hoogstens één robots (V11)
|
||||||
|
// en één kop 1 voor wie de pagina ziet of hoort. Op een 404 staat
|
||||||
|
// er een tijdje (tot pendingMinMs, 0,5 s) naast de echte kop een
|
||||||
|
// kopie van de serverpagina in een display:none-sectie: die ziet
|
||||||
|
// en hoort niemand, maar querySelectorAll telt hem wel mee.
|
||||||
const counts = await page.evaluate(() => ({
|
const counts = await page.evaluate(() => ({
|
||||||
titles: document.querySelectorAll('title').length,
|
titles: document.querySelectorAll('title').length,
|
||||||
robots: document.querySelectorAll('meta[name="robots"]').length,
|
robots: document.querySelectorAll('meta[name="robots"]').length,
|
||||||
h1: document.querySelectorAll('h1').length,
|
h1: [...document.querySelectorAll('h1')].filter(
|
||||||
|
(heading) =>
|
||||||
|
heading.checkVisibility() &&
|
||||||
|
!heading.closest('[aria-hidden="true"]'),
|
||||||
|
).length,
|
||||||
}));
|
}));
|
||||||
const noindex =
|
const noindex =
|
||||||
notFoundPaths.includes(path) || path === '/privacyverklaring';
|
notFoundPaths.includes(path) || path === '/privacyverklaring';
|
||||||
@@ -56,6 +64,10 @@ describe.each(widths)('hydratatie op %i px', (width) => {
|
|||||||
robots: noindex ? 1 : 0,
|
robots: noindex ? 1 : 0,
|
||||||
h1: 1,
|
h1: 1,
|
||||||
});
|
});
|
||||||
|
// Is de wissel klaar, dan is ook de verborgen kopie weg
|
||||||
|
await eventually(() =>
|
||||||
|
page.evaluate(() => document.querySelectorAll('h1').length),
|
||||||
|
).toBe(1);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user