diff --git a/src/test/datascience/widgets/commUtils.ts b/src/test/datascience/widgets/commUtils.ts index da99a00b70b..75dbff10c4b 100644 --- a/src/test/datascience/widgets/commUtils.ts +++ b/src/test/datascience/widgets/commUtils.ts @@ -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'; @@ -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'); +} diff --git a/src/test/datascience/widgets/standardWidgets.vscode.common.test.ts b/src/test/datascience/widgets/standardWidgets.vscode.common.test.ts index 6b727f71030..fe3aca60431 100644 --- a/src/test/datascience/widgets/standardWidgets.vscode.common.test.ts +++ b/src/test/datascience/widgets/standardWidgets.vscode.common.test.ts @@ -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'; @@ -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); @@ -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}`); diff --git a/src/test/datascience/widgets/thirdpartyWidgets.vscode.common.test.ts b/src/test/datascience/widgets/thirdpartyWidgets.vscode.common.test.ts index 1fb7fd4632d..e2cfcccb889 100644 --- a/src/test/datascience/widgets/thirdpartyWidgets.vscode.common.test.ts +++ b/src/test/datascience/widgets/thirdpartyWidgets.vscode.common.test.ts @@ -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) => { @@ -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); @@ -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}`);