Skip to content

Commit

Permalink
Add typescript typings; Bump version (v0.0.8) (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitali Haradkou authored and AndreyBelym committed Dec 20, 2018
1 parent ca705b7 commit 45d213e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
5 changes: 3 additions & 2 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "testcafe-browser-provider-electron",
"version": "0.0.7",
"version": "0.0.8",
"description": "TestCafe browser provider plugin for testing applications built with Electron.",
"repository": "https://github.com/DevExpress/testcafe-browser-provider-electron",
"homepage": "https://github.com/DevExpress/testcafe-browser-provider-electron",
Expand Down Expand Up @@ -56,5 +56,6 @@
"publish-please": "^5.4.3",
"testcafe": "*",
"tmp": "0.0.28"
}
},
"types": "./ts-defs/index.d.ts"
}
30 changes: 30 additions & 0 deletions ts-defs/index.d.ts
@@ -0,0 +1,30 @@
import { Accelerator, BrowserWindow, NativeImage, MenuItem, Menu } from "electron";

declare module 'testcafe-browser-provider-electron' {
interface Modifiers {
shift?: boolean;
ctrl?: boolean;
alt?: boolean;
meta?: boolean;
}

type HandlerType =
| 'open-dialog'
| 'save-dialog'
| 'message-box'
| 'error-box'
| 'certificate-trust-dialog'

type HandlerFn = (type: HandlerType, browserWindow?: BrowserWindow, ...args: any[]) => any;

export function getMainMenuItem(menuItemSelector: string[] | string | [string, { label: string, index: number }]): Promise<MenuItem>;
export function getMainMenuItems(): Promise<MenuItem[]>;

export function getContextMenuItem(menuItemSelector: string[] | string | [string, { label: string, index: number }]): Promise<MenuItem>
export function getContextMenuItems(): Promise<Menu[]>;

export function clickOnMainMenuItem(menuItem: string | MenuItem, modifiers?: Modifiers): Promise<void>;
export function clickOnContextMenuItem(menuItem: string | MenuItem, modifiers?: Modifiers): Promise<void>;

export function setElectronDialogHandler(handler: HandlerFn, dependencies: object)
}

0 comments on commit 45d213e

Please sign in to comment.