Merge pull request #137763 from microsoft/tyriar/cleanup_smoke

Move terminal smoke tests into a single suite and reduce boilterplate
This commit is contained in:
Daniel Imms 2021-11-24 09:54:50 -08:00 committed by GitHub
commit f880669743
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 64 additions and 57 deletions

View file

@ -4,22 +4,16 @@
*--------------------------------------------------------------------------------------------*/
import { ParsedArgs } from 'minimist';
import { Terminal, TerminalCommandId, TerminalCommandIdWithValue } from '../../../../automation/out';
import { afterSuite, beforeSuite } from '../../utils';
import { Application, Terminal, TerminalCommandId, TerminalCommandIdWithValue } from '../../../../automation/out';
export function setup(opts: ParsedArgs) {
describe('Terminal Editors', () => {
let terminal: Terminal;
beforeSuite(opts);
afterSuite(opts);
before(function () {
terminal = this.app.workbench.terminal;
});
afterEach(async () => {
await terminal.runCommand(TerminalCommandId.KillAll);
// Acquire automation API
before(async function () {
const app = this.app as Application;
terminal = app.workbench.terminal;
});
// TODO: This was flaky in CI

View file

@ -5,26 +5,14 @@
import { ParsedArgs } from 'minimist';
import { Application, Terminal, TerminalCommandId, TerminalCommandIdWithValue } from '../../../../automation/out';
import { afterSuite, beforeSuite } from '../../utils';
export function setup(opts: ParsedArgs) {
describe('Terminal Persistence', () => {
// Acquire automation API
let terminal: Terminal;
beforeSuite(opts);
afterSuite(opts);
before(async function () {
before(function () {
const app = this.app as Application;
terminal = app.workbench.terminal;
// Always show tabs to make getting terminal groups easier
await app.workbench.settingsEditor.addUserSetting('terminal.integrated.tabs.hideCondition', '"never"');
await app.workbench.quickaccess.runCommand('workbench.action.closeAllEditors');
});
afterEach(async () => {
await terminal.runCommand(TerminalCommandId.KillAll);
});
describe('detach/attach', () => {

View file

@ -4,25 +4,18 @@
*--------------------------------------------------------------------------------------------*/
import { ParsedArgs } from 'minimist';
import { Terminal, TerminalCommandId, TerminalCommandIdWithValue } from '../../../../automation';
import { afterSuite, beforeSuite } from '../../utils';
import { Application, Terminal, TerminalCommandId, TerminalCommandIdWithValue } from '../../../../automation';
const CONTRIBUTED_PROFILE_NAME = `JavaScript Debug Terminal`;
const ANY_PROFILE_NAME = '^((?!JavaScript Debug Terminal).)*$';
export function setup(opts: ParsedArgs) {
describe('Terminal Profiles', () => {
// Acquire automation API
let terminal: Terminal;
beforeSuite(opts);
afterSuite(opts);
before(function () {
terminal = this.app.workbench.terminal;
});
afterEach(async () => {
await terminal.runCommand(TerminalCommandId.KillAll);
const app = this.app as Application;
terminal = app.workbench.terminal;
});
it('should launch the default profile', async () => {

View file

@ -5,22 +5,15 @@
import { ParsedArgs } from 'minimist';
import { Terminal, TerminalCommandId, TerminalCommandIdWithValue } from '../../../../automation/out';
import { afterSuite, beforeSuite } from '../../utils';
import { Application, Terminal, TerminalCommandId, TerminalCommandIdWithValue } from '../../../../automation/out';
export function setup(opts: ParsedArgs) {
describe('Terminal Tabs', () => {
// Acquire automation API
let terminal: Terminal;
beforeSuite(opts);
afterSuite(opts);
before(function () {
terminal = this.app.workbench.terminal;
});
afterEach(async () => {
await terminal.runCommand(TerminalCommandId.KillAll);
const app = this.app as Application;
terminal = app.workbench.terminal;
});
it('clicking the plus button should create a terminal and display the tabs view showing no split decorations', async () => {

View file

@ -0,0 +1,47 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import minimist = require('minimist');
import { Application, Terminal, TerminalCommandId } from '../../../../automation/out';
import { afterSuite, beforeSuite } from '../../utils';
import { setup as setupTerminalEditorsTests } from './terminal-editors.test';
import { setup as setupTerminalPersistenceTests } from './terminal-persistence.test';
import { setup as setupTerminalProfileTests } from './terminal-profiles.test';
import { setup as setupTerminalTabsTests } from './terminal-tabs.test';
export function setup(opts: minimist.ParsedArgs) {
describe('Terminal', () => {
// TODO: Enable terminal tests for non-web when the desktop driver is moved to playwright
if (!opts.web) {
return;
}
beforeSuite(opts);
afterSuite(opts);
let terminal: Terminal;
before(async function () {
// Fetch terminal automation API
const app = this.app as Application;
terminal = app.workbench.terminal;
// Always show tabs to make getting terminal groups easier
await app.workbench.settingsEditor.addUserSetting('terminal.integrated.tabs.hideCondition', '"never"');
// Close the settings editor
await app.workbench.quickaccess.runCommand('workbench.action.closeAllEditors');
});
afterEach(async () => {
// Kill all terminals between every test for a consistent testing environment
await terminal.runCommand(TerminalCommandId.KillAll);
});
setupTerminalEditorsTests(opts);
setupTerminalPersistenceTests(opts);
setupTerminalProfileTests(opts);
setupTerminalTabsTests(opts);
});
}

View file

@ -28,10 +28,7 @@ import { setup as setupExtensionTests } from './areas/extensions/extensions.test
import { setup as setupMultirootTests } from './areas/multiroot/multiroot.test';
import { setup as setupLocalizationTests } from './areas/workbench/localization.test';
import { setup as setupLaunchTests } from './areas/workbench/launch.test';
import { setup as setupTerminalProfileTests } from './areas/terminal/terminal-profiles.test';
import { setup as setupTerminalTabsTests } from './areas/terminal/terminal-tabs.test';
import { setup as setupTerminalEditorsTests } from './areas/terminal/terminal-editors.test';
import { setup as setupTerminalPersistenceTests } from './areas/terminal/terminal-persistence.test';
import { setup as setupTerminalTests } from './areas/terminal/terminal.test';
try {
gracefulify(fs);
@ -362,15 +359,10 @@ describe(`VSCode Smoke Tests (${opts.web ? 'Web' : 'Electron'})`, () => {
setupNotebookTests(opts);
setupLanguagesTests(opts);
setupEditorTests(opts);
setupTerminalTests(opts);
setupStatusbarTests(opts);
setupExtensionTests(opts);
if (!opts.web) { setupMultirootTests(opts); }
if (!opts.web) { setupLocalizationTests(opts); }
if (!opts.web) { setupLaunchTests(opts); }
// TODO: Enable terminal tests for non-web when it moved to playwright
if (opts.web) { setupTerminalProfileTests(opts); }
if (opts.web) { setupTerminalTabsTests(opts); }
if (opts.web) { setupTerminalEditorsTests(opts); }
if (opts.web) { setupTerminalPersistenceTests(opts); }
});