screenshot support

This commit is contained in:
Joao Moreno
2018-04-18 08:14:38 +02:00
parent 66581ee338
commit 713e5c13c8
5 changed files with 53 additions and 2 deletions

View File

@@ -27,6 +27,7 @@ export interface IDriver {
_serviceBrand: any;
getWindowIds(): TPromise<number[]>;
capturePage(windowId: number): TPromise<string>;
reloadWindow(windowId: number): TPromise<void>;
dispatchKeybinding(windowId: number, keybinding: string): TPromise<void>;
click(windowId: number, selector: string, xoffset?: number | undefined, yoffset?: number | undefined): TPromise<void>;
@@ -43,6 +44,7 @@ export interface IDriver {
export interface IDriverChannel extends IChannel {
call(command: 'getWindowIds'): TPromise<number[]>;
call(command: 'capturePage'): TPromise<string>;
call(command: 'reloadWindow', arg: number): TPromise<void>;
call(command: 'dispatchKeybinding', arg: [number, string]): TPromise<void>;
call(command: 'click', arg: [number, string, number | undefined, number | undefined]): TPromise<void>;
@@ -64,6 +66,7 @@ export class DriverChannel implements IDriverChannel {
call(command: string, arg?: any): TPromise<any> {
switch (command) {
case 'getWindowIds': return this.driver.getWindowIds();
case 'capturePage': return this.driver.capturePage(arg);
case 'reloadWindow': return this.driver.reloadWindow(arg);
case 'dispatchKeybinding': return this.driver.dispatchKeybinding(arg[0], arg[1]);
case 'click': return this.driver.click(arg[0], arg[1], arg[2], arg[3]);
@@ -91,6 +94,10 @@ export class DriverChannelClient implements IDriver {
return this.channel.call('getWindowIds');
}
capturePage(windowId: number): TPromise<string> {
return this.channel.call('capturePage', windowId);
}
reloadWindow(windowId: number): TPromise<void> {
return this.channel.call('reloadWindow', windowId);
}