smoke - quickopen => quickaccess

This commit is contained in:
Benjamin Pasero 2020-03-26 12:28:44 +01:00
parent 4cfc630dc1
commit 85d2077f19
14 changed files with 41 additions and 41 deletions

View file

@ -16,7 +16,7 @@ export * from './logger';
export * from './peek'; export * from './peek';
export * from './problems'; export * from './problems';
export * from './quickinput'; export * from './quickinput';
export * from './quickopen'; export * from './quickaccess';
export * from './scm'; export * from './scm';
export * from './search'; export * from './search';
export * from './settings'; export * from './settings';

View file

@ -7,14 +7,14 @@ import { Editors } from './editors';
import { Code } from './code'; import { Code } from './code';
import { QuickInput } from './quickinput'; import { QuickInput } from './quickinput';
export class QuickOpen { export class QuickAccess {
constructor(private code: Code, private editors: Editors, private quickInput: QuickInput) { } constructor(private code: Code, private editors: Editors, private quickInput: QuickInput) { }
async openQuickOpen(value: string): Promise<void> { async openQuickAccess(value: string): Promise<void> {
let retries = 0; let retries = 0;
// other parts of code might steal focus away from quickopen :( // other parts of code might steal focus away from quickinput :(
while (retries < 5) { while (retries < 5) {
if (process.platform === 'darwin') { if (process.platform === 'darwin') {
await this.code.dispatchKeybinding('cmd+p'); await this.code.dispatchKeybinding('cmd+p');
@ -40,7 +40,7 @@ export class QuickOpen {
} }
async openFile(fileName: string): Promise<void> { async openFile(fileName: string): Promise<void> {
await this.openQuickOpen(fileName); await this.openQuickAccess(fileName);
await this.quickInput.waitForQuickInputElements(names => names[0] === fileName); await this.quickInput.waitForQuickInputElements(names => names[0] === fileName);
await this.code.dispatchKeybinding('enter'); await this.code.dispatchKeybinding('enter');
@ -49,7 +49,7 @@ export class QuickOpen {
} }
async runCommand(commandId: string): Promise<void> { async runCommand(commandId: string): Promise<void> {
await this.openQuickOpen(`>${commandId}`); await this.openQuickAccess(`>${commandId}`);
// wait for best choice to be focused // wait for best choice to be focused
await this.code.waitForTextContent(QuickInput.QUICK_INPUT_FOCUSED_ELEMENT); await this.code.waitForTextContent(QuickInput.QUICK_INPUT_FOCUSED_ELEMENT);

View file

@ -8,11 +8,11 @@ import * as path from 'path';
import { Editor } from './editor'; import { Editor } from './editor';
import { Editors } from './editors'; import { Editors } from './editors';
import { Code } from './code'; import { Code } from './code';
import { QuickOpen } from './quickopen'; import { QuickAccess } from './quickaccess';
export class SettingsEditor { export class SettingsEditor {
constructor(private code: Code, private userDataPath: string, private editors: Editors, private editor: Editor, private quickopen: QuickOpen) { } constructor(private code: Code, private userDataPath: string, private editors: Editors, private editor: Editor, private quickaccess: QuickAccess) { }
async addUserSetting(setting: string, value: string): Promise<void> { async addUserSetting(setting: string, value: string): Promise<void> {
await this.openSettings(); await this.openSettings();
@ -32,6 +32,6 @@ export class SettingsEditor {
} }
private async openSettings(): Promise<void> { private async openSettings(): Promise<void> {
await this.quickopen.runCommand('workbench.action.openSettingsJson'); await this.quickaccess.runCommand('workbench.action.openSettingsJson');
} }
} }

View file

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import { Code } from './code'; import { Code } from './code';
import { QuickOpen } from './quickopen'; import { QuickAccess } from './quickaccess';
const PANEL_SELECTOR = 'div[id="workbench.panel.terminal"]'; const PANEL_SELECTOR = 'div[id="workbench.panel.terminal"]';
const XTERM_SELECTOR = `${PANEL_SELECTOR} .terminal-wrapper`; const XTERM_SELECTOR = `${PANEL_SELECTOR} .terminal-wrapper`;
@ -12,10 +12,10 @@ const XTERM_TEXTAREA = `${XTERM_SELECTOR} textarea.xterm-helper-textarea`;
export class Terminal { export class Terminal {
constructor(private code: Code, private quickopen: QuickOpen) { } constructor(private code: Code, private quickaccess: QuickAccess) { }
async showTerminal(): Promise<void> { async showTerminal(): Promise<void> {
await this.quickopen.runCommand('workbench.action.terminal.toggleTerminal'); await this.quickaccess.runCommand('workbench.action.terminal.toggleTerminal');
await this.code.waitForActiveElement(XTERM_TEXTAREA); await this.code.waitForActiveElement(XTERM_TEXTAREA);
await this.code.waitForTerminalBuffer(XTERM_SELECTOR, lines => lines.some(line => line.length > 0)); await this.code.waitForTerminalBuffer(XTERM_SELECTOR, lines => lines.some(line => line.length > 0));
} }

View file

@ -5,7 +5,7 @@
import { Explorer } from './explorer'; import { Explorer } from './explorer';
import { ActivityBar } from './activityBar'; import { ActivityBar } from './activityBar';
import { QuickOpen } from './quickopen'; import { QuickAccess } from './quickaccess';
import { QuickInput } from './quickinput'; import { QuickInput } from './quickinput';
import { Extensions } from './extensions'; import { Extensions } from './extensions';
import { Search } from './search'; import { Search } from './search';
@ -26,7 +26,7 @@ export interface Commands {
export class Workbench { export class Workbench {
readonly quickopen: QuickOpen; readonly quickaccess: QuickAccess;
readonly quickinput: QuickInput; readonly quickinput: QuickInput;
readonly editors: Editors; readonly editors: Editors;
readonly explorer: Explorer; readonly explorer: Explorer;
@ -45,18 +45,18 @@ export class Workbench {
constructor(code: Code, userDataPath: string) { constructor(code: Code, userDataPath: string) {
this.editors = new Editors(code); this.editors = new Editors(code);
this.quickinput = new QuickInput(code); this.quickinput = new QuickInput(code);
this.quickopen = new QuickOpen(code, this.editors, this.quickinput); this.quickaccess = new QuickAccess(code, this.editors, this.quickinput);
this.explorer = new Explorer(code, this.editors); this.explorer = new Explorer(code, this.editors);
this.activitybar = new ActivityBar(code); this.activitybar = new ActivityBar(code);
this.search = new Search(code); this.search = new Search(code);
this.extensions = new Extensions(code); this.extensions = new Extensions(code);
this.editor = new Editor(code, this.quickopen); this.editor = new Editor(code, this.quickaccess);
this.scm = new SCM(code); this.scm = new SCM(code);
this.debug = new Debug(code, this.quickopen, this.editors, this.editor); this.debug = new Debug(code, this.quickaccess, this.editors, this.editor);
this.statusbar = new StatusBar(code); this.statusbar = new StatusBar(code);
this.problems = new Problems(code); this.problems = new Problems(code);
this.settingsEditor = new SettingsEditor(code, userDataPath, this.editors, this.editor, this.quickopen); this.settingsEditor = new SettingsEditor(code, userDataPath, this.editors, this.editor, this.quickaccess);
this.keybindingsEditor = new KeybindingsEditor(code); this.keybindingsEditor = new KeybindingsEditor(code);
this.terminal = new Terminal(code, this.quickopen); this.terminal = new Terminal(code, this.quickaccess);
} }
} }

View file

@ -9,14 +9,14 @@ export function setup() {
describe('Editor', () => { describe('Editor', () => {
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.quickopen.openFile('www'); await app.workbench.quickaccess.openFile('www');
await app.workbench.quickopen.openQuickOutline(); await app.workbench.quickaccess.openQuickOutline();
await app.workbench.quickinput.waitForQuickInputElements(names => names.length >= 6); await app.workbench.quickinput.waitForQuickInputElements(names => names.length >= 6);
}); });
// it('folds/unfolds the code correctly', async function () { // it('folds/unfolds the code correctly', async function () {
// await app.workbench.quickopen.openFile('www'); // await app.workbench.quickaccess.openFile('www');
// // Fold // // Fold
// await app.workbench.editor.foldAtLine(3); // await app.workbench.editor.foldAtLine(3);

View file

@ -24,7 +24,7 @@ export function setup() {
if (app.remote) { if (app.remote) {
await app.reload(); await app.reload();
} }
await app.workbench.quickopen.runCommand('Smoke Test Check'); await app.workbench.quickaccess.runCommand('Smoke Test Check');
await app.workbench.statusbar.waitForStatusbarText('smoke test', 'VS Code Smoke Test Check'); await app.workbench.statusbar.waitForStatusbarText('smoke test', 'VS Code Smoke Test Check');
}); });
}); });

View file

@ -9,15 +9,15 @@ export function setup() {
describe('Language Features', () => { describe('Language Features', () => {
it('verifies quick outline', async function () { it('verifies quick outline', async function () {
const app = this.app as Application; const app = this.app as Application;
await app.workbench.quickopen.openFile('style.css'); await app.workbench.quickaccess.openFile('style.css');
await app.workbench.quickopen.openQuickOutline(); await app.workbench.quickaccess.openQuickOutline();
await app.workbench.quickinput.waitForQuickInputElements(names => names.length === 2); await app.workbench.quickinput.waitForQuickInputElements(names => names.length === 2);
}); });
it('verifies problems view', async function () { it('verifies problems view', async function () {
const app = this.app as Application; const app = this.app as Application;
await app.workbench.quickopen.openFile('style.css'); await app.workbench.quickaccess.openFile('style.css');
await app.workbench.editor.waitForTypeInEditor('style.css', '.foo{}'); await app.workbench.editor.waitForTypeInEditor('style.css', '.foo{}');
await app.code.waitForElement(Problems.getSelectorInEditor(ProblemSeverity.WARNING)); await app.code.waitForElement(Problems.getSelectorInEditor(ProblemSeverity.WARNING));
@ -30,7 +30,7 @@ export function setup() {
it('verifies settings', async function () { it('verifies settings', async function () {
const app = this.app as Application; const app = this.app as Application;
await app.workbench.settingsEditor.addUserSetting('css.lint.emptyRules', '"error"'); await app.workbench.settingsEditor.addUserSetting('css.lint.emptyRules', '"error"');
await app.workbench.quickopen.openFile('style.css'); await app.workbench.quickaccess.openFile('style.css');
await app.code.waitForElement(Problems.getSelectorInEditor(ProblemSeverity.ERROR)); await app.code.waitForElement(Problems.getSelectorInEditor(ProblemSeverity.ERROR));

View file

@ -45,7 +45,7 @@ export function setup() {
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;
await app.workbench.quickopen.openQuickOpen('*.*'); await app.workbench.quickaccess.openQuickAccess('*.*');
await app.workbench.quickinput.waitForQuickInputElements(names => names.length === 6); await app.workbench.quickinput.waitForQuickInputElements(names => names.length === 6);
await app.workbench.quickinput.closeQuickInput(); await app.workbench.quickinput.closeQuickInput();

View file

@ -10,7 +10,7 @@ export function setup() {
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;
await app.workbench.quickopen.openFile('app.js'); await app.workbench.quickaccess.openFile('app.js');
await app.code.waitForElements('.line-numbers', false, elements => !!elements.length); await app.code.waitForElements('.line-numbers', false, elements => !!elements.length);
await app.workbench.settingsEditor.addUserSetting('editor.lineNumbers', '"off"'); await app.workbench.settingsEditor.addUserSetting('editor.lineNumbers', '"off"');

View file

@ -70,7 +70,7 @@ export function setup() {
'jsconfig.json' 'jsconfig.json'
]; ];
await app.workbench.quickopen.openQuickOpen('.js'); await app.workbench.quickaccess.openQuickAccess('.js');
await app.workbench.quickinput.waitForQuickInputElements(names => expectedNames.every(n => names.some(m => n === m))); await app.workbench.quickinput.waitForQuickInputElements(names => expectedNames.every(n => names.some(m => n === m)));
await app.code.dispatchKeybinding('escape'); await app.code.dispatchKeybinding('escape');
}); });
@ -83,7 +83,7 @@ export function setup() {
'package.json' 'package.json'
]; ];
await app.workbench.quickopen.openQuickOpen('a.s'); await app.workbench.quickaccess.openQuickAccess('a.s');
await app.workbench.quickinput.waitForQuickInputElements(names => expectedNames.every(n => names.some(m => n === m))); await app.workbench.quickinput.waitForQuickInputElements(names => expectedNames.every(n => names.some(m => n === m)));
await app.code.dispatchKeybinding('escape'); await app.code.dispatchKeybinding('escape');
}); });

View file

@ -17,7 +17,7 @@ export function setup(isWeb) {
await app.workbench.statusbar.waitForStatusbarElement(StatusBarElement.SYNC_STATUS); await app.workbench.statusbar.waitForStatusbarElement(StatusBarElement.SYNC_STATUS);
await app.workbench.statusbar.waitForStatusbarElement(StatusBarElement.PROBLEMS_STATUS); await app.workbench.statusbar.waitForStatusbarElement(StatusBarElement.PROBLEMS_STATUS);
await app.workbench.quickopen.openFile('app.js'); await app.workbench.quickaccess.openFile('app.js');
if (!isWeb) { if (!isWeb) {
// Encoding picker currently hidden in web (only UTF-8 supported) // Encoding picker currently hidden in web (only UTF-8 supported)
await app.workbench.statusbar.waitForStatusbarElement(StatusBarElement.ENCODING_STATUS); await app.workbench.statusbar.waitForStatusbarElement(StatusBarElement.ENCODING_STATUS);
@ -35,7 +35,7 @@ export function setup(isWeb) {
await app.workbench.quickinput.waitForQuickInputOpened(); await app.workbench.quickinput.waitForQuickInputOpened();
await app.workbench.quickinput.closeQuickInput(); await app.workbench.quickinput.closeQuickInput();
await app.workbench.quickopen.openFile('app.js'); await app.workbench.quickaccess.openFile('app.js');
await app.workbench.statusbar.clickOn(StatusBarElement.INDENTATION_STATUS); await app.workbench.statusbar.clickOn(StatusBarElement.INDENTATION_STATUS);
await app.workbench.quickinput.waitForQuickInputOpened(); await app.workbench.quickinput.waitForQuickInputOpened();
await app.workbench.quickinput.closeQuickInput(); await app.workbench.quickinput.closeQuickInput();
@ -74,7 +74,7 @@ export function setup(isWeb) {
it(`checks if 'Go to Line' works if called from the status bar`, async function () { it(`checks if 'Go to Line' works if called from the status bar`, async function () {
const app = this.app as Application; const app = this.app as Application;
await app.workbench.quickopen.openFile('app.js'); await app.workbench.quickaccess.openFile('app.js');
await app.workbench.statusbar.clickOn(StatusBarElement.SELECTION_STATUS); await app.workbench.statusbar.clickOn(StatusBarElement.SELECTION_STATUS);
await app.workbench.quickinput.waitForQuickInputOpened(); await app.workbench.quickinput.waitForQuickInputOpened();
@ -86,7 +86,7 @@ export function setup(isWeb) {
it(`verifies if changing EOL is reflected in the status bar`, async function () { it(`verifies if changing EOL is reflected in the status bar`, async function () {
const app = this.app as Application; const app = this.app as Application;
await app.workbench.quickopen.openFile('app.js'); await app.workbench.quickaccess.openFile('app.js');
await app.workbench.statusbar.clickOn(StatusBarElement.EOL_STATUS); await app.workbench.statusbar.clickOn(StatusBarElement.EOL_STATUS);
await app.workbench.quickinput.waitForQuickInputOpened(); await app.workbench.quickinput.waitForQuickInputOpened();

View file

@ -17,7 +17,7 @@ export function setup() {
const readmeMd = 'readme.md'; const readmeMd = 'readme.md';
const textToType = 'Hello, Code'; const textToType = 'Hello, Code';
await app.workbench.quickopen.openFile(readmeMd); await app.workbench.quickaccess.openFile(readmeMd);
await app.workbench.editor.waitForTypeInEditor(readmeMd, textToType); await app.workbench.editor.waitForTypeInEditor(readmeMd, textToType);
await app.reload(); await app.reload();

View file

@ -24,11 +24,11 @@ export function setup(stableCodePath: string, testDataPath: string) {
await stableApp!.start(); await stableApp!.start();
// Open 3 editors and pin 2 of them // Open 3 editors and pin 2 of them
await stableApp.workbench.quickopen.openFile('www'); await stableApp.workbench.quickaccess.openFile('www');
await stableApp.workbench.quickopen.runCommand('View: Keep Editor'); await stableApp.workbench.quickaccess.runCommand('View: Keep Editor');
await stableApp.workbench.quickopen.openFile('app.js'); await stableApp.workbench.quickaccess.openFile('app.js');
await stableApp.workbench.quickopen.runCommand('View: Keep Editor'); await stableApp.workbench.quickaccess.runCommand('View: Keep Editor');
await stableApp.workbench.editors.newUntitledFile(); await stableApp.workbench.editors.newUntitledFile();
@ -70,7 +70,7 @@ export function setup(stableCodePath: string, testDataPath: string) {
const readmeMd = 'readme.md'; const readmeMd = 'readme.md';
const textToType = 'Hello, Code'; const textToType = 'Hello, Code';
await stableApp.workbench.quickopen.openFile(readmeMd); await stableApp.workbench.quickaccess.openFile(readmeMd);
await stableApp.workbench.editor.waitForTypeInEditor(readmeMd, textToType); await stableApp.workbench.editor.waitForTypeInEditor(readmeMd, textToType);
await stableApp.stop(); await stableApp.stop();