UNPKG

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