cypress 6.1.0 → 6.2.0
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/types/cypress-eventemitter.d.ts +21 -0
- package/types/cypress.d.ts +53 -19
- package/types/net-stubbing.ts +12 -5
package/package.json
CHANGED
@@ -6,3 +6,24 @@ interface EventEmitter extends EventEmitter2 {
|
|
6
6
|
emitMap: (eventName: string, args: any[]) => Array<(...args: any[]) => any>
|
7
7
|
emitThen: (eventName: string, args: any[]) => Bluebird.BluebirdStatic
|
8
8
|
}
|
9
|
+
|
10
|
+
// Copied from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/events.d.ts
|
11
|
+
// to avoid type conflict.
|
12
|
+
interface NodeEventEmitter {
|
13
|
+
addListener(event: string | symbol, listener: (...args: any[]) => void): this
|
14
|
+
on(event: string | symbol, listener: (...args: any[]) => void): this
|
15
|
+
once(event: string | symbol, listener: (...args: any[]) => void): this
|
16
|
+
removeListener(event: string | symbol, listener: (...args: any[]) => void): this
|
17
|
+
off(event: string | symbol, listener: (...args: any[]) => void): this
|
18
|
+
removeAllListeners(event?: string | symbol): this
|
19
|
+
setMaxListeners(n: number): this
|
20
|
+
getMaxListeners(): number
|
21
|
+
listeners(event: string | symbol): Array<(...args: any[]) => void>
|
22
|
+
rawListeners(event: string | symbol): Array<(...args: any[]) => void>
|
23
|
+
emit(event: string | symbol, ...args: any[]): boolean
|
24
|
+
listenerCount(type: string | symbol): number
|
25
|
+
// Added in Node 6...
|
26
|
+
prependListener(event: string | symbol, listener: (...args: any[]) => void): this
|
27
|
+
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this
|
28
|
+
eventNames(): Array<string | symbol>
|
29
|
+
}
|
package/types/cypress.d.ts
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
/// <reference path="./cypress-npm-api.d.ts" />
|
2
|
+
|
1
3
|
declare namespace Cypress {
|
2
4
|
type FileContents = string | any[] | object
|
3
5
|
type HistoryDirection = 'back' | 'forward'
|
@@ -116,6 +118,17 @@ declare namespace Cypress {
|
|
116
118
|
*/
|
117
119
|
type CypressSpecType = 'integration' | 'component'
|
118
120
|
|
121
|
+
/**
|
122
|
+
* A Cypress spec.
|
123
|
+
*/
|
124
|
+
interface Spec {
|
125
|
+
name: string // "config_passing_spec.js"
|
126
|
+
relative: string // "cypress/integration/config_passing_spec.js" or "__all" if clicked all specs button
|
127
|
+
absolute: string // "/Users/janelane/app/cypress/integration/config_passing_spec.js"
|
128
|
+
specFilter?: string // optional spec filter used by the user
|
129
|
+
specType?: CypressSpecType
|
130
|
+
}
|
131
|
+
|
119
132
|
/**
|
120
133
|
* Window type for Application Under Test(AUT)
|
121
134
|
*/
|
@@ -227,23 +240,17 @@ declare namespace Cypress {
|
|
227
240
|
/**
|
228
241
|
* Currently executing spec file.
|
229
242
|
* @example
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
243
|
+
* ```
|
244
|
+
* Cypress.spec
|
245
|
+
* // {
|
246
|
+
* // name: "config_passing_spec.coffee",
|
247
|
+
* // relative: "cypress/integration/config_passing_spec.coffee",
|
248
|
+
* // absolute: "/users/smith/projects/web/cypress/integration/config_passing_spec.coffee"
|
249
|
+
* // specType: "integration"
|
250
|
+
* // }
|
251
|
+
* ```
|
239
252
|
*/
|
240
|
-
spec:
|
241
|
-
name: string // "config_passing_spec.coffee"
|
242
|
-
relative: string // "cypress/integration/config_passing_spec.coffee" or "__all" if clicked all specs button
|
243
|
-
absolute: string
|
244
|
-
specFilter?: string // optional spec filter used by the user
|
245
|
-
specType?: CypressSpecType
|
246
|
-
}
|
253
|
+
spec: Spec
|
247
254
|
|
248
255
|
/**
|
249
256
|
* Information about the browser currently running the tests
|
@@ -2569,6 +2576,11 @@ declare namespace Cypress {
|
|
2569
2576
|
* @default { runMode: 1, openMode: null }
|
2570
2577
|
*/
|
2571
2578
|
firefoxGcInterval: Nullable<number | { runMode: Nullable<number>, openMode: Nullable<number> }>
|
2579
|
+
/**
|
2580
|
+
* Allows listening to the `before:run`, `after:run`, `before:spec`, and `after:spec` events in the plugins file.
|
2581
|
+
* @default false
|
2582
|
+
*/
|
2583
|
+
experimentalRunEvents: boolean
|
2572
2584
|
/**
|
2573
2585
|
* Enables AST-based JS/HTML rewriting. This may fix issues caused by the existing regex-based JS/HTML replacement
|
2574
2586
|
* algorithm.
|
@@ -2592,7 +2604,7 @@ declare namespace Cypress {
|
|
2592
2604
|
includeShadowDom: boolean
|
2593
2605
|
}
|
2594
2606
|
|
2595
|
-
interface TestConfigOverrides extends Partial<Pick<ConfigOptions, 'baseUrl' | 'defaultCommandTimeout' | '
|
2607
|
+
interface TestConfigOverrides extends Partial<Pick<ConfigOptions, 'animationDistanceThreshold' | 'baseUrl' | 'defaultCommandTimeout' | 'env' | 'execTimeout' | 'includeShadowDom' | 'requestTimeout' | 'responseTimeout' | 'retries' | 'scrollBehavior' | 'taskTimeout' | 'viewportHeight' | 'viewportWidth' | 'waitForAnimations'>> {
|
2596
2608
|
browser?: IsBrowserMatcher | IsBrowserMatcher[]
|
2597
2609
|
}
|
2598
2610
|
|
@@ -4970,7 +4982,7 @@ declare namespace Cypress {
|
|
4970
4982
|
dimensions?: Dimensions
|
4971
4983
|
}
|
4972
4984
|
|
4973
|
-
interface FileObject {
|
4985
|
+
interface FileObject extends NodeEventEmitter {
|
4974
4986
|
filePath: string
|
4975
4987
|
outputPath: string
|
4976
4988
|
shouldWatch: boolean
|
@@ -4987,9 +4999,31 @@ declare namespace Cypress {
|
|
4987
4999
|
[key: string]: Task
|
4988
5000
|
}
|
4989
5001
|
|
5002
|
+
interface SystemDetails {
|
5003
|
+
osName: string
|
5004
|
+
osVersion: string
|
5005
|
+
}
|
5006
|
+
|
5007
|
+
interface BeforeRunDetails {
|
5008
|
+
browser: Browser
|
5009
|
+
config: ConfigOptions
|
5010
|
+
cypressVersion: string
|
5011
|
+
group?: string
|
5012
|
+
parallel: boolean
|
5013
|
+
runUrl?: string
|
5014
|
+
specs: Spec[]
|
5015
|
+
specPattern: string[]
|
5016
|
+
system: SystemDetails
|
5017
|
+
tag?: string
|
5018
|
+
}
|
5019
|
+
|
4990
5020
|
interface PluginEvents {
|
4991
|
-
(action: '
|
5021
|
+
(action: 'after:run', fn: (results: CypressCommandLine.CypressRunResult | CypressCommandLine.CypressFailedRunResult) => void | Promise<void>): void
|
4992
5022
|
(action: 'after:screenshot', fn: (details: ScreenshotDetails) => void | AfterScreenshotReturnObject | Promise<AfterScreenshotReturnObject>): void
|
5023
|
+
(action: 'after:spec', fn: (spec: Spec, results: CypressCommandLine.RunResult) => void | Promise<void>): void
|
5024
|
+
(action: 'before:run', fn: (runDetails: BeforeRunDetails) => void | Promise<void>): void
|
5025
|
+
(action: 'before:spec', fn: (spec: Spec) => void | Promise<void>): void
|
5026
|
+
(action: 'before:browser:launch', fn: (browser: Browser, browserLaunchOptions: BrowserLaunchOptions) => void | BrowserLaunchOptions | Promise<BrowserLaunchOptions>): void
|
4993
5027
|
(action: 'file:preprocessor', fn: (file: FileObject) => string | Promise<string>): void
|
4994
5028
|
(action: 'task', tasks: Tasks): void
|
4995
5029
|
}
|
package/types/net-stubbing.ts
CHANGED
@@ -180,6 +180,7 @@ export type NumberMatcher = number | number[]
|
|
180
180
|
*/
|
181
181
|
export interface Interception {
|
182
182
|
id: string
|
183
|
+
routeHandlerId: string
|
183
184
|
/* @internal */
|
184
185
|
log: any
|
185
186
|
request: CyHttpMessages.IncomingRequest
|
@@ -191,6 +192,10 @@ export interface Interception {
|
|
191
192
|
response?: CyHttpMessages.IncomingResponse
|
192
193
|
/* @internal */
|
193
194
|
responseHandler?: HttpResponseInterceptor
|
195
|
+
/**
|
196
|
+
* The error that occurred during this request.
|
197
|
+
*/
|
198
|
+
error?: Error
|
194
199
|
/**
|
195
200
|
* Was `cy.wait()` used to wait on the response to this request?
|
196
201
|
* @internal
|
@@ -215,6 +220,7 @@ export interface Route {
|
|
215
220
|
handler: RouteHandler
|
216
221
|
hitCount: number
|
217
222
|
requests: { [key: string]: Interception }
|
223
|
+
command: any
|
218
224
|
}
|
219
225
|
|
220
226
|
export interface RouteMap { [key: string]: Route }
|
@@ -224,13 +230,9 @@ export interface RouteMap { [key: string]: Route }
|
|
224
230
|
*/
|
225
231
|
export type RouteMatcher = StringMatcher | RouteMatcherOptions
|
226
232
|
|
227
|
-
export interface RouteMatcherCompatOptions {
|
228
|
-
response?: string | object
|
229
|
-
}
|
230
|
-
|
231
233
|
export type RouteMatcherOptions = RouteMatcherOptionsGeneric<StringMatcher>
|
232
234
|
|
233
|
-
export interface RouteMatcherOptionsGeneric<S>
|
235
|
+
export interface RouteMatcherOptionsGeneric<S> {
|
234
236
|
/**
|
235
237
|
* Match against the username and password used in HTTP Basic authentication.
|
236
238
|
*/
|
@@ -248,6 +250,11 @@ export interface RouteMatcherOptionsGeneric<S> extends RouteMatcherCompatOptions
|
|
248
250
|
* If 'false', only HTTP requests will be matched.
|
249
251
|
*/
|
250
252
|
https?: boolean
|
253
|
+
/**
|
254
|
+
* If `true`, will match the supplied `url` against incoming `path`s.
|
255
|
+
* Requires a `url` argument. Cannot be used with a `path` argument.
|
256
|
+
*/
|
257
|
+
matchUrlAgainstPath?: boolean
|
251
258
|
/**
|
252
259
|
* Match against the request's HTTP method.
|
253
260
|
* @default '*'
|