mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-14 18:46:34 -05:00
Merge from vscode e5834d3280fcd04898efeac32b9cf1b893f9b127 (#9385)
* Merge from vscode e5834d3280fcd04898efeac32b9cf1b893f9b127 * distro
This commit is contained in:
@@ -28,7 +28,8 @@
|
||||
"concurrently": "^3.5.1",
|
||||
"cpx": "^1.5.0",
|
||||
"typescript": "3.7.5",
|
||||
"watch": "^1.0.2"
|
||||
"watch": "^1.0.2",
|
||||
"tree-kill": "1.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"mkdirp": "^0.5.1",
|
||||
|
||||
@@ -115,9 +115,6 @@ async function createDriverHandle(): Promise<string> {
|
||||
}
|
||||
|
||||
export async function spawn(options: SpawnOptions): Promise<Code> {
|
||||
const codePath = options.codePath;
|
||||
const electronPath = codePath ? getBuildElectronPath(codePath) : getDevElectronPath();
|
||||
const outPath = codePath ? getBuildOutPath(codePath) : getDevOutPath();
|
||||
const handle = await createDriverHandle();
|
||||
|
||||
let child: cp.ChildProcess | undefined;
|
||||
@@ -126,63 +123,67 @@ export async function spawn(options: SpawnOptions): Promise<Code> {
|
||||
if (options.web) {
|
||||
await launch(options.userDataDir, options.workspacePath, options.codePath);
|
||||
connectDriver = connectPlaywrightDriver.bind(connectPlaywrightDriver, options.browser);
|
||||
} else {
|
||||
const env = process.env;
|
||||
|
||||
const args = [
|
||||
options.workspacePath,
|
||||
'--skip-getting-started',
|
||||
'--skip-release-notes',
|
||||
'--sticky-quickopen',
|
||||
'--disable-telemetry',
|
||||
'--disable-updates',
|
||||
'--disable-crash-reporter',
|
||||
`--extensions-dir=${options.extensionsPath}`,
|
||||
`--user-data-dir=${options.userDataDir}`,
|
||||
'--driver', handle
|
||||
];
|
||||
|
||||
if (options.remote) {
|
||||
// Replace workspace path with URI
|
||||
args[0] = `--${options.workspacePath.endsWith('.code-workspace') ? 'file' : 'folder'}-uri=vscode-remote://test+test/${URI.file(options.workspacePath).path}`;
|
||||
|
||||
if (codePath) {
|
||||
// running against a build: copy the test resolver extension
|
||||
const testResolverExtPath = path.join(options.extensionsPath, 'vscode-test-resolver');
|
||||
if (!fs.existsSync(testResolverExtPath)) {
|
||||
const orig = path.join(repoPath, 'extensions', 'vscode-test-resolver');
|
||||
await new Promise((c, e) => ncp(orig, testResolverExtPath, err => err ? e(err) : c()));
|
||||
}
|
||||
}
|
||||
args.push('--enable-proposed-api=vscode.vscode-test-resolver');
|
||||
const remoteDataDir = `${options.userDataDir}-server`;
|
||||
mkdirp.sync(remoteDataDir);
|
||||
env['TESTRESOLVER_DATA_FOLDER'] = remoteDataDir;
|
||||
}
|
||||
|
||||
if (!codePath) {
|
||||
args.unshift(repoPath);
|
||||
}
|
||||
|
||||
if (options.verbose) {
|
||||
args.push('--driver-verbose');
|
||||
}
|
||||
|
||||
if (options.log) {
|
||||
args.push('--log', options.log);
|
||||
}
|
||||
|
||||
if (options.extraArgs) {
|
||||
args.push(...options.extraArgs);
|
||||
}
|
||||
|
||||
const spawnOptions: cp.SpawnOptions = { env };
|
||||
child = cp.spawn(electronPath, args, spawnOptions);
|
||||
instances.add(child);
|
||||
child.once('exit', () => instances.delete(child!));
|
||||
connectDriver = connectElectronDriver;
|
||||
return connect(connectDriver, child, '', handle, options.logger);
|
||||
}
|
||||
|
||||
const env = process.env;
|
||||
const codePath = options.codePath;
|
||||
const outPath = codePath ? getBuildOutPath(codePath) : getDevOutPath();
|
||||
|
||||
const args = [
|
||||
options.workspacePath,
|
||||
'--skip-getting-started',
|
||||
'--skip-release-notes',
|
||||
'--sticky-quickopen',
|
||||
'--disable-telemetry',
|
||||
'--disable-updates',
|
||||
'--disable-crash-reporter',
|
||||
`--extensions-dir=${options.extensionsPath}`,
|
||||
`--user-data-dir=${options.userDataDir}`,
|
||||
`--disable-restore-windows`,
|
||||
'--driver', handle
|
||||
];
|
||||
|
||||
if (options.remote) {
|
||||
// Replace workspace path with URI
|
||||
args[0] = `--${options.workspacePath.endsWith('.code-workspace') ? 'file' : 'folder'}-uri=vscode-remote://test+test/${URI.file(options.workspacePath).path}`;
|
||||
|
||||
if (codePath) {
|
||||
// running against a build: copy the test resolver extension
|
||||
const testResolverExtPath = path.join(options.extensionsPath, 'vscode-test-resolver');
|
||||
if (!fs.existsSync(testResolverExtPath)) {
|
||||
const orig = path.join(repoPath, 'extensions', 'vscode-test-resolver');
|
||||
await new Promise((c, e) => ncp(orig, testResolverExtPath, err => err ? e(err) : c()));
|
||||
}
|
||||
}
|
||||
args.push('--enable-proposed-api=vscode.vscode-test-resolver');
|
||||
const remoteDataDir = `${options.userDataDir}-server`;
|
||||
mkdirp.sync(remoteDataDir);
|
||||
env['TESTRESOLVER_DATA_FOLDER'] = remoteDataDir;
|
||||
}
|
||||
|
||||
if (!codePath) {
|
||||
args.unshift(repoPath);
|
||||
}
|
||||
|
||||
if (options.verbose) {
|
||||
args.push('--driver-verbose');
|
||||
}
|
||||
|
||||
if (options.log) {
|
||||
args.push('--log', options.log);
|
||||
}
|
||||
|
||||
if (options.extraArgs) {
|
||||
args.push(...options.extraArgs);
|
||||
}
|
||||
|
||||
const electronPath = codePath ? getBuildElectronPath(codePath) : getDevElectronPath();
|
||||
const spawnOptions: cp.SpawnOptions = { env };
|
||||
child = cp.spawn(electronPath, args, spawnOptions);
|
||||
instances.add(child);
|
||||
child.once('exit', () => instances.delete(child!));
|
||||
connectDriver = connectElectronDriver;
|
||||
return connect(connectDriver, child, outPath, handle, options.logger);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import { mkdir } from 'fs';
|
||||
import { promisify } from 'util';
|
||||
import { IDriver, IDisposable } from './driver';
|
||||
import { URI } from 'vscode-uri';
|
||||
import * as kill from 'tree-kill';
|
||||
|
||||
const width = 1200;
|
||||
const height = 800;
|
||||
@@ -93,6 +94,7 @@ let workspacePath: string | undefined;
|
||||
|
||||
export async function launch(userDataDir: string, _workspacePath: string, codeServerPath = process.env.VSCODE_REMOTE_SERVER_PATH): Promise<void> {
|
||||
workspacePath = _workspacePath;
|
||||
|
||||
const agentFolder = userDataDir;
|
||||
await promisify(mkdir)(agentFolder);
|
||||
const env = {
|
||||
@@ -121,7 +123,7 @@ export async function launch(userDataDir: string, _workspacePath: string, codeSe
|
||||
|
||||
function teardown(): void {
|
||||
if (server) {
|
||||
server.kill();
|
||||
kill(server.pid);
|
||||
server = undefined;
|
||||
}
|
||||
}
|
||||
@@ -137,13 +139,9 @@ function waitForEndpoint(): Promise<string> {
|
||||
});
|
||||
}
|
||||
|
||||
export function connect(engine: 'chromium' | 'webkit' | 'firefox' = 'chromium'): Promise<{ client: IDisposable, driver: IDriver }> {
|
||||
export function connect(browserType: 'chromium' | 'webkit' | 'firefox' = 'chromium'): Promise<{ client: IDisposable, driver: IDriver }> {
|
||||
return new Promise(async (c) => {
|
||||
const browser = await playwright[engine].launch({
|
||||
// Run in Edge dev on macOS
|
||||
// executablePath: '/Applications/Microsoft\ Edge\ Dev.app/Contents/MacOS/Microsoft\ Edge\ Dev',
|
||||
headless: false
|
||||
});
|
||||
const browser = await playwright[browserType].launch({ headless: false, dumpio: true });
|
||||
const context = await browser.newContext();
|
||||
const page = await context.newPage();
|
||||
await page.setViewportSize({ width, height });
|
||||
|
||||
@@ -1634,6 +1634,11 @@ to-regex@^3.0.1, to-regex@^3.0.2:
|
||||
regex-not "^1.0.2"
|
||||
safe-regex "^1.1.0"
|
||||
|
||||
tree-kill@1.2.2:
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.2.tgz#4ca09a9092c88b73a7cdc5e8a01b507b0790a0cc"
|
||||
integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==
|
||||
|
||||
tree-kill@^1.1.0:
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.1.tgz#5398f374e2f292b9dcc7b2e71e30a5c3bb6c743a"
|
||||
|
||||
@@ -13,13 +13,13 @@ yarn --cwd test/automation
|
||||
yarn smoketest
|
||||
|
||||
# Dev (Web)
|
||||
yarn smoketest --web --browser [chromium|firefox|webkit]
|
||||
yarn smoketest --web --browser [chromium|webkit]
|
||||
|
||||
# Build (Electron)
|
||||
yarn smoketest --build <path latest built version> --stable-build <path to previous stable version>
|
||||
|
||||
# Build (Web - read instructions below)
|
||||
yarn smoketest --build <path to web server folder> --web --browser [chromium|firefox|webkit]
|
||||
yarn smoketest --build <path to web server folder> --web --browser [chromium|webkit]
|
||||
|
||||
# Remote (Electron)
|
||||
yarn smoketest --build <path latest built version> --remote
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Application, ProblemSeverity, Problems } from '../../../../automation';
|
||||
|
||||
export function setup() {
|
||||
describe('CSS', () => {
|
||||
it('verifies quick outline', async function () {
|
||||
const app = this.app as Application;
|
||||
await app.workbench.quickopen.openFile('style.css');
|
||||
|
||||
await app.workbench.quickopen.openQuickOutline();
|
||||
await app.workbench.quickopen.waitForQuickOpenElements(names => names.length === 2);
|
||||
});
|
||||
|
||||
it('verifies warnings for the empty rule', async function () {
|
||||
const app = this.app as Application;
|
||||
await app.workbench.quickopen.openFile('style.css');
|
||||
await app.workbench.editor.waitForTypeInEditor('style.css', '.foo{}');
|
||||
|
||||
await app.code.waitForElement(Problems.getSelectorInEditor(ProblemSeverity.WARNING));
|
||||
|
||||
await app.workbench.problems.showProblemsView();
|
||||
await app.code.waitForElement(Problems.getSelectorInProblemsView(ProblemSeverity.WARNING));
|
||||
await app.workbench.problems.hideProblemsView();
|
||||
});
|
||||
|
||||
it('verifies that warning becomes an error once setting changed', async function () {
|
||||
const app = this.app as Application;
|
||||
await app.workbench.settingsEditor.addUserSetting('css.lint.emptyRules', '"error"');
|
||||
await app.workbench.quickopen.openFile('style.css');
|
||||
|
||||
await app.code.waitForElement(Problems.getSelectorInEditor(ProblemSeverity.ERROR));
|
||||
|
||||
const problems = new Problems(app.code);
|
||||
await problems.showProblemsView();
|
||||
await app.code.waitForElement(Problems.getSelectorInProblemsView(ProblemSeverity.ERROR));
|
||||
await problems.hideProblemsView();
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -37,10 +37,10 @@ export function setup() {
|
||||
await app.workbench.scm.waitForTitle(title => /quellcodeverwaltung/i.test(title));
|
||||
|
||||
await app.workbench.debug.openDebugViewlet();
|
||||
await app.workbench.debug.waitForTitle(title => /debug/i.test(title));
|
||||
await app.workbench.debug.waitForTitle(title => /starten/i.test(title));
|
||||
|
||||
// await app.workbench.extensions.openExtensionsViewlet();
|
||||
// await app.workbench.extensions.waitForTitle(title => /erweiterungen/i.test(title));
|
||||
await app.workbench.extensions.openExtensionsViewlet();
|
||||
await app.workbench.extensions.waitForTitle(title => /extensions/i.test(title));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ import { setup as setupDataMigrationTests } from './areas/workbench/data-migrati
|
||||
import { setup as setupDataLossTests } from './areas/workbench/data-loss.test';
|
||||
import { setup as setupDataPreferencesTests } from './areas/preferences/preferences.test';
|
||||
import { setup as setupDataSearchTests } from './areas/search/search.test';
|
||||
import { setup as setupDataCSSTests } from './areas/css/css.test';
|
||||
import { setup as setupDataEditorTests } from './areas/editor/editor.test';
|
||||
import { setup as setupDataStatusbarTests } from './areas/statusbar/statusbar.test';
|
||||
import { setup as setupDataExtensionTests } from './areas/extensions/extensions.test';
|
||||
@@ -63,8 +62,7 @@ const opts = minimist(args, {
|
||||
boolean: [
|
||||
'verbose',
|
||||
'remote',
|
||||
'web',
|
||||
'ci'
|
||||
'web'
|
||||
],
|
||||
default: {
|
||||
verbose: false
|
||||
@@ -319,27 +317,17 @@ describe(`VSCode Smoke Tests (${opts.web ? 'Web' : 'Electron'})`, () => {
|
||||
});
|
||||
}
|
||||
|
||||
// CI only tests (must be reliable)
|
||||
if (opts.ci) {
|
||||
// TODO@Ben figure out tests that can run continously and reliably
|
||||
}
|
||||
|
||||
// Non-CI execution (all tests)
|
||||
else {
|
||||
/*if (!opts.web) { setupDataMigrationTests(opts['stable-build'], testDataPath); } {{SQL CARBON EDIT}} comment out tests
|
||||
if (!opts.web) { setupDataLossTests(); }
|
||||
if (!opts.web) { setupDataPreferencesTests(); }
|
||||
setupDataSearchTests();
|
||||
setupDataCSSTests();
|
||||
setupDataEditorTests();
|
||||
setupDataStatusbarTests(!!opts.web);
|
||||
if (!opts.web) { setupDataExtensionTests(); }
|
||||
setupTerminalTests();
|
||||
if (!opts.web) { setupDataMultirootTests(); }
|
||||
if (!opts.web) { setupDataLocalizationTests(); }
|
||||
if (!opts.web) { setupLaunchTests(); }*/
|
||||
|
||||
runProfilerTests(); // {{SQL CARBON EDIT}} add our tests
|
||||
runQueryEditorTests(); // {{SQL CARBON EDIT}} add our tests
|
||||
}
|
||||
/*if (!opts.web) { setupDataMigrationTests(opts['stable-build'], testDataPath); }
|
||||
if (!opts.web) { setupDataLossTests(); }
|
||||
if (!opts.web) { setupDataPreferencesTests(); }
|
||||
setupDataSearchTests();
|
||||
setupDataEditorTests();
|
||||
setupDataStatusbarTests(!!opts.web);
|
||||
if (!opts.web) { setupDataExtensionTests(); }
|
||||
setupTerminalTests();
|
||||
if (!opts.web) { setupDataMultirootTests(); }
|
||||
if (!opts.web) { setupDataLocalizationTests(); }
|
||||
if (!opts.web) { setupLaunchTests(); }*/
|
||||
runProfilerTests(); // {{SQL CARBON EDIT}} add our tests
|
||||
runQueryEditorTests(); // {{SQL CARBON EDIT}} add our tests
|
||||
});
|
||||
|
||||
@@ -9,6 +9,8 @@ All unit tests are run inside a electron-browser environment which access to DOM
|
||||
- use the `--debug` to see an electron window with dev tools which allows for debugging
|
||||
- to run only a subset of tests use the `--run` or `--glob` options
|
||||
|
||||
For instance, `./scripts/test.sh --debug --glob **/extHost*.test.js` runs all tests from `extHost`-files and enables you to debug them.
|
||||
|
||||
## Run (inside browser)
|
||||
|
||||
yarn test-browser --browser webkit --browser chromium
|
||||
@@ -24,11 +26,6 @@ Unit tests from layers `common` and `browser` are run inside `chromium`, `webkit
|
||||
|
||||
yarn run mocha --run src/vs/editor/test/browser/controller/cursor.test.ts
|
||||
|
||||
## Debug
|
||||
|
||||
To debug tests use `--debug` when running the test script. Also, the set of tests can be reduced with the `--run` and `--runGlob` flags. Both require a file path/pattern. Like so:
|
||||
|
||||
./scripts/test.sh --debug --runGrep **/extHost*.test.js
|
||||
|
||||
## Coverage
|
||||
|
||||
|
||||
Reference in New Issue
Block a user