Unverified Commit 8ccfff10 authored by Brandon Bayer's avatar Brandon Bayer Committed by GitHub

fix types of next-webdriver (#23995)

This does not touch any next.js code. This improves the integration test setup by properly typing next-webdriver.
parent 7fd5a24d
interface Chain { interface ChainMethods {
elementByCss: (selector: string) => Chain elementByCss: (selector: string) => Chain<Element>
elementById: () => Chain elementById: () => Chain<Element>
getValue: () => Chain getValue: () => Chain<any>
text: () => Chain text: () => Chain<string>
type: () => Chain type: () => Chain<any>
moveTo: () => Chain moveTo: () => Chain<any>
getComputedCss: () => Chain getComputedCss: () => Chain<any>
getAttribute: () => Chain getAttribute: () => Chain<any>
hasElementByCssSelector: () => Chain hasElementByCssSelector: () => Chain<any>
click: () => Chain click: () => Chain<any>
elementsByCss: () => Chain elementsByCss: () => Chain<Element[]>
waitForElementByCss: () => Chain waitForElementByCss: (arg: string) => Chain<any>
eval: () => Chain eval: () => Chain<any>
log: () => Chain log: () => Chain<any>
url: () => Chain url: () => Chain<any>
back: () => Chain back: () => Chain<any>
forward: () => Chain forward: () => Chain<any>
refresh: () => Chain refresh: () => Chain<any>
setDimensions: (opts: { height: number; width: number }) => Chain setDimensions: (opts: { height: number; width: number }) => Chain<any>
close: () => Chain close: () => Chain<any>
quit: () => Chain quit: () => Chain<any>
} }
interface Chain<T> extends Promise<T & ChainMethods>, ChainMethods {}
type Browser = { __brand: 'Browser' }
export default function ( export default function (
appPort: number, appPort: number,
path: string, path: string,
waitHydration?: boolean, waitHydration?: boolean,
allowHydrationRetry?: boolean allowHydrationRetry?: boolean
): Promise<Chain> ): Promise<Chain<Browser>>
...@@ -7,7 +7,7 @@ import { Builder, By } from 'selenium-webdriver' ...@@ -7,7 +7,7 @@ import { Builder, By } from 'selenium-webdriver'
import { Options as ChromeOptions } from 'selenium-webdriver/chrome' import { Options as ChromeOptions } from 'selenium-webdriver/chrome'
import { Options as SafariOptions } from 'selenium-webdriver/safari' import { Options as SafariOptions } from 'selenium-webdriver/safari'
import { Options as FireFoxOptions } from 'selenium-webdriver/firefox' import { Options as FireFoxOptions } from 'selenium-webdriver/firefox'
import { waitFor } from 'next-test-utils' import { waitFor } from './next-test-utils'
const { const {
BROWSER_NAME: browserName = 'chrome', BROWSER_NAME: browserName = 'chrome',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment