From 66798d2ab8e2e16e4549660787c14856b5d132b4 Mon Sep 17 00:00:00 2001 From: Priyansh Garg Date: Thu, 24 Oct 2024 02:40:47 +0530 Subject: [PATCH] type: Add `driver` property to NightwatchAPI. --- types/index.d.ts | 6 ++++++ types/tests/describe.test-d.ts | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/types/index.d.ts b/types/index.d.ts index 10ba3f0f0d..2d7254ec57 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -23,6 +23,7 @@ import { Actions, Capabilities, WebElement, + WebDriver, RelativeBy, locateWith as seleniumLocateWith } from 'selenium-webdriver'; @@ -560,6 +561,11 @@ export interface NightwatchAPI globals: NightwatchGlobals; + /** + * https://www.selenium.dev/selenium/docs/api/javascript/WebDriver.html + */ + driver: WebDriver; + launchUrl: string; launch_url: string; } diff --git a/types/tests/describe.test-d.ts b/types/tests/describe.test-d.ts index d8423d82ff..21eb0236bf 100644 --- a/types/tests/describe.test-d.ts +++ b/types/tests/describe.test-d.ts @@ -1,4 +1,5 @@ import { ExtendDescribeThis } from '..'; +import {FileDetector} from 'selenium-webdriver/remote'; describe('Ecosia', () => { before((browser) => browser.url('https://www.ecosia.org/')); @@ -12,6 +13,9 @@ describe('Ecosia', () => { upload_throughput: 500 * 1024, // Maximal aggregated upload throughput. }); + // https://www.selenium.dev/selenium/docs/api/javascript/WebDriver.html#setFileDetector + browser.driver.setFileDetector(new FileDetector()); + browser .waitForElementVisible('body') .assert.titleContains('Ecosia')