Skip to content

Commit 0d5a12e

Browse files
committed
New way to hide output panel for tests
1 parent 3fe87cd commit 0d5a12e

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

src/test/datascience/widgets/commUtils.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4-
import { NotebookCell, NotebookEditor, NotebookRendererMessaging, notebooks } from 'vscode';
4+
import { commands, NotebookCell, NotebookEditor, NotebookRendererMessaging, notebooks } from 'vscode';
55
import { dispose } from '../../../platform/common/utils/lifecycle';
66
import { logger } from '../../../platform/logging';
77
import { IDisposable } from '../../../platform/common/types';
@@ -124,3 +124,10 @@ export class Utils {
124124
});
125125
}
126126
}
127+
128+
export async function hideOutputPanel(){
129+
// Work around for the removal of the command `workbench.action.closePanel`.
130+
await commands.executeCommand('workbench.action.terminal.killAll');
131+
// await commands.executeCommand('workbench.action.terminal.new');
132+
// await commands.executeCommand('workbench.action.togglePanel');
133+
}

src/test/datascience/widgets/standardWidgets.vscode.common.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import {
3434
waitForExecutionCompletedSuccessfully,
3535
waitForTextOutput
3636
} from '../notebook/helper';
37-
import { initializeWidgetComms, Utils } from './commUtils';
37+
import { hideOutputPanel, initializeWidgetComms, Utils } from './commUtils';
3838
import { WidgetRenderingTimeoutForTests } from './constants';
3939
import { getTextOutputValue } from '../../../kernels/execution/helpers';
4040
import { isWeb } from '../../../platform/common/utils/misc';
@@ -128,7 +128,7 @@ suite('Standard IPyWidget Tests @widgets', function () {
128128
// Widgets get rendered only when the output is in view. If we have a very large notebook
129129
// and the output is not visible, then it will not get rendered & the tests will fail. The tests inspect the rendered HTML.
130130
// Solution - maximize available real-estate by hiding the output panels & hiding the input cells.
131-
await commands.executeCommand('workbench.action.closePanel');
131+
await hideOutputPanel();
132132
await commands.executeCommand('workbench.action.maximizeEditorHideSidebar');
133133
await commands.executeCommand('notebook.cell.collapseAllCellInputs');
134134
comms = await initializeWidgetComms(disposables);
@@ -142,7 +142,7 @@ suite('Standard IPyWidget Tests @widgets', function () {
142142
await startJupyterServer();
143143
logger.info(`Start Test (completed) ${this.currentTest?.title}`);
144144
// With less realestate, the outputs might not get rendered (VS Code optimization to avoid rendering if not in viewport).
145-
await commands.executeCommand('workbench.action.closePanel');
145+
await hideOutputPanel();
146146
});
147147
teardown(async function () {
148148
logger.info(`Ended Test ${this.currentTest?.title}`);

src/test/datascience/widgets/thirdpartyWidgets.vscode.common.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import {
3232
initializeNotebookForWidgetTest
3333
} from './standardWidgets.vscode.common.test';
3434
import { GlobalStateKeyToTrackIfUserConfiguredCDNAtLeastOnce } from '../../../notebooks/controllers/ipywidgets/scriptSourceProvider/cdnWidgetScriptSourceProvider';
35-
import { initializeWidgetComms, Utils } from './commUtils';
35+
import { hideOutputPanel, initializeWidgetComms, Utils } from './commUtils';
3636
import { isWeb } from '../../../platform/common/utils/misc';
3737

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

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

0 commit comments

Comments
 (0)