cypress 4.12.1 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cli.js +5 -1
- package/lib/errors.js +1 -1
- package/lib/tasks/install.js +164 -16
- package/lib/util.js +8 -9
- package/package.json +11 -9
- package/types/cy-blob-util.d.ts +1 -1
- package/types/cypress-npm-api.d.ts +31 -24
- package/types/cypress.d.ts +167 -73
- package/types/index.d.ts +2 -1
- package/types/net-stubbing.ts +257 -0
- package/types/blob-util/index.d.ts +0 -97
package/types/cypress.d.ts
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
declare namespace Cypress {
|
2
2
|
type FileContents = string | any[] | object
|
3
|
-
type HistoryDirection =
|
3
|
+
type HistoryDirection = 'back' | 'forward'
|
4
4
|
type HttpMethod = string
|
5
5
|
type RequestBody = string | object
|
6
|
-
type ViewportOrientation =
|
7
|
-
type PrevSubject =
|
6
|
+
type ViewportOrientation = 'portrait' | 'landscape'
|
7
|
+
type PrevSubject = 'optional' | 'element' | 'document' | 'window'
|
8
8
|
type PluginConfig = (on: PluginEvents, config: PluginConfigOptions) => void | ConfigOptions | Promise<ConfigOptions>
|
9
9
|
|
10
10
|
interface CommandOptions {
|
@@ -26,6 +26,7 @@ declare namespace Cypress {
|
|
26
26
|
* @see https://on.cypress.io/firefox-gc-issue
|
27
27
|
*/
|
28
28
|
(task: 'firefox:force:gc'): Promise<void>
|
29
|
+
(task: 'net', eventName: string, frame: any): Promise<void>
|
29
30
|
}
|
30
31
|
|
31
32
|
type BrowserName = 'electron' | 'chrome' | 'chromium' | 'firefox' | 'edge' | string
|
@@ -107,6 +108,24 @@ declare namespace Cypress {
|
|
107
108
|
fromAutWindow: WindowPosition & { x: number, y: number }
|
108
109
|
}
|
109
110
|
|
111
|
+
/**
|
112
|
+
* Spec type for the given test. "integration" is the default, but
|
113
|
+
* tests run using experimentalComponentTesting will be "component"
|
114
|
+
*
|
115
|
+
* @see https://on.cypress.io/experiments
|
116
|
+
*/
|
117
|
+
type CypressSpecType = 'integration' | 'component'
|
118
|
+
|
119
|
+
/**
|
120
|
+
* Window type for Application Under Test(AUT)
|
121
|
+
*/
|
122
|
+
type AUTWindow = Window & typeof globalThis & ApplicationWindow
|
123
|
+
|
124
|
+
/**
|
125
|
+
* The interface for user-defined properties in Window object under test.
|
126
|
+
*/
|
127
|
+
interface ApplicationWindow {} // tslint:disable-line
|
128
|
+
|
110
129
|
/**
|
111
130
|
* Several libraries are bundled with Cypress by default.
|
112
131
|
*
|
@@ -211,6 +230,7 @@ declare namespace Cypress {
|
|
211
230
|
// name: "config_passing_spec.coffee",
|
212
231
|
// relative: "cypress/integration/config_passing_spec.coffee",
|
213
232
|
// absolute: "/users/smith/projects/web/cypress/integration/config_passing_spec.coffee"
|
233
|
+
// specType: "integration"
|
214
234
|
// }
|
215
235
|
```
|
216
236
|
*/
|
@@ -219,6 +239,7 @@ declare namespace Cypress {
|
|
219
239
|
relative: string // "cypress/integration/config_passing_spec.coffee" or "__all" if clicked all specs button
|
220
240
|
absolute: string
|
221
241
|
specFilter?: string // optional spec filter used by the user
|
242
|
+
specType?: CypressSpecType
|
222
243
|
}
|
223
244
|
|
224
245
|
/**
|
@@ -324,6 +345,11 @@ declare namespace Cypress {
|
|
324
345
|
*/
|
325
346
|
getFirefoxGcInterval(): number | null | undefined
|
326
347
|
|
348
|
+
/**
|
349
|
+
* @returns the number of test retries currently enabled for the run
|
350
|
+
*/
|
351
|
+
getTestRetries(): number | null
|
352
|
+
|
327
353
|
/**
|
328
354
|
* Checks if a variable is a valid instance of `cy` or a `cy` chainable.
|
329
355
|
*
|
@@ -387,7 +413,7 @@ declare namespace Cypress {
|
|
387
413
|
* Returns a boolean indicating whether an object is a DOM object.
|
388
414
|
*/
|
389
415
|
isDom(obj: any): boolean
|
390
|
-
isType(element: JQuery | HTMLElement
|
416
|
+
isType(element: JQuery | HTMLElement, type: string): boolean
|
391
417
|
/**
|
392
418
|
* Returns a boolean indicating whether an element is visible.
|
393
419
|
*/
|
@@ -492,7 +518,7 @@ declare namespace Cypress {
|
|
492
518
|
off: Actions
|
493
519
|
}
|
494
520
|
|
495
|
-
type CanReturnChainable = void | Chainable
|
521
|
+
type CanReturnChainable = void | Chainable | Promise<unknown>
|
496
522
|
type ThenReturn<S, R> =
|
497
523
|
R extends void ? Chainable<S> :
|
498
524
|
R extends R | undefined ? Chainable<S | Exclude<R, undefined>> :
|
@@ -1062,7 +1088,7 @@ declare namespace Cypress {
|
|
1062
1088
|
*
|
1063
1089
|
* @see https://on.cypress.io/go
|
1064
1090
|
*/
|
1065
|
-
go(direction: HistoryDirection | number, options?: Partial<Loggable & Timeoutable>): Chainable<
|
1091
|
+
go(direction: HistoryDirection | number, options?: Partial<Loggable & Timeoutable>): Chainable<AUTWindow>
|
1066
1092
|
|
1067
1093
|
/**
|
1068
1094
|
* Get the current URL hash of the page that is currently active.
|
@@ -1399,7 +1425,7 @@ declare namespace Cypress {
|
|
1399
1425
|
* @example
|
1400
1426
|
* cy.reload()
|
1401
1427
|
*/
|
1402
|
-
reload(options?: Partial<Loggable & Timeoutable>): Chainable<
|
1428
|
+
reload(options?: Partial<Loggable & Timeoutable>): Chainable<AUTWindow>
|
1403
1429
|
/**
|
1404
1430
|
* Reload the page without cache
|
1405
1431
|
*
|
@@ -1410,7 +1436,7 @@ declare namespace Cypress {
|
|
1410
1436
|
* cy.visit('http://localhost:3000/admin')
|
1411
1437
|
* cy.reload(true)
|
1412
1438
|
*/
|
1413
|
-
reload(forceReload: boolean): Chainable<
|
1439
|
+
reload(forceReload: boolean): Chainable<AUTWindow>
|
1414
1440
|
|
1415
1441
|
/**
|
1416
1442
|
* Make an HTTP GET request.
|
@@ -1581,15 +1607,12 @@ declare namespace Cypress {
|
|
1581
1607
|
|
1582
1608
|
/**
|
1583
1609
|
* Traverse into an element's shadow root.
|
1584
|
-
* Requires `experimentalShadowDomSupport: true` config option
|
1585
1610
|
*
|
1586
|
-
|
1587
|
-
|
1588
|
-
|
1589
|
-
|
1590
|
-
|
1591
|
-
.click()
|
1592
|
-
```
|
1611
|
+
* @example
|
1612
|
+
* cy.get('my-component')
|
1613
|
+
* .shadow()
|
1614
|
+
* .find('.my-button')
|
1615
|
+
* .click()
|
1593
1616
|
* @see https://on.cypress.io/experimental
|
1594
1617
|
*/
|
1595
1618
|
shadow(): Chainable<Subject>
|
@@ -1976,8 +1999,8 @@ declare namespace Cypress {
|
|
1976
1999
|
* })
|
1977
2000
|
*
|
1978
2001
|
*/
|
1979
|
-
visit(url: string, options?: Partial<VisitOptions>): Chainable<
|
1980
|
-
visit(options: Partial<VisitOptions> & { url: string }): Chainable<
|
2002
|
+
visit(url: string, options?: Partial<VisitOptions>): Chainable<AUTWindow>
|
2003
|
+
visit(options: Partial<VisitOptions> & { url: string }): Chainable<AUTWindow>
|
1981
2004
|
|
1982
2005
|
/**
|
1983
2006
|
* Wait for a number of milliseconds.
|
@@ -2048,7 +2071,7 @@ declare namespace Cypress {
|
|
2048
2071
|
})
|
2049
2072
|
```
|
2050
2073
|
*/
|
2051
|
-
window(options?: Partial<Loggable & Timeoutable>): Chainable<
|
2074
|
+
window(options?: Partial<Loggable & Timeoutable>): Chainable<AUTWindow>
|
2052
2075
|
|
2053
2076
|
/**
|
2054
2077
|
* Scopes all subsequent cy commands to within this element.
|
@@ -2177,7 +2200,7 @@ declare namespace Cypress {
|
|
2177
2200
|
type Agent<T extends sinon.SinonSpy> = SinonSpyAgent<T> & T
|
2178
2201
|
|
2179
2202
|
interface CookieDefaults {
|
2180
|
-
|
2203
|
+
preserve: string | string[] | RegExp | ((cookie: any) => boolean)
|
2181
2204
|
}
|
2182
2205
|
|
2183
2206
|
interface Failable {
|
@@ -2276,7 +2299,7 @@ declare namespace Cypress {
|
|
2276
2299
|
* @default {@link Timeoutable#timeout}
|
2277
2300
|
* @see https://docs.cypress.io/guides/references/configuration.html#Timeouts
|
2278
2301
|
*/
|
2279
|
-
requestTimeout: number
|
2302
|
+
requestTimeout: number
|
2280
2303
|
/**
|
2281
2304
|
* Time to wait for the response (ms)
|
2282
2305
|
*
|
@@ -2319,6 +2342,54 @@ declare namespace Cypress {
|
|
2319
2342
|
* @default false
|
2320
2343
|
*/
|
2321
2344
|
multiple: boolean
|
2345
|
+
/**
|
2346
|
+
* Activates the control key during click
|
2347
|
+
*
|
2348
|
+
* @default false
|
2349
|
+
*/
|
2350
|
+
ctrlKey: boolean
|
2351
|
+
/**
|
2352
|
+
* Activates the control key during click
|
2353
|
+
*
|
2354
|
+
* @default false
|
2355
|
+
*/
|
2356
|
+
controlKey: boolean
|
2357
|
+
/**
|
2358
|
+
* Activates the alt key (option key for Mac) during click
|
2359
|
+
*
|
2360
|
+
* @default false
|
2361
|
+
*/
|
2362
|
+
altKey: boolean
|
2363
|
+
/**
|
2364
|
+
* Activates the alt key (option key for Mac) during click
|
2365
|
+
*
|
2366
|
+
* @default false
|
2367
|
+
*/
|
2368
|
+
optionKey: boolean
|
2369
|
+
/**
|
2370
|
+
* Activates the shift key during click
|
2371
|
+
*
|
2372
|
+
* @default false
|
2373
|
+
*/
|
2374
|
+
shiftKey: boolean
|
2375
|
+
/**
|
2376
|
+
* Activates the meta key (Windows key or command key for Mac) during click
|
2377
|
+
*
|
2378
|
+
* @default false
|
2379
|
+
*/
|
2380
|
+
metaKey: boolean
|
2381
|
+
/**
|
2382
|
+
* Activates the meta key (Windows key or command key for Mac) during click
|
2383
|
+
*
|
2384
|
+
* @default false
|
2385
|
+
*/
|
2386
|
+
commandKey: boolean
|
2387
|
+
/**
|
2388
|
+
* Activates the meta key (Windows key or command key for Mac) during click
|
2389
|
+
*
|
2390
|
+
* @default false
|
2391
|
+
*/
|
2392
|
+
cmdKey: boolean
|
2322
2393
|
}
|
2323
2394
|
|
2324
2395
|
interface ResolvedConfigOptions {
|
@@ -2353,7 +2424,12 @@ declare namespace Cypress {
|
|
2353
2424
|
*/
|
2354
2425
|
reporter: string
|
2355
2426
|
/**
|
2356
|
-
*
|
2427
|
+
* Some reporters accept [reporterOptions](https://on.cypress.io/reporters) that customize their behavior
|
2428
|
+
* @default "spec"
|
2429
|
+
*/
|
2430
|
+
reporterOptions: { [key: string]: any }
|
2431
|
+
/**
|
2432
|
+
* Whether Cypress will watch and restart tests on test file changes
|
2357
2433
|
* @default true
|
2358
2434
|
*/
|
2359
2435
|
watchForFileChanges: boolean
|
@@ -2406,7 +2482,7 @@ declare namespace Cypress {
|
|
2406
2482
|
* If set to `system`, Cypress will try to find a `node` executable on your path to use when executing your plugins. Otherwise, Cypress will use the Node version bundled with Cypress.
|
2407
2483
|
* @default "bundled"
|
2408
2484
|
*/
|
2409
|
-
nodeVersion:
|
2485
|
+
nodeVersion: 'system' | 'bundled'
|
2410
2486
|
/**
|
2411
2487
|
* Path to plugins file. (Pass false to disable)
|
2412
2488
|
* @default "cypress/plugins/index.js"
|
@@ -2488,18 +2564,12 @@ declare namespace Cypress {
|
|
2488
2564
|
*/
|
2489
2565
|
waitForAnimations: boolean
|
2490
2566
|
/**
|
2491
|
-
* Firefox
|
2567
|
+
* Firefox version 79 and below only: The number of tests that will run between forced garbage collections.
|
2492
2568
|
* If a number is supplied, it will apply to `run` mode and `open` mode.
|
2493
2569
|
* Set the interval to `null` or 0 to disable forced garbage collections.
|
2494
2570
|
* @default { runMode: 1, openMode: null }
|
2495
2571
|
*/
|
2496
2572
|
firefoxGcInterval: Nullable<number | { runMode: Nullable<number>, openMode: Nullable<number> }>
|
2497
|
-
/**
|
2498
|
-
* If `true`, Cypress will add `sameSite` values to the objects yielded from `cy.setCookie()`,
|
2499
|
-
* `cy.getCookie()`, and `cy.getCookies()`. This will become the default behavior in Cypress 5.0.
|
2500
|
-
* @default false
|
2501
|
-
*/
|
2502
|
-
experimentalGetCookiesSameSite: boolean
|
2503
2573
|
/**
|
2504
2574
|
* Enables AST-based JS/HTML rewriting. This may fix issues caused by the existing regex-based JS/HTML replacement
|
2505
2575
|
* algorithm.
|
@@ -2507,14 +2577,28 @@ declare namespace Cypress {
|
|
2507
2577
|
*/
|
2508
2578
|
experimentalSourceRewriting: boolean
|
2509
2579
|
/**
|
2510
|
-
* Enables
|
2511
|
-
*
|
2580
|
+
* Enables `cy.route2`, which can be used to dynamically intercept/stub/await any HTTP request or response (XHRs, fetch, beacons, etc.)
|
2581
|
+
* @default false
|
2582
|
+
*/
|
2583
|
+
experimentalNetworkStubbing: boolean
|
2584
|
+
/**
|
2585
|
+
* Number of times to retry a failed test.
|
2586
|
+
* If a number is set, tests will retry in both runMode and openMode.
|
2587
|
+
* To enable test retries only in runMode, set e.g. `{ openMode: null, runMode: 2 }`
|
2588
|
+
* @default null
|
2589
|
+
*/
|
2590
|
+
retries: Nullable<number | {runMode: Nullable<number>, openMode: Nullable<number>}>
|
2591
|
+
/**
|
2592
|
+
* Enables including elements within the shadow DOM when using querying
|
2593
|
+
* commands (e.g. cy.get(), cy.find()). Can be set globally in cypress.json,
|
2594
|
+
* per-suite or per-test in the test configuration object, or programmatically
|
2595
|
+
* with Cypress.config()
|
2596
|
+
* @default false
|
2512
2597
|
*/
|
2513
|
-
|
2598
|
+
includeShadowDom: boolean
|
2514
2599
|
}
|
2515
2600
|
|
2516
|
-
interface TestConfigOverrides extends Partial<Pick<ConfigOptions, 'baseUrl' | 'defaultCommandTimeout' | 'taskTimeout' | 'animationDistanceThreshold' | 'waitForAnimations' | 'viewportHeight' | 'viewportWidth' | 'requestTimeout' | 'execTimeout' | 'env' | 'responseTimeout'>> {
|
2517
|
-
// retries?: number
|
2601
|
+
interface TestConfigOverrides extends Partial<Pick<ConfigOptions, 'baseUrl' | 'defaultCommandTimeout' | 'taskTimeout' | 'animationDistanceThreshold' | 'waitForAnimations' | 'viewportHeight' | 'viewportWidth' | 'requestTimeout' | 'execTimeout' | 'env' | 'responseTimeout' | 'retries' | 'includeShadowDom'>> {
|
2518
2602
|
browser?: IsBrowserMatcher | IsBrowserMatcher[]
|
2519
2603
|
}
|
2520
2604
|
|
@@ -2614,18 +2698,18 @@ declare namespace Cypress {
|
|
2614
2698
|
scale: boolean
|
2615
2699
|
onBeforeScreenshot: ($el: JQuery) => void
|
2616
2700
|
onAfterScreenshot: ($el: JQuery, props: {
|
2617
|
-
path: string
|
2618
|
-
size: number
|
2701
|
+
path: string
|
2702
|
+
size: number
|
2619
2703
|
dimensions: {
|
2620
|
-
width: number
|
2704
|
+
width: number
|
2621
2705
|
height: number
|
2622
|
-
}
|
2623
|
-
multipart: boolean
|
2624
|
-
pixelRatio: number
|
2625
|
-
takenAt: string
|
2626
|
-
name: string
|
2627
|
-
blackout: string[]
|
2628
|
-
duration: number
|
2706
|
+
}
|
2707
|
+
multipart: boolean
|
2708
|
+
pixelRatio: number
|
2709
|
+
takenAt: string
|
2710
|
+
name: string
|
2711
|
+
blackout: string[]
|
2712
|
+
duration: number
|
2629
2713
|
testAttemptIndex: number
|
2630
2714
|
}) => void
|
2631
2715
|
}
|
@@ -2646,13 +2730,13 @@ declare namespace Cypress {
|
|
2646
2730
|
*
|
2647
2731
|
* @default 'swing'
|
2648
2732
|
*/
|
2649
|
-
easing: 'swing' | 'linear'
|
2733
|
+
easing: 'swing' | 'linear'
|
2650
2734
|
/**
|
2651
2735
|
* Ensure element is scrollable. Error if element is not scrollable
|
2652
2736
|
*
|
2653
2737
|
* @default true
|
2654
2738
|
*/
|
2655
|
-
ensureScrollable: boolean
|
2739
|
+
ensureScrollable: boolean
|
2656
2740
|
}
|
2657
2741
|
|
2658
2742
|
interface ScrollIntoViewOptions extends ScrollToOptions {
|
@@ -2684,7 +2768,7 @@ declare namespace Cypress {
|
|
2684
2768
|
enable: boolean
|
2685
2769
|
force404: boolean
|
2686
2770
|
urlMatchingOptions: object
|
2687
|
-
|
2771
|
+
ignore(xhr: Request): void
|
2688
2772
|
onAnyRequest(route: RouteOptions, proxy: any): void
|
2689
2773
|
onAnyResponse(route: RouteOptions, proxy: any): void
|
2690
2774
|
onAnyAbort(route: RouteOptions, proxy: any): void
|
@@ -2701,6 +2785,10 @@ declare namespace Cypress {
|
|
2701
2785
|
sameSite: SameSiteStatus
|
2702
2786
|
}
|
2703
2787
|
|
2788
|
+
interface ShadowDomOptions {
|
2789
|
+
includeShadowDom?: boolean
|
2790
|
+
}
|
2791
|
+
|
2704
2792
|
/**
|
2705
2793
|
* Options that control `cy.type` command
|
2706
2794
|
*
|
@@ -2783,16 +2871,16 @@ declare namespace Cypress {
|
|
2783
2871
|
/**
|
2784
2872
|
* Called before your page has loaded all of its resources.
|
2785
2873
|
*
|
2786
|
-
* @param {
|
2874
|
+
* @param {AUTWindow} contentWindow the remote page's window object
|
2787
2875
|
*/
|
2788
|
-
onBeforeLoad(win:
|
2876
|
+
onBeforeLoad(win: AUTWindow): void
|
2789
2877
|
|
2790
2878
|
/**
|
2791
2879
|
* Called once your page has fired its load event.
|
2792
2880
|
*
|
2793
|
-
* @param {
|
2881
|
+
* @param {AUTWindow} contentWindow the remote page's window object
|
2794
2882
|
*/
|
2795
|
-
onLoad(win:
|
2883
|
+
onLoad(win: AUTWindow): void
|
2796
2884
|
|
2797
2885
|
/**
|
2798
2886
|
* Cypress will automatically apply the right authorization headers
|
@@ -2831,6 +2919,12 @@ declare namespace Cypress {
|
|
2831
2919
|
* @default true
|
2832
2920
|
*/
|
2833
2921
|
cancelable: boolean
|
2922
|
+
/**
|
2923
|
+
* The type of the event you want to trigger
|
2924
|
+
*
|
2925
|
+
* @default 'Event'
|
2926
|
+
*/
|
2927
|
+
eventConstructor: string
|
2834
2928
|
}
|
2835
2929
|
|
2836
2930
|
/** Options to change the default behavior of .writeFile */
|
@@ -4857,9 +4951,9 @@ declare namespace Cypress {
|
|
4857
4951
|
}
|
4858
4952
|
|
4859
4953
|
interface BrowserLaunchOptions {
|
4860
|
-
extensions: string[]
|
4954
|
+
extensions: string[]
|
4861
4955
|
preferences: { [key: string]: any }
|
4862
|
-
args: string[]
|
4956
|
+
args: string[]
|
4863
4957
|
}
|
4864
4958
|
|
4865
4959
|
interface Dimensions {
|
@@ -4948,7 +5042,7 @@ declare namespace Cypress {
|
|
4948
5042
|
})
|
4949
5043
|
```
|
4950
5044
|
*/
|
4951
|
-
(action: 'uncaught:exception', fn: (error: Error, runnable: Mocha.
|
5045
|
+
(action: 'uncaught:exception', fn: (error: Error, runnable: Mocha.Runnable) => false | void): void
|
4952
5046
|
/**
|
4953
5047
|
* Fires when your app calls the global `window.confirm()` method.
|
4954
5048
|
* Cypress will auto accept confirmations. Return `false` from this event and the confirmation will be canceled.
|
@@ -4983,12 +5077,12 @@ declare namespace Cypress {
|
|
4983
5077
|
* Fires as the page begins to load, but before any of your applications JavaScript has executed. This fires at the exact same time as `cy.visit()` `onBeforeLoad` callback. Useful to modify the window on a page transition.
|
4984
5078
|
* @see https://on.cypress.io/catalog-of-events#App-Events
|
4985
5079
|
*/
|
4986
|
-
(action: 'window:before:load', fn: (win:
|
5080
|
+
(action: 'window:before:load', fn: (win: AUTWindow) => void): void
|
4987
5081
|
/**
|
4988
5082
|
* Fires after all your resources have finished loading after a page transition. This fires at the exact same time as a `cy.visit()` `onLoad` callback.
|
4989
5083
|
* @see https://on.cypress.io/catalog-of-events#App-Events
|
4990
5084
|
*/
|
4991
|
-
(action: 'window:load', fn: (win:
|
5085
|
+
(action: 'window:load', fn: (win: AUTWindow) => void): void
|
4992
5086
|
/**
|
4993
5087
|
* Fires when your application is about to navigate away. The real event object is provided to you. Your app may have set a `returnValue` on the event, which is useful to assert on.
|
4994
5088
|
* @see https://on.cypress.io/catalog-of-events#App-Events
|
@@ -5008,7 +5102,7 @@ declare namespace Cypress {
|
|
5008
5102
|
* Fires when the test has failed. It is technically possible to prevent the test from actually failing by binding to this event and invoking an async `done` callback. However this is **strongly discouraged**. Tests should never legitimately fail. This event exists because it's extremely useful for debugging purposes.
|
5009
5103
|
* @see https://on.cypress.io/catalog-of-events#App-Events
|
5010
5104
|
*/
|
5011
|
-
(action: 'fail', fn: (error: Error, mocha: Mocha.
|
5105
|
+
(action: 'fail', fn: (error: Error, mocha: Mocha.Runnable) => void): void
|
5012
5106
|
/**
|
5013
5107
|
* Fires whenever the viewport changes via a `cy.viewport()` or naturally when Cypress resets the viewport to the default between tests. Useful for debugging purposes.
|
5014
5108
|
* @see https://on.cypress.io/catalog-of-events#App-Events
|
@@ -5053,16 +5147,16 @@ declare namespace Cypress {
|
|
5053
5147
|
* Fires before the test and all **before** and **beforeEach** hooks run.
|
5054
5148
|
* @see https://on.cypress.io/catalog-of-events#App-Events
|
5055
5149
|
*/
|
5056
|
-
(action: 'test:before:run', fn: (attributes: ObjectLike, test: Mocha.
|
5150
|
+
(action: 'test:before:run', fn: (attributes: ObjectLike, test: Mocha.Test) => void): void
|
5057
5151
|
/**
|
5058
5152
|
* Fires before the test and all **before** and **beforeEach** hooks run. If a `Promise` is returned, it will be awaited before proceeding.
|
5059
5153
|
*/
|
5060
|
-
(action: 'test:before:run:async', fn: (attributes: ObjectLike, test: Mocha.
|
5154
|
+
(action: 'test:before:run:async', fn: (attributes: ObjectLike, test: Mocha.Test) => void | Promise<any>): void
|
5061
5155
|
/**
|
5062
5156
|
* Fires after the test and all **afterEach** and **after** hooks run.
|
5063
5157
|
* @see https://on.cypress.io/catalog-of-events#App-Events
|
5064
5158
|
*/
|
5065
|
-
(action: 'test:after:run', fn: (attributes: ObjectLike, test: Mocha.
|
5159
|
+
(action: 'test:after:run', fn: (attributes: ObjectLike, test: Mocha.Test) => void): void
|
5066
5160
|
}
|
5067
5161
|
|
5068
5162
|
// $CommandQueue from `command_queue.coffee` - a lot to type. Might be more useful if it was written in TS
|
@@ -5169,7 +5263,7 @@ declare namespace Cypress {
|
|
5169
5263
|
|
5170
5264
|
interface Server extends RouteOptions {
|
5171
5265
|
enable: boolean
|
5172
|
-
|
5266
|
+
ignore: (xhr: any) => boolean
|
5173
5267
|
}
|
5174
5268
|
|
5175
5269
|
interface Viewport {
|
@@ -5200,10 +5294,10 @@ declare namespace Cypress {
|
|
5200
5294
|
}
|
5201
5295
|
|
5202
5296
|
type Encodings = 'ascii' | 'base64' | 'binary' | 'hex' | 'latin1' | 'utf8' | 'utf-8' | 'ucs2' | 'ucs-2' | 'utf16le' | 'utf-16le'
|
5203
|
-
type PositionType =
|
5297
|
+
type PositionType = 'topLeft' | 'top' | 'topRight' | 'left' | 'center' | 'right' | 'bottomLeft' | 'bottom' | 'bottomRight'
|
5204
5298
|
type ViewportPreset = 'macbook-15' | 'macbook-13' | 'macbook-11' | 'ipad-2' | 'ipad-mini' | 'iphone-xr' | 'iphone-x' | 'iphone-6+' | 'iphone-6' | 'iphone-5' | 'iphone-4' | 'iphone-3' | 'samsung-s10' | 'samsung-note9'
|
5205
5299
|
interface Offset {
|
5206
|
-
top: number
|
5300
|
+
top: number
|
5207
5301
|
left: number
|
5208
5302
|
}
|
5209
5303
|
|
@@ -5236,39 +5330,39 @@ declare namespace Cypress {
|
|
5236
5330
|
declare namespace Mocha {
|
5237
5331
|
interface TestFunction {
|
5238
5332
|
/**
|
5239
|
-
* Describe a specification or test-case with the given `title`,
|
5333
|
+
* Describe a specification or test-case with the given `title`, TestOptions, and callback `fn` acting
|
5240
5334
|
* as a thunk.
|
5241
5335
|
*/
|
5242
5336
|
(title: string, config: Cypress.TestConfigOverrides, fn?: Func): Test
|
5243
5337
|
|
5244
5338
|
/**
|
5245
|
-
* Describe a specification or test-case with the given `title`,
|
5339
|
+
* Describe a specification or test-case with the given `title`, TestOptions, and callback `fn` acting
|
5246
5340
|
* as a thunk.
|
5247
5341
|
*/
|
5248
5342
|
(title: string, config: Cypress.TestConfigOverrides, fn?: AsyncFunc): Test
|
5249
5343
|
}
|
5250
5344
|
interface ExclusiveTestFunction {
|
5251
5345
|
/**
|
5252
|
-
* Describe a specification or test-case with the given `title`,
|
5346
|
+
* Describe a specification or test-case with the given `title`, TestOptions, and callback `fn` acting
|
5253
5347
|
* as a thunk.
|
5254
5348
|
*/
|
5255
5349
|
(title: string, config: Cypress.TestConfigOverrides, fn?: Func): Test
|
5256
5350
|
|
5257
5351
|
/**
|
5258
|
-
* Describe a specification or test-case with the given `title`,
|
5352
|
+
* Describe a specification or test-case with the given `title`, TestOptions, and callback `fn` acting
|
5259
5353
|
* as a thunk.
|
5260
5354
|
*/
|
5261
5355
|
(title: string, config: Cypress.TestConfigOverrides, fn?: AsyncFunc): Test
|
5262
5356
|
}
|
5263
5357
|
interface PendingTestFunction {
|
5264
5358
|
/**
|
5265
|
-
* Describe a specification or test-case with the given `title`,
|
5359
|
+
* Describe a specification or test-case with the given `title`, TestOptions, and callback `fn` acting
|
5266
5360
|
* as a thunk.
|
5267
5361
|
*/
|
5268
5362
|
(title: string, config: Cypress.TestConfigOverrides, fn?: Func): Test
|
5269
5363
|
|
5270
5364
|
/**
|
5271
|
-
* Describe a specification or test-case with the given `title`,
|
5365
|
+
* Describe a specification or test-case with the given `title`, TestOptions, and callback `fn` acting
|
5272
5366
|
* as a thunk.
|
5273
5367
|
*/
|
5274
5368
|
(title: string, config: Cypress.TestConfigOverrides, fn?: AsyncFunc): Test
|
@@ -5276,7 +5370,7 @@ declare namespace Mocha {
|
|
5276
5370
|
|
5277
5371
|
interface SuiteFunction {
|
5278
5372
|
/**
|
5279
|
-
* Describe a "suite" with the given `title`,
|
5373
|
+
* Describe a "suite" with the given `title`, TestOptions, and callback `fn` containing
|
5280
5374
|
* nested suites.
|
5281
5375
|
*/
|
5282
5376
|
(title: string, config: Cypress.TestConfigOverrides, fn: (this: Suite) => void): Suite
|
@@ -5284,13 +5378,13 @@ declare namespace Mocha {
|
|
5284
5378
|
|
5285
5379
|
interface ExclusiveSuiteFunction {
|
5286
5380
|
/**
|
5287
|
-
* Describe a "suite" with the given `title`,
|
5381
|
+
* Describe a "suite" with the given `title`, TestOptions, and callback `fn` containing
|
5288
5382
|
* nested suites. Indicates this suite should be executed exclusively.
|
5289
5383
|
*/
|
5290
5384
|
(title: string, config: Cypress.TestConfigOverrides, fn: (this: Suite) => void): Suite
|
5291
5385
|
}
|
5292
5386
|
|
5293
5387
|
interface PendingSuiteFunction {
|
5294
|
-
(title: string,
|
5388
|
+
(title: string, config: Cypress.TestConfigOverrides, fn: (this: Suite) => void): Suite | void
|
5295
5389
|
}
|
5296
5390
|
}
|
package/types/index.d.ts
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
// Mike Woudenberg <https://github.com/mikewoudenberg>
|
5
5
|
// Robbert van Markus <https://github.com/rvanmarkus>
|
6
6
|
// Nicholas Boll <https://github.com/nicholasboll>
|
7
|
-
// TypeScript Version: 3.
|
7
|
+
// TypeScript Version: 3.4
|
8
8
|
// Updated by the Cypress team: https://www.cypress.io/about/
|
9
9
|
|
10
10
|
/// <reference path="./cy-blob-util.d.ts" />
|
@@ -27,6 +27,7 @@
|
|
27
27
|
// hmm, how to load it better?
|
28
28
|
/// <reference path="./cypress-npm-api.d.ts" />
|
29
29
|
|
30
|
+
/// <reference path="./net-stubbing.ts" />
|
30
31
|
/// <reference path="./cypress.d.ts" />
|
31
32
|
/// <reference path="./cypress-global-vars.d.ts" />
|
32
33
|
/// <reference path="./cypress-type-helpers.d.ts" />
|