mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Merge from vscode 1ec43773e37997841c5af42b33ddb180e9735bf2
This commit is contained in:
@@ -153,7 +153,7 @@ export class Application {
|
||||
}
|
||||
|
||||
// wait a bit, since focus might be stolen off widgets
|
||||
// as soon as they open (e.g. quick open)
|
||||
// as soon as they open (e.g. quick access)
|
||||
await new Promise(c => setTimeout(c, 1000));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ export async function spawn(options: SpawnOptions): Promise<Code> {
|
||||
options.workspacePath,
|
||||
'--skip-getting-started',
|
||||
'--skip-release-notes',
|
||||
'--sticky-quickopen',
|
||||
'--sticky-quickinput',
|
||||
'--disable-telemetry',
|
||||
'--disable-updates',
|
||||
'--disable-crash-reporter',
|
||||
|
||||
@@ -16,7 +16,7 @@ export * from './logger';
|
||||
export * from './peek';
|
||||
export * from './problems';
|
||||
export * from './quickinput';
|
||||
export * from './quickopen';
|
||||
export * from './quickaccess';
|
||||
export * from './scm';
|
||||
export * from './search';
|
||||
export * from './settings';
|
||||
|
||||
@@ -7,14 +7,14 @@ import { Editors } from './editors';
|
||||
import { Code } from './code';
|
||||
import { QuickInput } from './quickinput';
|
||||
|
||||
export class QuickOpen {
|
||||
export class QuickAccess {
|
||||
|
||||
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;
|
||||
|
||||
// other parts of code might steal focus away from quickopen :(
|
||||
// other parts of code might steal focus away from quickinput :(
|
||||
while (retries < 5) {
|
||||
if (process.platform === 'darwin') {
|
||||
await this.code.dispatchKeybinding('cmd+p');
|
||||
@@ -40,7 +40,7 @@ export class QuickOpen {
|
||||
}
|
||||
|
||||
async openFile(fileName: string): Promise<void> {
|
||||
await this.openQuickOpen(fileName);
|
||||
await this.openQuickAccess(fileName);
|
||||
|
||||
await this.quickInput.waitForQuickInputElements(names => names[0] === fileName);
|
||||
await this.code.dispatchKeybinding('enter');
|
||||
@@ -49,7 +49,7 @@ export class QuickOpen {
|
||||
}
|
||||
|
||||
async runCommand(commandId: string): Promise<void> {
|
||||
await this.openQuickOpen(`>${commandId}`);
|
||||
await this.openQuickAccess(`>${commandId}`);
|
||||
|
||||
// wait for best choice to be focused
|
||||
await this.code.waitForTextContent(QuickInput.QUICK_INPUT_FOCUSED_ELEMENT);
|
||||
@@ -8,11 +8,11 @@ import * as path from 'path';
|
||||
import { Editor } from './editor';
|
||||
import { Editors } from './editors';
|
||||
import { Code } from './code';
|
||||
import { QuickOpen } from './quickopen';
|
||||
import { QuickAccess } from './quickaccess';
|
||||
|
||||
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> {
|
||||
await this.openSettings();
|
||||
@@ -32,6 +32,6 @@ export class SettingsEditor {
|
||||
}
|
||||
|
||||
private async openSettings(): Promise<void> {
|
||||
await this.quickopen.runCommand('workbench.action.openSettingsJson');
|
||||
await this.quickaccess.runCommand('workbench.action.openSettingsJson');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Code } from '../code';
|
||||
import { QuickOpen } from '../quickopen';
|
||||
import { QuickAccess } from '../quickaccess';
|
||||
import { waitForNewDialog, clickDialogButton } from './sqlutils';
|
||||
|
||||
const NEW_SESSION_DIALOG_TITLE: string = 'Start New Profiler Session';
|
||||
|
||||
export class Profiler {
|
||||
|
||||
constructor(private code: Code, private quickopen: QuickOpen) { }
|
||||
constructor(private code: Code, private quickopen: QuickAccess) { }
|
||||
|
||||
async launchProfiler(): Promise<void> {
|
||||
await this.quickopen.runCommand('Profiler: Launch Profiler');
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Code } from './code';
|
||||
import { QuickOpen } from './quickopen';
|
||||
import { QuickAccess } from './quickaccess';
|
||||
|
||||
const PANEL_SELECTOR = 'div[id="workbench.panel.terminal"]';
|
||||
const XTERM_SELECTOR = `${PANEL_SELECTOR} .terminal-wrapper`;
|
||||
@@ -12,10 +12,10 @@ const XTERM_TEXTAREA = `${XTERM_SELECTOR} textarea.xterm-helper-textarea`;
|
||||
|
||||
export class Terminal {
|
||||
|
||||
constructor(private code: Code, private quickopen: QuickOpen) { }
|
||||
constructor(private code: Code, private quickaccess: QuickAccess) { }
|
||||
|
||||
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.waitForTerminalBuffer(XTERM_SELECTOR, lines => lines.some(line => line.length > 0));
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { Explorer } from './explorer';
|
||||
import { ActivityBar } from './activityBar';
|
||||
import { QuickOpen } from './quickopen';
|
||||
import { QuickAccess } from './quickaccess';
|
||||
import { QuickInput } from './quickinput';
|
||||
import { Extensions } from './extensions';
|
||||
import { Search } from './search';
|
||||
@@ -32,7 +32,7 @@ export interface Commands {
|
||||
|
||||
export class Workbench {
|
||||
|
||||
readonly quickopen: QuickOpen;
|
||||
readonly quickaccess: QuickAccess;
|
||||
readonly quickinput: QuickInput;
|
||||
readonly editors: Editors;
|
||||
readonly explorer: Explorer;
|
||||
@@ -57,22 +57,22 @@ export class Workbench {
|
||||
constructor(code: Code, userDataPath: string) {
|
||||
this.editors = new Editors(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.activitybar = new ActivityBar(code);
|
||||
this.search = new Search(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.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.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.terminal = new Terminal(code, this.quickopen);
|
||||
this.terminal = new Terminal(code, this.quickaccess);
|
||||
// {{SQL CARBON EDIT}}
|
||||
this.connectionDialog = new ConnectionDialog(code);
|
||||
this.profiler = new Profiler(code, this.quickopen);
|
||||
this.profiler = new Profiler(code, this.quickaccess);
|
||||
this.queryEditors = new QueryEditors(code);
|
||||
// {{END}}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ async function launchServer(): Promise<{ endpoint: url.UrlWithStringQuery, serve
|
||||
|
||||
let serverProcess = cp.spawn(
|
||||
serverLocation,
|
||||
['--browser', 'none', '--driver', 'web'],
|
||||
['--browser', 'none', '--driver', 'web', '--enable-proposed-api'],
|
||||
{ env }
|
||||
);
|
||||
|
||||
|
||||
@@ -78,6 +78,6 @@ yarn watch
|
||||
|
||||
- Beware of **focus**. **Never** depend on DOM elements having focus using `.focused` classes or `:focus` pseudo-classes, since they will lose that state as soon as another window appears on top of the running VS Code window. A safe approach which avoids this problem is to use the `waitForActiveElement` API. Many tests use this whenever they need to wait for a specific element to _have focus_.
|
||||
|
||||
- Beware of **timing**. You need to read from or write to the DOM... but is it the right time to do that? Can you 100% guarantee that `input` box will be visible at that point in time? Or are you just hoping that it will be so? Hope is your worst enemy in UI tests. Example: just because you triggered Quick Open with `F1`, it doesn't mean that it's open and you can just start typing; you must first wait for the input element to be in the DOM as well as be the current active element.
|
||||
- Beware of **timing**. You need to read from or write to the DOM... but is it the right time to do that? Can you 100% guarantee that `input` box will be visible at that point in time? Or are you just hoping that it will be so? Hope is your worst enemy in UI tests. Example: just because you triggered Quick Access with `F1`, it doesn't mean that it's open and you can just start typing; you must first wait for the input element to be in the DOM as well as be the current active element.
|
||||
|
||||
- Beware of **waiting**. **Never** wait longer than a couple of seconds for anything, unless it's justified. Think of it as a human using Code. Would a human take 10 minutes to run through the Search viewlet smoke test? Then, the computer should even be faster. **Don't** use `setTimeout` just because. Think about what you should wait for in the DOM to be ready and wait for that instead.
|
||||
|
||||
@@ -9,14 +9,14 @@ export function setup() {
|
||||
describe('Editor', () => {
|
||||
it('shows correct quick outline', async function () {
|
||||
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);
|
||||
});
|
||||
|
||||
// it('folds/unfolds the code correctly', async function () {
|
||||
// await app.workbench.quickopen.openFile('www');
|
||||
// await app.workbench.quickaccess.openFile('www');
|
||||
|
||||
// // Fold
|
||||
// await app.workbench.editor.foldAtLine(3);
|
||||
|
||||
@@ -24,7 +24,7 @@ export function setup() {
|
||||
if (app.remote) {
|
||||
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');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -9,15 +9,15 @@ export function setup() {
|
||||
describe('Language Features', () => {
|
||||
it('verifies quick outline', async function () {
|
||||
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);
|
||||
});
|
||||
|
||||
it('verifies problems view', async function () {
|
||||
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.code.waitForElement(Problems.getSelectorInEditor(ProblemSeverity.WARNING));
|
||||
@@ -30,7 +30,7 @@ export function setup() {
|
||||
it('verifies settings', 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.workbench.quickaccess.openFile('style.css');
|
||||
|
||||
await app.code.waitForElement(Problems.getSelectorInEditor(ProblemSeverity.ERROR));
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ export function setup() {
|
||||
|
||||
it('shows results from all folders', async function () {
|
||||
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.closeQuickInput();
|
||||
|
||||
@@ -10,7 +10,7 @@ export function setup() {
|
||||
it('turns off editor line numbers and verifies the live change', async function () {
|
||||
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.workbench.settingsEditor.addUserSetting('editor.lineNumbers', '"off"');
|
||||
@@ -31,6 +31,9 @@ export function setup() {
|
||||
after(async function () {
|
||||
const app = this.app as Application;
|
||||
await app.workbench.settingsEditor.clearUserSettings();
|
||||
|
||||
// Wait for settings to be applied, which will happen after the settings file is empty
|
||||
await app.workbench.activitybar.waitForActivityBar(ActivityBarPosition.LEFT);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -57,8 +57,8 @@ export function setup() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Quick Open', () => {
|
||||
it('quick open search produces correct result', async function () {
|
||||
describe('Quick Access', () => {
|
||||
it('quick access search produces correct result', async function () {
|
||||
const app = this.app as Application;
|
||||
const expectedNames = [
|
||||
'.eslintrc.json',
|
||||
@@ -70,12 +70,12 @@ export function setup() {
|
||||
'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.code.dispatchKeybinding('escape');
|
||||
});
|
||||
|
||||
it('quick open respects fuzzy matching', async function () {
|
||||
it('quick access respects fuzzy matching', async function () {
|
||||
const app = this.app as Application;
|
||||
const expectedNames = [
|
||||
'tasks.json',
|
||||
@@ -83,7 +83,7 @@ export function setup() {
|
||||
'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.code.dispatchKeybinding('escape');
|
||||
});
|
||||
|
||||
@@ -17,7 +17,7 @@ export function setup(isWeb) {
|
||||
await app.workbench.statusbar.waitForStatusbarElement(StatusBarElement.SYNC_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) {
|
||||
// Encoding picker currently hidden in web (only UTF-8 supported)
|
||||
await app.workbench.statusbar.waitForStatusbarElement(StatusBarElement.ENCODING_STATUS);
|
||||
@@ -28,14 +28,14 @@ export function setup(isWeb) {
|
||||
await app.workbench.statusbar.waitForStatusbarElement(StatusBarElement.SELECTION_STATUS);
|
||||
});
|
||||
|
||||
it(`verifies that 'quick open' opens when clicking on status bar elements`, async function () {
|
||||
it(`verifies that 'quick input' opens when clicking on status bar elements`, async function () {
|
||||
const app = this.app as Application;
|
||||
|
||||
await app.workbench.statusbar.clickOn(StatusBarElement.BRANCH_STATUS);
|
||||
await app.workbench.quickinput.waitForQuickInputOpened();
|
||||
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.quickinput.waitForQuickInputOpened();
|
||||
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 () {
|
||||
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.quickinput.waitForQuickInputOpened();
|
||||
@@ -86,7 +86,7 @@ export function setup(isWeb) {
|
||||
it(`verifies if changing EOL is reflected in the status bar`, async function () {
|
||||
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.quickinput.waitForQuickInputOpened();
|
||||
|
||||
@@ -17,7 +17,7 @@ export function setup() {
|
||||
|
||||
const readmeMd = 'readme.md';
|
||||
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.reload();
|
||||
|
||||
@@ -24,11 +24,11 @@ export function setup(stableCodePath: string, testDataPath: string) {
|
||||
await stableApp!.start();
|
||||
|
||||
// Open 3 editors and pin 2 of them
|
||||
await stableApp.workbench.quickopen.openFile('www');
|
||||
await stableApp.workbench.quickopen.runCommand('View: Keep Editor');
|
||||
await stableApp.workbench.quickaccess.openFile('www');
|
||||
await stableApp.workbench.quickaccess.runCommand('View: Keep Editor');
|
||||
|
||||
await stableApp.workbench.quickopen.openFile('app.js');
|
||||
await stableApp.workbench.quickopen.runCommand('View: Keep Editor');
|
||||
await stableApp.workbench.quickaccess.openFile('app.js');
|
||||
await stableApp.workbench.quickaccess.runCommand('View: Keep Editor');
|
||||
|
||||
await stableApp.workbench.editors.newUntitledFile();
|
||||
|
||||
@@ -70,7 +70,7 @@ export function setup(stableCodePath: string, testDataPath: string) {
|
||||
|
||||
const readmeMd = 'readme.md';
|
||||
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.stop();
|
||||
|
||||
@@ -36,8 +36,9 @@ export function setup() {
|
||||
await app.workbench.scm.openSCMViewlet();
|
||||
await app.workbench.scm.waitForTitle(title => /quellcodeverwaltung/i.test(title));
|
||||
|
||||
await app.workbench.debug.openDebugViewlet();
|
||||
await app.workbench.debug.waitForTitle(title => /starten/i.test(title));
|
||||
// See https://github.com/microsoft/vscode/issues/93462
|
||||
// await app.workbench.debug.openDebugViewlet();
|
||||
// await app.workbench.debug.waitForTitle(title => /starten/i.test(title));
|
||||
|
||||
await app.workbench.extensions.openExtensionsViewlet();
|
||||
await app.workbench.extensions.waitForTitle(title => /extensions/i.test(title));
|
||||
|
||||
@@ -284,11 +284,11 @@ describe(`VSCode Smoke Tests (${opts.web ? 'Web' : 'Electron'})`, () => {
|
||||
const setupTestCommand = 'Test: Setup Integration Test';
|
||||
const waitForExtensionsCommand = 'Test: Wait For Extensions To Load';
|
||||
await app.workbench.statusbar.waitForStatusbarText(testExtLoadedText, testExtLoadedText);
|
||||
await app.workbench.quickopen.runCommand(setupTestCommand);
|
||||
await app.workbench.quickaccess.runCommand(setupTestCommand);
|
||||
await app.workbench.statusbar.waitForStatusbarText(testSetupCompletedText, testSetupCompletedText);
|
||||
await app!.reload();
|
||||
await app.workbench.statusbar.waitForStatusbarText(testExtLoadedText, testExtLoadedText);
|
||||
await app.workbench.quickopen.runCommand(waitForExtensionsCommand);
|
||||
await app.workbench.quickaccess.runCommand(waitForExtensionsCommand);
|
||||
await app.workbench.statusbar.waitForStatusbarText(allExtensionsLoadedText, allExtensionsLoadedText);
|
||||
//{{END}}
|
||||
});
|
||||
|
||||
@@ -16,7 +16,7 @@ export function setup() {
|
||||
await fs.writeFile(testFilePath, '');
|
||||
try {
|
||||
const app = this.app as Application;
|
||||
await app.workbench.quickopen.openFile(testFilePath);
|
||||
await app.workbench.quickaccess.openFile(testFilePath);
|
||||
const fileBaseName = path.basename(testFilePath);
|
||||
await app.workbench.editor.waitForTypeInEditor(fileBaseName, 'SELECT * FROM sys.tables');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user