cypress 6.2.0 → 6.5.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 +21 -1
- package/lib/exec/open.js +9 -1
- package/lib/exec/run.js +9 -1
- package/lib/exec/xvfb.js +4 -3
- package/lib/tasks/cache.js +6 -3
- package/lib/tasks/install.js +1 -1
- package/lib/util.js +1 -1
- package/package.json +5 -3
- package/types/chai/index.d.ts +13 -3
- package/types/cy-http.d.ts +13 -0
- package/types/cypress-global-vars.d.ts +0 -2
- package/types/cypress.d.ts +194 -35
- package/types/net-stubbing.ts +8 -3
- package/types/sinon/index.d.ts +204 -140
- package/types/sinon/ts3.1/index.d.ts +0 -1703
package/lib/cli.js
CHANGED
@@ -143,7 +143,7 @@ const descriptions = {
|
|
143
143
|
tag: 'named tag(s) for recorded runs in the Cypress Dashboard',
|
144
144
|
version: 'prints Cypress version'
|
145
145
|
};
|
146
|
-
const knownCommands = ['cache', 'help', '-h', '--help', 'install', 'open', 'run', 'verify', '-v', '--version', 'version', 'info'];
|
146
|
+
const knownCommands = ['cache', 'help', '-h', '--help', 'install', 'open', 'open-ct', 'run', 'run-ct', 'verify', '-v', '--version', 'version', 'info'];
|
147
147
|
|
148
148
|
const text = description => {
|
149
149
|
if (!descriptions[description]) {
|
@@ -322,6 +322,26 @@ module.exports = {
|
|
322
322
|
|
323
323
|
require('./exec/run').start(parseVariableOpts(fnArgs, args)).then(util.exit).catch(util.logErrorExit1);
|
324
324
|
});
|
325
|
+
program // TODO make this command public once CT will be merged completely
|
326
|
+
.command('open-ct', {
|
327
|
+
hidden: true
|
328
|
+
}).usage('[options]').description('Opens Cypress component testing interactive mode.').option('-b, --browser <browser-path>', text('browserOpenMode')).option('-c, --config <config>', text('config')).option('-C, --config-file <config-file>', text('configFile')).option('-d, --detached [bool]', text('detached'), coerceFalse).option('-e, --env <env>', text('env')).option('--global', text('global')).option('-p, --port <port>', text('port')).option('-P, --project <project-path>', text('project')).option('--dev', text('dev'), coerceFalse).action(opts => {
|
329
|
+
debug('opening Cypress');
|
330
|
+
|
331
|
+
require('./exec/open').start(util.parseOpts(opts), {
|
332
|
+
isComponentTesting: true
|
333
|
+
}).catch(util.logErrorExit1);
|
334
|
+
});
|
335
|
+
program // TODO make this command public once CT will be merged completely
|
336
|
+
.command('run-ct', {
|
337
|
+
hidden: true
|
338
|
+
}).usage('[options]').description('Runs all Cypress Component Testing suites').option('-b, --browser <browser-name-or-path>', text('browserRunMode')).option('--ci-build-id <id>', text('ciBuildId')).option('-c, --config <config>', text('config')).option('-C, --config-file <config-file>', text('configFile')).option('-e, --env <env>', text('env')).option('--group <name>', text('group')).option('-k, --key <record-key>', text('key')).option('--headed', text('headed')).option('--headless', text('headless')).option('--no-exit', text('exit')).option('--parallel', text('parallel')).option('-p, --port <port>', text('port')).option('-P, --project <project-path>', text('project')).option('-q, --quiet', text('quiet')).option('--record [bool]', text('record'), coerceFalse).option('-r, --reporter <reporter>', text('reporter')).option('-o, --reporter-options <reporter-options>', text('reporterOptions')).option('-s, --spec <spec>', text('spec')).option('-t, --tag <tag>', text('tag')).option('--dev', text('dev'), coerceFalse).action(opts => {
|
339
|
+
debug('running Cypress run-ct');
|
340
|
+
|
341
|
+
require('./exec/run').start(util.parseOpts(opts), {
|
342
|
+
isComponentTesting: true
|
343
|
+
}).then(util.exit).catch(util.logErrorExit1);
|
344
|
+
});
|
325
345
|
program.command('open').usage('[options]').description('Opens Cypress in the interactive GUI.').option('-b, --browser <browser-path>', text('browserOpenMode')).option('-c, --config <config>', text('config')).option('-C, --config-file <config-file>', text('configFile')).option('-d, --detached [bool]', text('detached'), coerceFalse).option('-e, --env <env>', text('env')).option('--global', text('global')).option('-p, --port <port>', text('port')).option('-P, --project <project-path>', text('project')).option('--dev', text('dev'), coerceFalse).action(opts => {
|
326
346
|
debug('opening Cypress');
|
327
347
|
|
package/lib/exec/open.js
CHANGED
@@ -9,7 +9,11 @@ const spawn = require('./spawn');
|
|
9
9
|
const verify = require('../tasks/verify');
|
10
10
|
|
11
11
|
module.exports = {
|
12
|
-
start(options = {}
|
12
|
+
start(options = {}, {
|
13
|
+
isComponentTesting
|
14
|
+
} = {
|
15
|
+
isComponentTesting: false
|
16
|
+
}) {
|
13
17
|
if (!util.isInstalledGlobally() && !options.global && !options.project) {
|
14
18
|
options.project = process.cwd();
|
15
19
|
}
|
@@ -40,6 +44,10 @@ module.exports = {
|
|
40
44
|
args.push('--project', options.project);
|
41
45
|
}
|
42
46
|
|
47
|
+
if (isComponentTesting) {
|
48
|
+
args.push('--componentTesting');
|
49
|
+
}
|
50
|
+
|
43
51
|
debug('opening from options %j', options);
|
44
52
|
debug('command line arguments %j', args);
|
45
53
|
|
package/lib/exec/run.js
CHANGED
@@ -174,7 +174,11 @@ module.exports = {
|
|
174
174
|
isValidProject,
|
175
175
|
|
176
176
|
// resolves with the number of failed tests
|
177
|
-
start(options = {}
|
177
|
+
start(options = {}, {
|
178
|
+
isComponentTesting
|
179
|
+
} = {
|
180
|
+
isComponentTesting: false
|
181
|
+
}) {
|
178
182
|
_.defaults(options, {
|
179
183
|
key: null,
|
180
184
|
spec: null,
|
@@ -196,6 +200,10 @@ module.exports = {
|
|
196
200
|
throw err;
|
197
201
|
}
|
198
202
|
|
203
|
+
if (isComponentTesting) {
|
204
|
+
args.push('--componentTesting');
|
205
|
+
}
|
206
|
+
|
199
207
|
debug('run to spawn.start args %j', args);
|
200
208
|
return spawn.start(args, {
|
201
209
|
dev: options.dev
|
package/lib/exec/xvfb.js
CHANGED
@@ -10,9 +10,7 @@ const {
|
|
10
10
|
stripIndent
|
11
11
|
} = require('common-tags');
|
12
12
|
|
13
|
-
const
|
14
|
-
|
15
|
-
const debugXvfb = require('debug')('cypress:xvfb');
|
13
|
+
const Debug = require('debug');
|
16
14
|
|
17
15
|
const {
|
18
16
|
throwFormErrorText,
|
@@ -21,6 +19,9 @@ const {
|
|
21
19
|
|
22
20
|
const util = require('../util');
|
23
21
|
|
22
|
+
const debug = Debug('cypress:cli');
|
23
|
+
const debugXvfb = Debug('cypress:xvfb');
|
24
|
+
debug.Debug = debugXvfb.Debug = Debug;
|
24
25
|
const xvfbOptions = {
|
25
26
|
timeout: 30000,
|
26
27
|
// milliseconds
|
package/lib/tasks/cache.js
CHANGED
@@ -14,7 +14,9 @@ const {
|
|
14
14
|
|
15
15
|
const Table = require('cli-table3');
|
16
16
|
|
17
|
-
const
|
17
|
+
const dayjs = require('dayjs');
|
18
|
+
|
19
|
+
const relativeTime = require('dayjs/plugin/relativeTime');
|
18
20
|
|
19
21
|
const chalk = require('chalk');
|
20
22
|
|
@@ -22,8 +24,9 @@ const _ = require('lodash');
|
|
22
24
|
|
23
25
|
const getFolderSize = require('./get-folder-size');
|
24
26
|
|
25
|
-
const Bluebird = require('bluebird');
|
27
|
+
const Bluebird = require('bluebird');
|
26
28
|
|
29
|
+
dayjs.extend(relativeTime); // output colors for the table
|
27
30
|
|
28
31
|
const colors = {
|
29
32
|
titles: chalk.white,
|
@@ -123,7 +126,7 @@ const getCachedVersions = showSize => {
|
|
123
126
|
return binary;
|
124
127
|
}
|
125
128
|
|
126
|
-
const accessed =
|
129
|
+
const accessed = dayjs(lastAccessedTime).fromNow();
|
127
130
|
binary.accessed = accessed;
|
128
131
|
return binary;
|
129
132
|
}, e => {
|
package/lib/tasks/install.js
CHANGED
@@ -173,7 +173,7 @@ const downloadAndUnzip = ({
|
|
173
173
|
throttle: 100,
|
174
174
|
onProgress: null
|
175
175
|
};
|
176
|
-
const downloadDestination = path.join(downloadDir,
|
176
|
+
const downloadDestination = path.join(downloadDir, `cypress-${process.pid}.zip`);
|
177
177
|
const rendererOptions = getRendererOptions(); // let the user know what version of cypress we're downloading!
|
178
178
|
|
179
179
|
logger.log(`Installing Cypress ${chalk.gray(`(version: ${version})`)}`);
|
package/lib/util.js
CHANGED
@@ -212,7 +212,7 @@ const dequote = str => {
|
|
212
212
|
};
|
213
213
|
|
214
214
|
const parseOpts = opts => {
|
215
|
-
opts = _.pick(opts, 'browser', 'cachePath', 'cacheList', 'cacheClear', 'cachePrune', 'ciBuildId', 'config', 'configFile', 'cypressVersion', 'destination', 'detached', 'dev', 'exit', 'env', 'force', 'global', 'group', 'headed', 'headless', 'key', 'path', 'parallel', 'port', 'project', 'quiet', 'reporter', 'reporterOptions', 'record', 'spec', 'tag');
|
215
|
+
opts = _.pick(opts, 'browser', 'cachePath', 'cacheList', 'cacheClear', 'cachePrune', 'ciBuildId', 'componentTesting', 'config', 'configFile', 'cypressVersion', 'destination', 'detached', 'dev', 'exit', 'env', 'force', 'global', 'group', 'headed', 'headless', 'key', 'path', 'parallel', 'port', 'project', 'quiet', 'reporter', 'reporterOptions', 'record', 'runProject', 'spec', 'tag');
|
216
216
|
|
217
217
|
if (opts.exit) {
|
218
218
|
opts = _.omit(opts, 'exit');
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "cypress",
|
3
|
-
"version": "6.
|
3
|
+
"version": "6.5.0",
|
4
4
|
"main": "index.js",
|
5
5
|
"scripts": {
|
6
6
|
"postinstall": "node index.js --exec install",
|
@@ -10,6 +10,7 @@
|
|
10
10
|
"@cypress/listr-verbose-renderer": "^0.4.1",
|
11
11
|
"@cypress/request": "^2.88.5",
|
12
12
|
"@cypress/xvfb": "^1.2.4",
|
13
|
+
"@types/node": "12.12.50",
|
13
14
|
"@types/sinonjs__fake-timers": "^6.0.1",
|
14
15
|
"@types/sizzle": "^2.3.2",
|
15
16
|
"arch": "^2.1.2",
|
@@ -21,7 +22,8 @@
|
|
21
22
|
"cli-table3": "~0.6.0",
|
22
23
|
"commander": "^5.1.0",
|
23
24
|
"common-tags": "^1.8.0",
|
24
|
-
"
|
25
|
+
"dayjs": "^1.9.3",
|
26
|
+
"debug": "4.3.2",
|
25
27
|
"eventemitter2": "^6.4.2",
|
26
28
|
"execa": "^4.0.2",
|
27
29
|
"executable": "^4.1.1",
|
@@ -35,7 +37,7 @@
|
|
35
37
|
"lodash": "^4.17.19",
|
36
38
|
"log-symbols": "^4.0.0",
|
37
39
|
"minimist": "^1.2.5",
|
38
|
-
"moment": "^2.
|
40
|
+
"moment": "^2.29.1",
|
39
41
|
"ospath": "^1.2.2",
|
40
42
|
"pretty-bytes": "^5.4.1",
|
41
43
|
"ramda": "~0.26.1",
|
package/types/chai/index.d.ts
CHANGED
@@ -67,7 +67,7 @@ declare namespace Chai {
|
|
67
67
|
getOwnEnumerableProperties(obj: object): Array<string | symbol>;
|
68
68
|
getMessage(errorLike: Error | string): string;
|
69
69
|
getMessage(obj: any, args: AssertionArgs): string;
|
70
|
-
inspect(obj: any, showHidden?: boolean, depth?: number, colors?: boolean):
|
70
|
+
inspect(obj: any, showHidden?: boolean, depth?: number, colors?: boolean): string;
|
71
71
|
isProxyEnabled(): boolean;
|
72
72
|
objDisplay(obj: object): void;
|
73
73
|
proxify(obj: object, nonChainableMethodName: string): object;
|
@@ -202,6 +202,7 @@ declare namespace Chai {
|
|
202
202
|
empty: Assertion;
|
203
203
|
arguments: Assertion;
|
204
204
|
Arguments: Assertion;
|
205
|
+
finite: Assertion;
|
205
206
|
equal: Equal;
|
206
207
|
equals: Equal;
|
207
208
|
eq: Equal;
|
@@ -310,7 +311,7 @@ declare namespace Chai {
|
|
310
311
|
property: Property;
|
311
312
|
}
|
312
313
|
|
313
|
-
interface Deep {
|
314
|
+
interface Deep extends KeyFilter {
|
314
315
|
equal: Equal;
|
315
316
|
equals: Equal;
|
316
317
|
eq: Equal;
|
@@ -319,7 +320,6 @@ declare namespace Chai {
|
|
319
320
|
contain: Include;
|
320
321
|
contains: Include;
|
321
322
|
property: Property;
|
322
|
-
members: Members;
|
323
323
|
ordered: Ordered;
|
324
324
|
nested: Nested;
|
325
325
|
own: Own;
|
@@ -762,6 +762,16 @@ declare namespace Chai {
|
|
762
762
|
*/
|
763
763
|
isNotNumber<T>(value: T, message?: string): void;
|
764
764
|
|
765
|
+
/**
|
766
|
+
* Asserts that value is a finite number.
|
767
|
+
* Unlike `.isNumber`, this will fail for `NaN` and `Infinity`.
|
768
|
+
*
|
769
|
+
* @type T Type of value
|
770
|
+
* @param value Actual value
|
771
|
+
* @param message Message to display on error.
|
772
|
+
*/
|
773
|
+
isFinite<T>(value: T, message?: string): void;
|
774
|
+
|
765
775
|
/**
|
766
776
|
* Asserts that value is a boolean.
|
767
777
|
*
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/**
|
2
|
+
* This file should be deleted as soon as the serever
|
3
|
+
* TODO: delete this file when ResolvedDevServerConfig.server is converted to closeServer
|
4
|
+
*/
|
5
|
+
|
6
|
+
/// <reference types="node" />
|
7
|
+
import * as cyUtilsHttp from 'http'
|
8
|
+
export = cyUtilsHttp
|
9
|
+
/**
|
10
|
+
* namespace created to bridge nodeJs.http typings so that
|
11
|
+
* we can type http Server in CT
|
12
|
+
*/
|
13
|
+
export as namespace cyUtilsHttp
|
package/types/cypress.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
/// <reference path="./cypress-npm-api.d.ts" />
|
2
|
+
/// <reference path="./cypress-eventemitter.d.ts" />
|
2
3
|
|
3
4
|
declare namespace Cypress {
|
4
5
|
type FileContents = string | any[] | object
|
@@ -281,7 +282,7 @@ declare namespace Cypress {
|
|
281
282
|
// {defaultCommandTimeout: 10000, pageLoadTimeout: 30000, ...}
|
282
283
|
```
|
283
284
|
*/
|
284
|
-
config(): ResolvedConfigOptions
|
285
|
+
config(): ResolvedConfigOptions & RuntimeConfigOptions
|
285
286
|
/**
|
286
287
|
* Returns one configuration value.
|
287
288
|
* @see https://on.cypress.io/config
|
@@ -2479,6 +2480,11 @@ declare namespace Cypress {
|
|
2479
2480
|
* @default "cypress/integration"
|
2480
2481
|
*/
|
2481
2482
|
integrationFolder: string
|
2483
|
+
/**
|
2484
|
+
* Path to folder where files downloaded during a test are saved
|
2485
|
+
* @default "cypress/downloads"
|
2486
|
+
*/
|
2487
|
+
downloadsFolder: string
|
2482
2488
|
/**
|
2483
2489
|
* 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.
|
2484
2490
|
* @default "bundled"
|
@@ -2587,6 +2593,11 @@ declare namespace Cypress {
|
|
2587
2593
|
* @default false
|
2588
2594
|
*/
|
2589
2595
|
experimentalSourceRewriting: boolean
|
2596
|
+
/**
|
2597
|
+
* Generate and save commands directly to your test suite by interacting with your app as an end user would.
|
2598
|
+
* @default false
|
2599
|
+
*/
|
2600
|
+
experimentalStudio: boolean
|
2590
2601
|
/**
|
2591
2602
|
* Number of times to retry a failed test.
|
2592
2603
|
* If a number is set, tests will retry in both runMode and openMode.
|
@@ -2604,6 +2615,110 @@ declare namespace Cypress {
|
|
2604
2615
|
includeShadowDom: boolean
|
2605
2616
|
}
|
2606
2617
|
|
2618
|
+
/**
|
2619
|
+
* Options appended to config object on runtime.
|
2620
|
+
*/
|
2621
|
+
interface RuntimeConfigOptions {
|
2622
|
+
/**
|
2623
|
+
* CPU architecture, from Node `os.arch()`
|
2624
|
+
*
|
2625
|
+
* @see https://nodejs.org/api/os.html#os_os_arch
|
2626
|
+
*/
|
2627
|
+
arch: string
|
2628
|
+
/**
|
2629
|
+
* The list of hosts to be blocked
|
2630
|
+
*/
|
2631
|
+
blockHosts: null | string | string[]
|
2632
|
+
/**
|
2633
|
+
* The browser Cypress is running on.
|
2634
|
+
*/
|
2635
|
+
browser: Browser
|
2636
|
+
/**
|
2637
|
+
* Available browsers found on your system.
|
2638
|
+
*/
|
2639
|
+
browsers: Browser[]
|
2640
|
+
/**
|
2641
|
+
* Path to folder containing component test files.
|
2642
|
+
*/
|
2643
|
+
componentFolder: string
|
2644
|
+
/**
|
2645
|
+
* Whether component testing is enabled.
|
2646
|
+
*/
|
2647
|
+
experimentalComponentTesting: boolean
|
2648
|
+
/**
|
2649
|
+
* Hosts mappings to IP addresses.
|
2650
|
+
*/
|
2651
|
+
hosts: null | string[]
|
2652
|
+
/**
|
2653
|
+
* Whether Cypress was launched via 'cypress open' (interactive mode)
|
2654
|
+
*/
|
2655
|
+
isInteractive: boolean
|
2656
|
+
/**
|
2657
|
+
* Whether Cypress will search for and replace
|
2658
|
+
* obstructive JS code in .js or .html files.
|
2659
|
+
*
|
2660
|
+
* @see https://on.cypress.io/configuration#modifyObstructiveCode
|
2661
|
+
*/
|
2662
|
+
modifyObstructiveCode: boolean
|
2663
|
+
/**
|
2664
|
+
* The platform Cypress is running on.
|
2665
|
+
*/
|
2666
|
+
platform: 'linux' | 'darwin' | 'win32'
|
2667
|
+
/**
|
2668
|
+
* A unique ID for the project used for recording
|
2669
|
+
*/
|
2670
|
+
projectId: null | string
|
2671
|
+
/**
|
2672
|
+
* Path to the support folder.
|
2673
|
+
*/
|
2674
|
+
supportFolder: string
|
2675
|
+
/**
|
2676
|
+
* Glob pattern to determine what test files to load.
|
2677
|
+
*/
|
2678
|
+
testFiles: string
|
2679
|
+
/**
|
2680
|
+
* The user agent the browser sends in all request headers.
|
2681
|
+
*/
|
2682
|
+
userAgent: null | string
|
2683
|
+
/**
|
2684
|
+
* The Cypress version being used.
|
2685
|
+
*/
|
2686
|
+
version: string
|
2687
|
+
|
2688
|
+
// Internal or Unlisted at server/lib/config_options
|
2689
|
+
autoOpen: boolean
|
2690
|
+
browserUrl: string
|
2691
|
+
clientRoute: string
|
2692
|
+
configFile: string
|
2693
|
+
cypressEnv: string
|
2694
|
+
integrationExampleName: string
|
2695
|
+
integrationExamplePath: string
|
2696
|
+
isNewProject: boolean
|
2697
|
+
isTextTerminal: boolean
|
2698
|
+
morgan: boolean
|
2699
|
+
namespace: string
|
2700
|
+
parentTestsFolder: string
|
2701
|
+
parentTestsFolderDisplay: string
|
2702
|
+
projectName: string
|
2703
|
+
projectRoot: string
|
2704
|
+
proxyUrl: string
|
2705
|
+
report: boolean
|
2706
|
+
reporterRoute: string
|
2707
|
+
reporterUrl: string
|
2708
|
+
socketId: null | string
|
2709
|
+
socketIoCookie: string
|
2710
|
+
socketIoRoute: string
|
2711
|
+
spec: {
|
2712
|
+
absolute: string
|
2713
|
+
name: string
|
2714
|
+
relative: string
|
2715
|
+
specFilter: null | string
|
2716
|
+
specType: 'integration' | 'component'
|
2717
|
+
}
|
2718
|
+
xhrRoute: string
|
2719
|
+
xhrUrl: string
|
2720
|
+
}
|
2721
|
+
|
2607
2722
|
interface TestConfigOverrides extends Partial<Pick<ConfigOptions, 'animationDistanceThreshold' | 'baseUrl' | 'defaultCommandTimeout' | 'env' | 'execTimeout' | 'includeShadowDom' | 'requestTimeout' | 'responseTimeout' | 'retries' | 'scrollBehavior' | 'taskTimeout' | 'viewportHeight' | 'viewportWidth' | 'waitForAnimations'>> {
|
2608
2723
|
browser?: IsBrowserMatcher | IsBrowserMatcher[]
|
2609
2724
|
}
|
@@ -5017,6 +5132,21 @@ declare namespace Cypress {
|
|
5017
5132
|
tag?: string
|
5018
5133
|
}
|
5019
5134
|
|
5135
|
+
interface DevServerOptions {
|
5136
|
+
specs: Spec[]
|
5137
|
+
config: {
|
5138
|
+
supportFile?: string
|
5139
|
+
projectRoot: string
|
5140
|
+
webpackDevServerPublicPathRoute: string
|
5141
|
+
},
|
5142
|
+
devServerEvents: NodeJS.EventEmitter,
|
5143
|
+
}
|
5144
|
+
|
5145
|
+
interface ResolvedDevServerConfig {
|
5146
|
+
port: number
|
5147
|
+
close: (done?: () => any) => void
|
5148
|
+
}
|
5149
|
+
|
5020
5150
|
interface PluginEvents {
|
5021
5151
|
(action: 'after:run', fn: (results: CypressCommandLine.CypressRunResult | CypressCommandLine.CypressFailedRunResult) => void | Promise<void>): void
|
5022
5152
|
(action: 'after:screenshot', fn: (details: ScreenshotDetails) => void | AfterScreenshotReturnObject | Promise<AfterScreenshotReturnObject>): void
|
@@ -5025,6 +5155,7 @@ declare namespace Cypress {
|
|
5025
5155
|
(action: 'before:spec', fn: (spec: Spec) => void | Promise<void>): void
|
5026
5156
|
(action: 'before:browser:launch', fn: (browser: Browser, browserLaunchOptions: BrowserLaunchOptions) => void | BrowserLaunchOptions | Promise<BrowserLaunchOptions>): void
|
5027
5157
|
(action: 'file:preprocessor', fn: (file: FileObject) => string | Promise<string>): void
|
5158
|
+
(action: 'dev-server:start', fn: (file: DevServerOptions) => Promise<ResolvedDevServerConfig>): void
|
5028
5159
|
(action: 'task', tasks: Tasks): void
|
5029
5160
|
}
|
5030
5161
|
|
@@ -5064,7 +5195,7 @@ declare namespace Cypress {
|
|
5064
5195
|
})
|
5065
5196
|
```
|
5066
5197
|
*/
|
5067
|
-
(action: 'uncaught:exception', fn: (error: Error, runnable: Mocha.Runnable) => false | void):
|
5198
|
+
(action: 'uncaught:exception', fn: (error: Error, runnable: Mocha.Runnable) => false | void): Cypress
|
5068
5199
|
/**
|
5069
5200
|
* Fires when your app calls the global `window.confirm()` method.
|
5070
5201
|
* Cypress will auto accept confirmations. Return `false` from this event and the confirmation will be canceled.
|
@@ -5077,7 +5208,7 @@ declare namespace Cypress {
|
|
5077
5208
|
})
|
5078
5209
|
```
|
5079
5210
|
*/
|
5080
|
-
(action: 'window:confirm', fn: ((text: string) => false | void) | SinonSpyAgent<sinon.SinonSpy> | SinonSpyAgent<sinon.SinonStub>):
|
5211
|
+
(action: 'window:confirm', fn: ((text: string) => false | void) | SinonSpyAgent<sinon.SinonSpy> | SinonSpyAgent<sinon.SinonStub>): Cypress
|
5081
5212
|
/**
|
5082
5213
|
* Fires when your app calls the global `window.alert()` method.
|
5083
5214
|
* Cypress will auto accept alerts. You cannot change this behavior.
|
@@ -5094,91 +5225,117 @@ declare namespace Cypress {
|
|
5094
5225
|
```
|
5095
5226
|
* @see https://on.cypress.io/catalog-of-events#App-Events
|
5096
5227
|
*/
|
5097
|
-
(action: 'window:alert', fn: ((text: string) => void) | SinonSpyAgent<sinon.SinonSpy> | SinonSpyAgent<sinon.SinonStub>):
|
5228
|
+
(action: 'window:alert', fn: ((text: string) => void) | SinonSpyAgent<sinon.SinonSpy> | SinonSpyAgent<sinon.SinonStub>): Cypress
|
5098
5229
|
/**
|
5099
|
-
* Fires as the page begins to load, but before any of your applications JavaScript has executed.
|
5230
|
+
* Fires as the page begins to load, but before any of your applications JavaScript has executed.
|
5231
|
+
* This fires at the exact same time as `cy.visit()` `onBeforeLoad` callback.
|
5232
|
+
* Useful to modify the window on a page transition.
|
5100
5233
|
* @see https://on.cypress.io/catalog-of-events#App-Events
|
5101
5234
|
*/
|
5102
|
-
(action: 'window:before:load', fn: (win: AUTWindow) => void):
|
5235
|
+
(action: 'window:before:load', fn: (win: AUTWindow) => void): Cypress
|
5103
5236
|
/**
|
5104
|
-
* Fires after all your resources have finished loading after a page transition.
|
5237
|
+
* Fires after all your resources have finished loading after a page transition.
|
5238
|
+
* This fires at the exact same time as a `cy.visit()` `onLoad` callback.
|
5105
5239
|
* @see https://on.cypress.io/catalog-of-events#App-Events
|
5106
5240
|
*/
|
5107
|
-
(action: 'window:load', fn: (win: AUTWindow) => void):
|
5241
|
+
(action: 'window:load', fn: (win: AUTWindow) => void): Cypress
|
5108
5242
|
/**
|
5109
|
-
* Fires when your application is about to navigate away.
|
5243
|
+
* Fires when your application is about to navigate away.
|
5244
|
+
* The real event object is provided to you.
|
5245
|
+
* Your app may have set a `returnValue` on the event, which is useful to assert on.
|
5110
5246
|
* @see https://on.cypress.io/catalog-of-events#App-Events
|
5111
5247
|
*/
|
5112
|
-
(action: 'window:before:unload', fn: (event: BeforeUnloadEvent) => void):
|
5248
|
+
(action: 'window:before:unload', fn: (event: BeforeUnloadEvent) => void): Cypress
|
5113
5249
|
/**
|
5114
|
-
* Fires when your application is has unloaded and is navigating away.
|
5250
|
+
* Fires when your application is has unloaded and is navigating away.
|
5251
|
+
* The real event object is provided to you. This event is not cancelable.
|
5115
5252
|
* @see https://on.cypress.io/catalog-of-events#App-Events
|
5116
5253
|
*/
|
5117
|
-
(action: 'window:unload', fn: (event: Event) => void):
|
5254
|
+
(action: 'window:unload', fn: (event: Event) => void): Cypress
|
5118
5255
|
/**
|
5119
5256
|
* Fires whenever Cypress detects that your application's URL has changed.
|
5120
5257
|
* @see https://on.cypress.io/catalog-of-events#App-Events
|
5121
5258
|
*/
|
5122
|
-
(action: 'url:changed', fn: (url: string) => void):
|
5259
|
+
(action: 'url:changed', fn: (url: string) => void): Cypress
|
5123
5260
|
/**
|
5124
|
-
* Fires when the test has failed. It is technically possible to prevent the test
|
5261
|
+
* Fires when the test has failed. It is technically possible to prevent the test
|
5262
|
+
* from actually failing by binding to this event and invoking an async `done` callback.
|
5263
|
+
* However this is **strongly discouraged**. Tests should never legitimately fail.
|
5264
|
+
* This event exists because it's extremely useful for debugging purposes.
|
5125
5265
|
* @see https://on.cypress.io/catalog-of-events#App-Events
|
5126
5266
|
*/
|
5127
|
-
(action: 'fail', fn: (error: Error, mocha: Mocha.Runnable) => void):
|
5267
|
+
(action: 'fail', fn: (error: Error, mocha: Mocha.Runnable) => void): Cypress
|
5128
5268
|
/**
|
5129
|
-
* Fires whenever the viewport changes via a `cy.viewport()` or naturally when
|
5269
|
+
* Fires whenever the viewport changes via a `cy.viewport()` or naturally when
|
5270
|
+
* Cypress resets the viewport to the default between tests. Useful for debugging purposes.
|
5130
5271
|
* @see https://on.cypress.io/catalog-of-events#App-Events
|
5131
5272
|
*/
|
5132
|
-
(action: 'viewport:changed', fn: (viewport: Viewport) => void):
|
5273
|
+
(action: 'viewport:changed', fn: (viewport: Viewport) => void): Cypress
|
5133
5274
|
/**
|
5134
|
-
* Fires whenever **Cypress** is scrolling your application.
|
5275
|
+
* Fires whenever **Cypress** is scrolling your application.
|
5276
|
+
* This event is fired when Cypress is {% url 'waiting for and calculating
|
5277
|
+
* actionability' interacting-with-elements %}. It will scroll to 'uncover'
|
5278
|
+
* elements currently being covered. This event is extremely useful to debug why
|
5279
|
+
* Cypress may think an element is not interactive.
|
5135
5280
|
* @see https://on.cypress.io/catalog-of-events#App-Events
|
5136
5281
|
*/
|
5137
|
-
(action: 'scrolled', fn: ($el: JQuery) => void):
|
5282
|
+
(action: 'scrolled', fn: ($el: JQuery) => void): Cypress
|
5138
5283
|
/**
|
5139
|
-
* Fires when a cy command is first invoked and enqueued to be run later.
|
5284
|
+
* Fires when a cy command is first invoked and enqueued to be run later.
|
5285
|
+
* Useful for debugging purposes if you're confused about the order in which commands will execute.
|
5140
5286
|
* @see https://on.cypress.io/catalog-of-events#App-Events
|
5141
5287
|
*/
|
5142
|
-
(action: 'command:enqueued', fn: (command: EnqueuedCommand) => void):
|
5288
|
+
(action: 'command:enqueued', fn: (command: EnqueuedCommand) => void): Cypress
|
5143
5289
|
/**
|
5144
|
-
* Fires when cy begins actually running and executing your command.
|
5290
|
+
* Fires when cy begins actually running and executing your command.
|
5291
|
+
* Useful for debugging and understanding how the command queue is async.
|
5145
5292
|
* @see https://on.cypress.io/catalog-of-events#App-Events
|
5146
5293
|
*/
|
5147
|
-
(action: 'command:start', fn: (command: CommandQueue) => void):
|
5294
|
+
(action: 'command:start', fn: (command: CommandQueue) => void): Cypress
|
5148
5295
|
/**
|
5149
|
-
* Fires when cy finishes running and executing your command.
|
5296
|
+
* Fires when cy finishes running and executing your command.
|
5297
|
+
* Useful for debugging and understanding how commands are handled.
|
5150
5298
|
* @see https://on.cypress.io/catalog-of-events#App-Events
|
5151
5299
|
*/
|
5152
|
-
(action: 'command:end', fn: (command: CommandQueue) => void):
|
5300
|
+
(action: 'command:end', fn: (command: CommandQueue) => void): Cypress
|
5153
5301
|
/**
|
5154
|
-
* Fires whenever a command begins its retrying routines.
|
5302
|
+
* Fires whenever a command begins its retrying routines.
|
5303
|
+
* This is called on the trailing edge after Cypress has internally
|
5304
|
+
* waited for the retry interval. Useful to understand **why** a command is retrying,
|
5305
|
+
* and generally includes the actual error causing the retry to happen.
|
5306
|
+
* When commands fail the final error is the one that actually bubbles up to fail the test.
|
5307
|
+
* This event is essentially to debug why Cypress is failing.
|
5155
5308
|
* @see https://on.cypress.io/catalog-of-events#App-Events
|
5156
5309
|
*/
|
5157
|
-
(action: 'command:retry', fn: (command: CommandQueue) => void):
|
5310
|
+
(action: 'command:retry', fn: (command: CommandQueue) => void): Cypress
|
5158
5311
|
/**
|
5159
|
-
* Fires whenever a command emits this event so it can be displayed in the Command Log.
|
5312
|
+
* Fires whenever a command emits this event so it can be displayed in the Command Log.
|
5313
|
+
* Useful to see how internal cypress commands utilize the {% url 'Cypress.log()' cypress-log %} API.
|
5160
5314
|
* @see https://on.cypress.io/catalog-of-events#App-Events
|
5161
5315
|
*/
|
5162
|
-
(action: 'log:added', fn: (log: any, interactive: boolean) => void):
|
5316
|
+
(action: 'log:added', fn: (log: any, interactive: boolean) => void): Cypress
|
5163
5317
|
/**
|
5164
|
-
* Fires whenever a command's attributes changes.
|
5318
|
+
* Fires whenever a command's attributes changes.
|
5319
|
+
* This event is debounced to prevent it from firing too quickly and too often.
|
5320
|
+
* Useful to see how internal cypress commands utilize the {% url 'Cypress.log()' cypress-log %} API.
|
5165
5321
|
* @see https://on.cypress.io/catalog-of-events#App-Events
|
5166
5322
|
*/
|
5167
|
-
(action: 'log:changed', fn: (log: any, interactive: boolean) => void):
|
5323
|
+
(action: 'log:changed', fn: (log: any, interactive: boolean) => void): Cypress
|
5168
5324
|
/**
|
5169
5325
|
* Fires before the test and all **before** and **beforeEach** hooks run.
|
5170
5326
|
* @see https://on.cypress.io/catalog-of-events#App-Events
|
5171
5327
|
*/
|
5172
|
-
(action: 'test:before:run', fn: (attributes: ObjectLike, test: Mocha.Test) => void):
|
5328
|
+
(action: 'test:before:run', fn: (attributes: ObjectLike, test: Mocha.Test) => void): Cypress
|
5173
5329
|
/**
|
5174
|
-
* Fires before the test and all **before** and **beforeEach** hooks run.
|
5330
|
+
* Fires before the test and all **before** and **beforeEach** hooks run.
|
5331
|
+
* If a `Promise` is returned, it will be awaited before proceeding.
|
5175
5332
|
*/
|
5176
|
-
(action: 'test:before:run:async', fn: (attributes: ObjectLike, test: Mocha.Test) => void | Promise<any>):
|
5333
|
+
(action: 'test:before:run:async', fn: (attributes: ObjectLike, test: Mocha.Test) => void | Promise<any>): Cypress
|
5177
5334
|
/**
|
5178
5335
|
* Fires after the test and all **afterEach** and **after** hooks run.
|
5179
5336
|
* @see https://on.cypress.io/catalog-of-events#App-Events
|
5180
5337
|
*/
|
5181
|
-
(action: 'test:after:run', fn: (attributes: ObjectLike, test: Mocha.Test) => void):
|
5338
|
+
(action: 'test:after:run', fn: (attributes: ObjectLike, test: Mocha.Test) => void): Cypress
|
5182
5339
|
}
|
5183
5340
|
|
5184
5341
|
// $CommandQueue from `command_queue.coffee` - a lot to type. Might be more useful if it was written in TS
|
@@ -5267,6 +5424,8 @@ declare namespace Cypress {
|
|
5267
5424
|
/** Override *name* for display purposes only */
|
5268
5425
|
displayName: string
|
5269
5426
|
message: any
|
5427
|
+
/** Set to false if you want to control the finishing of the command in the log yourself */
|
5428
|
+
autoEnd: boolean
|
5270
5429
|
/** Return an object that will be printed in the dev tools console */
|
5271
5430
|
consoleProps(): ObjectLike
|
5272
5431
|
}
|
package/types/net-stubbing.ts
CHANGED
@@ -95,9 +95,9 @@ export namespace CyHttpMessages {
|
|
95
95
|
*/
|
96
96
|
send(): void
|
97
97
|
/**
|
98
|
-
* Wait for `
|
98
|
+
* Wait for `delay` milliseconds before sending the response to the client.
|
99
99
|
*/
|
100
|
-
delay: (
|
100
|
+
delay: (delay: number) => IncomingHttpResponse
|
101
101
|
/**
|
102
102
|
* Serve the response at `throttleKbps` kilobytes per second.
|
103
103
|
*/
|
@@ -295,8 +295,9 @@ export type RouteHandler = string | StaticResponse | RouteHandlerController | ob
|
|
295
295
|
export type StaticResponse = GenericStaticResponse<string, string | object> & {
|
296
296
|
/**
|
297
297
|
* Milliseconds to delay before the response is sent.
|
298
|
+
* @deprecated Use `delay` instead of `delayMs`.
|
298
299
|
*/
|
299
|
-
|
300
|
+
delayMs?: number
|
300
301
|
}
|
301
302
|
|
302
303
|
export interface GenericStaticResponse<Fixture, Body> {
|
@@ -328,6 +329,10 @@ export interface GenericStaticResponse<Fixture, Body> {
|
|
328
329
|
* Kilobits per second to send 'body'.
|
329
330
|
*/
|
330
331
|
throttleKbps?: number
|
332
|
+
/**
|
333
|
+
* Milliseconds to delay before the response is sent.
|
334
|
+
*/
|
335
|
+
delay?: number
|
331
336
|
}
|
332
337
|
|
333
338
|
/**
|