diff --git a/docs/source/memory-leak/index.md b/docs/source/memory-leak/index.md index cbc10cf3..d03a7287 100644 --- a/docs/source/memory-leak/index.md +++ b/docs/source/memory-leak/index.md @@ -19,7 +19,7 @@ jupyter lab --config memory-leaks/jupyter_lab_config.py ``` cd memory-leaks yarn install -yarn build +yarn start-jlab & yarn test:mocha ``` diff --git a/memory-leaks/tests/cell.test.mjs b/memory-leaks/tests/cell.test.mjs index 38c3101f..1295f197 100644 --- a/memory-leaks/tests/cell.test.mjs +++ b/memory-leaks/tests/cell.test.mjs @@ -16,7 +16,10 @@ describe("# Cell memory leaks", () => { }); }); - it("Drag and drop a cell", async () => { + // Currently (as of 2022.09.22) the move cell in JupyterLab is + // not a move motion but a delete-insert action as YJs version + // supporting motion is not yet used. + it.skip("Drag and drop a cell", async () => { await testScenario(moveScenario, { expectations: [ // Code cell diff --git a/tests/jupyterlab/notebook.spec.ts b/tests/jupyterlab/notebook.spec.ts index 6f815671..345ca467 100644 --- a/tests/jupyterlab/notebook.spec.ts +++ b/tests/jupyterlab/notebook.spec.ts @@ -15,28 +15,28 @@ const notebookEnv = process.env.BENCHMARK_NOTEBOOKS; const NOTEBOOK_PACKAGES: Array = notebookEnv ? JSON.parse(notebookEnv) : [ - "codeNotebook", - "mdNotebook", - "largeMetadata", - "largePlotly", - "longOutput", - "manyPlotly", - "manyOutputs", - "errorOutputs", - ]; + "codeNotebook", + "mdNotebook", + "largeMetadata", + "largePlotly", + "longOutput", + "manyPlotly", + "manyOutputs", + "errorOutputs", + ]; // Steps to test const stepsEnv = process.env.BENCHMARK_STEPS; const STEPS: Array = stepsEnv ? JSON.parse(stepsEnv) : [ - "open", - "switch-with-copy", - "switch-with-txt", - "search", - "start-debug", - "close", - ]; + "open", + "switch-with-copy", + "switch-with-txt", + "search", + "start-debug", + "close", + ]; const tmpPath = "test-performance"; const textFile = "lorem_ipsum.txt"; @@ -152,10 +152,17 @@ test.describe("JupyterLab Benchmark", () => { // Check the notebook is correctly opened let panel = await page.$( - '[role="main"] >> .jp-NotebookPanel[aria-labelledby="tab-key-1"]' + '[role="main"] >> .jp-NotebookPanel[aria-labelledby="tab-key-2-1"]' ); + if (!panel) { + panel = await page.$( + '[role="main"] >> .jp-NotebookPanel[aria-labelledby="tab-key-1"]' + ); + } // Get only the document node to avoid noise from kernel and debugger in the toolbar let documentContent = await panel.$(".jp-Notebook"); + // Wait for Plotly figures to resize + await page.waitForTimeout(150); expect(await documentContent.screenshot()).toMatchSnapshot( `${file.replace(".", "-")}.png` ); @@ -208,10 +215,17 @@ test.describe("JupyterLab Benchmark", () => { // Check the notebook is correctly opened panel = await page.$( - '[role="main"] >> .jp-NotebookPanel[aria-labelledby="tab-key-3"]' + '[role="main"] >> .jp-NotebookPanel[aria-labelledby="tab-key-2-3"]' ); + if (!panel) { + panel = await page.$( + '[role="main"] >> .jp-NotebookPanel[aria-labelledby="tab-key-3"]' + ); + } // Get only the document node to avoid noise from kernel and debugger in the toolbar documentContent = await panel.$(".jp-Notebook"); + // Wait for Plotly figures to resize + await page.waitForTimeout(150); expect(await documentContent.screenshot()).toMatchSnapshot( `${file.replace(".", "-")}.png` ); @@ -239,10 +253,17 @@ test.describe("JupyterLab Benchmark", () => { // Check the notebook is correctly opened panel = await page.$( - '[role="main"] >> .jp-NotebookPanel[aria-labelledby="tab-key-1"]' + '[role="main"] >> .jp-NotebookPanel[aria-labelledby="tab-key-2-1"]' ); + if (!panel) { + panel = await page.$( + '[role="main"] >> .jp-NotebookPanel[aria-labelledby="tab-key-1"]' + ); + } // Get only the document node to avoid noise from kernel and debugger in the toolbar documentContent = await panel.$(".jp-Notebook"); + // Wait for Plotly figures to resize + await page.waitForTimeout(150); expect(await documentContent.screenshot()).toMatchSnapshot( `${file.replace(".", "-")}.png` ); @@ -288,10 +309,17 @@ test.describe("JupyterLab Benchmark", () => { // Check the notebook is correctly opened panel = await page.$( - '[role="main"] >> .jp-NotebookPanel[aria-labelledby="tab-key-1"]' + '[role="main"] >> .jp-NotebookPanel[aria-labelledby="tab-key-2-1"]' ); + if (!panel) { + panel = await page.$( + '[role="main"] >> .jp-NotebookPanel[aria-labelledby="tab-key-1"]' + ); + } // Get only the document node to avoid noise from kernel and debugger in the toolbar documentContent = await panel.$(".jp-Notebook"); + // Wait for Plotly figures to resize + await page.waitForTimeout(150); expect(await documentContent.screenshot()).toMatchSnapshot( `${file.replace(".", "-")}.png` ); @@ -318,6 +346,12 @@ test.describe("JupyterLab Benchmark", () => { !(await page.locator('text=Search Cell Outputs >> input[type="checkbox"]').isChecked()) ) { await page.click("text=Search Cell Outputs"); + + // Acknowledge confirmation dialog + const confirmation = await page.locator('.jp-Dialog-footer >> button:has-text("Ok")').count(); + if (confirmation === 1) { + await page.locator('.jp-Dialog-footer >> button:has-text("Ok")').click(); + } } const searchTime = await perf.measure(async () => {