Skip to content

Commit 45d213e

Browse files
Vitali HaradkouAndreyBelym
authored andcommitted
Add typescript typings; Bump version (v0.0.8) (#35)
1 parent ca705b7 commit 45d213e

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "testcafe-browser-provider-electron",
3-
"version": "0.0.7",
3+
"version": "0.0.8",
44
"description": "TestCafe browser provider plugin for testing applications built with Electron.",
55
"repository": "https://github.com/DevExpress/testcafe-browser-provider-electron",
66
"homepage": "https://github.com/DevExpress/testcafe-browser-provider-electron",
@@ -56,5 +56,6 @@
5656
"publish-please": "^5.4.3",
5757
"testcafe": "*",
5858
"tmp": "0.0.28"
59-
}
59+
},
60+
"types": "./ts-defs/index.d.ts"
6061
}

ts-defs/index.d.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { Accelerator, BrowserWindow, NativeImage, MenuItem, Menu } from "electron";
2+
3+
declare module 'testcafe-browser-provider-electron' {
4+
interface Modifiers {
5+
shift?: boolean;
6+
ctrl?: boolean;
7+
alt?: boolean;
8+
meta?: boolean;
9+
}
10+
11+
type HandlerType =
12+
| 'open-dialog'
13+
| 'save-dialog'
14+
| 'message-box'
15+
| 'error-box'
16+
| 'certificate-trust-dialog'
17+
18+
type HandlerFn = (type: HandlerType, browserWindow?: BrowserWindow, ...args: any[]) => any;
19+
20+
export function getMainMenuItem(menuItemSelector: string[] | string | [string, { label: string, index: number }]): Promise<MenuItem>;
21+
export function getMainMenuItems(): Promise<MenuItem[]>;
22+
23+
export function getContextMenuItem(menuItemSelector: string[] | string | [string, { label: string, index: number }]): Promise<MenuItem>
24+
export function getContextMenuItems(): Promise<Menu[]>;
25+
26+
export function clickOnMainMenuItem(menuItem: string | MenuItem, modifiers?: Modifiers): Promise<void>;
27+
export function clickOnContextMenuItem(menuItem: string | MenuItem, modifiers?: Modifiers): Promise<void>;
28+
29+
export function setElectronDialogHandler(handler: HandlerFn, dependencies: object)
30+
}

0 commit comments

Comments
 (0)