Skip to content

Commit b248deb

Browse files
authored
Add ability to DS notebook tests within a headless browser (#10657)
* Add ability to launch DS ui in browser in tests * Address code review comments * Dump screenshots in temp dir * Ignore windows * Additional launch config * Added comments
1 parent 3eedc21 commit b248deb

23 files changed

Lines changed: 2086 additions & 712 deletions

‎.vscode/launch.json‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,43 @@
238238
"--timeout=300000"
239239
],
240240
"env": {
241+
// Remove `X` prefix to test with real browser to host DS ui (for DS functional tests).
242+
"xVSC_PYTHON_DS_UI_BROWSER": "1",
243+
// Remove `X` prefix to test with real python (for DS functional tests).
244+
"XVSCODE_PYTHON_ROLLING": "1",
245+
// Remove 'X' to turn on all logging in the debug output
246+
"XVSC_PYTHON_FORCE_LOGGING": "1",
247+
// Remove `X` prefix and update path to test with real python interpreter (for DS functional tests).
248+
"XCI_PYTHON_PATH": "<Python Path>",
249+
},
250+
"outFiles": [
251+
"${workspaceFolder}/out/**/*.js"
252+
],
253+
"preLaunchTask": "Compile",
254+
"skipFiles": [
255+
"<node_internals>/**"
256+
]
257+
},
258+
{
259+
"name": "Functional DS UI Tests (without VS Code, *.ui.functional.test.ts)",
260+
"type": "node",
261+
"request": "launch",
262+
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
263+
"stopOnEntry": false,
264+
"sourceMaps": true,
265+
"args": [
266+
"./out/test/**/*.ui.functional.test.js",
267+
"--require=out/test/unittests.js",
268+
"--ui=tdd",
269+
"--recursive",
270+
"--colors",
271+
//"--grep", "<suite>",
272+
"--timeout=300000",
273+
"--fast"
274+
],
275+
"env": {
276+
// Remove `X` prefix to test with real browser to host DS ui (for DS functional tests).
277+
"xVSC_PYTHON_DS_UI_BROWSER": "1",
241278
// Remove `X` prefix to test with real python (for DS functional tests).
242279
"XVSCODE_PYTHON_ROLLING": "1",
243280
// Remove 'X' to turn on all logging in the debug output

‎.vscode/settings.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Place your settings in this file to overwrite default and user settings.
22
{
33
"files.exclude": {
4-
"out": true, // set this to true to hide the "out" folder with the compiled JS files
4+
"out": false, // set this to true to hide the "out" folder with the compiled JS files
55
"**/*.pyc": true,
66
".nyc_output": true,
77
"obj": true,
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head> </head>
4+
<body>
5+
<a href="./index.nativeEditor.html">Click here to Open Native Editor</a><br />
6+
<a href="./index.interactiveWindow.html">Click here to Open Interactive Window</a>
7+
</body>
8+
</html>

‎build/webpack/webpack.datascience-ui.config.builder.js‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,18 @@ function getPlugins(isNotebook) {
4545
new MonacoWebpackPlugin({
4646
languages: [] // force to empty so onigasm will be used
4747
}),
48+
new HtmlWebpackPlugin({
49+
template: path.join(__dirname, '/nativeOrInteractivePicker.html'),
50+
chunks: [],
51+
filename: 'index.html'
52+
}),
4853
new HtmlWebpackPlugin({
4954
template: 'src/datascience-ui/native-editor/index.html',
50-
indexUrl: `${constants.ExtensionRootDir}/out/1`,
5155
chunks: ['monaco', 'commons', 'nativeEditor'],
5256
filename: 'index.nativeEditor.html'
5357
}),
5458
new HtmlWebpackPlugin({
5559
template: 'src/datascience-ui/history-react/index.html',
56-
indexUrl: `${constants.ExtensionRootDir}/out/1`,
5760
chunks: ['monaco', 'commons', 'interactiveWindow'],
5861
filename: 'index.interactiveWindow.html'
5962
})

0 commit comments

Comments
 (0)