| 1 |
/* |
| 2 |
* Copyright (c) Jupyter Development Team. |
| 3 |
* Distributed under the terms of the Modified BSD License. |
| 4 |
*/ |
| 5 |
|
| 6 |
import { ConsoleMessage, expect, test } from '@playwright/test'; |
| 7 |
|
| 8 |
const URL = `file://${process.cwd()}/index.html`; |
| 9 |
|
| 10 |
test.setTimeout(120000); |
| 11 |
|
| 12 |
test('should load the example', async ({ page }) => { |
| 13 |
console.info('Navigating to page:', URL); |
| 14 |
let success = true; |
| 15 |
|
| 16 |
const handleMessage = async (msg: ConsoleMessage) => { |
| 17 |
if (msg.type() === 'error') { |
| 18 |
console.log('Error: ', msg.text()); |
| 19 |
success = false; |
| 20 |
} |
| 21 |
}; |
| 22 |
|
| 23 |
page.on('console', handleMessage); |
| 24 |
|
| 25 |
await page.goto(URL); |
| 26 |
|
| 27 |
await page.waitForLoadState('networkidle'); |
| 28 |
|
| 29 |
expect(success).toEqual(true); |
| 30 |
}); |