fix screenshots in smoketests

related to #122685
This commit is contained in:
João Moreno 2021-07-16 11:58:49 +02:00
parent 599f5d2c67
commit 3c4fdb58a1
No known key found for this signature in database
GPG key ID: 896B853774D1A575
12 changed files with 42 additions and 62 deletions

View file

@ -10,14 +10,14 @@ import { afterSuite, beforeSuite } from '../../utils';
export function setup(opts: minimist.ParsedArgs) { export function setup(opts: minimist.ParsedArgs) {
describe('Editor', () => { describe('Editor', () => {
beforeSuite(opts); beforeSuite(opts);
afterSuite(); afterSuite(opts);
it('shows correct quick outline', async function () { it('shows correct quick outline', async function () {
const app = this.app as Application; const app = this.app as Application;
await app.workbench.quickaccess.openFile('www'); await app.workbench.quickaccess.openFile('www');
await app.workbench.quickaccess.openQuickOutline(); await app.workbench.quickaccess.openQuickOutline();
await app.workbench.quickinput.waitForQuickInputElements(names => names.length >= 6); await app.workbench.quickinput.waitForQuickInputElements(names => names.length >= 6000);
}); });
}); });
} }

View file

@ -10,7 +10,7 @@ import { afterSuite, beforeSuite } from '../../utils';
export function setup(opts: minimist.ParsedArgs) { export function setup(opts: minimist.ParsedArgs) {
describe('Extensions', () => { describe('Extensions', () => {
beforeSuite(opts); beforeSuite(opts);
afterSuite(); afterSuite(opts);
it(`install and enable vscode-smoketest-check extension`, async function () { it(`install and enable vscode-smoketest-check extension`, async function () {
const app = this.app as Application; const app = this.app as Application;

View file

@ -10,7 +10,7 @@ import { afterSuite, beforeSuite } from '../../utils';
export function setup(opts: minimist.ParsedArgs) { export function setup(opts: minimist.ParsedArgs) {
describe('Language Features', () => { describe('Language Features', () => {
beforeSuite(opts); beforeSuite(opts);
afterSuite(); afterSuite(opts);
it('verifies quick outline', async function () { it('verifies quick outline', async function () {
const app = this.app as Application; const app = this.app as Application;

View file

@ -43,7 +43,7 @@ export function setup(opts: minimist.ParsedArgs) {
return { ...opts, workspacePath }; return { ...opts, workspacePath };
}); });
afterSuite(); afterSuite(opts);
it('shows results from all folders', async function () { it('shows results from all folders', async function () {
const app = this.app as Application; const app = this.app as Application;

View file

@ -24,7 +24,7 @@ export function setup(opts: minimist.ParsedArgs) {
cp.execSync('git reset --hard HEAD --quiet', { cwd: app.workspacePathOrFolder }); cp.execSync('git reset --hard HEAD --quiet', { cwd: app.workspacePathOrFolder });
}); });
afterSuite(); afterSuite(opts);
it.skip('inserts/edits code cell', async function () { it.skip('inserts/edits code cell', async function () {
const app = this.app as Application; const app = this.app as Application;

View file

@ -10,7 +10,7 @@ import { afterSuite, beforeSuite } from '../../utils';
export function setup(opts: minimist.ParsedArgs) { export function setup(opts: minimist.ParsedArgs) {
describe('Preferences', () => { describe('Preferences', () => {
beforeSuite(opts); beforeSuite(opts);
afterSuite(); afterSuite(opts);
it('turns off editor line numbers and verifies the live change', async function () { it('turns off editor line numbers and verifies the live change', async function () {
const app = this.app as Application; const app = this.app as Application;

View file

@ -19,7 +19,7 @@ export function setup(opts: minimist.ParsedArgs) {
cp.execSync('git reset --hard HEAD --quiet', { cwd: app.workspacePathOrFolder }); cp.execSync('git reset --hard HEAD --quiet', { cwd: app.workspacePathOrFolder });
}); });
afterSuite(); afterSuite(opts);
// https://github.com/microsoft/vscode/issues/124146 // https://github.com/microsoft/vscode/issues/124146
it.skip /* https://github.com/microsoft/vscode/issues/124335 */('has a tooltp with a keybinding', async function () { it.skip /* https://github.com/microsoft/vscode/issues/124335 */('has a tooltp with a keybinding', async function () {
@ -75,7 +75,7 @@ export function setup(opts: minimist.ParsedArgs) {
describe('Quick Access', () => { describe('Quick Access', () => {
beforeSuite(opts); beforeSuite(opts);
afterSuite(); afterSuite(opts);
it('quick access search produces correct result', async function () { it('quick access search produces correct result', async function () {
const app = this.app as Application; const app = this.app as Application;

View file

@ -10,7 +10,7 @@ import { afterSuite, beforeSuite } from '../../utils';
export function setup(opts: minimist.ParsedArgs) { export function setup(opts: minimist.ParsedArgs) {
describe('Statusbar', () => { describe('Statusbar', () => {
beforeSuite(opts); beforeSuite(opts);
afterSuite(); afterSuite(opts);
it('verifies presence of all default status bar elements', async function () { it('verifies presence of all default status bar elements', async function () {
const app = this.app as Application; const app = this.app as Application;

View file

@ -11,7 +11,7 @@ export function setup(opts: minimist.ParsedArgs) {
describe('Dataloss', () => { describe('Dataloss', () => {
beforeSuite(opts); beforeSuite(opts);
afterSuite(); afterSuite(opts);
it(`verifies that 'hot exit' works for dirty files`, async function () { it(`verifies that 'hot exit' works for dirty files`, async function () {
const app = this.app as Application; const app = this.app as Application;

View file

@ -10,7 +10,7 @@ import { afterSuite, beforeSuite } from '../../utils';
export function setup(opts: minimist.ParsedArgs) { export function setup(opts: minimist.ParsedArgs) {
describe('Localization', () => { describe('Localization', () => {
beforeSuite(opts); beforeSuite(opts);
afterSuite(); afterSuite(opts);
it(`starts with 'DE' locale and verifies title and viewlets text is in German`, async function () { it(`starts with 'DE' locale and verifies title and viewlets text is in German`, async function () {
const app = this.app as Application; const app = this.app as Application;

View file

@ -13,15 +13,7 @@ import * as mkdirp from 'mkdirp';
import { ncp } from 'ncp'; import { ncp } from 'ncp';
import * as vscodetest from 'vscode-test'; import * as vscodetest from 'vscode-test';
import fetch from 'node-fetch'; import fetch from 'node-fetch';
import { import { Quality, ApplicationOptions, MultiLogger, Logger, ConsoleLogger, FileLogger } from '../../automation';
Application,
Quality,
ApplicationOptions,
MultiLogger,
Logger,
ConsoleLogger,
FileLogger,
} from '../../automation';
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 setupDataLossTests } from './areas/workbench/data-loss.test';
@ -335,45 +327,22 @@ after(async function () {
await new Promise((c, e) => rimraf(testDataPath, { maxBusyTries: 10 }, err => err ? e(err) : c(undefined))); await new Promise((c, e) => rimraf(testDataPath, { maxBusyTries: 10 }, err => err ? e(err) : c(undefined)));
}); });
describe(`VSCode Smoke Tests (${opts.web ? 'Web' : 'Electron'})`, () => { if (!opts.web && opts['build'] && !opts['remote']) {
if (screenshotsPath) { describe(`Stable vs Insiders Smoke Tests: This test MUST run before releasing`, () => {
afterEach(async function () { setupDataMigrationTests(opts, testDataPath);
if (this.currentTest!.state !== 'failed') {
return;
}
const app = this.app as Application;
const name = this.currentTest!.fullTitle().replace(/[^a-z0-9\-]/ig, '_');
await app.captureScreenshot(name);
});
}
if (opts.log) {
beforeEach(async function () {
const app = this.app as Application;
const title = this.currentTest!.fullTitle();
app.logger.log('*** Test start:', title);
});
}
if (!opts.web && opts['build'] && !opts['remote']) {
describe(`Stable vs Insiders Smoke Tests: This test MUST run before releasing`, () => {
setupDataMigrationTests(opts, testDataPath);
});
}
describe(`VSCode Smoke Tests (${opts.web ? 'Web' : 'Electron'})`, () => {
if (!opts.web) { setupDataLossTests(opts); }
if (!opts.web) { setupDataPreferencesTests(opts); }
setupDataSearchTests(opts);
setupDataNotebookTests(opts);
setupDataLanguagesTests(opts);
setupDataEditorTests(opts);
setupDataStatusbarTests(opts);
setupDataExtensionTests(opts);
if (!opts.web) { setupDataMultirootTests(opts); }
if (!opts.web) { setupDataLocalizationTests(opts); }
if (!opts.web) { setupLaunchTests(); }
}); });
}
describe(`VSCode Smoke Tests (${opts.web ? 'Web' : 'Electron'})`, () => {
if (!opts.web) { setupDataLossTests(opts); }
if (!opts.web) { setupDataPreferencesTests(opts); }
setupDataSearchTests(opts);
setupDataNotebookTests(opts);
setupDataLanguagesTests(opts);
setupDataEditorTests(opts);
setupDataStatusbarTests(opts);
setupDataExtensionTests(opts);
if (!opts.web) { setupDataMultirootTests(opts); }
if (!opts.web) { setupDataLocalizationTests(opts); }
if (!opts.web) { setupLaunchTests(); }
}); });

View file

@ -34,12 +34,23 @@ export function beforeSuite(opts: minimist.ParsedArgs, optionsTransform?: (opts:
const app = new Application({ ...options, userDataDir }); const app = new Application({ ...options, userDataDir });
await app!.start(opts.web ? false : undefined); await app!.start(opts.web ? false : undefined);
this.app = app; this.app = app;
if (opts.log) {
const title = this.currentTest!.fullTitle();
app.logger.log('*** Test start:', title);
}
}); });
} }
export function afterSuite() { export function afterSuite(opts: minimist.ParsedArgs) {
after(async function () { after(async function () {
const app = this.app as Application; const app = this.app as Application;
if (this.currentTest?.state === 'failed' && opts.screenshots) {
const name = this.currentTest!.fullTitle().replace(/[^a-z0-9\-]/ig, '_');
await app.captureScreenshot(name);
}
if (app) { if (app) {
await app.stop(); await app.stop();
} }