From f6b11a8510d1ff487160eee5f38bdddda7762eeb Mon Sep 17 00:00:00 2001 From: Wim Selles Date: Sat, 7 Mar 2020 09:26:56 +0100 Subject: [PATCH] feat: add all types --- package-lock.json | 12 +++--- package.json | 2 +- types/index.d.ts | 99 +++++++++++++++++++++++++++-------------------- 3 files changed, 65 insertions(+), 48 deletions(-) diff --git a/package-lock.json b/package-lock.json index 63d41292..8e15971c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10554,9 +10554,9 @@ "dev": true }, "needle": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/needle/-/needle-2.3.2.tgz", - "integrity": "sha512-DUzITvPVDUy6vczKKYTnWc/pBZ0EnjMJnQ3y+Jo5zfKFimJs7S3HFCxCRZYB9FUZcrzUQr3WsmvZgddMEIZv6w==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/needle/-/needle-2.3.3.tgz", + "integrity": "sha512-EkY0GeSq87rWp1hoq/sH/wnTWgFVhYlnIkbJ0YJFfRgEFlz2RraCjBpFQ+vrEgEdp0ThfyHADmkChEhcb7PKyw==", "requires": { "debug": "^3.2.6", "iconv-lite": "^0.4.4", @@ -14038,9 +14038,9 @@ } }, "webdriver-image-comparison": { - "version": "0.13.1", - "resolved": "https://registry.npmjs.org/webdriver-image-comparison/-/webdriver-image-comparison-0.13.1.tgz", - "integrity": "sha512-+ny7KxCswS4caMpO/wmIlgYtrfg9UDcc1tFPUVb/pzihmN07VzfaICXuzoK54zrv79TeTU5sqyescZG89p4lPQ==", + "version": "0.13.2", + "resolved": "https://registry.npmjs.org/webdriver-image-comparison/-/webdriver-image-comparison-0.13.2.tgz", + "integrity": "sha512-LWNDLHlG0OmnfV4fjAG2z99WTdpgpL8KUQIn233beEB7g60mTA8pUSgfm1C0bLOgkDj2/y5z7XGLPttyvFoYJQ==", "requires": { "canvas": "^2.6.1", "chalk": "^3.0.0", diff --git a/package.json b/package.json index 8f4fcf56..761ed44e 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "webdriverio": "^5.18.7" }, "dependencies": { - "webdriver-image-comparison": "0.13.1" + "webdriver-image-comparison": "0.13.2" }, "repository": { "type": "git", diff --git a/types/index.d.ts b/types/index.d.ts index ac843417..23b827d3 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,43 +1,60 @@ -declare module WebdriverIO { - interface Browser { - /** - * Saves an image of an element - */ - saveElement(element: Element, tag: string, saveElementOptions?: {}); - - /** - * Saves an image of a viewport - */ - saveScreen(tag: string, saveScreenOptions?: {}); - - /** - * Saves an image of the complete screen - */ - saveFullPageScreen(tag: string, saveFullPageScreenOptions?: {}); - - /** - * Saves an image of the complete screen with the tabbable lines and dots - */ - saveTabbablePage(tag: string, saveTabbableOptions?: {}); - - /** - * Compare an image of an element - */ - checkElement(element: Element, tag: string, checkElementOptions?: {}); - - /** - * Compares an image of a viewport - */ - checkScreen(tag: string, checkScreenOptions?: {}); - - /** - * Compares an image of the complete screen - */ - checkFullPageScreen(tag: string, checkFullPageOptions?: {}); - - /** - * Compares an image of the complete screen with the tabbable lines and dots - */ - checkTabbablePage(tag: string, checkTabbableOptions?: {}); +import {ScreenshotOutput} from "webdriver-image-comparison/build/helpers/afterScreenshot.interfaces"; +import {ImageCompareResult} from "webdriver-image-comparison"; +import { + CheckScreenMethodOptions, + SaveScreenMethodOptions +} from "webdriver-image-comparison/build/commands/screen.interfaces"; +import { + CheckElementMethodOptions, + SaveElementMethodOptions, +} from "webdriver-image-comparison/build/commands/element.interfaces"; +import { + CheckFullPageMethodOptions, + SaveFullPageMethodOptions +} from "webdriver-image-comparison/build/commands/fullPage.interfaces"; + +declare global { + namespace WebdriverIO { + interface Browser { + /** + * Saves an image of an element + */ + saveElement(element: Element, tag: string, saveElementOptions?: SaveElementMethodOptions): ScreenshotOutput; + + /** + * Saves an image of a viewport + */ + saveScreen(tag: string, saveScreenOptions?: SaveScreenMethodOptions): ScreenshotOutput; + + /** + * Saves an image of the complete screen + */ + saveFullPageScreen(tag: string, saveFullPageScreenOptions?: SaveFullPageMethodOptions): ScreenshotOutput; + + /** + * Saves an image of the complete screen with the tabbable lines and dots + */ + saveTabbablePage(tag: string, saveTabbableOptions?: SaveFullPageMethodOptions): ScreenshotOutput; + + /** + * Compare an image of an element + */ + checkElement(element: Element, tag: string, checkElementOptions?: CheckElementMethodOptions): (ImageCompareResult | number); + + /** + * Compares an image of a viewport + */ + checkScreen(tag: string, checkScreenOptions?: CheckScreenMethodOptions): (ImageCompareResult | number); + + /** + * Compares an image of the complete screen + */ + checkFullPageScreen(tag: string, checkFullPageOptions?: CheckFullPageMethodOptions): (ImageCompareResult | number); + + /** + * Compares an image of the complete screen with the tabbable lines and dots + */ + checkTabbablePage(tag: string, checkTabbableOptions?: CheckFullPageMethodOptions): (ImageCompareResult | number); + } } }