Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix command to run memory-leak test #115

Merged
merged 5 commits into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/source/memory-leak/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down
5 changes: 4 additions & 1 deletion memory-leaks/tests/cell.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
74 changes: 54 additions & 20 deletions tests/jupyterlab/notebook.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,28 @@ const notebookEnv = process.env.BENCHMARK_NOTEBOOKS;
const NOTEBOOK_PACKAGES: Array<string> = 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<string> = 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";
Expand Down Expand Up @@ -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`
);
Expand Down Expand Up @@ -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`
);
Expand Down Expand Up @@ -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`
);
Expand Down Expand Up @@ -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`
);
Expand All @@ -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 () => {
Expand Down