cypress 8.4.1 → 9.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/cli.js +12 -7
- package/lib/cypress.js +18 -0
- package/lib/errors.js +9 -6
- package/lib/exec/info.js +12 -7
- package/lib/exec/spawn.js +1 -1
- package/lib/logger.js +4 -3
- package/lib/tasks/download.js +7 -19
- package/lib/tasks/install.js +13 -1
- package/lib/tasks/state.js +6 -5
- package/lib/util.js +19 -9
- package/package.json +3 -3
- package/types/cy-bluebird.d.ts +3 -2
- package/types/cypress-npm-api.d.ts +19 -0
- package/types/cypress.d.ts +105 -100
package/lib/cli.js
CHANGED
@@ -3,8 +3,6 @@
|
|
3
3
|
// @ts-check
|
4
4
|
const _ = require('lodash');
|
5
5
|
|
6
|
-
const R = require('ramda');
|
7
|
-
|
8
6
|
const commander = require('commander');
|
9
7
|
|
10
8
|
const {
|
@@ -238,11 +236,18 @@ const castCypressRunOptions = opts => {
|
|
238
236
|
// only properties that have type "string | false" in our TS definition
|
239
237
|
// require special handling, because CLI parsing takes care of purely
|
240
238
|
// boolean arguments
|
241
|
-
const
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
239
|
+
const castOpts = { ...opts
|
240
|
+
};
|
241
|
+
|
242
|
+
if (_.has(opts, 'port')) {
|
243
|
+
castOpts.port = coerceAnyStringToInt(opts.port);
|
244
|
+
}
|
245
|
+
|
246
|
+
if (_.has(opts, 'configFile')) {
|
247
|
+
castOpts.configFile = coerceFalseOrString(opts.configFile);
|
248
|
+
}
|
249
|
+
|
250
|
+
return castOpts;
|
246
251
|
};
|
247
252
|
|
248
253
|
module.exports = {
|
package/lib/cypress.js
CHANGED
@@ -70,6 +70,24 @@ const cypressModuleApi = {
|
|
70
70
|
return cli.parseRunCommand(args);
|
71
71
|
}
|
72
72
|
|
73
|
+
},
|
74
|
+
|
75
|
+
/**
|
76
|
+
* Provides automatic code completion for configuration in many popular code editors.
|
77
|
+
* While it's not strictly necessary for Cypress to parse your configuration, we
|
78
|
+
* recommend wrapping your config object with `defineConfig()`
|
79
|
+
* @example
|
80
|
+
* module.exports = defineConfig({
|
81
|
+
* viewportWith: 400
|
82
|
+
* })
|
83
|
+
*
|
84
|
+
* @see ../types/cypress-npm-api.d.ts
|
85
|
+
* @param {Cypress.ConfigOptions} config
|
86
|
+
* @returns {Cypress.ConfigOptions} the configuration passed in parameter
|
87
|
+
*/
|
88
|
+
defineConfig(config) {
|
89
|
+
return config;
|
73
90
|
}
|
91
|
+
|
74
92
|
};
|
75
93
|
module.exports = cypressModuleApi;
|
package/lib/errors.js
CHANGED
@@ -7,10 +7,6 @@ const {
|
|
7
7
|
stripIndents
|
8
8
|
} = require('common-tags');
|
9
9
|
|
10
|
-
const {
|
11
|
-
merge
|
12
|
-
} = require('ramda');
|
13
|
-
|
14
10
|
const la = require('lazy-ass');
|
15
11
|
|
16
12
|
const is = require('check-more-types');
|
@@ -45,6 +41,12 @@ const invalidRunProjectPath = {
|
|
45
41
|
${chalk.blue(runDocumentationUrl)}
|
46
42
|
`
|
47
43
|
};
|
44
|
+
const invalidOS = {
|
45
|
+
description: 'The Cypress App could not be installed. Your machine does not meet the operating system requirements.',
|
46
|
+
solution: stripIndent`
|
47
|
+
|
48
|
+
${chalk.blue('https://on.cypress.io/guides/getting-started/installing-cypress#system-requirements')}`
|
49
|
+
};
|
48
50
|
const failedDownload = {
|
49
51
|
description: 'The Cypress App could not be downloaded.',
|
50
52
|
solution: stripIndent`
|
@@ -233,9 +235,9 @@ const CYPRESS_RUN_BINARY = {
|
|
233
235
|
|
234
236
|
function addPlatformInformation(info) {
|
235
237
|
return util.getPlatformInfo().then(platform => {
|
236
|
-
return
|
238
|
+
return { ...info,
|
237
239
|
platform
|
238
|
-
}
|
240
|
+
};
|
239
241
|
});
|
240
242
|
}
|
241
243
|
/**
|
@@ -374,6 +376,7 @@ module.exports = {
|
|
374
376
|
missingApp,
|
375
377
|
notInstalledCI,
|
376
378
|
missingDependency,
|
379
|
+
invalidOS,
|
377
380
|
invalidSmokeTestDisplayError,
|
378
381
|
versionMismatch,
|
379
382
|
binaryNotExecutable,
|
package/lib/exec/info.js
CHANGED
@@ -13,9 +13,7 @@ const chalk = require('chalk');
|
|
13
13
|
|
14
14
|
const prettyBytes = require('pretty-bytes');
|
15
15
|
|
16
|
-
const _ = require('lodash');
|
17
|
-
|
18
|
-
const R = require('ramda'); // color for numbers and show values
|
16
|
+
const _ = require('lodash'); // color for numbers and show values
|
19
17
|
|
20
18
|
|
21
19
|
const g = chalk.green; // color for paths
|
@@ -30,14 +28,21 @@ methods.findProxyEnvironmentVariables = () => {
|
|
30
28
|
return _.pick(process.env, ['HTTP_PROXY', 'HTTPS_PROXY', 'NO_PROXY']);
|
31
29
|
};
|
32
30
|
|
33
|
-
const maskSensitiveVariables =
|
34
|
-
|
35
|
-
}
|
31
|
+
const maskSensitiveVariables = obj => {
|
32
|
+
const masked = { ...obj
|
33
|
+
};
|
34
|
+
|
35
|
+
if (masked.CYPRESS_RECORD_KEY) {
|
36
|
+
masked.CYPRESS_RECORD_KEY = '<redacted>';
|
37
|
+
}
|
38
|
+
|
39
|
+
return masked;
|
40
|
+
};
|
36
41
|
|
37
42
|
methods.findCypressEnvironmentVariables = () => {
|
38
43
|
const isCyVariable = (val, key) => key.startsWith('CYPRESS_');
|
39
44
|
|
40
|
-
return
|
45
|
+
return _.pickBy(process.env, isCyVariable);
|
41
46
|
};
|
42
47
|
|
43
48
|
const formatCypressVariables = () => {
|
package/lib/exec/spawn.js
CHANGED
package/lib/logger.js
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
const R = require('ramda');
|
4
|
-
|
5
3
|
const chalk = require('chalk');
|
6
4
|
|
7
5
|
let logs = [];
|
@@ -36,7 +34,10 @@ const always = (...messages) => {
|
|
36
34
|
|
37
35
|
const logLines = text => {
|
38
36
|
const lines = text.split('\n');
|
39
|
-
|
37
|
+
|
38
|
+
for (const line of lines) {
|
39
|
+
log(line);
|
40
|
+
}
|
40
41
|
};
|
41
42
|
|
42
43
|
const print = () => {
|
package/lib/tasks/download.js
CHANGED
@@ -24,6 +24,8 @@ const {
|
|
24
24
|
stripIndent
|
25
25
|
} = require('common-tags');
|
26
26
|
|
27
|
+
const getProxyForUrl = require('proxy-from-env').getProxyForUrl;
|
28
|
+
|
27
29
|
const {
|
28
30
|
throwFormErrorText,
|
29
31
|
errors
|
@@ -35,21 +37,8 @@ const util = require('../util');
|
|
35
37
|
|
36
38
|
const defaultBaseUrl = 'https://download.cypress.io/';
|
37
39
|
|
38
|
-
const
|
39
|
-
return
|
40
|
-
};
|
41
|
-
|
42
|
-
const getRealOsArch = () => {
|
43
|
-
// os.arch() returns the arch for which this node was compiled
|
44
|
-
// we want the operating system's arch instead: x64 or x86
|
45
|
-
const osArch = arch();
|
46
|
-
|
47
|
-
if (osArch === 'x86') {
|
48
|
-
// match process.platform output
|
49
|
-
return 'ia32';
|
50
|
-
}
|
51
|
-
|
52
|
-
return osArch;
|
40
|
+
const getProxyForUrlWithNpmConfig = url => {
|
41
|
+
return getProxyForUrl(url) || process.env.npm_config_https_proxy || process.env.npm_config_proxy || null;
|
53
42
|
};
|
54
43
|
|
55
44
|
const getBaseUrl = () => {
|
@@ -89,8 +78,7 @@ const getCA = () => {
|
|
89
78
|
const prepend = urlPath => {
|
90
79
|
const endpoint = url.resolve(getBaseUrl(), urlPath);
|
91
80
|
const platform = os.platform();
|
92
|
-
|
93
|
-
return `${endpoint}?platform=${platform}&arch=${arch}`;
|
81
|
+
return `${endpoint}?platform=${platform}&arch=${arch()}`;
|
94
82
|
};
|
95
83
|
|
96
84
|
const getUrl = version => {
|
@@ -198,7 +186,7 @@ const downloadFromUrl = ({
|
|
198
186
|
ca
|
199
187
|
}) => {
|
200
188
|
return new Promise((resolve, reject) => {
|
201
|
-
const proxy =
|
189
|
+
const proxy = getProxyForUrlWithNpmConfig(url);
|
202
190
|
debug('Downloading package', {
|
203
191
|
url,
|
204
192
|
proxy,
|
@@ -338,6 +326,6 @@ const start = opts => {
|
|
338
326
|
module.exports = {
|
339
327
|
start,
|
340
328
|
getUrl,
|
341
|
-
|
329
|
+
getProxyForUrlWithNpmConfig,
|
342
330
|
getCA
|
343
331
|
};
|
package/lib/tasks/install.js
CHANGED
@@ -226,6 +226,12 @@ const downloadAndUnzip = ({
|
|
226
226
|
return Promise.resolve(tasks.run());
|
227
227
|
};
|
228
228
|
|
229
|
+
const validateOS = () => {
|
230
|
+
return util.getPlatformInfo().then(platformInfo => {
|
231
|
+
return platformInfo.match(/(darwin|linux|win32)-x64/);
|
232
|
+
});
|
233
|
+
};
|
234
|
+
|
229
235
|
const start = (options = {}) => {
|
230
236
|
debug('installing with options %j', options);
|
231
237
|
|
@@ -269,7 +275,13 @@ const start = (options = {}) => {
|
|
269
275
|
const installDir = state.getVersionDir(pkgVersion);
|
270
276
|
const cacheDir = state.getCacheDir();
|
271
277
|
const binaryDir = state.getBinaryDir(pkgVersion);
|
272
|
-
return
|
278
|
+
return validateOS().then(isValid => {
|
279
|
+
if (!isValid) {
|
280
|
+
return throwFormErrorText(errors.invalidOS)();
|
281
|
+
}
|
282
|
+
}).then(() => {
|
283
|
+
return fs.ensureDirAsync(cacheDir);
|
284
|
+
}).catch({
|
273
285
|
code: 'EACCES'
|
274
286
|
}, err => {
|
275
287
|
return throwFormErrorText(errors.invalidCacheDirectory)(stripIndent`
|
package/lib/tasks/state.js
CHANGED
@@ -8,8 +8,6 @@ const path = require('path');
|
|
8
8
|
|
9
9
|
const untildify = require('untildify');
|
10
10
|
|
11
|
-
const R = require('ramda');
|
12
|
-
|
13
11
|
const debug = require('debug')('cypress:cli');
|
14
12
|
|
15
13
|
const fs = require('../fs');
|
@@ -203,9 +201,12 @@ const getBinaryPkgAsync = binaryDir => {
|
|
203
201
|
});
|
204
202
|
};
|
205
203
|
|
206
|
-
const getBinaryPkgVersion =
|
207
|
-
|
208
|
-
const
|
204
|
+
const getBinaryPkgVersion = o => _.get(o, 'version', null);
|
205
|
+
|
206
|
+
const getBinaryElectronVersion = o => _.get(o, 'electronVersion', null);
|
207
|
+
|
208
|
+
const getBinaryElectronNodeVersion = o => _.get(o, 'electronNodeVersion', null);
|
209
|
+
|
209
210
|
module.exports = {
|
210
211
|
getPathToExecutable,
|
211
212
|
getPlatformExecutable,
|
package/lib/util.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
const _ = require('lodash');
|
4
4
|
|
5
|
-
const
|
5
|
+
const arch = require('arch');
|
6
6
|
|
7
7
|
const os = require('os');
|
8
8
|
|
@@ -133,9 +133,8 @@ const logBrokenGtkDisplayWarning = () => {
|
|
133
133
|
};
|
134
134
|
|
135
135
|
function stdoutLineMatches(expectedLine, stdout) {
|
136
|
-
const lines = stdout.split('\n').map(
|
137
|
-
|
138
|
-
return lines.some(lineMatches);
|
136
|
+
const lines = stdout.split('\n').map(val => val.trim());
|
137
|
+
return lines.some(line => line === expectedLine);
|
139
138
|
}
|
140
139
|
/**
|
141
140
|
* Confirms if given value is a valid CYPRESS_INTERNAL_ENV value. Undefined values
|
@@ -220,11 +219,16 @@ const parseOpts = opts => {
|
|
220
219
|
// remove double quotes from certain options
|
221
220
|
|
222
221
|
|
223
|
-
const
|
224
|
-
group: dequote,
|
225
|
-
ciBuildId: dequote
|
222
|
+
const cleanOpts = { ...opts
|
226
223
|
};
|
227
|
-
const
|
224
|
+
const toDequote = ['group', 'ciBuildId'];
|
225
|
+
|
226
|
+
for (const prop of toDequote) {
|
227
|
+
if (_.has(opts, prop)) {
|
228
|
+
cleanOpts[prop] = dequote(opts[prop]);
|
229
|
+
}
|
230
|
+
}
|
231
|
+
|
228
232
|
debug('parsed cli options %o', cleanOpts);
|
229
233
|
return cleanOpts;
|
230
234
|
};
|
@@ -404,8 +408,14 @@ const util = {
|
|
404
408
|
|
405
409
|
getPlatformInfo() {
|
406
410
|
return util.getOsVersionAsync().then(version => {
|
411
|
+
let osArch = arch();
|
412
|
+
|
413
|
+
if (osArch === 'x86') {
|
414
|
+
osArch = 'ia32';
|
415
|
+
}
|
416
|
+
|
407
417
|
return stripIndent`
|
408
|
-
Platform: ${os.platform()} (${version})
|
418
|
+
Platform: ${os.platform()}-${osArch} (${version})
|
409
419
|
Cypress Version: ${util.pkgVersion()}
|
410
420
|
`;
|
411
421
|
});
|
package/package.json
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
{
|
2
2
|
"name": "cypress",
|
3
|
-
"version": "
|
3
|
+
"version": "9.0.0",
|
4
4
|
"main": "index.js",
|
5
5
|
"scripts": {
|
6
6
|
"postinstall": "node index.js --exec install",
|
7
7
|
"size": "t=\"$(npm pack .)\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";"
|
8
8
|
},
|
9
9
|
"dependencies": {
|
10
|
-
"@cypress/request": "^2.88.
|
10
|
+
"@cypress/request": "^2.88.7",
|
11
11
|
"@cypress/xvfb": "^1.2.4",
|
12
12
|
"@types/node": "^14.14.31",
|
13
13
|
"@types/sinonjs__fake-timers": "^6.0.2",
|
@@ -41,7 +41,7 @@
|
|
41
41
|
"minimist": "^1.2.5",
|
42
42
|
"ospath": "^1.2.2",
|
43
43
|
"pretty-bytes": "^5.6.0",
|
44
|
-
"
|
44
|
+
"proxy-from-env": "1.0.0",
|
45
45
|
"request-progress": "^3.0.0",
|
46
46
|
"supports-color": "^8.1.1",
|
47
47
|
"tmp": "~0.2.1",
|
package/types/cy-bluebird.d.ts
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
// Shim definition to export a namespace. Cypress is actually a global module
|
2
2
|
// so import/export isn't allowed there. We import here and define a global module
|
3
3
|
// so that Cypress can get and use the Blob type
|
4
|
-
import
|
4
|
+
import ImportedBluebird = require('./bluebird')
|
5
5
|
|
6
6
|
export = Bluebird
|
7
7
|
export as namespace Bluebird
|
8
8
|
|
9
9
|
declare namespace Bluebird {
|
10
|
-
type BluebirdStatic = typeof
|
10
|
+
type BluebirdStatic = typeof ImportedBluebird
|
11
|
+
interface Promise<T> extends ImportedBluebird<T> {}
|
11
12
|
}
|
@@ -91,6 +91,10 @@ declare namespace CypressCommandLine {
|
|
91
91
|
* Specify mocha reporter options
|
92
92
|
*/
|
93
93
|
reporterOptions: any
|
94
|
+
/**
|
95
|
+
* Slow test threshold in milliseconds. Only affects the visual output of some reporters. For example, the spec reporter will display the test time in yellow if over the threshold.
|
96
|
+
*/
|
97
|
+
slowTestThreshold: number
|
94
98
|
/**
|
95
99
|
* Specify the specs to run
|
96
100
|
*/
|
@@ -377,6 +381,21 @@ declare module 'cypress' {
|
|
377
381
|
* Cypress does
|
378
382
|
*/
|
379
383
|
cli: CypressCommandLine.CypressCliParser
|
384
|
+
|
385
|
+
/**
|
386
|
+
* Provides automatic code completion for configuration in many popular code editors.
|
387
|
+
* While it's not strictly necessary for Cypress to parse your configuration, we
|
388
|
+
* recommend wrapping your config object with `defineConfig()`
|
389
|
+
* @example
|
390
|
+
* module.exports = defineConfig({
|
391
|
+
* viewportWith: 400
|
392
|
+
* })
|
393
|
+
*
|
394
|
+
* @see ../types/cypress-npm-api.d.ts
|
395
|
+
* @param {Cypress.ConfigOptions} config
|
396
|
+
* @returns {Cypress.ConfigOptions} the configuration passed in parameter
|
397
|
+
*/
|
398
|
+
defineConfig(config: Cypress.ConfigOptions): Cypress.ConfigOptions
|
380
399
|
}
|
381
400
|
|
382
401
|
// export Cypress NPM module interface
|
package/types/cypress.d.ts
CHANGED
@@ -168,7 +168,12 @@ declare namespace Cypress {
|
|
168
168
|
/**
|
169
169
|
* The interface for user-defined properties in Window object under test.
|
170
170
|
*/
|
171
|
-
interface ApplicationWindow {} // tslint:disable-line
|
171
|
+
interface ApplicationWindow { } // tslint:disable-line
|
172
|
+
|
173
|
+
/**
|
174
|
+
* The configuration for Cypress.
|
175
|
+
*/
|
176
|
+
type Config = ResolvedConfigOptions & RuntimeConfigOptions
|
172
177
|
|
173
178
|
/**
|
174
179
|
* Several libraries are bundled with Cypress by default.
|
@@ -275,7 +280,7 @@ declare namespace Cypress {
|
|
275
280
|
* Currently executing test runnable instance.
|
276
281
|
*/
|
277
282
|
currentTest: {
|
278
|
-
title: string
|
283
|
+
title: string
|
279
284
|
titlePath: string[]
|
280
285
|
}
|
281
286
|
|
@@ -297,7 +302,7 @@ declare namespace Cypress {
|
|
297
302
|
/**
|
298
303
|
* Fire automation:request event for internal use.
|
299
304
|
*/
|
300
|
-
automation(eventName: string, ...args: any[]): Promise<any>
|
305
|
+
automation(eventName: string, ...args: any[]): Bluebird.Promise<any>
|
301
306
|
|
302
307
|
/**
|
303
308
|
* Promise wrapper for certain internal tasks.
|
@@ -313,7 +318,7 @@ declare namespace Cypress {
|
|
313
318
|
// {defaultCommandTimeout: 10000, pageLoadTimeout: 30000, ...}
|
314
319
|
```
|
315
320
|
*/
|
316
|
-
config():
|
321
|
+
config(): Config
|
317
322
|
/**
|
318
323
|
* Returns one configuration value.
|
319
324
|
* @see https://on.cypress.io/config
|
@@ -415,9 +420,9 @@ declare namespace Cypress {
|
|
415
420
|
* @see https://on.cypress.io/api/commands
|
416
421
|
*/
|
417
422
|
Commands: {
|
418
|
-
add(name:
|
419
|
-
add(name:
|
420
|
-
overwrite(name:
|
423
|
+
add<T extends keyof Chainable>(name: T, fn: Chainable[T]): void
|
424
|
+
add<T extends keyof Chainable>(name: T, options: CommandOptions, fn: Chainable[T]): void
|
425
|
+
overwrite<T extends keyof Chainable>(name: T, fn: Chainable[T]): void
|
421
426
|
}
|
422
427
|
|
423
428
|
/**
|
@@ -521,7 +526,7 @@ declare namespace Cypress {
|
|
521
526
|
/**
|
522
527
|
* @see https://on.cypress.io/keyboard-api
|
523
528
|
*/
|
524
|
-
|
529
|
+
Keyboard: {
|
525
530
|
defaults(options: Partial<KeyboardDefaultsOptions>): void
|
526
531
|
}
|
527
532
|
|
@@ -579,7 +584,7 @@ declare namespace Cypress {
|
|
579
584
|
}
|
580
585
|
|
581
586
|
interface SessionOptions {
|
582
|
-
validate?: () => false|void
|
587
|
+
validate?: () => false | void
|
583
588
|
}
|
584
589
|
|
585
590
|
type CanReturnChainable = void | Chainable | Promise<unknown>
|
@@ -717,36 +722,36 @@ declare namespace Cypress {
|
|
717
722
|
```
|
718
723
|
*/
|
719
724
|
clearLocalStorage(re: RegExp): Chainable<Storage>
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
725
|
+
/**
|
726
|
+
* Clear data in local storage.
|
727
|
+
* Cypress automatically runs this command before each test to prevent state from being
|
728
|
+
* shared across tests. You shouldn’t need to use this command unless you’re using it
|
729
|
+
* to clear localStorage inside a single test. Yields `localStorage` object.
|
730
|
+
*
|
731
|
+
* @see https://on.cypress.io/clearlocalstorage
|
732
|
+
* @param {options} [object] - options object
|
733
|
+
* @example
|
734
|
+
```
|
735
|
+
// Removes all local storage items, without logging
|
736
|
+
cy.clearLocalStorage({ log: false })
|
737
|
+
```
|
738
|
+
*/
|
734
739
|
clearLocalStorage(options: Partial<Loggable>): Chainable<Storage>
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
740
|
+
/**
|
741
|
+
* Clear data in local storage.
|
742
|
+
* Cypress automatically runs this command before each test to prevent state from being
|
743
|
+
* shared across tests. You shouldn’t need to use this command unless you’re using it
|
744
|
+
* to clear localStorage inside a single test. Yields `localStorage` object.
|
745
|
+
*
|
746
|
+
* @see https://on.cypress.io/clearlocalstorage
|
747
|
+
* @param {string} [key] - name of a particular item to remove (optional).
|
748
|
+
* @param {options} [object] - options object
|
749
|
+
* @example
|
750
|
+
```
|
751
|
+
// Removes item "todos" without logging
|
752
|
+
cy.clearLocalStorage("todos", { log: false })
|
753
|
+
```
|
754
|
+
*/
|
750
755
|
clearLocalStorage(key: string, options: Partial<Loggable>): Chainable<Storage>
|
751
756
|
|
752
757
|
/**
|
@@ -834,7 +839,7 @@ declare namespace Cypress {
|
|
834
839
|
* // or use this shortcut
|
835
840
|
* cy.clock().invoke('restore')
|
836
841
|
*/
|
837
|
-
clock(now: number|Date, options?: Loggable): Chainable<Clock>
|
842
|
+
clock(now: number | Date, options?: Loggable): Chainable<Clock>
|
838
843
|
/**
|
839
844
|
* Mocks global clock but only overrides specific functions.
|
840
845
|
*
|
@@ -843,7 +848,7 @@ declare namespace Cypress {
|
|
843
848
|
* // keep current date but override "setTimeout" and "clearTimeout"
|
844
849
|
* cy.clock(null, ['setTimeout', 'clearTimeout'])
|
845
850
|
*/
|
846
|
-
clock(now: number|Date, functions?: Array<'setTimeout' | 'clearTimeout' | 'setInterval' | 'clearInterval' | 'Date'>, options?: Loggable): Chainable<Clock>
|
851
|
+
clock(now: number | Date, functions?: Array<'setTimeout' | 'clearTimeout' | 'setInterval' | 'clearInterval' | 'Date'>, options?: Loggable): Chainable<Clock>
|
847
852
|
/**
|
848
853
|
* Mocks global clock and all functions.
|
849
854
|
*
|
@@ -977,14 +982,14 @@ declare namespace Cypress {
|
|
977
982
|
*/
|
978
983
|
debug(options?: Partial<Loggable>): Chainable<Subject>
|
979
984
|
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
session(id: string|object, setup?: SessionOptions['validate'], options?: SessionOptions): Chainable<null>
|
985
|
+
/**
|
986
|
+
* Save/Restore browser Cookies, LocalStorage, and SessionStorage data resulting from the supplied `setup` function.
|
987
|
+
*
|
988
|
+
* Only available if the `experimentalSessionSupport` config option is enabled.
|
989
|
+
*
|
990
|
+
* @see https://on.cypress.io/session
|
991
|
+
*/
|
992
|
+
session(id: string | object, setup?: SessionOptions['validate'], options?: SessionOptions): Chainable<null>
|
988
993
|
|
989
994
|
/**
|
990
995
|
* Get the window.document of the page that is currently active.
|
@@ -1648,17 +1653,11 @@ declare namespace Cypress {
|
|
1648
1653
|
scrollTo(x: number | string, y: number | string, options?: Partial<ScrollToOptions>): Chainable<Subject>
|
1649
1654
|
|
1650
1655
|
/**
|
1651
|
-
* Select an `<option>` with specific text within a `<select>`.
|
1652
|
-
*
|
1653
|
-
* @see https://on.cypress.io/select
|
1654
|
-
*/
|
1655
|
-
select(text: string | string[], options?: Partial<SelectOptions>): Chainable<Subject>
|
1656
|
-
/**
|
1657
|
-
* Select an `<option>` with specific value(s) within a `<select>`.
|
1656
|
+
* Select an `<option>` with specific text, value, or index within a `<select>`.
|
1658
1657
|
*
|
1659
1658
|
* @see https://on.cypress.io/select
|
1660
1659
|
*/
|
1661
|
-
select(
|
1660
|
+
select(valueOrTextOrIndex: string | number | Array<string | number>, options?: Partial<SelectOptions>): Chainable<Subject>
|
1662
1661
|
|
1663
1662
|
/**
|
1664
1663
|
* @deprecated Use `cy.intercept()` instead.
|
@@ -1909,13 +1908,13 @@ declare namespace Cypress {
|
|
1909
1908
|
*
|
1910
1909
|
* @see https://on.cypress.io/then
|
1911
1910
|
*/
|
1912
|
-
|
1913
|
-
|
1914
|
-
|
1915
|
-
|
1916
|
-
|
1917
|
-
|
1918
|
-
|
1911
|
+
then<S extends HTMLElement>(options: Partial<Timeoutable>, fn: (this: ObjectLike, currentSubject: Subject) => S): Chainable<JQuery<S>>
|
1912
|
+
/**
|
1913
|
+
* Enables you to work with the subject yielded from the previous command / promise.
|
1914
|
+
*
|
1915
|
+
* @see https://on.cypress.io/then
|
1916
|
+
*/
|
1917
|
+
then<S extends ArrayLike<HTMLElement>>(options: Partial<Timeoutable>, fn: (this: ObjectLike, currentSubject: Subject) => S): Chainable<JQuery<S extends ArrayLike<infer T> ? T : never>>
|
1919
1918
|
/**
|
1920
1919
|
* Enables you to work with the subject yielded from the previous command / promise.
|
1921
1920
|
*
|
@@ -2578,6 +2577,11 @@ declare namespace Cypress {
|
|
2578
2577
|
* @default "spec"
|
2579
2578
|
*/
|
2580
2579
|
reporterOptions: { [key: string]: any }
|
2580
|
+
/**
|
2581
|
+
* Slow test threshold in milliseconds. Only affects the visual output of some reporters. For example, the spec reporter will display the test time in yellow if over the threshold.
|
2582
|
+
* @default 10000
|
2583
|
+
*/
|
2584
|
+
slowTestThreshold: number
|
2581
2585
|
/**
|
2582
2586
|
* Whether Cypress will watch and restart tests on test file changes
|
2583
2587
|
* @default true
|
@@ -2754,7 +2758,7 @@ declare namespace Cypress {
|
|
2754
2758
|
* To enable test retries only in runMode, set e.g. `{ openMode: null, runMode: 2 }`
|
2755
2759
|
* @default null
|
2756
2760
|
*/
|
2757
|
-
retries: Nullable<number | {runMode?: Nullable<number>, openMode?: Nullable<number>}>
|
2761
|
+
retries: Nullable<number | { runMode?: Nullable<number>, openMode?: Nullable<number> }>
|
2758
2762
|
/**
|
2759
2763
|
* Enables including elements within the shadow DOM when using querying
|
2760
2764
|
* commands (e.g. cy.get(), cy.find()). Can be set globally in cypress.json,
|
@@ -2891,7 +2895,7 @@ declare namespace Cypress {
|
|
2891
2895
|
* All configuration items are optional.
|
2892
2896
|
*/
|
2893
2897
|
type CoreConfigOptions = Partial<Omit<ResolvedConfigOptions, TestingType>>
|
2894
|
-
type ConfigOptions = CoreConfigOptions & {e2e?: CoreConfigOptions, component?: CoreConfigOptions }
|
2898
|
+
type ConfigOptions = CoreConfigOptions & { e2e?: CoreConfigOptions, component?: CoreConfigOptions }
|
2895
2899
|
|
2896
2900
|
interface PluginConfigOptions extends ResolvedConfigOptions {
|
2897
2901
|
/**
|
@@ -2998,6 +3002,7 @@ declare namespace Cypress {
|
|
2998
3002
|
disableTimersAndAnimations: boolean
|
2999
3003
|
padding: Padding
|
3000
3004
|
scale: boolean
|
3005
|
+
overwrite: boolean
|
3001
3006
|
onBeforeScreenshot: ($el: JQuery) => void
|
3002
3007
|
onAfterScreenshot: ($el: JQuery, props: {
|
3003
3008
|
path: string
|
@@ -5672,7 +5677,7 @@ declare namespace Cypress {
|
|
5672
5677
|
xhr: XMLHttpRequest
|
5673
5678
|
}
|
5674
5679
|
|
5675
|
-
type Encodings = 'ascii' | 'base64' | 'binary' | 'hex' | 'latin1' | 'utf8' | 'utf-8' | 'ucs2' | 'ucs-2' | 'utf16le' | 'utf-16le'
|
5680
|
+
type Encodings = 'ascii' | 'base64' | 'binary' | 'hex' | 'latin1' | 'utf8' | 'utf-8' | 'ucs2' | 'ucs-2' | 'utf16le' | 'utf-16le' | null
|
5676
5681
|
type PositionType = 'topLeft' | 'top' | 'topRight' | 'left' | 'center' | 'right' | 'bottomLeft' | 'bottom' | 'bottomRight'
|
5677
5682
|
type ViewportPreset = 'macbook-16' | 'macbook-15' | 'macbook-13' | 'macbook-11' | 'ipad-2' | 'ipad-mini' | 'iphone-xr' | 'iphone-x' | 'iphone-6+' | 'iphone-se2' | 'iphone-8' | 'iphone-7' | 'iphone-6' | 'iphone-5' | 'iphone-4' | 'iphone-3' | 'samsung-s10' | 'samsung-note9'
|
5678
5683
|
interface Offset {
|
@@ -5703,48 +5708,48 @@ declare namespace Cypress {
|
|
5703
5708
|
}
|
5704
5709
|
```
|
5705
5710
|
*/
|
5706
|
-
interface cy extends Chainable<undefined> {}
|
5711
|
+
interface cy extends Chainable<undefined> { }
|
5707
5712
|
}
|
5708
5713
|
|
5709
5714
|
declare namespace Mocha {
|
5710
5715
|
interface TestFunction {
|
5711
|
-
|
5712
|
-
|
5713
|
-
|
5714
|
-
|
5715
|
-
|
5716
|
-
|
5717
|
-
|
5718
|
-
|
5719
|
-
|
5720
|
-
|
5721
|
-
|
5716
|
+
/**
|
5717
|
+
* Describe a specification or test-case with the given `title`, TestOptions, and callback `fn` acting
|
5718
|
+
* as a thunk.
|
5719
|
+
*/
|
5720
|
+
(title: string, config: Cypress.TestConfigOverrides, fn?: Func): Test
|
5721
|
+
|
5722
|
+
/**
|
5723
|
+
* Describe a specification or test-case with the given `title`, TestOptions, and callback `fn` acting
|
5724
|
+
* as a thunk.
|
5725
|
+
*/
|
5726
|
+
(title: string, config: Cypress.TestConfigOverrides, fn?: AsyncFunc): Test
|
5722
5727
|
}
|
5723
5728
|
interface ExclusiveTestFunction {
|
5724
|
-
|
5725
|
-
|
5726
|
-
|
5727
|
-
|
5728
|
-
|
5729
|
-
|
5730
|
-
|
5731
|
-
|
5732
|
-
|
5733
|
-
|
5734
|
-
|
5729
|
+
/**
|
5730
|
+
* Describe a specification or test-case with the given `title`, TestOptions, and callback `fn` acting
|
5731
|
+
* as a thunk.
|
5732
|
+
*/
|
5733
|
+
(title: string, config: Cypress.TestConfigOverrides, fn?: Func): Test
|
5734
|
+
|
5735
|
+
/**
|
5736
|
+
* Describe a specification or test-case with the given `title`, TestOptions, and callback `fn` acting
|
5737
|
+
* as a thunk.
|
5738
|
+
*/
|
5739
|
+
(title: string, config: Cypress.TestConfigOverrides, fn?: AsyncFunc): Test
|
5735
5740
|
}
|
5736
5741
|
interface PendingTestFunction {
|
5737
|
-
|
5738
|
-
|
5739
|
-
|
5740
|
-
|
5741
|
-
|
5742
|
-
|
5743
|
-
|
5744
|
-
|
5745
|
-
|
5746
|
-
|
5747
|
-
|
5742
|
+
/**
|
5743
|
+
* Describe a specification or test-case with the given `title`, TestOptions, and callback `fn` acting
|
5744
|
+
* as a thunk.
|
5745
|
+
*/
|
5746
|
+
(title: string, config: Cypress.TestConfigOverrides, fn?: Func): Test
|
5747
|
+
|
5748
|
+
/**
|
5749
|
+
* Describe a specification or test-case with the given `title`, TestOptions, and callback `fn` acting
|
5750
|
+
* as a thunk.
|
5751
|
+
*/
|
5752
|
+
(title: string, config: Cypress.TestConfigOverrides, fn?: AsyncFunc): Test
|
5748
5753
|
}
|
5749
5754
|
|
5750
5755
|
interface SuiteFunction {
|