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

New way to hide output panel for tests #16311

Merged
merged 3 commits into from
Dec 17, 2024
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
9 changes: 8 additions & 1 deletion src/test/datascience/widgets/commUtils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { NotebookCell, NotebookEditor, NotebookRendererMessaging, notebooks } from 'vscode';
import { commands, NotebookCell, NotebookEditor, NotebookRendererMessaging, notebooks } from 'vscode';
import { dispose } from '../../../platform/common/utils/lifecycle';
import { logger } from '../../../platform/logging';
import { IDisposable } from '../../../platform/common/types';
Expand Down Expand Up @@ -124,3 +124,10 @@ export class Utils {
});
}
}

export async function hideOutputPanel() {
// Work around for the removal of the command `workbench.action.closePanel`.
// await commands.executeCommand('workbench.action.terminal.killAll');
await commands.executeCommand('workbench.action.problems.focus');
await commands.executeCommand('workbench.action.togglePanel');
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
waitForExecutionCompletedSuccessfully,
waitForTextOutput
} from '../notebook/helper';
import { initializeWidgetComms, Utils } from './commUtils';
import { hideOutputPanel, initializeWidgetComms, Utils } from './commUtils';
import { WidgetRenderingTimeoutForTests } from './constants';
import { getTextOutputValue } from '../../../kernels/execution/helpers';
import { isWeb } from '../../../platform/common/utils/misc';
Expand Down Expand Up @@ -128,7 +128,7 @@ suite('Standard IPyWidget Tests @widgets', function () {
// Widgets get rendered only when the output is in view. If we have a very large notebook
// and the output is not visible, then it will not get rendered & the tests will fail. The tests inspect the rendered HTML.
// Solution - maximize available real-estate by hiding the output panels & hiding the input cells.
await commands.executeCommand('workbench.action.closePanel');
await hideOutputPanel();
await commands.executeCommand('workbench.action.maximizeEditorHideSidebar');
await commands.executeCommand('notebook.cell.collapseAllCellInputs');
comms = await initializeWidgetComms(disposables);
Expand All @@ -142,7 +142,7 @@ suite('Standard IPyWidget Tests @widgets', function () {
await startJupyterServer();
logger.info(`Start Test (completed) ${this.currentTest?.title}`);
// With less realestate, the outputs might not get rendered (VS Code optimization to avoid rendering if not in viewport).
await commands.executeCommand('workbench.action.closePanel');
await hideOutputPanel();
});
teardown(async function () {
logger.info(`Ended Test ${this.currentTest?.title}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
initializeNotebookForWidgetTest
} from './standardWidgets.vscode.common.test';
import { GlobalStateKeyToTrackIfUserConfiguredCDNAtLeastOnce } from '../../../notebooks/controllers/ipywidgets/scriptSourceProvider/cdnWidgetScriptSourceProvider';
import { initializeWidgetComms, Utils } from './commUtils';
import { hideOutputPanel, initializeWidgetComms, Utils } from './commUtils';
import { isWeb } from '../../../platform/common/utils/misc';

[true, false].forEach((useCDN) => {
Expand Down Expand Up @@ -71,7 +71,7 @@ import { isWeb } from '../../../platform/common/utils/misc';
// Widgets get rendered only when the output is in view. If we have a very large notebook
// and the output is not visible, then it will not get rendered & the tests will fail. The tests inspect the rendered HTML.
// Solution - maximize available real-estate by hiding the output panels & hiding the input cells.
await commands.executeCommand('workbench.action.closePanel');
await hideOutputPanel();
await commands.executeCommand('workbench.action.maximizeEditorHideSidebar');
comms = await initializeWidgetComms(disposables);

Expand All @@ -83,7 +83,7 @@ import { isWeb } from '../../../platform/common/utils/misc';
sinon.restore();
logger.info(`Start Test (completed) ${this.currentTest?.title}`);
// With less real estate, the outputs might not get rendered (VS Code optimization to avoid rendering if not in viewport).
await commands.executeCommand('workbench.action.closePanel');
await hideOutputPanel();
});
teardown(async function () {
logger.info(`Ended Test ${this.currentTest?.title}`);
Expand Down
Loading