mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 12:19:20 +00:00
Reenable a couple notebook smoketests (#159521)
* Remove vscode-notebook-tests in favor of an .ipynb in vscode-smoketest-express * Update build folder * Add build task to correct platform * Build for smoke tests on other platforms * Fix repo url and remove comment * Just -media? * Update darwin/win32 as well
This commit is contained in:
@@ -75,7 +75,6 @@ steps:
|
||||
compile-extension:typescript-language-features \
|
||||
compile-extension:vscode-api-tests \
|
||||
compile-extension:vscode-colorize-tests \
|
||||
compile-extension:vscode-notebook-tests \
|
||||
compile-extension:vscode-test-resolver
|
||||
displayName: Build integration tests
|
||||
|
||||
@@ -130,6 +129,11 @@ steps:
|
||||
yarn --cwd test/smoke compile
|
||||
displayName: Compile smoke tests
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
yarn gulp compile-extension-media
|
||||
displayName: Build extensions for smoke tests
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
yarn smoketest-no-compile --tracing
|
||||
|
||||
@@ -99,7 +99,6 @@ steps:
|
||||
compile-extension:typescript-language-features \
|
||||
compile-extension:vscode-api-tests \
|
||||
compile-extension:vscode-colorize-tests \
|
||||
compile-extension:vscode-notebook-tests \
|
||||
compile-extension:vscode-test-resolver
|
||||
displayName: Build integration tests
|
||||
|
||||
@@ -172,6 +171,13 @@ steps:
|
||||
yarn --cwd test/smoke compile
|
||||
displayName: Compile smoke tests
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
yarn gulp \
|
||||
compile-extension:markdown-language-features \
|
||||
compile-extension-media
|
||||
displayName: Build extensions for smoke tests
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
yarn smoketest-no-compile --tracing
|
||||
|
||||
@@ -85,7 +85,6 @@ steps:
|
||||
compile-extension:typescript-language-features `
|
||||
compile-extension:vscode-api-tests `
|
||||
compile-extension:vscode-colorize-tests `
|
||||
compile-extension:vscode-notebook-tests `
|
||||
compile-extension:vscode-test-resolver `
|
||||
}
|
||||
displayName: Build integration tests
|
||||
@@ -158,6 +157,11 @@ steps:
|
||||
exec { yarn --cwd test/smoke compile }
|
||||
displayName: Compile smoke tests
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
yarn gulp compile-extension-media
|
||||
displayName: Build extensions for smoke tests
|
||||
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
@@ -67,7 +67,6 @@ const compilations = [
|
||||
'typescript-language-features/tsconfig.json',
|
||||
'vscode-api-tests/tsconfig.json',
|
||||
'vscode-colorize-tests/tsconfig.json',
|
||||
'vscode-notebook-tests/tsconfig.json',
|
||||
'vscode-test-resolver/tsconfig.json'
|
||||
];
|
||||
|
||||
|
||||
@@ -246,7 +246,6 @@ const excludedExtensions = [
|
||||
'vscode-test-resolver',
|
||||
'ms-vscode.node-debug',
|
||||
'ms-vscode.node-debug2',
|
||||
'vscode-notebook-tests',
|
||||
];
|
||||
const marketplaceWebExtensionsExclude = new Set([
|
||||
'ms-vscode.node-debug',
|
||||
|
||||
@@ -286,7 +286,6 @@ const excludedExtensions = [
|
||||
'vscode-test-resolver',
|
||||
'ms-vscode.node-debug',
|
||||
'ms-vscode.node-debug2',
|
||||
'vscode-notebook-tests',
|
||||
];
|
||||
|
||||
const marketplaceWebExtensionsExclude = new Set([
|
||||
|
||||
@@ -42,7 +42,6 @@ exports.dirs = [
|
||||
'extensions/typescript-language-features',
|
||||
'extensions/vscode-api-tests',
|
||||
'extensions/vscode-colorize-tests',
|
||||
'extensions/vscode-notebook-tests',
|
||||
'extensions/vscode-test-resolver',
|
||||
'remote',
|
||||
'remote/web',
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
// A launch configuration that compiles the extension and then opens it inside a new window
|
||||
{
|
||||
"version": "0.1.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch Tests",
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": ["${workspaceFolder}/../../", "${workspaceFolder}/test", "--extensionDevelopmentPath=${workspaceFolder}", "--extensionTestsPath=${workspaceFolder}/out" ],
|
||||
"stopOnEntry": false,
|
||||
"sourceMaps": true,
|
||||
"outDir": "${workspaceFolder}/out",
|
||||
"preLaunchTask": "npm"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"command": "npm",
|
||||
"type": "shell",
|
||||
"presentation": {
|
||||
"reveal": "silent"
|
||||
},
|
||||
"args": ["run", "compile"],
|
||||
"isBackground": true,
|
||||
"problemMatcher": "$tsc-watch"
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.2 KiB |
@@ -1,88 +0,0 @@
|
||||
{
|
||||
"name": "vscode-notebook-tests",
|
||||
"description": "Notebook tests for VS Code",
|
||||
"version": "0.0.1",
|
||||
"publisher": "vscode",
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
"activationEvents": [
|
||||
"*"
|
||||
],
|
||||
"main": "./out/extension",
|
||||
"enabledApiProposals": [
|
||||
"notebookCellExecutionState",
|
||||
"notebookContentProvider",
|
||||
"notebookControllerKind",
|
||||
"notebookDebugOptions",
|
||||
"notebookDeprecated",
|
||||
"notebookLiveShare",
|
||||
"notebookMessaging",
|
||||
"notebookMime"
|
||||
],
|
||||
"engines": {
|
||||
"vscode": "^1.25.0"
|
||||
},
|
||||
"icon": "media/icon.png",
|
||||
"scripts": {
|
||||
"compile": "node ./node_modules/vscode/bin/compile -watch -p ./",
|
||||
"vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:vscode-notebook-tests ./tsconfig.json"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@types/node": "16.x"
|
||||
},
|
||||
"contributes": {
|
||||
"commands": [
|
||||
{
|
||||
"command": "vscode-notebook-tests.createNewNotebook",
|
||||
"title": "Create New Notebook"
|
||||
},
|
||||
{
|
||||
"command": "vscode-notebook-tests.debugAction",
|
||||
"title": "Debug Notebook Test Cell Action",
|
||||
"icon": "$(debug)"
|
||||
}
|
||||
],
|
||||
"notebooks": [
|
||||
{
|
||||
"type": "notebookSmokeTest",
|
||||
"displayName": "Notebook Smoke Test",
|
||||
"selector": [
|
||||
{
|
||||
"filenamePattern": "*.smoke-nb",
|
||||
"excludeFileNamePattern": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"notebookRenderer": [
|
||||
{
|
||||
"id": "notebookCoreTestRenderer",
|
||||
"displayName": "Notebook Core Test Renderer",
|
||||
"entrypoint": "./src/customRenderer.js",
|
||||
"mimeTypes": [
|
||||
"text/custom"
|
||||
]
|
||||
}
|
||||
],
|
||||
"menus": {
|
||||
"notebook/cell/title": [
|
||||
{
|
||||
"command": "vscode-notebook-tests.debugAction",
|
||||
"when": "notebookType == notebookSmokeTest",
|
||||
"group": "inline@1"
|
||||
}
|
||||
]
|
||||
},
|
||||
"jsonValidation": [
|
||||
{
|
||||
"fileMatch": "vscode://vscode-notebook-cell-metadata/*",
|
||||
"url": "vscode://schemas/notebook/cellmetadata"
|
||||
}
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/microsoft/vscode.git"
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
const vscode = acquireVsCodeApi();
|
||||
|
||||
const notebook = acquireNotebookRendererApi();
|
||||
|
||||
notebook.onDidCreateOutput(({ element, mimeType }) => {
|
||||
const div = document.createElement('div');
|
||||
div.innerText = `Hello ${mimeType}!`;
|
||||
element.appendChild(div);
|
||||
});
|
||||
@@ -1,78 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as child_process from 'child_process';
|
||||
import * as path from 'path';
|
||||
|
||||
function wait(ms: number): Promise<void> {
|
||||
return new Promise(r => setTimeout(r, ms));
|
||||
}
|
||||
|
||||
export function activate(context: vscode.ExtensionContext): any {
|
||||
context.subscriptions.push(vscode.commands.registerCommand('vscode-notebook-tests.createNewNotebook', async () => {
|
||||
const workspacePath = vscode.workspace.workspaceFolders![0].uri.fsPath;
|
||||
const notebookPath = path.join(workspacePath, 'test.smoke-nb');
|
||||
child_process.execSync('echo \'\' > ' + notebookPath);
|
||||
await wait(500);
|
||||
await vscode.commands.executeCommand('vscode.open', vscode.Uri.file(notebookPath));
|
||||
}));
|
||||
|
||||
context.subscriptions.push(vscode.workspace.registerNotebookContentProvider('notebookSmokeTest', {
|
||||
openNotebook: async (_resource: vscode.Uri) => {
|
||||
const dto: vscode.NotebookData = {
|
||||
metadata: {},
|
||||
cells: [
|
||||
{
|
||||
value: 'code()',
|
||||
languageId: 'typescript',
|
||||
kind: vscode.NotebookCellKind.Code,
|
||||
outputs: [],
|
||||
metadata: { custom: { testCellMetadata: 123 } }
|
||||
},
|
||||
{
|
||||
value: 'Markdown Cell',
|
||||
languageId: 'markdown',
|
||||
kind: vscode.NotebookCellKind.Markup,
|
||||
outputs: [],
|
||||
metadata: { custom: { testCellMetadata: 123 } }
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
return dto;
|
||||
}
|
||||
}));
|
||||
|
||||
const controller = vscode.notebooks.createNotebookController(
|
||||
'notebookSmokeTest',
|
||||
'notebookSmokeTest',
|
||||
'notebookSmokeTest'
|
||||
);
|
||||
|
||||
controller.executeHandler = (cells) => {
|
||||
for (const cell of cells) {
|
||||
const task = controller.createNotebookCellExecution(cell);
|
||||
task.start();
|
||||
task.replaceOutput([new vscode.NotebookCellOutput([
|
||||
vscode.NotebookCellOutputItem.text('test output', 'text/html')
|
||||
])]);
|
||||
task.end(true);
|
||||
}
|
||||
};
|
||||
|
||||
context.subscriptions.push(controller);
|
||||
|
||||
context.subscriptions.push(vscode.commands.registerCommand('vscode-notebook-tests.debugAction', async (cell: vscode.NotebookCell) => {
|
||||
if (cell) {
|
||||
const edit = new vscode.WorkspaceEdit();
|
||||
const fullRange = new vscode.Range(0, 0, cell.document.lineCount - 1, cell.document.lineAt(cell.document.lineCount - 1).range.end.character);
|
||||
edit.replace(cell.document.uri, fullRange, 'test');
|
||||
await vscode.workspace.applyEdit(edit);
|
||||
} else {
|
||||
throw new Error('Cell not set correctly');
|
||||
}
|
||||
}));
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
const path = require('path');
|
||||
const testRunner = require('../../../test/integration/electron/testrunner');
|
||||
|
||||
const options: any = {
|
||||
ui: 'tdd',
|
||||
color: true,
|
||||
timeout: 60000
|
||||
};
|
||||
|
||||
// These integration tests is being run in multiple environments (electron, web, remote)
|
||||
// so we need to set the suite name based on the environment as the suite name is used
|
||||
// for the test results file name
|
||||
let suite = '';
|
||||
if (process.env.VSCODE_BROWSER) {
|
||||
suite = `${process.env.VSCODE_BROWSER} Browser Integration Notebook Tests`;
|
||||
} else if (process.env.REMOTE_VSCODE) {
|
||||
suite = 'Remote Integration Notebook Tests';
|
||||
} else {
|
||||
suite = 'Integration Notebook Tests';
|
||||
}
|
||||
|
||||
if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
|
||||
options.reporter = 'mocha-multi-reporters';
|
||||
options.reporterOptions = {
|
||||
reporterEnabled: 'spec, mocha-junit-reporter',
|
||||
mochaJunitReporterReporterOptions: {
|
||||
testsuitesTitle: `${suite} ${process.platform}`,
|
||||
mochaFile: path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
testRunner.configure(options);
|
||||
|
||||
export = testRunner;
|
||||
@@ -1,266 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
import * as path from 'path';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
class File implements vscode.FileStat {
|
||||
|
||||
type: vscode.FileType;
|
||||
ctime: number;
|
||||
mtime: number;
|
||||
size: number;
|
||||
|
||||
name: string;
|
||||
data?: Uint8Array;
|
||||
|
||||
constructor(name: string) {
|
||||
this.type = vscode.FileType.File;
|
||||
this.ctime = Date.now();
|
||||
this.mtime = Date.now();
|
||||
this.size = 0;
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
||||
class Directory implements vscode.FileStat {
|
||||
|
||||
type: vscode.FileType;
|
||||
ctime: number;
|
||||
mtime: number;
|
||||
size: number;
|
||||
|
||||
name: string;
|
||||
entries: Map<string, File | Directory>;
|
||||
|
||||
constructor(name: string) {
|
||||
this.type = vscode.FileType.Directory;
|
||||
this.ctime = Date.now();
|
||||
this.mtime = Date.now();
|
||||
this.size = 0;
|
||||
this.name = name;
|
||||
this.entries = new Map();
|
||||
}
|
||||
}
|
||||
|
||||
export type Entry = File | Directory;
|
||||
|
||||
export class TestFS implements vscode.FileSystemProvider {
|
||||
|
||||
constructor(
|
||||
readonly scheme: string,
|
||||
readonly isCaseSensitive: boolean
|
||||
) { }
|
||||
|
||||
readonly root = new Directory('');
|
||||
|
||||
// --- manage file metadata
|
||||
|
||||
stat(uri: vscode.Uri): vscode.FileStat {
|
||||
return this._lookup(uri, false);
|
||||
}
|
||||
|
||||
readDirectory(uri: vscode.Uri): [string, vscode.FileType][] {
|
||||
const entry = this._lookupAsDirectory(uri, false);
|
||||
const result: [string, vscode.FileType][] = [];
|
||||
for (const [name, child] of entry.entries) {
|
||||
result.push([name, child.type]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// --- manage file contents
|
||||
|
||||
readFile(uri: vscode.Uri): Uint8Array {
|
||||
const data = this._lookupAsFile(uri, false).data;
|
||||
if (data) {
|
||||
return data;
|
||||
}
|
||||
throw vscode.FileSystemError.FileNotFound();
|
||||
}
|
||||
|
||||
writeFile(uri: vscode.Uri, content: Uint8Array, options: { create: boolean; overwrite: boolean }): void {
|
||||
const basename = path.posix.basename(uri.path);
|
||||
const parent = this._lookupParentDirectory(uri);
|
||||
let entry = parent.entries.get(basename);
|
||||
if (entry instanceof Directory) {
|
||||
throw vscode.FileSystemError.FileIsADirectory(uri);
|
||||
}
|
||||
if (!entry && !options.create) {
|
||||
throw vscode.FileSystemError.FileNotFound(uri);
|
||||
}
|
||||
if (entry && options.create && !options.overwrite) {
|
||||
throw vscode.FileSystemError.FileExists(uri);
|
||||
}
|
||||
if (!entry) {
|
||||
entry = new File(basename);
|
||||
parent.entries.set(basename, entry);
|
||||
this._fireSoon({ type: vscode.FileChangeType.Created, uri });
|
||||
}
|
||||
entry.mtime = Date.now();
|
||||
entry.size = content.byteLength;
|
||||
entry.data = content;
|
||||
|
||||
this._fireSoon({ type: vscode.FileChangeType.Changed, uri });
|
||||
}
|
||||
|
||||
// --- manage files/folders
|
||||
|
||||
rename(oldUri: vscode.Uri, newUri: vscode.Uri, options: { overwrite: boolean }): void {
|
||||
|
||||
if (!options.overwrite && this._lookup(newUri, true)) {
|
||||
throw vscode.FileSystemError.FileExists(newUri);
|
||||
}
|
||||
|
||||
const entry = this._lookup(oldUri, false);
|
||||
const oldParent = this._lookupParentDirectory(oldUri);
|
||||
|
||||
const newParent = this._lookupParentDirectory(newUri);
|
||||
const newName = path.posix.basename(newUri.path);
|
||||
|
||||
oldParent.entries.delete(entry.name);
|
||||
entry.name = newName;
|
||||
newParent.entries.set(newName, entry);
|
||||
|
||||
this._fireSoon(
|
||||
{ type: vscode.FileChangeType.Deleted, uri: oldUri },
|
||||
{ type: vscode.FileChangeType.Created, uri: newUri }
|
||||
);
|
||||
}
|
||||
|
||||
delete(uri: vscode.Uri): void {
|
||||
const dirname = uri.with({ path: path.posix.dirname(uri.path) });
|
||||
const basename = path.posix.basename(uri.path);
|
||||
const parent = this._lookupAsDirectory(dirname, false);
|
||||
if (!parent.entries.has(basename)) {
|
||||
throw vscode.FileSystemError.FileNotFound(uri);
|
||||
}
|
||||
parent.entries.delete(basename);
|
||||
parent.mtime = Date.now();
|
||||
parent.size -= 1;
|
||||
this._fireSoon({ type: vscode.FileChangeType.Changed, uri: dirname }, { uri, type: vscode.FileChangeType.Deleted });
|
||||
}
|
||||
|
||||
createDirectory(uri: vscode.Uri): void {
|
||||
const basename = path.posix.basename(uri.path);
|
||||
const dirname = uri.with({ path: path.posix.dirname(uri.path) });
|
||||
const parent = this._lookupAsDirectory(dirname, false);
|
||||
|
||||
const entry = new Directory(basename);
|
||||
parent.entries.set(entry.name, entry);
|
||||
parent.mtime = Date.now();
|
||||
parent.size += 1;
|
||||
this._fireSoon({ type: vscode.FileChangeType.Changed, uri: dirname }, { type: vscode.FileChangeType.Created, uri });
|
||||
}
|
||||
|
||||
// --- lookup
|
||||
|
||||
private _lookup(uri: vscode.Uri, silent: false): Entry;
|
||||
private _lookup(uri: vscode.Uri, silent: boolean): Entry | undefined;
|
||||
private _lookup(uri: vscode.Uri, silent: boolean): Entry | undefined {
|
||||
const parts = uri.path.split('/');
|
||||
let entry: Entry = this.root;
|
||||
for (const part of parts) {
|
||||
const partLow = part.toLowerCase();
|
||||
if (!part) {
|
||||
continue;
|
||||
}
|
||||
let child: Entry | undefined;
|
||||
if (entry instanceof Directory) {
|
||||
if (this.isCaseSensitive) {
|
||||
child = entry.entries.get(part);
|
||||
} else {
|
||||
for (const [key, value] of entry.entries) {
|
||||
if (key.toLowerCase() === partLow) {
|
||||
child = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!child) {
|
||||
if (!silent) {
|
||||
throw vscode.FileSystemError.FileNotFound(uri);
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
entry = child;
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
|
||||
private _lookupAsDirectory(uri: vscode.Uri, silent: boolean): Directory {
|
||||
const entry = this._lookup(uri, silent);
|
||||
if (entry instanceof Directory) {
|
||||
return entry;
|
||||
}
|
||||
throw vscode.FileSystemError.FileNotADirectory(uri);
|
||||
}
|
||||
|
||||
private _lookupAsFile(uri: vscode.Uri, silent: boolean): File {
|
||||
const entry = this._lookup(uri, silent);
|
||||
if (entry instanceof File) {
|
||||
return entry;
|
||||
}
|
||||
throw vscode.FileSystemError.FileIsADirectory(uri);
|
||||
}
|
||||
|
||||
private _lookupParentDirectory(uri: vscode.Uri): Directory {
|
||||
const dirname = uri.with({ path: path.posix.dirname(uri.path) });
|
||||
return this._lookupAsDirectory(dirname, false);
|
||||
}
|
||||
|
||||
// --- manage file events
|
||||
|
||||
private _emitter = new vscode.EventEmitter<vscode.FileChangeEvent[]>();
|
||||
private _bufferedEvents: vscode.FileChangeEvent[] = [];
|
||||
private _fireSoonHandle?: NodeJS.Timer;
|
||||
|
||||
readonly onDidChangeFile: vscode.Event<vscode.FileChangeEvent[]> = this._emitter.event;
|
||||
|
||||
watch(_resource: vscode.Uri): vscode.Disposable {
|
||||
// ignore, fires for all changes...
|
||||
return new vscode.Disposable(() => { });
|
||||
}
|
||||
|
||||
private _fireSoon(...events: vscode.FileChangeEvent[]): void {
|
||||
this._bufferedEvents.push(...events);
|
||||
|
||||
if (this._fireSoonHandle) {
|
||||
clearTimeout(this._fireSoonHandle);
|
||||
}
|
||||
|
||||
this._fireSoonHandle = setTimeout(() => {
|
||||
this._emitter.fire(this._bufferedEvents);
|
||||
this._bufferedEvents.length = 0;
|
||||
}, 5);
|
||||
}
|
||||
}
|
||||
|
||||
export function rndName() {
|
||||
let name = '';
|
||||
const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
for (let i = 0; i < 10; i++) {
|
||||
name += possible.charAt(Math.floor(Math.random() * possible.length));
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
export const testFs = new TestFS('fake-fs', true);
|
||||
vscode.workspace.registerFileSystemProvider(testFs.scheme, testFs, { isCaseSensitive: testFs.isCaseSensitive });
|
||||
|
||||
export async function createRandomFile(contents = '', dir: vscode.Uri | undefined = undefined, prefix = '', ext = ''): Promise<vscode.Uri> {
|
||||
let fakeFile: vscode.Uri;
|
||||
if (dir) {
|
||||
fakeFile = dir.with({ path: dir.path + '/' + rndName() + ext });
|
||||
} else {
|
||||
fakeFile = vscode.Uri.parse(`${testFs.scheme}:/${prefix}-${rndName() + ext}`);
|
||||
}
|
||||
|
||||
await testFs.writeFile(fakeFile, Buffer.from(contents), { create: true, overwrite: true });
|
||||
return fakeFile;
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
@@ -1,4 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
@@ -1,4 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
@@ -1,4 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"extends": "../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out",
|
||||
"types": [
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*",
|
||||
"../../src/vscode-dts/vscode.d.ts",
|
||||
"../../src/vscode-dts/vscode.proposed.notebook*.d.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@types/node@16.x":
|
||||
version "16.11.6"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.6.tgz#6bef7a2a0ad684cf6e90fcfe31cecabd9ce0a3ae"
|
||||
integrity sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w==
|
||||
@@ -25,7 +25,6 @@ if "%INTEGRATION_TEST_ELECTRON_PATH%"=="" (
|
||||
:: compile-extension:vscode-colorize-tests^
|
||||
:: compile-extension:markdown-language-features^
|
||||
:: compile-extension:typescript-language-features^
|
||||
:: compile-extension:vscode-notebook-tests^
|
||||
:: compile-extension:emmet^
|
||||
:: compile-extension:css-language-features-server^
|
||||
:: compile-extension:html-language-features-server^
|
||||
|
||||
@@ -32,7 +32,6 @@ else
|
||||
# and the build bundles extensions into .build webpacked
|
||||
# yarn gulp compile-extension:vscode-api-tests \
|
||||
# compile-extension:vscode-colorize-tests \
|
||||
# compile-extension:vscode-notebook-tests \
|
||||
# compile-extension:markdown-language-features \
|
||||
# compile-extension:typescript-language-features \
|
||||
# compile-extension:emmet \
|
||||
|
||||
@@ -3,19 +3,15 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { join } from 'path';
|
||||
import * as os from 'os';
|
||||
import * as cp from 'child_process';
|
||||
import { IElement, ILocalizedStrings, ILocaleInfo } from './driver';
|
||||
import { launch as launchPlaywrightBrowser } from './playwrightBrowser';
|
||||
import { launch as launchPlaywrightElectron } from './playwrightElectron';
|
||||
import { Logger, measureAndLog } from './logger';
|
||||
import { copyExtension } from './extensions';
|
||||
import * as os from 'os';
|
||||
import * as treekill from 'tree-kill';
|
||||
import { teardown } from './processes';
|
||||
import { IElement, ILocaleInfo, ILocalizedStrings } from './driver';
|
||||
import { Logger, measureAndLog } from './logger';
|
||||
import { launch as launchPlaywrightBrowser } from './playwrightBrowser';
|
||||
import { PlaywrightDriver } from './playwrightDriver';
|
||||
|
||||
const rootPath = join(__dirname, '../../..');
|
||||
import { launch as launchPlaywrightElectron } from './playwrightElectron';
|
||||
import { teardown } from './processes';
|
||||
|
||||
export interface LaunchOptions {
|
||||
codePath?: string;
|
||||
@@ -76,8 +72,6 @@ export async function launch(options: LaunchOptions): Promise<Code> {
|
||||
throw new Error('Smoke test process has terminated, refusing to spawn Code');
|
||||
}
|
||||
|
||||
await measureAndLog(() => copyExtension(rootPath, options.extensionsPath, 'vscode-notebook-tests'), 'copyExtension(vscode-notebook-tests)', options.logger);
|
||||
|
||||
// Browser smoke tests
|
||||
if (options.web) {
|
||||
const { serverProcess, driver } = await measureAndLog(() => launchPlaywrightBrowser(options), 'launch playwright (browser)', options.logger);
|
||||
|
||||
@@ -61,13 +61,6 @@ export async function resolveElectronConfiguration(options: LaunchOptions): Prom
|
||||
const remoteDataDir = `${userDataDir}-server`;
|
||||
mkdirp.sync(remoteDataDir);
|
||||
|
||||
if (codePath) {
|
||||
// running against a build: copy the test resolver extension into remote extensions dir
|
||||
const remoteExtensionsDir = join(remoteDataDir, 'extensions');
|
||||
mkdirp.sync(remoteExtensionsDir);
|
||||
await measureAndLog(() => copyExtension(root, remoteExtensionsDir, 'vscode-notebook-tests'), 'copyExtension(vscode-notebook-tests)', logger);
|
||||
}
|
||||
|
||||
env['TESTRESOLVER_DATA_FOLDER'] = remoteDataDir;
|
||||
env['TESTRESOLVER_LOGS_FOLDER'] = join(logsPath, 'server');
|
||||
if (options.verbose) {
|
||||
@@ -75,8 +68,6 @@ export async function resolveElectronConfiguration(options: LaunchOptions): Prom
|
||||
}
|
||||
}
|
||||
|
||||
args.push('--enable-proposed-api=vscode.vscode-notebook-tests');
|
||||
|
||||
if (!codePath) {
|
||||
args.unshift(root);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
import { Code } from './code';
|
||||
import { QuickAccess } from './quickaccess';
|
||||
import { QuickInput } from './quickinput';
|
||||
|
||||
const activeRowSelector = `.notebook-editor .monaco-list-row.focused`;
|
||||
|
||||
@@ -12,11 +13,14 @@ export class Notebook {
|
||||
|
||||
constructor(
|
||||
private readonly quickAccess: QuickAccess,
|
||||
private readonly quickInput: QuickInput,
|
||||
private readonly code: Code) {
|
||||
}
|
||||
|
||||
async openNotebook() {
|
||||
await this.quickAccess.runCommand('vscode-notebook-tests.createNewNotebook');
|
||||
await this.quickAccess.openFileQuickAccessAndWait('notebook.ipynb', 1);
|
||||
await this.quickInput.selectQuickInputElement(0);
|
||||
|
||||
await this.code.waitForElement(activeRowSelector);
|
||||
await this.focusFirstCell();
|
||||
await this.waitForActiveCellEditorContents('code()');
|
||||
|
||||
@@ -64,7 +64,7 @@ export class Workbench {
|
||||
this.settingsEditor = new SettingsEditor(code, this.editors, this.editor, this.quickaccess);
|
||||
this.keybindingsEditor = new KeybindingsEditor(code);
|
||||
this.terminal = new Terminal(code, this.quickaccess, this.quickinput);
|
||||
this.notebook = new Notebook(this.quickaccess, code);
|
||||
this.notebook = new Notebook(this.quickaccess, this.quickinput, code);
|
||||
this.localization = new Localization(code);
|
||||
this.task = new Task(code, this.editor, this.editors, this.quickaccess, this.quickinput, this.terminal);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Application, Logger } from '../../../../automation';
|
||||
import { installAllHandlers } from '../../utils';
|
||||
|
||||
export function setup(logger: Logger) {
|
||||
describe.skip('Notebooks', () => { // TODO@rebornix https://github.com/microsoft/vscode/issues/140575
|
||||
describe('Notebooks', () => {
|
||||
|
||||
// Shared before/after handling
|
||||
installAllHandlers(logger);
|
||||
@@ -25,7 +25,7 @@ export function setup(logger: Logger) {
|
||||
cp.execSync('git reset --hard HEAD --quiet', { cwd: app.workspacePathOrFolder });
|
||||
});
|
||||
|
||||
it.skip('inserts/edits code cell', async function () { // TODO@rebornix https://github.com/microsoft/vscode/issues/139672
|
||||
it('inserts/edits code cell', async function () {
|
||||
const app = this.app as Application;
|
||||
await app.workbench.notebook.openNotebook();
|
||||
await app.workbench.notebook.focusNextCell();
|
||||
@@ -34,7 +34,7 @@ export function setup(logger: Logger) {
|
||||
await app.workbench.notebook.stopEditingCell();
|
||||
});
|
||||
|
||||
it.skip('inserts/edits markdown cell', async function () {
|
||||
it('inserts/edits markdown cell', async function () {
|
||||
const app = this.app as Application;
|
||||
await app.workbench.notebook.openNotebook();
|
||||
await app.workbench.notebook.focusNextCell();
|
||||
|
||||
Reference in New Issue
Block a user