mirror of
https://github.com/microsoft/vscode.git
synced 2026-10-05 15:36:22 +01:00
tweak smoke test
This commit is contained in:
1 parent
2b8281d7da
commit
5b14cbc145
9 files changed
+20
-78
No files matched your search
@@ -51,13 +51,10 @@ import { KeyboardLayoutMonitor } from 'vs/code/electron-main/keyboard';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { WorkspacesChannel } from 'vs/platform/workspaces/common/workspacesIpc';
|
||||
import { IWorkspacesMainService } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { dirname, join } from 'path';
|
||||
import { touch } from 'vs/base/node/pfs';
|
||||
import { getMachineId } from 'vs/base/node/id';
|
||||
|
||||
export class CodeApplication {
|
||||
|
||||
private static readonly APP_ICON_REFRESH_KEY = 'macOSAppIconRefresh3';
|
||||
private static readonly MACHINE_ID_KEY = 'telemetry.machineId';
|
||||
|
||||
private toDispose: IDisposable[];
|
||||
@@ -424,20 +421,6 @@ export class CodeApplication {
|
||||
|
||||
// Start shared process here
|
||||
this.sharedProcess.spawn();
|
||||
|
||||
// Helps application icon refresh after an update with new icon is installed (macOS)
|
||||
// TODO@Ben remove after a couple of releases
|
||||
if (platform.isMacintosh) {
|
||||
if (!this.stateService.getItem(CodeApplication.APP_ICON_REFRESH_KEY)) {
|
||||
this.stateService.setItem(CodeApplication.APP_ICON_REFRESH_KEY, true);
|
||||
|
||||
// 'exe' => /Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Electron
|
||||
const appPath = dirname(dirname(dirname(app.getPath('exe'))));
|
||||
const infoPlistPath = join(appPath, 'Contents', 'Info.plist');
|
||||
touch(appPath).done(null, error => { /* ignore */ });
|
||||
touch(infoPlistPath).done(null, error => { /* ignore */ });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private dispose(): void {
|
||||
|
||||
@@ -148,7 +148,7 @@ export class WindowsManager implements IWindowsMainService {
|
||||
this.windowsState.openedWindows = [];
|
||||
}
|
||||
|
||||
this.dialogs = new Dialogs(environmentService, telemetryService, stateService, this, this.logService);
|
||||
this.dialogs = new Dialogs(environmentService, telemetryService, stateService, this);
|
||||
this.workspacesManager = new WorkspacesManager(workspacesMainService, backupMainService, environmentService, this);
|
||||
}
|
||||
|
||||
@@ -369,7 +369,7 @@ export class WindowsManager implements IWindowsMainService {
|
||||
let foldersToRestore: string[] = [];
|
||||
let workspacesToRestore: IWorkspaceIdentifier[] = [];
|
||||
let emptyToRestore: string[] = [];
|
||||
if (openConfig.initialStartup && !openConfig.cli.extensionDevelopmentPath) {
|
||||
if (openConfig.initialStartup && !openConfig.cli.extensionDevelopmentPath && !openConfig.cli['disable-restore-windows']) {
|
||||
foldersToRestore = this.backupMainService.getFolderBackupPaths();
|
||||
|
||||
workspacesToRestore = this.backupMainService.getWorkspaceBackups(); // collect from workspaces with hot-exit backups
|
||||
@@ -1565,7 +1565,6 @@ class Dialogs {
|
||||
private telemetryService: ITelemetryService,
|
||||
private stateService: IStateService,
|
||||
private windowsMainService: IWindowsMainService,
|
||||
private logService: ILogService // TODO@Ben remove logging when no longer needed
|
||||
) {
|
||||
this.mapWindowToDialogQueue = new Map<number, Queue<any>>();
|
||||
this.noWindowDialogQueue = new Queue<any>();
|
||||
@@ -1645,31 +1644,22 @@ class Dialogs {
|
||||
|
||||
private getDialogQueue(window?: ICodeWindow): Queue<any> {
|
||||
if (!window) {
|
||||
this.logService.info('getDialogQueue: using NO WINDOW queue. size: ', this.noWindowDialogQueue.size);
|
||||
return this.noWindowDialogQueue;
|
||||
}
|
||||
|
||||
let windowDialogQueue = this.mapWindowToDialogQueue.get(window.id);
|
||||
if (!windowDialogQueue) {
|
||||
this.logService.info('getDialogQueue: creating window dialog queue for window:', window.id);
|
||||
windowDialogQueue = new Queue<any>();
|
||||
this.mapWindowToDialogQueue.set(window.id, windowDialogQueue);
|
||||
} else {
|
||||
this.logService.info('getDialogQueue: found existing window dialog queue for window:', window.id);
|
||||
}
|
||||
|
||||
this.logService.info('getDialogQueue: size: ', windowDialogQueue.size);
|
||||
|
||||
return windowDialogQueue;
|
||||
}
|
||||
|
||||
public showMessageBox(options: Electron.MessageBoxOptions, window?: ICodeWindow): TPromise<IMessageBoxResult> {
|
||||
this.logService.info('showMessageBox begin: ', options, window ? window.id : 'No Window');
|
||||
return this.getDialogQueue(window).queue(() => {
|
||||
return new TPromise((c, e) => {
|
||||
this.logService.info('showMessageBox opening');
|
||||
dialog.showMessageBox(window ? window.win : void 0, options, (response: number, checkboxChecked: boolean) => {
|
||||
this.logService.info('showMessageBox closed, response: ', response, checkboxChecked);
|
||||
c({ button: response, checkboxChecked });
|
||||
});
|
||||
});
|
||||
@@ -1685,12 +1675,9 @@ class Dialogs {
|
||||
return path;
|
||||
}
|
||||
|
||||
this.logService.info('showSaveDialog begin: ', options, window ? window.id : 'No Window');
|
||||
return this.getDialogQueue(window).queue(() => {
|
||||
return new TPromise((c, e) => {
|
||||
this.logService.info('showSaveDialog opening');
|
||||
dialog.showSaveDialog(window ? window.win : void 0, options, path => {
|
||||
this.logService.info('showSaveDialog closed, response: ', path);
|
||||
c(normalizePath(path));
|
||||
});
|
||||
});
|
||||
@@ -1706,12 +1693,9 @@ class Dialogs {
|
||||
return paths;
|
||||
}
|
||||
|
||||
this.logService.info('showOpenDialog begin: ', options, window ? window.id : 'No Window');
|
||||
return this.getDialogQueue(window).queue(() => {
|
||||
return new TPromise((c, e) => {
|
||||
this.logService.info('showOpenDialog opening');
|
||||
dialog.showOpenDialog(window ? window.win : void 0, options, paths => {
|
||||
this.logService.info('showOpenDialog closed, response: ', paths);
|
||||
c(normalizePaths(paths));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -47,6 +47,7 @@ export interface ParsedArgs {
|
||||
'skip-getting-started'?: boolean;
|
||||
'skip-release-notes'?: boolean;
|
||||
'sticky-quickopen'?: boolean;
|
||||
'disable-restore-windows'?: boolean;
|
||||
'disable-telemetry'?: boolean;
|
||||
'export-default-configuration'?: string;
|
||||
'install-source'?: string;
|
||||
|
||||
@@ -52,6 +52,7 @@ const options: minimist.Opts = {
|
||||
'skip-getting-started',
|
||||
'skip-release-notes',
|
||||
'sticky-quickopen',
|
||||
'disable-restore-windows',
|
||||
'disable-telemetry',
|
||||
'disable-updates',
|
||||
'disable-crash-reporter',
|
||||
|
||||
@@ -11,7 +11,6 @@ import { IWindowService, IWindowsService, INativeOpenDialogOptions, IEnterWorksp
|
||||
import { IRecentlyOpened } from 'vs/platform/history/common/history';
|
||||
import { ICommandAction } from 'vs/platform/actions/common/actions';
|
||||
import { IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
export class WindowService implements IWindowService {
|
||||
|
||||
@@ -22,8 +21,7 @@ export class WindowService implements IWindowService {
|
||||
constructor(
|
||||
private windowId: number,
|
||||
private configuration: IWindowConfiguration,
|
||||
@IWindowsService private windowsService: IWindowsService,
|
||||
@ILogService private logService: ILogService // TODO@Ben remove logging when no longer needed
|
||||
@IWindowsService private windowsService: IWindowsService
|
||||
) {
|
||||
const onThisWindowFocus = mapEvent(filterEvent(windowsService.onWindowFocus, id => id === windowId), _ => true);
|
||||
const onThisWindowBlur = mapEvent(filterEvent(windowsService.onWindowBlur, id => id === windowId), _ => false);
|
||||
@@ -41,32 +39,24 @@ export class WindowService implements IWindowService {
|
||||
pickFileFolderAndOpen(options: INativeOpenDialogOptions): TPromise<void> {
|
||||
options.windowId = this.windowId;
|
||||
|
||||
this.logService.info('pickFileFolderAndOpen: begin');
|
||||
|
||||
return this.windowsService.pickFileFolderAndOpen(options);
|
||||
}
|
||||
|
||||
pickFileAndOpen(options: INativeOpenDialogOptions): TPromise<void> {
|
||||
options.windowId = this.windowId;
|
||||
|
||||
this.logService.info('pickFileAndOpen: begin');
|
||||
|
||||
return this.windowsService.pickFileAndOpen(options);
|
||||
}
|
||||
|
||||
pickFolderAndOpen(options: INativeOpenDialogOptions): TPromise<void> {
|
||||
options.windowId = this.windowId;
|
||||
|
||||
this.logService.info('pickFolderAndOpen: begin');
|
||||
|
||||
return this.windowsService.pickFolderAndOpen(options);
|
||||
}
|
||||
|
||||
pickWorkspaceAndOpen(options: INativeOpenDialogOptions): TPromise<void> {
|
||||
options.windowId = this.windowId;
|
||||
|
||||
this.logService.info('pickWorkspaceAndOpen: begin');
|
||||
|
||||
return this.windowsService.pickWorkspaceAndOpen(options);
|
||||
}
|
||||
|
||||
@@ -131,27 +121,15 @@ export class WindowService implements IWindowService {
|
||||
}
|
||||
|
||||
showMessageBox(options: Electron.MessageBoxOptions): TPromise<IMessageBoxResult> {
|
||||
this.logService.info('showMessageBox begin: ', options);
|
||||
return this.windowsService.showMessageBox(this.windowId, options).then(result => {
|
||||
this.logService.info('showMessageBox closed, response: ', result);
|
||||
return result;
|
||||
});
|
||||
return this.windowsService.showMessageBox(this.windowId, options);
|
||||
}
|
||||
|
||||
showSaveDialog(options: Electron.SaveDialogOptions): TPromise<string> {
|
||||
this.logService.info('showSaveDialog begin: ', options);
|
||||
return this.windowsService.showSaveDialog(this.windowId, options).then(result => {
|
||||
this.logService.info('showSaveDialog begin: ', result);
|
||||
return result;
|
||||
});
|
||||
return this.windowsService.showSaveDialog(this.windowId, options);
|
||||
}
|
||||
|
||||
showOpenDialog(options: Electron.OpenDialogOptions): TPromise<string[]> {
|
||||
this.logService.info('showOpenDialog begin: ', options);
|
||||
return this.windowsService.showOpenDialog(this.windowId, options).then(result => {
|
||||
this.logService.info('showOpenDialog closed: ', result);
|
||||
return result;
|
||||
});
|
||||
return this.windowsService.showOpenDialog(this.windowId, options);
|
||||
}
|
||||
|
||||
updateTouchBar(items: ICommandAction[][]): TPromise<void> {
|
||||
|
||||
@@ -14,18 +14,16 @@ export function setup() {
|
||||
|
||||
const app = this.app as SpectronApplication;
|
||||
|
||||
await app.restart([app.workspaceFilePath]);
|
||||
|
||||
// for some reason Code opens 2 windows at this point
|
||||
// so let's select the last one
|
||||
await app.webclient.windowByIndex(1);
|
||||
// restart with preventing additional windows from restoring
|
||||
// to ensure the window after restart is the multi-root workspace
|
||||
await app.restart({ workspaceOrFolder: app.workspaceFilePath, extraArgs: ['--disable-restore-windows'] });
|
||||
});
|
||||
|
||||
it('shows results from all folders', async function () {
|
||||
const app = this.app as SpectronApplication;
|
||||
await app.workbench.quickopen.openQuickOpen('*.*');
|
||||
|
||||
await app.workbench.quickopen.waitForQuickOpenElements(names => names.length >= 6);
|
||||
await app.workbench.quickopen.waitForQuickOpenElements(names => names.length === 6);
|
||||
await app.workbench.quickopen.closeQuickOpen();
|
||||
});
|
||||
|
||||
|
||||
@@ -50,9 +50,6 @@ export class QuickOpen {
|
||||
|
||||
async waitForQuickOpenOpened(): Promise<void> {
|
||||
await this.spectron.client.waitForActiveElement(QuickOpen.QUICK_OPEN_INPUT);
|
||||
|
||||
// we gotta wait 50 milliseconds due to https://github.com/Microsoft/vscode/blob/master/src/vs/platform/list/browser/listService.ts#L59
|
||||
await new Promise(c => setTimeout(c, 50));
|
||||
}
|
||||
|
||||
private async waitForQuickOpenClosed(): Promise<void> {
|
||||
|
||||
@@ -17,7 +17,7 @@ export function setup() {
|
||||
return;
|
||||
}
|
||||
|
||||
await app.restart(['--locale=DE']);
|
||||
await app.restart({ extraArgs: ['--locale=DE'] });
|
||||
});
|
||||
|
||||
it(`starts with 'DE' locale and verifies title and viewlets text is in German`, async function () {
|
||||
|
||||
@@ -116,16 +116,16 @@ export class SpectronApplication {
|
||||
}
|
||||
}
|
||||
|
||||
async restart(codeArgs: string[] = []): Promise<any> {
|
||||
async restart(options: { workspaceOrFolder?: string, extraArgs?: string[] }): Promise<any> {
|
||||
await this.stop();
|
||||
await new Promise(c => setTimeout(c, 1000));
|
||||
await this._start(codeArgs);
|
||||
await this._start(options.workspaceOrFolder, options.extraArgs);
|
||||
}
|
||||
|
||||
private async _start(codeArgs: string[] = []): Promise<any> {
|
||||
private async _start(workspaceOrFolder = this.options.workspacePath, extraArgs: string[] = []): Promise<any> {
|
||||
await this.retrieveKeybindings();
|
||||
cp.execSync('git checkout .', { cwd: this.options.workspacePath });
|
||||
await this.startApplication(codeArgs);
|
||||
await this.startApplication(workspaceOrFolder, extraArgs);
|
||||
await this.checkWindowReady();
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ export class SpectronApplication {
|
||||
}
|
||||
}
|
||||
|
||||
private async startApplication(codeArgs: string[] = []): Promise<any> {
|
||||
private async startApplication(workspaceOrFolder: string, extraArgs: string[] = []): Promise<any> {
|
||||
|
||||
let args: string[] = [];
|
||||
let chromeDriverArgs: string[] = [];
|
||||
@@ -157,7 +157,7 @@ export class SpectronApplication {
|
||||
args.push(process.env.VSCODE_REPOSITORY as string);
|
||||
}
|
||||
|
||||
args.push(this.options.workspacePath);
|
||||
args.push(workspaceOrFolder);
|
||||
|
||||
// Prevent 'Getting Started' web page from opening on clean user-data-dir
|
||||
args.push('--skip-getting-started');
|
||||
@@ -182,7 +182,7 @@ export class SpectronApplication {
|
||||
// Ensure that running over custom extensions directory, rather than picking up the one that was used by a tester previously
|
||||
args.push(`--extensions-dir=${this.options.extensionsPath}`);
|
||||
|
||||
args.push(...codeArgs);
|
||||
args.push(...extraArgs);
|
||||
|
||||
chromeDriverArgs.push(`--user-data-dir=${this.options.userDataDir}`);
|
||||
|
||||
|
||||
Reference in new issue
Block a user