From 73dd4e148f4561c649b62482bdadaef6757e8948 Mon Sep 17 00:00:00 2001 From: Andrew Lessels Date: Fri, 18 Aug 2017 08:42:17 +1000 Subject: [PATCH] Add typeInterval constructor option and screenshot overload for clipping path --- types/nightmare/index.d.ts | 2 ++ types/nightmare/nightmare-tests.ts | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/types/nightmare/index.d.ts b/types/nightmare/index.d.ts index d99947ab27..5e4160fd41 100644 --- a/types/nightmare/index.d.ts +++ b/types/nightmare/index.d.ts @@ -96,6 +96,7 @@ declare class Nightmare { removeListener(event: 'error', cb: (msg: string, trace?: Nightmare.IStackTrace[]) => void): Nightmare; removeListener(event: 'timeout', cb: (msg: string) => void): Nightmare; screenshot(path: string): Nightmare; + screenshot(path: string, clip: Object): Nightmare; html(path: string, saveType: string): Nightmare; html(path: string, saveType: 'HTMLOnly'): Nightmare; html(path: string, saveType: 'HTMLComplete'): Nightmare; @@ -134,6 +135,7 @@ declare namespace Nightmare { cookiesFile?: string; phantomPath?: string; show?: boolean; + typeInterval?: number; } export interface IRequest { diff --git a/types/nightmare/nightmare-tests.ts b/types/nightmare/nightmare-tests.ts index 921e961538..37ac342d5f 100644 --- a/types/nightmare/nightmare-tests.ts +++ b/types/nightmare/nightmare-tests.ts @@ -167,6 +167,11 @@ new Nightmare() .screenshot('test/test.png') .run(done); +new Nightmare() + .goto('http://yahoo.com') + .screenshot('test/test.png', { x: 10, y: 5, width: 10, height: 10}) + .run(done); + new Nightmare() .goto('http://yahoo.com') .pdf('test/test.pdf')