main
js 29 lines 893 Bytes
Raw
1 import {test, expect} from '@playwright/test';
2
3 test('smoke test', async ({page}) => {
4 const consoleErrors = [];
5 page.on('console', msg => {
6 const type = msg.type();
7 if (type === 'warn' || type === 'error') {
8 consoleErrors.push({type: type, text: msg.text()});
9 }
10 });
11 const pageErrors = [];
12 page.on('pageerror', error => {
13 pageErrors.push(error.stack);
14 });
15 await page.goto('/');
16 await expect(page.getByTestId('promise-as-a-child-test')).toHaveText(
17 'Promise as a child hydrates without errors: deferred text'
18 );
19 await expect(page.getByTestId('prerendered')).not.toBeAttached();
20
21 await expect(consoleErrors).toEqual([]);
22 await expect(pageErrors).toEqual([]);
23
24 await page.goto('/prerender');
25 await expect(page.getByTestId('prerendered')).toBeAttached();
26
27 await expect(consoleErrors).toEqual([]);
28 await expect(pageErrors).toEqual([]);
29 });