|
1 | 1 | import type { EventInitDict, EventSpy, ScreenshotDiff, ScreenshotOptions } from '@stencil/core/internal';
|
2 | 2 | import type {
|
3 | 3 | ClickOptions,
|
4 |
| - HTTPResponse, |
| 4 | + HTTPResponse as PuppeteerHTTPResponse, |
5 | 5 | Page,
|
6 | 6 | ScreenshotOptions as PuppeteerScreenshotOptions,
|
7 |
| - WaitForOptions, |
8 | 7 | } from 'puppeteer';
|
9 | 8 |
|
| 9 | +/** |
| 10 | + * This type helps with declaration merging as a part of Stencil's migration from Puppeteer v5.4.3 to v10.0.0. In |
| 11 | + * v5.4.3, `HttpResponse` was an interface whereas v10.0.0 declares it as a class. It is redeclared here to help teams |
| 12 | + * migrate to a newer version of Stencil minor version without requiring a Puppeteer upgrade. This type should be |
| 13 | + * removed as a part of the Stencil 3.0 release. |
| 14 | + */ |
| 15 | +export type HTTPResponse = PuppeteerHTTPResponse; |
| 16 | + |
| 17 | +/** |
| 18 | + * These types help with declaration merging as a part of Stencil's migration from Puppeteer v5.4.3 to v10.0.0. In |
| 19 | + * v10.0.0, `WaitForOptions` is a renamed version of `NavigationOptions` from v5.4.3, who has had its type hierarchy |
| 20 | + * flattened. |
| 21 | + * |
| 22 | + * See {@link https://github.com/DefinitelyTyped/DefinitelyTyped/blob/8290e943f6b398acf39ee1b2e486824144e15bc8/types/puppeteer/index.d.ts#L605-L622} |
| 23 | + * for the v5.4.3 types. |
| 24 | + * |
| 25 | + * These types are redeclared here to help teams migrate to a newer version of Stencil minor version without requiring a |
| 26 | + * Puppeteer upgrade. This type should be removed as a part of the Stencil 3.0 release. |
| 27 | + */ |
| 28 | +export type PuppeteerLifeCycleEvent = 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2'; |
| 29 | +export interface WaitForOptions { |
| 30 | + timeout?: number; |
| 31 | + waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[]; |
| 32 | +} |
| 33 | + |
10 | 34 | /**
|
11 | 35 | * This type was once exported by Puppeteer, but has since moved to an object literal in (Puppeteer’s) native types.
|
12 | 36 | * Re-create it here as a named type to use across multiple Stencil-related testing files.
|
|
0 commit comments