Files
Josh StoryandGitHub 5ce6a099bd [Flight] Implement prerender (#30686)
Prerendering in flight is similar to prerendering in Fizz. Instead of
receiving a result (the stream) immediately a promise is returned which
resolves to the stream when the prerender is complete. The promise will
reject if the flight render fatally errors otherwise it will resolve
when the render is completed or is aborted.
2024-08-15 14:28:28 -07:00

30 lines
893 B
JavaScript

import {test, expect} from '@playwright/test';
test('smoke test', async ({page}) => {
const consoleErrors = [];
page.on('console', msg => {
const type = msg.type();
if (type === 'warn' || type === 'error') {
consoleErrors.push({type: type, text: msg.text()});
}
});
const pageErrors = [];
page.on('pageerror', error => {
pageErrors.push(error.stack);
});
await page.goto('/');
await expect(page.getByTestId('promise-as-a-child-test')).toHaveText(
'Promise as a child hydrates without errors: deferred text'
);
await expect(page.getByTestId('prerendered')).not.toBeAttached();
await expect(consoleErrors).toEqual([]);
await expect(pageErrors).toEqual([]);
await page.goto('/prerender');
await expect(page.getByTestId('prerendered')).toBeAttached();
await expect(consoleErrors).toEqual([]);
await expect(pageErrors).toEqual([]);
});