From 708928b2f067754eeb6c78603aca94e6b3e46dbe Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Thu, 6 Oct 2022 10:26:56 +0200 Subject: [PATCH] Try resize workaround in tests for now Fix order of selectors --- ui-tests/test/mobile.spec.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/ui-tests/test/mobile.spec.ts b/ui-tests/test/mobile.spec.ts index 229606088..fd4eb17dc 100644 --- a/ui-tests/test/mobile.spec.ts +++ b/ui-tests/test/mobile.spec.ts @@ -6,9 +6,10 @@ import path from 'path'; import { expect } from '@playwright/test'; import { test } from './fixtures'; + import { waitForKernelReady } from './utils'; -test.use({ autoGoto: false, viewport: { width: 524, height: 800 } }); +test.use({ autoGoto: false }); test.describe('Mobile', () => { test('The layout should be more compact on the file browser page', async ({ @@ -16,7 +17,13 @@ test.describe('Mobile', () => { tmpPath }) => { await page.goto(`tree/${tmpPath}`); + + // temporary workaround to trigger a toolbar resize + // TODO: investigate in https://github.com/jupyter/notebook/issues/6553 + await page.setViewportSize({ width: 524, height: 800 }); + await page.waitForSelector('#top-panel-wrapper', { state: 'hidden' }); + expect(await page.screenshot()).toMatchSnapshot('tree.png'); }); @@ -30,12 +37,14 @@ test.describe('Mobile', () => { `${tmpPath}/${notebook}` ); await page.goto(`notebooks/${tmpPath}/${notebook}`); - // TODO: investigate why this does not run the cells in Jupyter Notebook - // await page.notebook.run(); // wait for the kernel status animations to be finished await waitForKernelReady(page); + // temporary workaround to trigger a toolbar resize + // TODO: investigate in https://github.com/jupyter/notebook/issues/6553 + await page.setViewportSize({ width: 524, height: 800 }); + // force switching back to command mode to avoid capturing the cursor in the screenshot await page.evaluate(async () => { await window.jupyterapp.commands.execute('notebook:enter-command-mode');