diff --git a/ui-tests/playwright.config.js b/ui-tests/playwright.config.js index be93efbd..e537a61c 100644 --- a/ui-tests/playwright.config.js +++ b/ui-tests/playwright.config.js @@ -15,7 +15,12 @@ module.exports = { autoGoto: false, baseURL: 'http://localhost:3000', trace: 'retain-on-failure', - video: 'retain-on-failure' + video: 'retain-on-failure', + screenshot: 'only-on-failure', + // Capture browser console logs + launchOptions: { + args: process.env.CI ? ['--disable-dev-shm-usage'] : [] + } }, webServer: { command: 'jlpm start', diff --git a/ui-tests/tests/jupytereverywhere.spec.ts b/ui-tests/tests/jupytereverywhere.spec.ts index 195ea69f..b253fbed 100644 --- a/ui-tests/tests/jupytereverywhere.spec.ts +++ b/ui-tests/tests/jupytereverywhere.spec.ts @@ -1044,12 +1044,33 @@ test.describe('Kernel Switching', () => { }); test('Should switch to R kernel and run R code', async ({ page }) => { + const consoleMessages: string[] = []; + const pageErrors: string[] = []; + + page.on('console', msg => { + const text = `[${msg.type()}] ${msg.text()}`; + consoleMessages.push(text); + console.log(text); + }); + + page.on('pageerror', error => { + const errorText = `Page error: ${error.message}\n${error.stack}`; + pageErrors.push(errorText); + console.error(errorText); + }); + + page.on('crash', () => { + console.error('PAGE CRASHED!'); + }); + await page.goto('lab/index.html'); await page.waitForSelector('.jp-NotebookPanel'); + // Wait for Python kernel to fully initialise + await page.waitForTimeout(30000); + await runCommand(page, 'jupytereverywhere:switch-kernel', { kernel: 'xr' }); - await page.waitForTimeout(10000); - await runCommand(page, 'notebook:insert-cell-below'); + await page.waitForTimeout(30000); const code = 'lm(mpg ~ wt + hp + disp + cyl, data=mtcars)'; const cell = page.locator('.jp-Cell').last(); @@ -1074,6 +1095,25 @@ test.describe('Kernel networking', () => { const expectedContent = 'col1'; test('R kernel should be able to fetch from a remote URL', async ({ page }) => { + const consoleMessages: string[] = []; + const pageErrors: string[] = []; + + page.on('console', msg => { + const text = `[${msg.type()}] ${msg.text()}`; + consoleMessages.push(text); + console.log(text); + }); + + page.on('pageerror', error => { + const errorText = `Page error: ${error.message}\n${error.stack}`; + pageErrors.push(errorText); + console.error(errorText); + }); + + page.on('crash', () => { + console.error('PAGE CRASHED!'); + }); + await page.goto('lab/index.html?kernel=r'); await page.waitForSelector('.jp-NotebookPanel');