Merge from master

This commit is contained in:
Raj Musuku
2019-02-21 17:56:04 -08:00
parent 5a146e34fa
commit 666ae11639
11482 changed files with 119352 additions and 255574 deletions

View File

@@ -11,12 +11,12 @@ import * as tmp from 'tmp';
import * as rimraf from 'rimraf';
import * as mkdirp from 'mkdirp';
import { ncp } from 'ncp';
import { Application, Quality } from './application';
import { Application, Quality, ApplicationOptions } from './application';
//{{SQL CARBON EDIT}}
import { setup as runProfilerTests } from './sql/profiler/profiler.test';
//Original
/*
import { setup as setupDataMigrationTests } from './areas/workbench/data-migration.test';
// import { setup as setupDataMigrationTests } from './areas/workbench/data-migration.test';
import { setup as setupDataLossTests } from './areas/workbench/data-loss.test';
import { setup as setupDataExplorerTests } from './areas/explorer/explorer.test';
import { setup as setupDataPreferencesTests } from './areas/preferences/preferences.test';
@@ -30,6 +30,7 @@ import { setup as setupDataExtensionTests } from './areas/extensions/extensions.
import { setup as setupTerminalTests } from './areas/terminal/terminal.test';
import { setup as setupDataMultirootTests } from './areas/multiroot/multiroot.test';
import { setup as setupDataLocalizationTests } from './areas/workbench/localization.test';
import { setup as setupLaunchTests } from './areas/workbench/launch.test';
*/
//{{END}}
import { MultiLogger, Logger, ConsoleLogger, FileLogger } from './logger';
@@ -56,7 +57,6 @@ const opts = minimist(args, {
}
});
const workspaceFilePath = path.join(testDataPath, 'smoketest.code-workspace');
const testRepoUrl = 'https://github.com/Microsoft/vscode-smoketest-express';
const workspacePath = path.join(testDataPath, 'vscode-smoketest-express');
const extensionsPath = path.join(testDataPath, 'extensions-dir');
@@ -146,37 +146,6 @@ if (process.env.VSCODE_DEV === '1') {
quality = Quality.Stable;
}
function toUri(path: string): string {
if (process.platform === 'win32') {
return `${path.replace(/\\/g, '/')}`;
}
return `${path}`;
}
async function createWorkspaceFile(): Promise<void> {
if (fs.existsSync(workspaceFilePath)) {
return;
}
console.log('*** Creating workspace file...');
const workspace = {
folders: [
{
path: toUri(path.join(workspacePath, 'public'))
},
{
path: toUri(path.join(workspacePath, 'routes'))
},
{
path: toUri(path.join(workspacePath, 'views'))
}
]
};
fs.writeFileSync(workspaceFilePath, JSON.stringify(workspace, null, '\t'));
}
async function setupRepository(): Promise<void> {
if (opts['test-repo']) {
console.log('*** Copying test project repository:', opts['test-repo']);
@@ -203,13 +172,12 @@ async function setup(): Promise<void> {
console.log('*** Test data:', testDataPath);
console.log('*** Preparing smoketest setup...');
await createWorkspaceFile();
await setupRepository();
console.log('*** Smoketest setup done!\n');
}
function createApp(quality: Quality): Application {
function createOptions(): ApplicationOptions {
const loggers: Logger[] = [];
if (opts.verbose) {
@@ -222,25 +190,25 @@ function createApp(quality: Quality): Application {
loggers.push(new FileLogger(opts.log));
log = 'trace';
}
return new Application({
return {
quality,
codePath: opts.build,
workspacePath,
userDataDir,
extensionsPath,
workspaceFilePath,
waitTime: parseInt(opts['wait-time'] || '0') || 20,
logger: new MultiLogger(loggers),
verbose: opts.verbose,
log
});
log,
screenshotsPath
};
}
before(async function () {
// allow two minutes for setup
this.timeout(2 * 60 * 1000);
await setup();
this.defaultOptions = createOptions();
});
after(async function () {
@@ -255,17 +223,13 @@ after(async function () {
await new Promise((c, e) => rimraf(testDataPath, { maxBusyTries: 10 }, err => err ? e(err) : c()));
});
//{{SQL CARBON EDIT}}
/*
describe('Data Migration', () => {
setupDataMigrationTests(userDataDir, createApp);
});
*/
//{{END}}
// describe('Data Migration', () => {
// setupDataMigrationTests(userDataDir, createApp);
// });
describe('Smoke Test', () => {
describe('Running Code', () => {
before(async function () {
const app = createApp(quality);
const app = new Application(this.defaultOptions);
await app!.start();
//{{SQL CARBON EDIT}}
const testExtLoadedText = 'Test Extension Loaded';
@@ -293,19 +257,10 @@ describe('Smoke Test', () => {
if (this.currentTest.state !== 'failed') {
return;
}
const app = this.app as Application;
const raw = await app.capturePage();
const buffer = new Buffer(raw, 'base64');
const name = this.currentTest.fullTitle().replace(/[^a-z0-9\-]/ig, '_');
const screenshotPath = path.join(screenshotsPath, `${name}.png`);
if (opts.log) {
app.logger.log('*** Screenshot recorded:', screenshotPath);
}
fs.writeFileSync(screenshotPath, buffer);
await app.captureScreenshot(name);
});
}
@@ -338,3 +293,6 @@ describe('Smoke Test', () => {
*/
//{{END}}
});
// {{SQL CARBON EDIT}}
// setupLaunchTests();