UNPKG

2.98 kBTypeScriptView Raw
1// Type definitions for launchpad 0.6.0
2// Project: https://www.npmjs.com/package/launchpad
3// Definitions by: Peter Burns <https://github.com/rictic>
4// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
6/**
7 * For launching local browsers. The callback will be given a Launcher to
8 * perform the actual launching.
9 */
10export function local(cb: (err: any, localBrowsers: Launcher) => void): void;
11
12export namespace local {
13 export const platform: {
14 chrome?: BrowserPlatformDetails | undefined;
15 chromium?: BrowserPlatformDetails | undefined;
16 canary?: BrowserPlatformDetails | undefined;
17 firefox?: BrowserPlatformDetails | undefined;
18 aurora?: BrowserPlatformDetails | undefined;
19 opera?: BrowserPlatformDetails | undefined;
20 ie?: BrowserPlatformDetails | undefined;
21 edge?: BrowserPlatformDetails | undefined;
22 safari?: BrowserPlatformDetails | undefined;
23 phantom?: BrowserPlatformDetails | undefined;
24 nodeWebkit?: BrowserPlatformDetails | undefined;
25 };
26}
27
28interface BrowserstackAuth {
29 username: string;
30 password: string;
31}
32
33export function browserstack(
34 authCreds: BrowserstackAuth,
35 cb: (err: any, browserstack: Launcher) => void): void;
36
37interface BrowserPlatformDetails {
38 pathQuery?: string | undefined;
39 plistPath?: string | undefined;
40 command?: string | undefined;
41 process?: string | undefined;
42 versionKey?: string | undefined;
43 defaultLocation?: string | undefined;
44 args?: string[] | undefined;
45 opensTab?: boolean | undefined;
46 multi?: boolean | undefined;
47 getCommand?: ((browser: BrowserPlatformDetails, url: string, args: string[]) => string) | undefined;
48 cwd?: string | undefined;
49 imageName?: string | undefined;
50}
51
52interface LaunchOptions {
53 browser: string;
54 version?: string | undefined;
55}
56
57interface Launcher {
58 (url: string, options: LaunchOptions, callback: (err: any, instance: Instance) => void): void;
59 browsers(cb: (error: any, browsers?: Browser[]) => void): void;
60
61 chrome: BrowserFunction;
62 chromium: BrowserFunction;
63 canary: BrowserFunction;
64 firefox: BrowserFunction;
65 aurora: BrowserFunction;
66 opera: BrowserFunction;
67 ie: BrowserFunction;
68 edge: BrowserFunction;
69 safari: BrowserFunction;
70 phantom: BrowserFunction;
71 nodeWebkit: BrowserFunction;
72}
73
74interface Browser {
75 name: string;
76 version: string;
77 binPath: string;
78}
79
80interface BrowserFunction {
81 (url: string, callback: (err: any, instance: Instance) => void): void;
82}
83export interface Instance {
84 id: string;
85 stop(cb: (err: any) => void): void;
86 status(cb: (err: any, status: any) => void): void;
87
88 addListener(event: string, listener: Function): this;
89 on(event: string, listener: Function): this;
90 once(event: string, listener: Function): this;
91 removeListener(event: string, listener: Function): this;
92 removeAllListeners(event?: string): this;
93 setMaxListeners(n: number): void;
94 listeners(event: string): Function[];
95 emit(event: string, ...args: any[]): boolean;
96}
97
\No newline at end of file