rsnext/test/e2e/pages-performance-mark/index.test.ts
Jiachi Liu 28ef2473af
Fix performance measures crashing the app (#54858)
There're various of cases would cause the `beforeRender` performance mark is not existed in the performance entries, learned from the issues description. We have to check if that mark is existed.

This PR also refactors all the mark names and measurement names into constants so that we won't easily mistype them


Fixes #20743
Fixes #40903
Fixes #47560

Co-authored-by: Balázs Orbán <18369201+balazsorban44@users.noreply.github.com>
2023-09-01 14:51:38 +00:00

17 lines
538 B
TypeScript

import { createNextDescribe } from 'e2e-utils'
// This test case doesn't indicate rendering duplicate head in _document is valid,
// but it's a way to reproduce the performance mark crashing.
createNextDescribe(
'pages performance mark',
{
files: __dirname,
skipDeployment: true,
},
({ next }) => {
it('should render the page correctly without crashing with performance mark', async () => {
const browser = await next.browser('/')
expect(await browser.elementByCss('h1').text()).toBe('home')
})
}
)