From 317400a4fe4130b4f1b30b73a5fe013d013b34df Mon Sep 17 00:00:00 2001 From: Ian Huff Date: Wed, 3 Feb 2021 10:47:37 -0800 Subject: [PATCH 01/10] working doc switch test --- .vscode/launch.json | 3 +- src/test/constants.ts | 3 +- .../variableView/variableView.vscode.test.ts | 135 ++++++++++++++++++ 3 files changed, 139 insertions(+), 2 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 9c80c29f401..6d89c0a4c8a 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -201,7 +201,8 @@ "--extensionTestsPath=${workspaceFolder}/out/test" ], "env": { - "VSC_JUPYTER_CI_TEST_GREP": "VSCode Notebook", // Leave as `VSCode Notebook` to run only Notebook tests. + "XVSC_JUPYTER_CI_TEST_GREP": "VSCode Notebook", // Leave as `VSCode Notebook` to run only Notebook tests. + "VSC_JUPYTER_CI_TEST_GREP": "VariableView", // Leave as `VSCode Notebook` to run only Notebook tests. "VSC_JUPYTER_CI_TEST_INVERT_GREP": "", // Initialize this to invert the grep (exclude tests with value defined in grep). "CI_PYTHON_PATH": "", // Update with path to real python interpereter used for testing. "VSC_FORCE_REAL_JUPYTER": "true", // Enalbe tests that require Jupyter. diff --git a/src/test/constants.ts b/src/test/constants.ts index fe101b40c18..5f21a52e655 100644 --- a/src/test/constants.ts +++ b/src/test/constants.ts @@ -7,7 +7,8 @@ import { IS_CI_SERVER, IS_CI_SERVER_TEST_DEBUGGER } from './ciConstants'; // Activating extension for Multiroot and Debugger CI tests for Windows takes just over 2 minutes sometimes, so 3 minutes seems like a safe margin export const MAX_EXTENSION_ACTIVATION_TIME = 180_000; export const TEST_TIMEOUT = 25000; -export const TEST_RETRYCOUNT = 3; +//export const TEST_RETRYCOUNT = 3; +export const TEST_RETRYCOUNT = 0; export const IS_SMOKE_TEST = process.env.VSC_JUPYTER_SMOKE_TEST === '1'; export const IS_PERF_TEST = process.env.VSC_JUPYTER_PERF_TEST === '1'; export const IS_REMOTE_NATIVE_TEST = (process.env.VSC_JUPYTER_REMOTE_NATIVE_TEST || '').toLowerCase() === 'true'; diff --git a/src/test/datascience/variableView/variableView.vscode.test.ts b/src/test/datascience/variableView/variableView.vscode.test.ts index 66a61041564..c4cccff58ae 100644 --- a/src/test/datascience/variableView/variableView.vscode.test.ts +++ b/src/test/datascience/variableView/variableView.vscode.test.ts @@ -24,6 +24,7 @@ import { InteractiveWindowMessages } from '../../../client/datascience/interacti import { verifyViewVariables } from './variableViewHelpers'; import { ITestVariableViewProvider } from './variableViewTestInterfaces'; import { ITestWebviewHost } from '../testInterfaces'; +import { sleep } from '../../core'; suite('DataScience - VariableView', () => { let api: IExtensionTestApi; @@ -70,6 +71,7 @@ suite('DataScience - VariableView', () => { // Test showing the basic variable view with a value or two test('Can show VariableView (webview-test)', async function () { + return this.skip(); // Add one simple cell and execute it await insertCodeCell('test = "MYTESTVALUE"', { index: 0 }); const cell = vscodeNotebook.activeNotebookEditor?.document.cells![0]!; @@ -104,4 +106,137 @@ suite('DataScience - VariableView', () => { ]; verifyViewVariables(expectedVariables, htmlResult); }); + + test('Variable view document switching (webview-test)', async function () { + this.timeout(60_000); + // Add one simple cell and execute it + await insertCodeCell('test = "MYTESTVALUE"', { index: 0 }); + const cell = vscodeNotebook.activeNotebookEditor?.document.cells![0]!; + await runCell(cell); + await waitForExecutionCompletedSuccessfully(cell); + + // Send the command to open the view + await commandManager.executeCommand(Commands.OpenVariableView); + + // Aquire the variable view from the provider + const coreVariableView = await variableViewProvider.activeVariableView; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const variableView = (coreVariableView as any) as ITestWebviewHost; + + // Add our message listener + const onMessageListener = new OnMessageListener(variableView); + + // Wait until our VariablesComplete message to see that we have the new variables and have rendered them + await onMessageListener.waitForMessage(InteractiveWindowMessages.VariablesComplete); + + const htmlResult = await variableView?.getHTMLById('variable-view-main-panel'); + + // Parse the HTML for our expected variables + const expectedVariables = [{ name: 'test', type: 'str', length: '11', value: ' MYTESTVALUE' }]; + verifyViewVariables(expectedVariables, htmlResult); + + // Now create a second document + await createEmptyPythonNotebook(disposables); + + // Execute a cell on the second document + await insertCodeCell('test2 = "MYTESTVALUE2"', { index: 0 }); + const cell2 = vscodeNotebook.activeNotebookEditor?.document.cells![0]!; + await runCell(cell2); + await waitForExecutionCompletedSuccessfully(cell2); + + // Because this document was not open, we need to open the variable view again + await commandManager.executeCommand(Commands.OpenVariableView); + + // Aquire the variable view from the provider + const coreVariableView2 = await variableViewProvider.activeVariableView; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const variableView2 = (coreVariableView2 as any) as ITestWebviewHost; + + // Add our message listener + const onMessageListener2 = new OnMessageListener(variableView2); + + // Execute a second cell on the second document + await insertCodeCell('test3 = "MYTESTVALUE3"', { index: 1 }); + const cell3 = vscodeNotebook.activeNotebookEditor?.document.cells![1]!; + await runCell(cell3); + await waitForExecutionCompletedSuccessfully(cell3); + + // Wait until our VariablesComplete message to see that we have the new variables and have rendered them + await onMessageListener2.waitForMessage(InteractiveWindowMessages.VariablesComplete); + + const htmlResult2 = await variableView2?.getHTMLById('variable-view-main-panel'); + + // Parse the HTML for our expected variables + const expectedVariables2 = [ + { name: 'test2', type: 'str', length: '12', value: ' MYTESTVALUE2' }, + { name: 'test3', type: 'str', length: '12', value: ' MYTESTVALUE3' } + ]; + verifyViewVariables(expectedVariables2, htmlResult2); + // Change back to the first document + }); + + // Variable change between two documents + test('Variable view document switching (webview-test)', async function () { + return this.skip(); + this.timeout(60_000); + // Add one simple cell and execute it + await insertCodeCell('test = "MYTESTVALUE"', { index: 0 }); + const cell = vscodeNotebook.activeNotebookEditor?.document.cells![0]!; + await runCell(cell); + await waitForExecutionCompletedSuccessfully(cell); + + // Send the command to open the view + await commandManager.executeCommand(Commands.OpenVariableView); + + // Aquire the variable view from the provider + const coreVariableView = await variableViewProvider.activeVariableView; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const variableView = (coreVariableView as any) as ITestWebviewHost; + + // Add our message listener + const onMessageListener = new OnMessageListener(variableView); + + // Wait until our VariablesComplete message to see that we have the new variables and have rendered them + await onMessageListener.waitForMessage(InteractiveWindowMessages.VariablesComplete); + + const htmlResult = await variableView?.getHTMLById('variable-view-main-panel'); + + // Parse the HTML for our expected variables + const expectedVariables = [{ name: 'test', type: 'str', length: '11', value: ' MYTESTVALUE' }]; + verifyViewVariables(expectedVariables, htmlResult); + + // Now create a second document + await createEmptyPythonNotebook(disposables); + + // Execute a cell on the second document + await insertCodeCell('test2 = "MYTESTVALUE2"', { index: 0 }); + const cell2 = vscodeNotebook.activeNotebookEditor?.document.cells![0]!; + await runCell(cell2); + await waitForExecutionCompletedSuccessfully(cell2); + + // Send the command to open the view + await commandManager.executeCommand(Commands.OpenVariableView); + + const coreVariableView2 = await variableViewProvider.activeVariableView; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const variableView2 = (coreVariableView2 as any) as ITestWebviewHost; + + // We have to create a second message listener? + const onMessageListener2 = new OnMessageListener(variableView2); + + // Wait until our VariablesComplete message to see that we have the new variables and have rendered them + await onMessageListener2.waitForMessage(InteractiveWindowMessages.VariablesComplete); + + const htmlResult2 = await variableView2?.getHTMLById('variable-view-main-panel'); + + // Parse the HTML for our expected variables + const expectedVariables2 = [{ name: 'test2', type: 'str', length: '12', value: ' MYTESTVALUE2' }]; + verifyViewVariables(expectedVariables2, htmlResult2); + + //await sleep(5_000); + // Change back to the first document + }); + + // Long list of variables loads + // Open data viewer? }); From 4a90015659c10d930037318804f5129ec44b3b6d Mon Sep 17 00:00:00 2001 From: Ian Huff Date: Fri, 5 Feb 2021 15:59:04 -0800 Subject: [PATCH 02/10] more test code added --- .../variableView/variableView.vscode.test.ts | 66 +------------------ 1 file changed, 2 insertions(+), 64 deletions(-) diff --git a/src/test/datascience/variableView/variableView.vscode.test.ts b/src/test/datascience/variableView/variableView.vscode.test.ts index c4cccff58ae..d00fec9f6a8 100644 --- a/src/test/datascience/variableView/variableView.vscode.test.ts +++ b/src/test/datascience/variableView/variableView.vscode.test.ts @@ -47,7 +47,7 @@ suite('DataScience - VariableView', () => { return this.skip(); } await trustAllNotebooks(); - await prewarmNotebooks(); + //await prewarmNotebooks(); sinon.restore(); commandManager = api.serviceContainer.get(ICommandManager); const coreVariableViewProvider = api.serviceContainer.get(IVariableViewProvider); @@ -71,7 +71,7 @@ suite('DataScience - VariableView', () => { // Test showing the basic variable view with a value or two test('Can show VariableView (webview-test)', async function () { - return this.skip(); + //return this.skip(); // Add one simple cell and execute it await insertCodeCell('test = "MYTESTVALUE"', { index: 0 }); const cell = vscodeNotebook.activeNotebookEditor?.document.cells![0]!; @@ -175,68 +175,6 @@ suite('DataScience - VariableView', () => { // Change back to the first document }); - // Variable change between two documents - test('Variable view document switching (webview-test)', async function () { - return this.skip(); - this.timeout(60_000); - // Add one simple cell and execute it - await insertCodeCell('test = "MYTESTVALUE"', { index: 0 }); - const cell = vscodeNotebook.activeNotebookEditor?.document.cells![0]!; - await runCell(cell); - await waitForExecutionCompletedSuccessfully(cell); - - // Send the command to open the view - await commandManager.executeCommand(Commands.OpenVariableView); - - // Aquire the variable view from the provider - const coreVariableView = await variableViewProvider.activeVariableView; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const variableView = (coreVariableView as any) as ITestWebviewHost; - - // Add our message listener - const onMessageListener = new OnMessageListener(variableView); - - // Wait until our VariablesComplete message to see that we have the new variables and have rendered them - await onMessageListener.waitForMessage(InteractiveWindowMessages.VariablesComplete); - - const htmlResult = await variableView?.getHTMLById('variable-view-main-panel'); - - // Parse the HTML for our expected variables - const expectedVariables = [{ name: 'test', type: 'str', length: '11', value: ' MYTESTVALUE' }]; - verifyViewVariables(expectedVariables, htmlResult); - - // Now create a second document - await createEmptyPythonNotebook(disposables); - - // Execute a cell on the second document - await insertCodeCell('test2 = "MYTESTVALUE2"', { index: 0 }); - const cell2 = vscodeNotebook.activeNotebookEditor?.document.cells![0]!; - await runCell(cell2); - await waitForExecutionCompletedSuccessfully(cell2); - - // Send the command to open the view - await commandManager.executeCommand(Commands.OpenVariableView); - - const coreVariableView2 = await variableViewProvider.activeVariableView; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const variableView2 = (coreVariableView2 as any) as ITestWebviewHost; - - // We have to create a second message listener? - const onMessageListener2 = new OnMessageListener(variableView2); - - // Wait until our VariablesComplete message to see that we have the new variables and have rendered them - await onMessageListener2.waitForMessage(InteractiveWindowMessages.VariablesComplete); - - const htmlResult2 = await variableView2?.getHTMLById('variable-view-main-panel'); - - // Parse the HTML for our expected variables - const expectedVariables2 = [{ name: 'test2', type: 'str', length: '12', value: ' MYTESTVALUE2' }]; - verifyViewVariables(expectedVariables2, htmlResult2); - - //await sleep(5_000); - // Change back to the first document - }); - // Long list of variables loads // Open data viewer? }); From 2fc7252c86e6f360ec7f7c1f5a164f5afc116cd3 Mon Sep 17 00:00:00 2001 From: Ian Huff Date: Thu, 18 Feb 2021 15:50:00 -0800 Subject: [PATCH 03/10] WIP --- pvsc.code-workspace | 5 +++-- src/datascience-ui/variable-view/variableViewPanel.tsx | 5 +++++ src/test/datascience/.vscode/settings.json | 2 +- .../datascience/variableView/variableView.vscode.test.ts | 4 ++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/pvsc.code-workspace b/pvsc.code-workspace index b941afcaa47..588c82258cb 100644 --- a/pvsc.code-workspace +++ b/pvsc.code-workspace @@ -141,9 +141,10 @@ "--extensionTestsPath=${workspaceFolder:vscode-jupyter}/out/test" ], "env": { - "VSC_JUPYTER_CI_TEST_GREP": "VSCode Notebook", // Leave as `VSCode Notebook` to run only Notebook tests. + "XVSC_JUPYTER_CI_TEST_GREP": "VSCode Notebook", // Leave as `VSCode Notebook` to run only Notebook tests. + "VSC_JUPYTER_CI_TEST_GREP": "IANHU", // Leave as `VSCode Notebook` to run only Notebook tests. "VSC_JUPYTER_CI_TEST_INVERT_GREP": "", // Initialize this to invert the grep (exclude tests with value defined in grep). - "CI_PYTHON_PATH": "/Users/donjayamanne/Desktop/Development/crap/docBug/venvDS/bin/python", // Update with path to real python interpereter used for testing. + "CI_PYTHON_PATH": "/Users/ianhuff/Documents/DataScience/DebuggingDemo/.debugEnv/bin/python", // Update with path to real python interpereter used for testing. "VSC_FORCE_REAL_JUPYTER": "true", // Enalbe tests that require Jupyter. "VSC_JUPYTER_CI_RUN_NON_PYTHON_NB_TEST": "", // Initialize this to run tests again Julia & other kernels. "VSC_JUPYTER_RUN_NB_TEST": "true", // Initialize this to run notebook tests (must be using VSC Insiders). diff --git a/src/datascience-ui/variable-view/variableViewPanel.tsx b/src/datascience-ui/variable-view/variableViewPanel.tsx index 5e744e9de51..a90fa32de75 100644 --- a/src/datascience-ui/variable-view/variableViewPanel.tsx +++ b/src/datascience-ui/variable-view/variableViewPanel.tsx @@ -2,6 +2,7 @@ // Licensed under the MIT License. import * as React from 'react'; import { connect } from 'react-redux'; +import { buildSettingsCss } from '../interactive-common/buildSettingsCss'; import { handleLinkClick } from '../interactive-common/handlers'; import { IMainWithVariables, IStore } from '../interactive-common/redux/store'; import { IVariablePanelProps, VariablePanel } from '../interactive-common/variablePanel'; @@ -60,6 +61,10 @@ export class VariableViewPanel extends React.Component // we can size and host it differently from the variable panel in the interactive window or native editor return (
+
+ +
{this.renderVariablePanel(this.props.baseTheme)}
); diff --git a/src/test/datascience/.vscode/settings.json b/src/test/datascience/.vscode/settings.json index 88c7e01cba5..33a33b713a5 100644 --- a/src/test/datascience/.vscode/settings.json +++ b/src/test/datascience/.vscode/settings.json @@ -11,7 +11,7 @@ "python.linting.mypyEnabled": false, "python.linting.banditEnabled": false, "python.formatting.provider": "yapf", - "python.pythonPath": "python", + "python.pythonPath": "/Users/ianhuff/Documents/DataScience/DebuggingDemo/.debugEnv/bin/python", "jupyter.experiments.optInto": [ "NativeNotebookEditor" ], diff --git a/src/test/datascience/variableView/variableView.vscode.test.ts b/src/test/datascience/variableView/variableView.vscode.test.ts index d00fec9f6a8..d8d86482ce7 100644 --- a/src/test/datascience/variableView/variableView.vscode.test.ts +++ b/src/test/datascience/variableView/variableView.vscode.test.ts @@ -47,7 +47,7 @@ suite('DataScience - VariableView', () => { return this.skip(); } await trustAllNotebooks(); - //await prewarmNotebooks(); + await prewarmNotebooks(); sinon.restore(); commandManager = api.serviceContainer.get(ICommandManager); const coreVariableViewProvider = api.serviceContainer.get(IVariableViewProvider); @@ -70,7 +70,7 @@ suite('DataScience - VariableView', () => { suiteTeardown(() => closeNotebooksAndCleanUpAfterTests(disposables)); // Test showing the basic variable view with a value or two - test('Can show VariableView (webview-test)', async function () { + test('IANHU Can show VariableView (webview-test)', async function () { //return this.skip(); // Add one simple cell and execute it await insertCodeCell('test = "MYTESTVALUE"', { index: 0 }); From 961ff3204e2c51c068b26bc598b6fcf02e7041fa Mon Sep 17 00:00:00 2001 From: Ian Huff Date: Wed, 24 Mar 2021 13:05:57 -0700 Subject: [PATCH 04/10] checkpoint --- .vscode/launch.json | 4 ++-- src/test/datascience/.vscode/settings.json | 2 +- .../datascience/variableView/variableView.vscode.test.ts | 5 ++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 1bd583191db..d40f07cc9fa 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -199,9 +199,9 @@ ], "env": { "XVSC_JUPYTER_CI_TEST_GREP": "VSCode Notebook", // Leave as `VSCode Notebook` to run only Notebook tests. - "VSC_JUPYTER_CI_TEST_GREP": "VariableView", // Leave as `VSCode Notebook` to run only Notebook tests. + "VSC_JUPYTER_CI_TEST_GREP": "IANHU", // Leave as `VSCode Notebook` to run only Notebook tests. "VSC_JUPYTER_CI_TEST_INVERT_GREP": "", // Initialize this to invert the grep (exclude tests with value defined in grep). - "CI_PYTHON_PATH": "", // Update with path to real python interpereter used for testing. + "CI_PYTHON_PATH": "/Users/ianhuff/opt/miniconda3/envs/functionalTestEnv/bin/python", // Update with path to real python interpereter used for testing. "VSC_FORCE_REAL_JUPYTER": "true", // Enalbe tests that require Jupyter. "VSC_JUPYTER_CI_RUN_NON_PYTHON_NB_TEST": "", // Initialize this to run tests again Julia & other kernels. "VSC_JUPYTER_RUN_NB_TEST": "true", // Initialize this to run notebook tests (must be using VSC Insiders). diff --git a/src/test/datascience/.vscode/settings.json b/src/test/datascience/.vscode/settings.json index 33a33b713a5..4ddceb0b3fb 100644 --- a/src/test/datascience/.vscode/settings.json +++ b/src/test/datascience/.vscode/settings.json @@ -11,7 +11,7 @@ "python.linting.mypyEnabled": false, "python.linting.banditEnabled": false, "python.formatting.provider": "yapf", - "python.pythonPath": "/Users/ianhuff/Documents/DataScience/DebuggingDemo/.debugEnv/bin/python", + "python.pythonPath": "/Users/ianhuff/opt/miniconda3/envs/functionalTestEnv/bin/python", "jupyter.experiments.optInto": [ "NativeNotebookEditor" ], diff --git a/src/test/datascience/variableView/variableView.vscode.test.ts b/src/test/datascience/variableView/variableView.vscode.test.ts index 5ef0f8039d5..b2ecf7bcafe 100644 --- a/src/test/datascience/variableView/variableView.vscode.test.ts +++ b/src/test/datascience/variableView/variableView.vscode.test.ts @@ -24,7 +24,6 @@ import { InteractiveWindowMessages } from '../../../client/datascience/interacti import { verifyViewVariables } from './variableViewHelpers'; import { ITestVariableViewProvider } from './variableViewTestInterfaces'; import { ITestWebviewHost } from '../testInterfaces'; -import { sleep } from '../../core'; import { traceInfo } from '../../../client/common/logger'; suite('DataScience - VariableView', () => { @@ -75,7 +74,7 @@ suite('DataScience - VariableView', () => { suiteTeardown(() => closeNotebooksAndCleanUpAfterTests(disposables)); // Test showing the basic variable view with a value or two - test('IANHU Can show VariableView (webview-test)', async function () { + test('Can show VariableView (webview-test)', async function () { //return this.skip(); // Add one simple cell and execute it await insertCodeCell('test = "MYTESTVALUE"', { index: 0 }); @@ -112,7 +111,7 @@ suite('DataScience - VariableView', () => { verifyViewVariables(expectedVariables, htmlResult); }); - test('Variable view document switching (webview-test)', async function () { + test('IANHU Variable view document switching (webview-test)', async function () { this.timeout(60_000); // Add one simple cell and execute it await insertCodeCell('test = "MYTESTVALUE"', { index: 0 }); From 0ab2cbc056545647cf47dc6d311fc6a29fa3e8e7 Mon Sep 17 00:00:00 2001 From: Ian Huff Date: Mon, 5 Apr 2021 16:35:22 -0700 Subject: [PATCH 05/10] working second test --- src/test/datascience/variableView/variableView.vscode.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/datascience/variableView/variableView.vscode.test.ts b/src/test/datascience/variableView/variableView.vscode.test.ts index b2ecf7bcafe..370074b88a5 100644 --- a/src/test/datascience/variableView/variableView.vscode.test.ts +++ b/src/test/datascience/variableView/variableView.vscode.test.ts @@ -74,7 +74,7 @@ suite('DataScience - VariableView', () => { suiteTeardown(() => closeNotebooksAndCleanUpAfterTests(disposables)); // Test showing the basic variable view with a value or two - test('Can show VariableView (webview-test)', async function () { + test('IANHU Can show VariableView (webview-test)', async function () { //return this.skip(); // Add one simple cell and execute it await insertCodeCell('test = "MYTESTVALUE"', { index: 0 }); From b774ba02ddf7d72748380be3e4526d6099952b67 Mon Sep 17 00:00:00 2001 From: Ian Huff Date: Mon, 12 Apr 2021 16:47:54 -0700 Subject: [PATCH 06/10] more working tests --- .../variableView/variableView.vscode.test.ts | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/test/datascience/variableView/variableView.vscode.test.ts b/src/test/datascience/variableView/variableView.vscode.test.ts index 370074b88a5..5cab3e3d61a 100644 --- a/src/test/datascience/variableView/variableView.vscode.test.ts +++ b/src/test/datascience/variableView/variableView.vscode.test.ts @@ -25,6 +25,7 @@ import { verifyViewVariables } from './variableViewHelpers'; import { ITestVariableViewProvider } from './variableViewTestInterfaces'; import { ITestWebviewHost } from '../testInterfaces'; import { traceInfo } from '../../../client/common/logger'; +import { createDeferred, createDeferredFromPromise } from '../../../client/common/utils/async'; suite('DataScience - VariableView', () => { let api: IExtensionTestApi; @@ -74,7 +75,7 @@ suite('DataScience - VariableView', () => { suiteTeardown(() => closeNotebooksAndCleanUpAfterTests(disposables)); // Test showing the basic variable view with a value or two - test('IANHU Can show VariableView (webview-test)', async function () { + test('Can show VariableView (webview-test)', async function () { //return this.skip(); // Add one simple cell and execute it await insertCodeCell('test = "MYTESTVALUE"', { index: 0 }); @@ -152,12 +153,16 @@ suite('DataScience - VariableView', () => { await commandManager.executeCommand(Commands.OpenVariableView); // Aquire the variable view from the provider - const coreVariableView2 = await variableViewProvider.activeVariableView; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const variableView2 = (coreVariableView2 as any) as ITestWebviewHost; + //const coreVariableView2 = await variableViewProvider.activeVariableView; + //// eslint-disable-next-line @typescript-eslint/no-explicit-any + //const variableView2 = (coreVariableView2 as any) as ITestWebviewHost; // Add our message listener - const onMessageListener2 = new OnMessageListener(variableView2); + //const onMessageListener2 = new OnMessageListener(variableView); + + const varsDone = createDeferredFromPromise( + onMessageListener.waitForMessage(InteractiveWindowMessages.VariablesComplete) + ); // Execute a second cell on the second document await insertCodeCell('test3 = "MYTESTVALUE3"', { index: 1 }); @@ -166,9 +171,12 @@ suite('DataScience - VariableView', () => { await waitForExecutionCompletedSuccessfully(cell3); // Wait until our VariablesComplete message to see that we have the new variables and have rendered them - await onMessageListener2.waitForMessage(InteractiveWindowMessages.VariablesComplete); + await onMessageListener.waitForMessage(InteractiveWindowMessages.VariablesComplete); + + //const htmlResult2 = await variableView2?.getHTMLById('variable-view-main-panel'); + //await onMessageListener.waitForMessage(InteractiveWindowMessages.VariablesComplete); - const htmlResult2 = await variableView2?.getHTMLById('variable-view-main-panel'); + const htmlResult2 = await variableView?.getHTMLById('variable-view-main-panel'); // Parse the HTML for our expected variables const expectedVariables2 = [ From 3f607e34ac39730141aca5d1278f95af92314b90 Mon Sep 17 00:00:00 2001 From: Ian Huff Date: Tue, 15 Jun 2021 15:01:49 -0700 Subject: [PATCH 07/10] lint fix --- .../variableView/variableView.vscode.test.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/test/datascience/variableView/variableView.vscode.test.ts b/src/test/datascience/variableView/variableView.vscode.test.ts index 035358db47b..99c3be60a6e 100644 --- a/src/test/datascience/variableView/variableView.vscode.test.ts +++ b/src/test/datascience/variableView/variableView.vscode.test.ts @@ -25,7 +25,6 @@ import { verifyViewVariables } from './variableViewHelpers'; import { ITestVariableViewProvider } from './variableViewTestInterfaces'; import { ITestWebviewHost } from '../testInterfaces'; import { traceInfo } from '../../../client/common/logger'; -import { createDeferred, createDeferredFromPromise } from '../../../client/common/utils/async'; suite('DataScience - VariableView', () => { let api: IExtensionTestApi; @@ -75,7 +74,7 @@ suite('DataScience - VariableView', () => { suiteTeardown(() => closeNotebooksAndCleanUpAfterTests(disposables)); // Test showing the basic variable view with a value or two - test('Can show VariableView (webview-test)', async function () { + test('IANHU Can show VariableView (webview-test)', async function () { //return this.skip(); // Add one simple cell and execute it await insertCodeCell('test = "MYTESTVALUE"', { index: 0 }); @@ -116,7 +115,7 @@ suite('DataScience - VariableView', () => { this.timeout(60_000); // Add one simple cell and execute it await insertCodeCell('test = "MYTESTVALUE"', { index: 0 }); - const cell = vscodeNotebook.activeNotebookEditor?.document.cells![0]!; + const cell = vscodeNotebook.activeNotebookEditor?.document.getCells()![0]!; await runCell(cell); await waitForExecutionCompletedSuccessfully(cell); @@ -145,7 +144,7 @@ suite('DataScience - VariableView', () => { // Execute a cell on the second document await insertCodeCell('test2 = "MYTESTVALUE2"', { index: 0 }); - const cell2 = vscodeNotebook.activeNotebookEditor?.document.cells![0]!; + const cell2 = vscodeNotebook.activeNotebookEditor?.document.getCells()![0]!; await runCell(cell2); await waitForExecutionCompletedSuccessfully(cell2); @@ -160,13 +159,13 @@ suite('DataScience - VariableView', () => { // Add our message listener //const onMessageListener2 = new OnMessageListener(variableView); - const varsDone = createDeferredFromPromise( - onMessageListener.waitForMessage(InteractiveWindowMessages.VariablesComplete) - ); + // const varsDone = createDeferredFromPromise( + // onMessageListener.waitForMessage(InteractiveWindowMessages.VariablesComplete) + // ); // Execute a second cell on the second document await insertCodeCell('test3 = "MYTESTVALUE3"', { index: 1 }); - const cell3 = vscodeNotebook.activeNotebookEditor?.document.cells![1]!; + const cell3 = vscodeNotebook.activeNotebookEditor?.document.getCells()![1]!; await runCell(cell3); await waitForExecutionCompletedSuccessfully(cell3); @@ -186,7 +185,4 @@ suite('DataScience - VariableView', () => { verifyViewVariables(expectedVariables2, htmlResult2); // Change back to the first document }); - - // Long list of variables loads - // Open data viewer? }); From bbb3a8fc9b30af942a08cb736752b143f4112fdb Mon Sep 17 00:00:00 2001 From: Ian Huff Date: Tue, 15 Jun 2021 15:20:04 -0700 Subject: [PATCH 08/10] cleanup for review --- .vscode/launch.json | 3 +-- pvsc.code-workspace | 3 +-- src/test/datascience/.vscode/settings.json | 2 +- .../variableView/variableView.vscode.test.ts | 22 ++----------------- 4 files changed, 5 insertions(+), 25 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 0cb355258e9..119d073bdd7 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -200,9 +200,8 @@ ], "env": { "XVSC_JUPYTER_CI_TEST_GREP": "VSCode Notebook", // Leave as `VSCode Notebook` to run only Notebook tests. - "VSC_JUPYTER_CI_TEST_GREP": "IANHU", // Leave as `VSCode Notebook` to run only Notebook tests. "VSC_JUPYTER_CI_TEST_INVERT_GREP": "", // Initialize this to invert the grep (exclude tests with value defined in grep). - "CI_PYTHON_PATH": "/Users/ianhuff/opt/miniconda3/envs/functionalTestEnv/bin/python", // Update with path to real python interpereter used for testing. + "CI_PYTHON_PATH": "", // Update with path to real python interpereter used for testing. "VSC_FORCE_REAL_JUPYTER": "true", // Enalbe tests that require Jupyter. "VSC_JUPYTER_CI_RUN_NON_PYTHON_NB_TEST": "", // Initialize this to run tests again Julia & other kernels. "VSC_JUPYTER_RUN_NB_TEST": "true", // Initialize this to run notebook tests (must be using VSC Insiders). diff --git a/pvsc.code-workspace b/pvsc.code-workspace index 588c82258cb..11991ccc53c 100644 --- a/pvsc.code-workspace +++ b/pvsc.code-workspace @@ -142,9 +142,8 @@ ], "env": { "XVSC_JUPYTER_CI_TEST_GREP": "VSCode Notebook", // Leave as `VSCode Notebook` to run only Notebook tests. - "VSC_JUPYTER_CI_TEST_GREP": "IANHU", // Leave as `VSCode Notebook` to run only Notebook tests. "VSC_JUPYTER_CI_TEST_INVERT_GREP": "", // Initialize this to invert the grep (exclude tests with value defined in grep). - "CI_PYTHON_PATH": "/Users/ianhuff/Documents/DataScience/DebuggingDemo/.debugEnv/bin/python", // Update with path to real python interpereter used for testing. + "CI_PYTHON_PATH": "", // Update with path to real python interpereter used for testing. "VSC_FORCE_REAL_JUPYTER": "true", // Enalbe tests that require Jupyter. "VSC_JUPYTER_CI_RUN_NON_PYTHON_NB_TEST": "", // Initialize this to run tests again Julia & other kernels. "VSC_JUPYTER_RUN_NB_TEST": "true", // Initialize this to run notebook tests (must be using VSC Insiders). diff --git a/src/test/datascience/.vscode/settings.json b/src/test/datascience/.vscode/settings.json index 16fd12b6381..2f3ad1fb32f 100644 --- a/src/test/datascience/.vscode/settings.json +++ b/src/test/datascience/.vscode/settings.json @@ -11,7 +11,7 @@ "python.linting.mypyEnabled": false, "python.linting.banditEnabled": false, "python.formatting.provider": "yapf", - "python.pythonPath": "/Users/ianhuff/opt/miniconda3/envs/functionalTestEnv/bin/python", + "python.pythonPath": "python", "jupyter.experiments.optInto": [ "NativeNotebookEditor" ], diff --git a/src/test/datascience/variableView/variableView.vscode.test.ts b/src/test/datascience/variableView/variableView.vscode.test.ts index 99c3be60a6e..af7c38b4c2a 100644 --- a/src/test/datascience/variableView/variableView.vscode.test.ts +++ b/src/test/datascience/variableView/variableView.vscode.test.ts @@ -74,8 +74,7 @@ suite('DataScience - VariableView', () => { suiteTeardown(() => closeNotebooksAndCleanUpAfterTests(disposables)); // Test showing the basic variable view with a value or two - test('IANHU Can show VariableView (webview-test)', async function () { - //return this.skip(); + test('Can show VariableView (webview-test)', async function () { // Add one simple cell and execute it await insertCodeCell('test = "MYTESTVALUE"', { index: 0 }); const cell = vscodeNotebook.activeNotebookEditor?.document.cellAt(0)!; @@ -111,8 +110,7 @@ suite('DataScience - VariableView', () => { verifyViewVariables(expectedVariables, htmlResult); }); - test('IANHU Variable view document switching (webview-test)', async function () { - this.timeout(60_000); + test('Variable view document switching (webview-test)', async function () { // Add one simple cell and execute it await insertCodeCell('test = "MYTESTVALUE"', { index: 0 }); const cell = vscodeNotebook.activeNotebookEditor?.document.getCells()![0]!; @@ -151,18 +149,6 @@ suite('DataScience - VariableView', () => { // Because this document was not open, we need to open the variable view again await commandManager.executeCommand(Commands.OpenVariableView); - // Aquire the variable view from the provider - //const coreVariableView2 = await variableViewProvider.activeVariableView; - //// eslint-disable-next-line @typescript-eslint/no-explicit-any - //const variableView2 = (coreVariableView2 as any) as ITestWebviewHost; - - // Add our message listener - //const onMessageListener2 = new OnMessageListener(variableView); - - // const varsDone = createDeferredFromPromise( - // onMessageListener.waitForMessage(InteractiveWindowMessages.VariablesComplete) - // ); - // Execute a second cell on the second document await insertCodeCell('test3 = "MYTESTVALUE3"', { index: 1 }); const cell3 = vscodeNotebook.activeNotebookEditor?.document.getCells()![1]!; @@ -172,9 +158,6 @@ suite('DataScience - VariableView', () => { // Wait until our VariablesComplete message to see that we have the new variables and have rendered them await onMessageListener.waitForMessage(InteractiveWindowMessages.VariablesComplete); - //const htmlResult2 = await variableView2?.getHTMLById('variable-view-main-panel'); - //await onMessageListener.waitForMessage(InteractiveWindowMessages.VariablesComplete); - const htmlResult2 = await variableView?.getHTMLById('variable-view-main-panel'); // Parse the HTML for our expected variables @@ -183,6 +166,5 @@ suite('DataScience - VariableView', () => { { name: 'test3', type: 'str', length: '12', value: ' MYTESTVALUE3' } ]; verifyViewVariables(expectedVariables2, htmlResult2); - // Change back to the first document }); }); From 2aea4cd6d55717dbab56b901ae536b155f53aead Mon Sep 17 00:00:00 2001 From: Ian Huff Date: Tue, 15 Jun 2021 15:58:10 -0700 Subject: [PATCH 09/10] fix ENV --- .vscode/launch.json | 2 +- pvsc.code-workspace | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 119d073bdd7..6a2332b956c 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -199,7 +199,7 @@ "--extensionTestsPath=${workspaceFolder}/out/test" ], "env": { - "XVSC_JUPYTER_CI_TEST_GREP": "VSCode Notebook", // Leave as `VSCode Notebook` to run only Notebook tests. + "VSC_JUPYTER_CI_TEST_GREP": "VSCode Notebook", // Leave as `VSCode Notebook` to run only Notebook tests. "VSC_JUPYTER_CI_TEST_INVERT_GREP": "", // Initialize this to invert the grep (exclude tests with value defined in grep). "CI_PYTHON_PATH": "", // Update with path to real python interpereter used for testing. "VSC_FORCE_REAL_JUPYTER": "true", // Enalbe tests that require Jupyter. diff --git a/pvsc.code-workspace b/pvsc.code-workspace index 11991ccc53c..ae0b9d9d7f4 100644 --- a/pvsc.code-workspace +++ b/pvsc.code-workspace @@ -141,7 +141,7 @@ "--extensionTestsPath=${workspaceFolder:vscode-jupyter}/out/test" ], "env": { - "XVSC_JUPYTER_CI_TEST_GREP": "VSCode Notebook", // Leave as `VSCode Notebook` to run only Notebook tests. + "VSC_JUPYTER_CI_TEST_GREP": "VSCode Notebook", // Leave as `VSCode Notebook` to run only Notebook tests. "VSC_JUPYTER_CI_TEST_INVERT_GREP": "", // Initialize this to invert the grep (exclude tests with value defined in grep). "CI_PYTHON_PATH": "", // Update with path to real python interpereter used for testing. "VSC_FORCE_REAL_JUPYTER": "true", // Enalbe tests that require Jupyter. From 4593f03194a50735a638862e5be94f94a41c3c6e Mon Sep 17 00:00:00 2001 From: Ian Huff Date: Tue, 15 Jun 2021 15:59:48 -0700 Subject: [PATCH 10/10] add news --- news/3 Code Health/4355.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/3 Code Health/4355.md diff --git a/news/3 Code Health/4355.md b/news/3 Code Health/4355.md new file mode 100644 index 00000000000..f3d5788aa64 --- /dev/null +++ b/news/3 Code Health/4355.md @@ -0,0 +1 @@ +Add doc switching variable view tests for native notebooks. \ No newline at end of file