mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-14 12:11:43 +01:00
green git smoke tests!
This commit is contained in:
@@ -10,6 +10,8 @@ import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IWindowDriver, IElement, WindowDriverChannel, WindowDriverRegistryChannelClient } from 'vs/platform/driver/common/driver';
|
||||
import { IPCClient } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { getTopLeftOffset, getClientArea } from 'vs/base/browser/dom';
|
||||
import * as electron from 'electron';
|
||||
|
||||
function serializeElement(element: Element, recursive: boolean): IElement {
|
||||
const attributes = Object.create(null);
|
||||
@@ -40,8 +42,31 @@ class WindowDriver implements IWindowDriver {
|
||||
|
||||
constructor() { }
|
||||
|
||||
click(selector: string, xoffset?: number, yoffset?: number): TPromise<void> {
|
||||
throw new Error('Method not implemented.');
|
||||
async click(selector: string, xoffset?: number, yoffset?: number): TPromise<void> {
|
||||
const element = document.querySelector(selector);
|
||||
|
||||
if (!element) {
|
||||
throw new Error('Element not found');
|
||||
}
|
||||
|
||||
await TPromise.timeout(500);
|
||||
const { left, top } = getTopLeftOffset(element as HTMLElement);
|
||||
const { width, height } = getClientArea(element as HTMLElement);
|
||||
let x: number, y: number;
|
||||
|
||||
if ((typeof xoffset === 'number') || (typeof yoffset === 'number')) {
|
||||
x = left + xoffset;
|
||||
y = top + yoffset;
|
||||
} else {
|
||||
x = left + (width / 2);
|
||||
y = top + (height / 2);
|
||||
}
|
||||
|
||||
const webContents = electron.remote.getCurrentWebContents();
|
||||
webContents.sendInputEvent({ type: 'mouseDown', x, y, button: 'left', clickCount: 1 } as any);
|
||||
webContents.sendInputEvent({ type: 'mouseUp', x, y, button: 'left', clickCount: 1 } as any);
|
||||
|
||||
await TPromise.timeout(100);
|
||||
}
|
||||
|
||||
doubleClick(selector: string): TPromise<void> {
|
||||
|
||||
@@ -11,8 +11,7 @@ export class Editors {
|
||||
constructor(private api: API, private commands: Commands) { }
|
||||
|
||||
async saveOpenedFile(): Promise<any> {
|
||||
await this.api.waitForElement('.tabs-container div.tab.active.dirty');
|
||||
await this.commands.runCommand('File: Save');
|
||||
await this.commands.runCommand('workbench.action.files.save');
|
||||
}
|
||||
|
||||
async selectTab(tabName: string, untitled: boolean = false): Promise<void> {
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
--timeout 20000
|
||||
--slow 2000
|
||||
--slow 20000
|
||||
out/main.js
|
||||
Reference in New Issue
Block a user