cypress 9.5.2 → 9.6.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 +7 -3
- package/lib/errors.js +8 -1
- package/lib/exec/open.js +34 -27
- package/lib/exec/spawn.js +26 -9
- package/lib/tasks/download.js +2 -2
- package/lib/tasks/state.js +1 -1
- package/lib/tasks/unzip.js +16 -7
- package/package.json +4 -4
- package/types/cypress-eventemitter.d.ts +1 -1
- package/types/cypress-npm-api.d.ts +2 -2
- package/types/cypress.d.ts +128 -71
package/lib/cli.js
CHANGED
|
@@ -223,6 +223,10 @@ const createProgram = () => {
|
|
|
223
223
|
const addCypressRunCommand = program => {
|
|
224
224
|
return program.command('run').usage('[options]').description('Runs Cypress tests from the CLI without the GUI').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);
|
|
225
225
|
};
|
|
226
|
+
|
|
227
|
+
const addCypressOpenCommand = program => {
|
|
228
|
+
return 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);
|
|
229
|
+
};
|
|
226
230
|
/**
|
|
227
231
|
* Casts known command line options for "cypress run" to their intended type.
|
|
228
232
|
* For example if the user passes "--port 5005" the ".port" property should be
|
|
@@ -322,10 +326,10 @@ module.exports = {
|
|
|
322
326
|
program.option('-v, --version', text('version')).command('version').description(text('version')).action(() => {
|
|
323
327
|
showVersions(args);
|
|
324
328
|
});
|
|
325
|
-
program
|
|
329
|
+
addCypressOpenCommand(program).action(opts => {
|
|
326
330
|
debug('opening Cypress');
|
|
327
331
|
|
|
328
|
-
require('./exec/open').start(util.parseOpts(opts)).catch(util.logErrorExit1);
|
|
332
|
+
require('./exec/open').start(util.parseOpts(opts)).then(util.exit).catch(util.logErrorExit1);
|
|
329
333
|
});
|
|
330
334
|
addCypressRunCommand(program).action((...fnArgs) => {
|
|
331
335
|
debug('running Cypress with args %o', fnArgs);
|
|
@@ -337,7 +341,7 @@ module.exports = {
|
|
|
337
341
|
|
|
338
342
|
require('./exec/open').start({ ...util.parseOpts(opts),
|
|
339
343
|
testingType: 'component'
|
|
340
|
-
}).catch(util.logErrorExit1);
|
|
344
|
+
}).then(util.exit).catch(util.logErrorExit1);
|
|
341
345
|
});
|
|
342
346
|
program.command('run-ct').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 => {
|
|
343
347
|
debug('running Cypress run-ct');
|
package/lib/errors.js
CHANGED
|
@@ -58,6 +58,12 @@ const failedUnzip = {
|
|
|
58
58
|
description: 'The Cypress App could not be unzipped.',
|
|
59
59
|
solution: genericErrorSolution
|
|
60
60
|
};
|
|
61
|
+
const failedUnzipWindowsMaxPathLength = {
|
|
62
|
+
description: 'The Cypress App could not be unzipped.',
|
|
63
|
+
solution: `This is most likely because the maximum path length is being exceeded on your system.
|
|
64
|
+
|
|
65
|
+
Read here for solutions to this problem: https://on.cypress.io/win-max-path-length-error`
|
|
66
|
+
};
|
|
61
67
|
|
|
62
68
|
const missingApp = binaryDir => {
|
|
63
69
|
return {
|
|
@@ -79,7 +85,7 @@ const binaryNotExecutable = executable => {
|
|
|
79
85
|
|
|
80
86
|
Please check that you have the appropriate user permissions.
|
|
81
87
|
|
|
82
|
-
You can also try clearing the cache with 'cypress cache clear' and reinstalling.
|
|
88
|
+
You can also try clearing the cache with 'cypress cache clear' and reinstalling.
|
|
83
89
|
`
|
|
84
90
|
};
|
|
85
91
|
};
|
|
@@ -383,6 +389,7 @@ module.exports = {
|
|
|
383
389
|
unexpected,
|
|
384
390
|
failedDownload,
|
|
385
391
|
failedUnzip,
|
|
392
|
+
failedUnzipWindowsMaxPathLength,
|
|
386
393
|
invalidCypressEnv,
|
|
387
394
|
invalidCacheDirectory,
|
|
388
395
|
CYPRESS_RUN_BINARY,
|
package/lib/exec/open.js
CHANGED
|
@@ -12,41 +12,48 @@ const {
|
|
|
12
12
|
processTestingType
|
|
13
13
|
} = require('./shared');
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
15
|
+
const processOpenOptions = options => {
|
|
16
|
+
if (!util.isInstalledGlobally() && !options.global && !options.project) {
|
|
17
|
+
options.project = process.cwd();
|
|
18
|
+
}
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
const args = [];
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
if (options.config) {
|
|
23
|
+
args.push('--config', options.config);
|
|
24
|
+
}
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
if (options.configFile !== undefined) {
|
|
27
|
+
args.push('--config-file', options.configFile);
|
|
28
|
+
}
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
if (options.browser) {
|
|
31
|
+
args.push('--browser', options.browser);
|
|
32
|
+
}
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
if (options.env) {
|
|
35
|
+
args.push('--env', options.env);
|
|
36
|
+
}
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
if (options.port) {
|
|
39
|
+
args.push('--port', options.port);
|
|
40
|
+
}
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
if (options.project) {
|
|
43
|
+
args.push('--project', options.project);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
args.push(...processTestingType(options.testingType));
|
|
47
|
+
debug('opening from options %j', options);
|
|
48
|
+
debug('command line arguments %j', args);
|
|
49
|
+
return args;
|
|
50
|
+
};
|
|
46
51
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
module.exports = {
|
|
53
|
+
processOpenOptions,
|
|
54
|
+
|
|
55
|
+
start(options = {}) {
|
|
56
|
+
const args = processOpenOptions(options);
|
|
50
57
|
|
|
51
58
|
function open() {
|
|
52
59
|
return spawn.start(args, {
|
package/lib/exec/spawn.js
CHANGED
|
@@ -26,8 +26,18 @@ const errors = require('../errors');
|
|
|
26
26
|
|
|
27
27
|
const isXlibOrLibudevRe = /^(?:Xlib|libudev)/;
|
|
28
28
|
const isHighSierraWarningRe = /\*\*\* WARNING/;
|
|
29
|
-
const isRenderWorkerRe = /\.RenderWorker-/;
|
|
30
|
-
|
|
29
|
+
const isRenderWorkerRe = /\.RenderWorker-/; // Chromium (which Electron uses) always makes several attempts to connect to the system dbus.
|
|
30
|
+
// This works fine in most desktop environments, but in a docker container, there is no dbus service
|
|
31
|
+
// and Chromium emits several error lines, similar to these:
|
|
32
|
+
// [1957:0406/160550.146820:ERROR:bus.cc(392)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
|
|
33
|
+
// [1957:0406/160550.147994:ERROR:bus.cc(392)] Failed to connect to the bus: Address does not contain a colon
|
|
34
|
+
// These warnings are absolutely harmless. Failure to connect to dbus means that electron won't be able to access the user's
|
|
35
|
+
// credential wallet (none exists in a docker container) and won't show up in the system tray (again, none exists).
|
|
36
|
+
// Failure to connect is expected and normal here, but users frequently misidentify these errors as the cause of their problems.
|
|
37
|
+
// https://github.com/cypress-io/cypress/issues/19299
|
|
38
|
+
|
|
39
|
+
const isDbusWarning = /Failed to connect to the bus:/;
|
|
40
|
+
const GARBAGE_WARNINGS = [isXlibOrLibudevRe, isHighSierraWarningRe, isRenderWorkerRe, isDbusWarning];
|
|
31
41
|
|
|
32
42
|
const isGarbageLineWarning = str => {
|
|
33
43
|
return _.some(GARBAGE_WARNINGS, re => {
|
|
@@ -109,19 +119,23 @@ module.exports = {
|
|
|
109
119
|
const envOverrides = util.getEnvOverrides(options);
|
|
110
120
|
const electronArgs = [];
|
|
111
121
|
const node11WindowsFix = isPlatform('win32');
|
|
122
|
+
let startScriptPath;
|
|
112
123
|
|
|
113
124
|
if (options.dev) {
|
|
114
|
-
// if we're in dev then reset
|
|
125
|
+
executable = 'node'; // if we're in dev then reset
|
|
115
126
|
// the launch cmd to be 'npm run dev'
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
debug('in dev mode the args became %o', args);
|
|
127
|
+
|
|
128
|
+
startScriptPath = path.resolve(__dirname, '..', '..', '..', 'scripts', 'start.js'), debug('in dev mode the args became %o', args);
|
|
119
129
|
}
|
|
120
130
|
|
|
121
131
|
if (!options.dev && verify.needsSandbox()) {
|
|
122
132
|
electronArgs.push('--no-sandbox');
|
|
123
133
|
} // strip dev out of child process options
|
|
124
134
|
|
|
135
|
+
/**
|
|
136
|
+
* @type {import('child_process').ForkOptions}
|
|
137
|
+
*/
|
|
138
|
+
|
|
125
139
|
|
|
126
140
|
let stdioOptions = _.pick(options, 'env', 'detached', 'stdio'); // figure out if we're going to be force enabling or disabling colors.
|
|
127
141
|
// also figure out whether we should force stdout and stderr into thinking
|
|
@@ -148,8 +162,7 @@ module.exports = {
|
|
|
148
162
|
|
|
149
163
|
if (stdioOptions.env.ELECTRON_RUN_AS_NODE) {
|
|
150
164
|
// Since we are running electron as node, we need to add an entry point file.
|
|
151
|
-
|
|
152
|
-
args = [serverEntryPoint, ...args];
|
|
165
|
+
startScriptPath = path.join(state.getBinaryPkgPath(path.dirname(executable)), '..', 'index.js');
|
|
153
166
|
} else {
|
|
154
167
|
// Start arguments with "--" so Electron knows these are OUR
|
|
155
168
|
// arguments and does not try to sanitize them. Otherwise on Windows
|
|
@@ -158,8 +171,12 @@ module.exports = {
|
|
|
158
171
|
args = [...electronArgs, '--', ...args];
|
|
159
172
|
}
|
|
160
173
|
|
|
161
|
-
|
|
174
|
+
if (startScriptPath) {
|
|
175
|
+
args.unshift(startScriptPath);
|
|
176
|
+
}
|
|
177
|
+
|
|
162
178
|
debug('spawn args %o %o', args, _.omit(stdioOptions, 'env'));
|
|
179
|
+
debug('spawning Cypress with executable: %s', executable);
|
|
163
180
|
const child = cp.spawn(executable, args, stdioOptions);
|
|
164
181
|
|
|
165
182
|
function resolveOn(event) {
|
package/lib/tasks/download.js
CHANGED
|
@@ -79,8 +79,8 @@ const getCA = () => {
|
|
|
79
79
|
const prepend = urlPath => {
|
|
80
80
|
const endpoint = url.resolve(getBaseUrl(), urlPath);
|
|
81
81
|
const platform = os.platform();
|
|
82
|
-
const pathTemplate = util.getEnv('CYPRESS_DOWNLOAD_PATH_TEMPLATE');
|
|
83
|
-
return pathTemplate ? pathTemplate.replace(
|
|
82
|
+
const pathTemplate = util.getEnv('CYPRESS_DOWNLOAD_PATH_TEMPLATE', true);
|
|
83
|
+
return pathTemplate ? pathTemplate.replace(/\\?\$\{endpoint\}/, endpoint).replace(/\\?\$\{platform\}/, platform).replace(/\\?\$\{arch\}/, arch()) : `${endpoint}?platform=${platform}&arch=${arch()}`;
|
|
84
84
|
};
|
|
85
85
|
|
|
86
86
|
const getUrl = version => {
|
package/lib/tasks/state.js
CHANGED
|
@@ -81,7 +81,7 @@ const getBinaryDir = (version = util.pkgVersion()) => {
|
|
|
81
81
|
|
|
82
82
|
const getVersionDir = (version = util.pkgVersion(), buildInfo = util.pkgBuildInfo()) => {
|
|
83
83
|
if (buildInfo && !buildInfo.stable) {
|
|
84
|
-
version = ['beta', version, buildInfo.commitBranch, buildInfo.commitSha].join('-');
|
|
84
|
+
version = ['beta', version, buildInfo.commitBranch, buildInfo.commitSha.slice(0, 8)].join('-');
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
return path.join(getCacheDir(), version);
|
package/lib/tasks/unzip.js
CHANGED
|
@@ -188,7 +188,11 @@ const unzip = ({
|
|
|
188
188
|
});
|
|
189
189
|
};
|
|
190
190
|
|
|
191
|
-
|
|
191
|
+
function isMaybeWindowsMaxPathLengthError(err) {
|
|
192
|
+
return os.platform() === 'win32' && err.code === 'ENOENT' && err.syscall === 'realpath';
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const start = async ({
|
|
192
196
|
zipFilePath,
|
|
193
197
|
installDir,
|
|
194
198
|
progress
|
|
@@ -203,18 +207,23 @@ const start = ({
|
|
|
203
207
|
};
|
|
204
208
|
}
|
|
205
209
|
|
|
206
|
-
|
|
207
|
-
|
|
210
|
+
try {
|
|
211
|
+
const installDirExists = await fs.pathExists(installDir);
|
|
212
|
+
|
|
213
|
+
if (installDirExists) {
|
|
208
214
|
debug('removing existing unzipped binary', installDir);
|
|
209
|
-
|
|
215
|
+
await fs.removeAsync(installDir);
|
|
210
216
|
}
|
|
211
|
-
|
|
212
|
-
|
|
217
|
+
|
|
218
|
+
await unzip({
|
|
213
219
|
zipFilePath,
|
|
214
220
|
installDir,
|
|
215
221
|
progress
|
|
216
222
|
});
|
|
217
|
-
}
|
|
223
|
+
} catch (err) {
|
|
224
|
+
const errorTemplate = isMaybeWindowsMaxPathLengthError(err) ? errors.failedUnzipWindowsMaxPathLength : errors.failedUnzip;
|
|
225
|
+
await throwFormErrorText(errorTemplate)(err);
|
|
226
|
+
}
|
|
218
227
|
};
|
|
219
228
|
|
|
220
229
|
module.exports = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cypress",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.6.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"postinstall": "node index.js --exec install",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"listr2": "^3.8.3",
|
|
40
40
|
"lodash": "^4.17.21",
|
|
41
41
|
"log-symbols": "^4.0.0",
|
|
42
|
-
"minimist": "^1.2.
|
|
42
|
+
"minimist": "^1.2.6",
|
|
43
43
|
"ospath": "^1.2.2",
|
|
44
44
|
"pretty-bytes": "^5.6.0",
|
|
45
45
|
"proxy-from-env": "1.0.0",
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
"types": "types",
|
|
67
67
|
"buildInfo": {
|
|
68
68
|
"commitBranch": "develop",
|
|
69
|
-
"commitSha": "
|
|
70
|
-
"commitDate": "2022-
|
|
69
|
+
"commitSha": "676fc97f46f9798b5f17ee6d292924f8e1a0c82b",
|
|
70
|
+
"commitDate": "2022-04-25T12:54:32.000Z",
|
|
71
71
|
"stable": true
|
|
72
72
|
},
|
|
73
73
|
"description": "Cypress.io end to end testing tool",
|
|
@@ -36,7 +36,7 @@ declare namespace CypressCommandLine {
|
|
|
36
36
|
*/
|
|
37
37
|
interface CypressRunOptions extends CypressCommonOptions {
|
|
38
38
|
/**
|
|
39
|
-
* Specify
|
|
39
|
+
* Specify browser to run tests in, either by name or by filesystem path
|
|
40
40
|
*/
|
|
41
41
|
browser: string
|
|
42
42
|
/**
|
|
@@ -118,7 +118,7 @@ declare namespace CypressCommandLine {
|
|
|
118
118
|
*/
|
|
119
119
|
interface CypressOpenOptions extends CypressCommonOptions {
|
|
120
120
|
/**
|
|
121
|
-
* Specify
|
|
121
|
+
* Specify browser to run tests in, either by name or by filesystem path
|
|
122
122
|
*/
|
|
123
123
|
browser: string
|
|
124
124
|
/**
|
package/types/cypress.d.ts
CHANGED
|
@@ -10,10 +10,13 @@ declare namespace Cypress {
|
|
|
10
10
|
type PrevSubject = keyof PrevSubjectMap
|
|
11
11
|
type TestingType = 'e2e' | 'component'
|
|
12
12
|
type PluginConfig = (on: PluginEvents, config: PluginConfigOptions) => void | ConfigOptions | Promise<ConfigOptions>
|
|
13
|
+
interface JQueryWithSelector<TElement = HTMLElement> extends JQuery<TElement> {
|
|
14
|
+
selector?: string | null
|
|
15
|
+
}
|
|
13
16
|
|
|
14
17
|
interface PrevSubjectMap<O = unknown> {
|
|
15
18
|
optional: O
|
|
16
|
-
element:
|
|
19
|
+
element: JQueryWithSelector
|
|
17
20
|
document: Document
|
|
18
21
|
window: Window
|
|
19
22
|
}
|
|
@@ -24,9 +27,15 @@ declare namespace Cypress {
|
|
|
24
27
|
interface CommandFn<T extends keyof ChainableMethods> {
|
|
25
28
|
(this: Mocha.Context, ...args: Parameters<ChainableMethods[T]>): ReturnType<ChainableMethods[T]> | void
|
|
26
29
|
}
|
|
30
|
+
interface CommandFns {
|
|
31
|
+
[name: string]: (this: Mocha.Context, ...args: any) => any
|
|
32
|
+
}
|
|
27
33
|
interface CommandFnWithSubject<T extends keyof ChainableMethods, S> {
|
|
28
34
|
(this: Mocha.Context, prevSubject: S, ...args: Parameters<ChainableMethods[T]>): ReturnType<ChainableMethods[T]> | void
|
|
29
35
|
}
|
|
36
|
+
interface CommandFnsWithSubject<S> {
|
|
37
|
+
[name: string]: (this: Mocha.Context, prevSubject: S, ...args: any) => any
|
|
38
|
+
}
|
|
30
39
|
interface CommandOriginalFn<T extends keyof ChainableMethods> extends CallableFunction {
|
|
31
40
|
(...args: Parameters<ChainableMethods[T]>): ReturnType<ChainableMethods[T]>
|
|
32
41
|
}
|
|
@@ -47,19 +56,6 @@ declare namespace Cypress {
|
|
|
47
56
|
password: string
|
|
48
57
|
}
|
|
49
58
|
|
|
50
|
-
interface RemoteState {
|
|
51
|
-
auth?: {
|
|
52
|
-
username: string
|
|
53
|
-
password: string
|
|
54
|
-
}
|
|
55
|
-
domainName: string
|
|
56
|
-
strategy: 'file' | 'http'
|
|
57
|
-
origin: string
|
|
58
|
-
fileServer: string
|
|
59
|
-
props: Record<string, any>
|
|
60
|
-
visiting: string
|
|
61
|
-
}
|
|
62
|
-
|
|
63
59
|
interface Backend {
|
|
64
60
|
/**
|
|
65
61
|
* Firefox only: Force Cypress to run garbage collection routines.
|
|
@@ -461,12 +457,22 @@ declare namespace Cypress {
|
|
|
461
457
|
Commands: {
|
|
462
458
|
add<T extends keyof Chainable>(name: T, fn: CommandFn<T>): void
|
|
463
459
|
add<T extends keyof Chainable>(name: T, options: CommandOptions & {prevSubject: false}, fn: CommandFn<T>): void
|
|
460
|
+
add<T extends keyof Chainable, S = any>(name: T, options: CommandOptions & {prevSubject: true}, fn: CommandFnWithSubject<T, S>): void
|
|
464
461
|
add<T extends keyof Chainable, S extends PrevSubject>(
|
|
465
|
-
name: T, options: CommandOptions & { prevSubject:
|
|
462
|
+
name: T, options: CommandOptions & { prevSubject: S | ['optional'] }, fn: CommandFnWithSubject<T, PrevSubjectMap[S]>,
|
|
466
463
|
): void
|
|
467
464
|
add<T extends keyof Chainable, S extends PrevSubject>(
|
|
468
465
|
name: T, options: CommandOptions & { prevSubject: S[] }, fn: CommandFnWithSubject<T, PrevSubjectMap<void>[S]>,
|
|
469
466
|
): void
|
|
467
|
+
addAll<T extends keyof Chainable>(fns: CommandFns): void
|
|
468
|
+
addAll<T extends keyof Chainable>(options: CommandOptions & {prevSubject: false}, fns: CommandFns): void
|
|
469
|
+
addAll<T extends keyof Chainable, S = any>(options: CommandOptions & { prevSubject: true }, fns: CommandFnsWithSubject<S>): void
|
|
470
|
+
addAll<T extends keyof Chainable, S extends PrevSubject>(
|
|
471
|
+
options: CommandOptions & { prevSubject: S | ['optional'] }, fns: CommandFnsWithSubject<PrevSubjectMap[S]>,
|
|
472
|
+
): void
|
|
473
|
+
addAll<T extends keyof Chainable, S extends PrevSubject>(
|
|
474
|
+
options: CommandOptions & { prevSubject: S[] }, fns: CommandFnsWithSubject<PrevSubjectMap<void>[S]>,
|
|
475
|
+
): void
|
|
470
476
|
overwrite<T extends keyof Chainable>(name: T, fn: CommandFnWithOriginalFn<T>): void
|
|
471
477
|
overwrite<T extends keyof Chainable, S extends PrevSubject>(name: T, fn: CommandFnWithOriginalFnAndSubject<T, PrevSubjectMap[S]>): void
|
|
472
478
|
}
|
|
@@ -620,7 +626,7 @@ declare namespace Cypress {
|
|
|
620
626
|
* Trigger action
|
|
621
627
|
* @private
|
|
622
628
|
*/
|
|
623
|
-
action: (action: string, ...args: any[]) => void
|
|
629
|
+
action: (action: string, ...args: any[]) => any[] | void
|
|
624
630
|
|
|
625
631
|
/**
|
|
626
632
|
* Load files
|
|
@@ -1045,7 +1051,7 @@ declare namespace Cypress {
|
|
|
1045
1051
|
/**
|
|
1046
1052
|
* Save/Restore browser Cookies, LocalStorage, and SessionStorage data resulting from the supplied `setup` function.
|
|
1047
1053
|
*
|
|
1048
|
-
* Only available if the `
|
|
1054
|
+
* Only available if the `experimentalSessionAndOrigin` config option is enabled.
|
|
1049
1055
|
*
|
|
1050
1056
|
* @see https://on.cypress.io/session
|
|
1051
1057
|
*/
|
|
@@ -1407,6 +1413,29 @@ declare namespace Cypress {
|
|
|
1407
1413
|
*/
|
|
1408
1414
|
off: Actions
|
|
1409
1415
|
|
|
1416
|
+
/**
|
|
1417
|
+
* Enables running Cypress commands in a secondary origin.
|
|
1418
|
+
* @see https://on.cypress.io/origin
|
|
1419
|
+
* @example
|
|
1420
|
+
* cy.origin('example.com', () => {
|
|
1421
|
+
* cy.get('h1').should('equal', 'Example Domain')
|
|
1422
|
+
* })
|
|
1423
|
+
*/
|
|
1424
|
+
origin<T extends any>(urlOrDomain: string, fn: () => void): Chainable<T>
|
|
1425
|
+
|
|
1426
|
+
/**
|
|
1427
|
+
* Enables running Cypress commands in a secondary origin.
|
|
1428
|
+
* @see https://on.cypress.io/origin
|
|
1429
|
+
* @example
|
|
1430
|
+
* cy.origin('example.com', { args: { key: 'value', foo: 'foo' } }, ({ key, foo }) => {
|
|
1431
|
+
* expect(key).to.equal('value')
|
|
1432
|
+
* expect(foo).to.equal('foo')
|
|
1433
|
+
* })
|
|
1434
|
+
*/
|
|
1435
|
+
origin<T, S extends any>(urlOrDomain: string, options: {
|
|
1436
|
+
args: T
|
|
1437
|
+
}, fn: (args: T) => void): Chainable<S>
|
|
1438
|
+
|
|
1410
1439
|
/**
|
|
1411
1440
|
* Get the parent DOM element of a set of DOM elements.
|
|
1412
1441
|
*
|
|
@@ -2341,7 +2370,7 @@ declare namespace Cypress {
|
|
|
2341
2370
|
type Agent<T extends sinon.SinonSpy> = SinonSpyAgent<T> & T
|
|
2342
2371
|
|
|
2343
2372
|
interface CookieDefaults {
|
|
2344
|
-
preserve: string | string[] | RegExp | ((cookie:
|
|
2373
|
+
preserve: string | string[] | RegExp | ((cookie: Cookie) => boolean)
|
|
2345
2374
|
}
|
|
2346
2375
|
|
|
2347
2376
|
interface Failable {
|
|
@@ -2500,7 +2529,7 @@ declare namespace Cypress {
|
|
|
2500
2529
|
action: 'select' | 'drag-drop'
|
|
2501
2530
|
}
|
|
2502
2531
|
|
|
2503
|
-
interface BlurOptions extends Loggable, Forceable { }
|
|
2532
|
+
interface BlurOptions extends Loggable, Timeoutable, Forceable { }
|
|
2504
2533
|
|
|
2505
2534
|
interface CheckOptions extends Loggable, Timeoutable, ActionableOptions {
|
|
2506
2535
|
interval: number
|
|
@@ -2803,15 +2832,15 @@ declare namespace Cypress {
|
|
|
2803
2832
|
*/
|
|
2804
2833
|
scrollBehavior: scrollBehaviorOptions
|
|
2805
2834
|
/**
|
|
2806
|
-
*
|
|
2835
|
+
* Allows listening to the `before:run`, `after:run`, `before:spec`, and `after:spec` events in the plugins file during interactive mode.
|
|
2807
2836
|
* @default false
|
|
2808
2837
|
*/
|
|
2809
|
-
|
|
2838
|
+
experimentalInteractiveRunEvents: boolean
|
|
2810
2839
|
/**
|
|
2811
|
-
*
|
|
2840
|
+
* Enables cross-origin and improved session support, including the `cy.origin` and `cy.session` commands. See https://on.cypress.io/origin and https://on.cypress.io/session.
|
|
2812
2841
|
* @default false
|
|
2813
2842
|
*/
|
|
2814
|
-
|
|
2843
|
+
experimentalSessionAndOrigin: boolean
|
|
2815
2844
|
/**
|
|
2816
2845
|
* Generate and save commands directly to your test suite by interacting with your app as an end user would.
|
|
2817
2846
|
* @default false
|
|
@@ -2943,7 +2972,6 @@ declare namespace Cypress {
|
|
|
2943
2972
|
projectName: string
|
|
2944
2973
|
projectRoot: string
|
|
2945
2974
|
proxyUrl: string
|
|
2946
|
-
remote: RemoteState
|
|
2947
2975
|
report: boolean
|
|
2948
2976
|
reporterRoute: string
|
|
2949
2977
|
reporterUrl: string
|
|
@@ -3347,7 +3375,7 @@ declare namespace Cypress {
|
|
|
3347
3375
|
(chainer: 'be.a', type: string): Chainable<Subject>
|
|
3348
3376
|
/**
|
|
3349
3377
|
* Asserts that the target is a number or a date greater than the given number or date n respectively.
|
|
3350
|
-
* However, it
|
|
3378
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
|
3351
3379
|
* @example
|
|
3352
3380
|
* cy.wrap(6).should('be.above', 5)
|
|
3353
3381
|
* @see http://chaijs.com/api/bdd/#method_above
|
|
@@ -3367,7 +3395,7 @@ declare namespace Cypress {
|
|
|
3367
3395
|
(chainer: 'be.an', value: string): Chainable<Subject>
|
|
3368
3396
|
/**
|
|
3369
3397
|
* Asserts that the target is a number or a `n` date greater than or equal to the given number or date n respectively.
|
|
3370
|
-
* However, it
|
|
3398
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
|
3371
3399
|
* @example
|
|
3372
3400
|
* cy.wrap(6).should('be.at.least', 5)
|
|
3373
3401
|
* @see http://chaijs.com/api/bdd/#method_least
|
|
@@ -3376,7 +3404,7 @@ declare namespace Cypress {
|
|
|
3376
3404
|
(chainer: 'be.at.least', value: number | Date): Chainable<Subject>
|
|
3377
3405
|
/**
|
|
3378
3406
|
* Asserts that the target is a number or a `n` date less than or equal to the given number or date n respectively.
|
|
3379
|
-
* However, it
|
|
3407
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
|
3380
3408
|
* @example
|
|
3381
3409
|
* cy.wrap(4).should('be.below', 5)
|
|
3382
3410
|
* @see http://chaijs.com/api/bdd/#method_below
|
|
@@ -3392,7 +3420,7 @@ declare namespace Cypress {
|
|
|
3392
3420
|
*/
|
|
3393
3421
|
(chainer: 'be.arguments'): Chainable<Subject>
|
|
3394
3422
|
/**
|
|
3395
|
-
* Asserts that the target is a number that’s within a given +/- `delta` range of the given number `expected`. However, it
|
|
3423
|
+
* Asserts that the target is a number that’s within a given +/- `delta` range of the given number `expected`. However, it's often best to assert that the target is equal to its expected value.
|
|
3396
3424
|
* @example
|
|
3397
3425
|
* cy.wrap(5.1).should('be.approximately', 5, 0.5)
|
|
3398
3426
|
* @alias closeTo
|
|
@@ -3401,7 +3429,7 @@ declare namespace Cypress {
|
|
|
3401
3429
|
*/
|
|
3402
3430
|
(chainer: 'be.approximately', value: number, delta: number): Chainable<Subject>
|
|
3403
3431
|
/**
|
|
3404
|
-
* Asserts that the target is a number that’s within a given +/- `delta` range of the given number `expected`. However, it
|
|
3432
|
+
* Asserts that the target is a number that’s within a given +/- `delta` range of the given number `expected`. However, it's often best to assert that the target is equal to its expected value.
|
|
3405
3433
|
* @example
|
|
3406
3434
|
* cy.wrap(5.1).should('be.closeTo', 5, 0.5)
|
|
3407
3435
|
* @see http://chaijs.com/api/bdd/#method_closeto
|
|
@@ -3435,7 +3463,7 @@ declare namespace Cypress {
|
|
|
3435
3463
|
(chainer: 'be.false'): Chainable<Subject>
|
|
3436
3464
|
/**
|
|
3437
3465
|
* Asserts that the target is a number or a date greater than the given number or date n respectively.
|
|
3438
|
-
* However, it
|
|
3466
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
|
3439
3467
|
* @example
|
|
3440
3468
|
* cy.wrap(6).should('be.greaterThan', 5)
|
|
3441
3469
|
* @alias above
|
|
@@ -3445,7 +3473,7 @@ declare namespace Cypress {
|
|
|
3445
3473
|
(chainer: 'be.greaterThan', value: number): Chainable<Subject>
|
|
3446
3474
|
/**
|
|
3447
3475
|
* Asserts that the target is a number or a date greater than the given number or date n respectively.
|
|
3448
|
-
* However, it
|
|
3476
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
|
3449
3477
|
* @example
|
|
3450
3478
|
* cy.wrap(6).should('be.gt', 5)
|
|
3451
3479
|
* @alias above
|
|
@@ -3455,7 +3483,7 @@ declare namespace Cypress {
|
|
|
3455
3483
|
(chainer: 'be.gt', value: number): Chainable<Subject>
|
|
3456
3484
|
/**
|
|
3457
3485
|
* Asserts that the target is a number or a `n` date greater than or equal to the given number or date n respectively.
|
|
3458
|
-
* However, it
|
|
3486
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
|
3459
3487
|
* @example
|
|
3460
3488
|
* cy.wrap(6).should('be.gte', 5)
|
|
3461
3489
|
* @alias least
|
|
@@ -3465,7 +3493,7 @@ declare namespace Cypress {
|
|
|
3465
3493
|
(chainer: 'be.gte', value: number): Chainable<Subject>
|
|
3466
3494
|
/**
|
|
3467
3495
|
* Asserts that the target is a number or a `n` date less than or equal to the given number or date n respectively.
|
|
3468
|
-
* However, it
|
|
3496
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
|
3469
3497
|
* @example
|
|
3470
3498
|
* cy.wrap(4).should('be.lessThan', 5)
|
|
3471
3499
|
* @alias below
|
|
@@ -3475,7 +3503,7 @@ declare namespace Cypress {
|
|
|
3475
3503
|
(chainer: 'be.lessThan', value: number): Chainable<Subject>
|
|
3476
3504
|
/**
|
|
3477
3505
|
* Asserts that the target is a number or a `n` date less than or equal to the given number or date n respectively.
|
|
3478
|
-
* However, it
|
|
3506
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
|
3479
3507
|
* @example
|
|
3480
3508
|
* cy.wrap(4).should('be.lt', 5)
|
|
3481
3509
|
* @alias below
|
|
@@ -3485,7 +3513,7 @@ declare namespace Cypress {
|
|
|
3485
3513
|
(chainer: 'be.lt', value: number): Chainable<Subject>
|
|
3486
3514
|
/**
|
|
3487
3515
|
* Asserts that the target is a number or a date less than or equal to the given number or date n respectively.
|
|
3488
|
-
* However, it
|
|
3516
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
|
3489
3517
|
* @example
|
|
3490
3518
|
* cy.wrap(4).should('be.lte', 5)
|
|
3491
3519
|
* @alias most
|
|
@@ -3494,7 +3522,7 @@ declare namespace Cypress {
|
|
|
3494
3522
|
*/
|
|
3495
3523
|
(chainer: 'be.lte', value: number): Chainable<Subject>
|
|
3496
3524
|
/**
|
|
3497
|
-
* Asserts that the target is loosely (`==`) equal to `true`. However, it
|
|
3525
|
+
* Asserts that the target is loosely (`==`) equal to `true`. However, it's often best to assert that the target is strictly (`===`) or deeply equal to its expected value.
|
|
3498
3526
|
* @example
|
|
3499
3527
|
* cy.wrap(1).should('be.ok')
|
|
3500
3528
|
* @see http://chaijs.com/api/bdd/#method_ok
|
|
@@ -3535,7 +3563,7 @@ declare namespace Cypress {
|
|
|
3535
3563
|
(chainer: 'be.NaN'): Chainable<Subject>
|
|
3536
3564
|
/**
|
|
3537
3565
|
* Asserts that the target is a number or a date greater than or equal to the given number or date `start`, and less than or equal to the given number or date `finish` respectively.
|
|
3538
|
-
* However, it
|
|
3566
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
|
3539
3567
|
* @example
|
|
3540
3568
|
* cy.wrap(6).should('be.within', 5, 10)
|
|
3541
3569
|
* @see http://chaijs.com/api/bdd/#method_within
|
|
@@ -3544,8 +3572,8 @@ declare namespace Cypress {
|
|
|
3544
3572
|
(chainer: 'be.within', start: number, end: number): Chainable<Subject>
|
|
3545
3573
|
(chainer: 'be.within', start: Date, end: Date): Chainable<Subject>
|
|
3546
3574
|
/**
|
|
3547
|
-
* When one argument is provided, `.change` asserts that the given function `subject` returns a different value when it
|
|
3548
|
-
* However, it
|
|
3575
|
+
* When one argument is provided, `.change` asserts that the given function `subject` returns a different value when it's invoked before the target function compared to when it's invoked afterward.
|
|
3576
|
+
* However, it's often best to assert that `subject` is equal to its expected value.
|
|
3549
3577
|
* @example
|
|
3550
3578
|
* let dots = ''
|
|
3551
3579
|
* function addDot() { dots += '.' }
|
|
@@ -3575,8 +3603,8 @@ declare namespace Cypress {
|
|
|
3575
3603
|
*/
|
|
3576
3604
|
(chainer: 'contain', value: any): Chainable<Subject>
|
|
3577
3605
|
/**
|
|
3578
|
-
* When one argument is provided, `.decrease` asserts that the given function `subject` returns a lesser number when it
|
|
3579
|
-
* `.decrease` also causes all `.by` assertions that follow in the chain to assert how much lesser of a number is returned.
|
|
3606
|
+
* When one argument is provided, `.decrease` asserts that the given function `subject` returns a lesser number when it's invoked after invoking the target function compared to when it's invoked beforehand.
|
|
3607
|
+
* `.decrease` also causes all `.by` assertions that follow in the chain to assert how much lesser of a number is returned. it's often best to assert that the return value decreased by the expected amount, rather than asserting it decreased by any amount.
|
|
3580
3608
|
* @example
|
|
3581
3609
|
* let val = 1
|
|
3582
3610
|
* function subtractTwo() { val -= 2 }
|
|
@@ -3606,7 +3634,7 @@ declare namespace Cypress {
|
|
|
3606
3634
|
*/
|
|
3607
3635
|
(chainer: 'deep.equal', value: Subject): Chainable<Subject>
|
|
3608
3636
|
/**
|
|
3609
|
-
* Asserts that the target is not strictly (`===`) equal to either `null` or `undefined`. However, it
|
|
3637
|
+
* Asserts that the target is not strictly (`===`) equal to either `null` or `undefined`. However, it's often best to assert that the target is equal to its expected value.
|
|
3610
3638
|
* @example
|
|
3611
3639
|
* cy.wrap(1).should('exist')
|
|
3612
3640
|
* @see http://chaijs.com/api/bdd/#method_exist
|
|
@@ -3825,10 +3853,10 @@ declare namespace Cypress {
|
|
|
3825
3853
|
*/
|
|
3826
3854
|
(chainer: 'include.members' | 'include.ordered.members' | 'include.deep.ordered.members', value: any[]): Chainable<Subject>
|
|
3827
3855
|
/**
|
|
3828
|
-
* When one argument is provided, `.increase` asserts that the given function `subject` returns a greater number when it
|
|
3829
|
-
* invoked after invoking the target function compared to when it
|
|
3856
|
+
* When one argument is provided, `.increase` asserts that the given function `subject` returns a greater number when it's
|
|
3857
|
+
* invoked after invoking the target function compared to when it's invoked beforehand.
|
|
3830
3858
|
* `.increase` also causes all `.by` assertions that follow in the chain to assert how much greater of a number is returned.
|
|
3831
|
-
*
|
|
3859
|
+
* it's often best to assert that the return value increased by the expected amount, rather than asserting it increased by any amount.
|
|
3832
3860
|
*
|
|
3833
3861
|
* When two arguments are provided, `.increase` asserts that the value of the given object `subject`’s `prop` property is greater after
|
|
3834
3862
|
* invoking the target function compared to beforehand.
|
|
@@ -3875,7 +3903,7 @@ declare namespace Cypress {
|
|
|
3875
3903
|
(chainer: 'satisfy', fn: (val: any) => boolean): Chainable<Subject>
|
|
3876
3904
|
/**
|
|
3877
3905
|
* When no arguments are provided, `.throw` invokes the target function and asserts that an error is thrown.
|
|
3878
|
-
* When one argument is provided, and it
|
|
3906
|
+
* When one argument is provided, and it's a string, `.throw` invokes the target function and asserts that an error is thrown with a message that contains that string.
|
|
3879
3907
|
* @example
|
|
3880
3908
|
* function badFn() { throw new TypeError('Illegal salmon!') }
|
|
3881
3909
|
* cy.wrap(badFn).should('throw')
|
|
@@ -3887,7 +3915,7 @@ declare namespace Cypress {
|
|
|
3887
3915
|
(chainer: 'throw', value?: string | RegExp): Chainable<Subject>
|
|
3888
3916
|
/**
|
|
3889
3917
|
* When no arguments are provided, `.throw` invokes the target function and asserts that an error is thrown.
|
|
3890
|
-
* When one argument is provided, and it
|
|
3918
|
+
* When one argument is provided, and it's a string, `.throw` invokes the target function and asserts that an error is thrown with a message that contains that string.
|
|
3891
3919
|
* @example
|
|
3892
3920
|
* function badFn() { throw new TypeError('Illegal salmon!') }
|
|
3893
3921
|
* cy.wrap(badFn).should('throw')
|
|
@@ -3956,7 +3984,7 @@ declare namespace Cypress {
|
|
|
3956
3984
|
(chainer: 'not.be.a', type: string): Chainable<Subject>
|
|
3957
3985
|
/**
|
|
3958
3986
|
* Asserts that the target is a not number or not a date greater than the given number or date n respectively.
|
|
3959
|
-
* However, it
|
|
3987
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
|
3960
3988
|
* @example
|
|
3961
3989
|
* cy.wrap(6).should('not.be.above', 10)
|
|
3962
3990
|
* @see http://chaijs.com/api/bdd/#method_above
|
|
@@ -3976,7 +4004,7 @@ declare namespace Cypress {
|
|
|
3976
4004
|
(chainer: 'not.be.an', value: string): Chainable<Subject>
|
|
3977
4005
|
/**
|
|
3978
4006
|
* Asserts that the target is not a number or not a `n` date greater than or equal to the given number or date n respectively.
|
|
3979
|
-
* However, it
|
|
4007
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
|
3980
4008
|
* @example
|
|
3981
4009
|
* cy.wrap(6).should('not.be.at.least', 10)
|
|
3982
4010
|
* @see http://chaijs.com/api/bdd/#method_least
|
|
@@ -3985,7 +4013,7 @@ declare namespace Cypress {
|
|
|
3985
4013
|
(chainer: 'not.be.at.least', value: number | Date): Chainable<Subject>
|
|
3986
4014
|
/**
|
|
3987
4015
|
* Asserts that the target is not a number or not a `n` date less than or equal to the given number or date n respectively.
|
|
3988
|
-
* However, it
|
|
4016
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
|
3989
4017
|
* @example
|
|
3990
4018
|
* cy.wrap(4).should('not.be.below', 1)
|
|
3991
4019
|
* @see http://chaijs.com/api/bdd/#method_below
|
|
@@ -4001,7 +4029,7 @@ declare namespace Cypress {
|
|
|
4001
4029
|
*/
|
|
4002
4030
|
(chainer: 'not.be.arguments'): Chainable<Subject>
|
|
4003
4031
|
/**
|
|
4004
|
-
* Asserts that the target is a not number that’s within a given +/- `delta` range of the given number `expected`. However, it
|
|
4032
|
+
* Asserts that the target is a not number that’s within a given +/- `delta` range of the given number `expected`. However, it's often best to assert that the target is equal to its expected value.
|
|
4005
4033
|
* @example
|
|
4006
4034
|
* cy.wrap(5.1).should('not.be.approximately', 6, 0.5)
|
|
4007
4035
|
* @alias closeTo
|
|
@@ -4010,7 +4038,7 @@ declare namespace Cypress {
|
|
|
4010
4038
|
*/
|
|
4011
4039
|
(chainer: 'not.be.approximately', value: number, delta: number): Chainable<Subject>
|
|
4012
4040
|
/**
|
|
4013
|
-
* Asserts that the target is not a number that’s within a given +/- `delta` range of the given number `expected`. However, it
|
|
4041
|
+
* Asserts that the target is not a number that’s within a given +/- `delta` range of the given number `expected`. However, it's often best to assert that the target is equal to its expected value.
|
|
4014
4042
|
* @example
|
|
4015
4043
|
* cy.wrap(5.1).should('not.be.closeTo', 6, 0.5)
|
|
4016
4044
|
* @see http://chaijs.com/api/bdd/#method_closeto
|
|
@@ -4044,7 +4072,7 @@ declare namespace Cypress {
|
|
|
4044
4072
|
(chainer: 'not.be.false'): Chainable<Subject>
|
|
4045
4073
|
/**
|
|
4046
4074
|
* Asserts that the target is a not number or a date greater than the given number or date n respectively.
|
|
4047
|
-
* However, it
|
|
4075
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
|
4048
4076
|
* @example
|
|
4049
4077
|
* cy.wrap(6).should('be.greaterThan', 7)
|
|
4050
4078
|
* @alias above
|
|
@@ -4054,7 +4082,7 @@ declare namespace Cypress {
|
|
|
4054
4082
|
(chainer: 'not.be.greaterThan', value: number): Chainable<Subject>
|
|
4055
4083
|
/**
|
|
4056
4084
|
* Asserts that the target is a not number or a date greater than the given number or date n respectively.
|
|
4057
|
-
* However, it
|
|
4085
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
|
4058
4086
|
* @example
|
|
4059
4087
|
* cy.wrap(6).should('not.be.gt', 7)
|
|
4060
4088
|
* @alias above
|
|
@@ -4064,7 +4092,7 @@ declare namespace Cypress {
|
|
|
4064
4092
|
(chainer: 'not.be.gt', value: number): Chainable<Subject>
|
|
4065
4093
|
/**
|
|
4066
4094
|
* Asserts that the target is a not number or a `n` date greater than or equal to the given number or date n respectively.
|
|
4067
|
-
* However, it
|
|
4095
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
|
4068
4096
|
* @example
|
|
4069
4097
|
* cy.wrap(6).should('not.be.gte', 7)
|
|
4070
4098
|
* @alias least
|
|
@@ -4074,7 +4102,7 @@ declare namespace Cypress {
|
|
|
4074
4102
|
(chainer: 'not.be.gte', value: number): Chainable<Subject>
|
|
4075
4103
|
/**
|
|
4076
4104
|
* Asserts that the target is not a number or a `n` date less than or equal to the given number or date n respectively.
|
|
4077
|
-
* However, it
|
|
4105
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
|
4078
4106
|
* @example
|
|
4079
4107
|
* cy.wrap(4).should('not.be.lessThan', 3)
|
|
4080
4108
|
* @alias below
|
|
@@ -4084,7 +4112,7 @@ declare namespace Cypress {
|
|
|
4084
4112
|
(chainer: 'not.be.lessThan', value: number): Chainable<Subject>
|
|
4085
4113
|
/**
|
|
4086
4114
|
* Asserts that the target is not a number or a `n` date less than or equal to the given number or date n respectively.
|
|
4087
|
-
* However, it
|
|
4115
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
|
4088
4116
|
* @example
|
|
4089
4117
|
* cy.wrap(4).should('not.be.lt', 3)
|
|
4090
4118
|
* @alias below
|
|
@@ -4094,7 +4122,7 @@ declare namespace Cypress {
|
|
|
4094
4122
|
(chainer: 'not.be.lt', value: number): Chainable<Subject>
|
|
4095
4123
|
/**
|
|
4096
4124
|
* Asserts that the target is not a number or a date less than or equal to the given number or date n respectively.
|
|
4097
|
-
* However, it
|
|
4125
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
|
4098
4126
|
* @example
|
|
4099
4127
|
* cy.wrap(4).should('not.be.lte', 3)
|
|
4100
4128
|
* @alias most
|
|
@@ -4103,7 +4131,7 @@ declare namespace Cypress {
|
|
|
4103
4131
|
*/
|
|
4104
4132
|
(chainer: 'not.be.lte', value: number): Chainable<Subject>
|
|
4105
4133
|
/**
|
|
4106
|
-
* Asserts that the target is not loosely (`==`) equal to `true`. However, it
|
|
4134
|
+
* Asserts that the target is not loosely (`==`) equal to `true`. However, it's often best to assert that the target is strictly (`===`) or deeply equal to its expected value.
|
|
4107
4135
|
* @example
|
|
4108
4136
|
* cy.wrap(0).should('not.be.ok')
|
|
4109
4137
|
* @see http://chaijs.com/api/bdd/#method_ok
|
|
@@ -4144,7 +4172,7 @@ declare namespace Cypress {
|
|
|
4144
4172
|
(chainer: 'not.be.NaN'): Chainable<Subject>
|
|
4145
4173
|
/**
|
|
4146
4174
|
* Asserts that the target is not a number or a date greater than or equal to the given number or date `start`, and less than or equal to the given number or date `finish` respectively.
|
|
4147
|
-
* However, it
|
|
4175
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
|
4148
4176
|
* @example
|
|
4149
4177
|
* cy.wrap(3).should('not.be.within', 5, 10)
|
|
4150
4178
|
* @see http://chaijs.com/api/bdd/#method_within
|
|
@@ -4153,8 +4181,8 @@ declare namespace Cypress {
|
|
|
4153
4181
|
(chainer: 'not.be.within', start: number, end: number): Chainable<Subject>
|
|
4154
4182
|
(chainer: 'not.be.within', start: Date, end: Date): Chainable<Subject>
|
|
4155
4183
|
/**
|
|
4156
|
-
* When one argument is provided, `.change` asserts that the given function `subject` returns a different value when it
|
|
4157
|
-
* However, it
|
|
4184
|
+
* When one argument is provided, `.change` asserts that the given function `subject` returns a different value when it's invoked before the target function compared to when it's invoked afterward.
|
|
4185
|
+
* However, it's often best to assert that `subject` is equal to its expected value.
|
|
4158
4186
|
* @example
|
|
4159
4187
|
* let dots = ''
|
|
4160
4188
|
* function addDot() { dots += '.' }
|
|
@@ -4184,8 +4212,8 @@ declare namespace Cypress {
|
|
|
4184
4212
|
*/
|
|
4185
4213
|
(chainer: 'not.contain', value: any): Chainable<Subject>
|
|
4186
4214
|
/**
|
|
4187
|
-
* When one argument is provided, `.decrease` asserts that the given function `subject` does not returns a lesser number when it
|
|
4188
|
-
* `.decrease` also causes all `.by` assertions that follow in the chain to assert how much lesser of a number is returned.
|
|
4215
|
+
* When one argument is provided, `.decrease` asserts that the given function `subject` does not returns a lesser number when it's invoked after invoking the target function compared to when it's invoked beforehand.
|
|
4216
|
+
* `.decrease` also causes all `.by` assertions that follow in the chain to assert how much lesser of a number is returned. it's often best to assert that the return value decreased by the expected amount, rather than asserting it decreased by any amount.
|
|
4189
4217
|
* @example
|
|
4190
4218
|
* let val = 1
|
|
4191
4219
|
* function subtractTwo() { val -= 2 }
|
|
@@ -4214,7 +4242,7 @@ declare namespace Cypress {
|
|
|
4214
4242
|
*/
|
|
4215
4243
|
(chainer: 'not.deep.equal', value: Subject): Chainable<Subject>
|
|
4216
4244
|
/**
|
|
4217
|
-
* Asserts that the target is not strictly (`===`) equal to either `null` or `undefined`. However, it
|
|
4245
|
+
* Asserts that the target is not strictly (`===`) equal to either `null` or `undefined`. However, it's often best to assert that the target is equal to its expected value.
|
|
4218
4246
|
* @example
|
|
4219
4247
|
* cy.wrap(null).should('not.exist')
|
|
4220
4248
|
* @see http://chaijs.com/api/bdd/#method_exist
|
|
@@ -4409,10 +4437,10 @@ declare namespace Cypress {
|
|
|
4409
4437
|
*/
|
|
4410
4438
|
(chainer: 'not.include.members' | 'not.include.ordered.members' | 'not.include.deep.ordered.members', value: any[]): Chainable<Subject>
|
|
4411
4439
|
/**
|
|
4412
|
-
* When one argument is provided, `.increase` asserts that the given function `subject` returns a greater number when it
|
|
4413
|
-
* invoked after invoking the target function compared to when it
|
|
4440
|
+
* When one argument is provided, `.increase` asserts that the given function `subject` returns a greater number when it's
|
|
4441
|
+
* invoked after invoking the target function compared to when it's invoked beforehand.
|
|
4414
4442
|
* `.increase` also causes all `.by` assertions that follow in the chain to assert how much greater of a number is returned.
|
|
4415
|
-
*
|
|
4443
|
+
* it's often best to assert that the return value increased by the expected amount, rather than asserting it increased by any amount.
|
|
4416
4444
|
*
|
|
4417
4445
|
* When two arguments are provided, `.increase` asserts that the value of the given object `subject`’s `prop` property is greater after
|
|
4418
4446
|
* invoking the target function compared to beforehand.
|
|
@@ -4459,7 +4487,7 @@ declare namespace Cypress {
|
|
|
4459
4487
|
(chainer: 'not.satisfy', fn: (val: any) => boolean): Chainable<Subject>
|
|
4460
4488
|
/**
|
|
4461
4489
|
* When no arguments are provided, `.throw` invokes the target function and asserts that no error is thrown.
|
|
4462
|
-
* When one argument is provided, and it
|
|
4490
|
+
* When one argument is provided, and it's a string, `.throw` invokes the target function and asserts that no error is thrown with a message that contains that string.
|
|
4463
4491
|
* @example
|
|
4464
4492
|
* function badFn() { console.log('Illegal salmon!') }
|
|
4465
4493
|
* cy.wrap(badFn).should('not.throw')
|
|
@@ -4471,7 +4499,7 @@ declare namespace Cypress {
|
|
|
4471
4499
|
(chainer: 'not.throw', value?: string | RegExp): Chainable<Subject>
|
|
4472
4500
|
/**
|
|
4473
4501
|
* When no arguments are provided, `.throw` invokes the target function and asserts that no error is thrown.
|
|
4474
|
-
* When one argument is provided, and it
|
|
4502
|
+
* When one argument is provided, and it's a string, `.throw` invokes the target function and asserts that no error is thrown with a message that contains that string.
|
|
4475
4503
|
* @example
|
|
4476
4504
|
* function badFn() { console.log('Illegal salmon!') }
|
|
4477
4505
|
* cy.wrap(badFn).should('not.throw')
|
|
@@ -5433,6 +5461,21 @@ declare namespace Cypress {
|
|
|
5433
5461
|
(action: 'task', tasks: Tasks): void
|
|
5434
5462
|
}
|
|
5435
5463
|
|
|
5464
|
+
interface CodeFrame {
|
|
5465
|
+
frame: string
|
|
5466
|
+
language: string
|
|
5467
|
+
line: number
|
|
5468
|
+
column: number
|
|
5469
|
+
absoluteFile: string
|
|
5470
|
+
originalFile: string
|
|
5471
|
+
relativeFile: string
|
|
5472
|
+
}
|
|
5473
|
+
|
|
5474
|
+
interface CypressError extends Error {
|
|
5475
|
+
docsUrl?: string
|
|
5476
|
+
codeFrame?: CodeFrame
|
|
5477
|
+
}
|
|
5478
|
+
|
|
5436
5479
|
// for just a few events like "window:alert" it makes sense to allow passing cy.stub() or
|
|
5437
5480
|
// a user callback function. Others probably only need a callback function.
|
|
5438
5481
|
|
|
@@ -5538,7 +5581,7 @@ declare namespace Cypress {
|
|
|
5538
5581
|
* This event exists because it's extremely useful for debugging purposes.
|
|
5539
5582
|
* @see https://on.cypress.io/catalog-of-events#App-Events
|
|
5540
5583
|
*/
|
|
5541
|
-
(action: 'fail', fn: (error:
|
|
5584
|
+
(action: 'fail', fn: (error: CypressError, mocha: Mocha.Runnable) => void): Cypress
|
|
5542
5585
|
/**
|
|
5543
5586
|
* Fires whenever the viewport changes via a `cy.viewport()` or naturally when
|
|
5544
5587
|
* Cypress resets the viewport to the default between tests. Useful for debugging purposes.
|
|
@@ -5572,6 +5615,12 @@ declare namespace Cypress {
|
|
|
5572
5615
|
* @see https://on.cypress.io/catalog-of-events#App-Events
|
|
5573
5616
|
*/
|
|
5574
5617
|
(action: 'command:end', fn: (command: CommandQueue) => void): Cypress
|
|
5618
|
+
/**
|
|
5619
|
+
* Fires when a command is skipped, namely the `should` command.
|
|
5620
|
+
* Useful for debugging and understanding how commands are handled.
|
|
5621
|
+
* @see https://on.cypress.io/catalog-of-events#App-Events
|
|
5622
|
+
*/
|
|
5623
|
+
(action: 'skipped:command:end', fn: (command: CommandQueue) => void): Cypress
|
|
5575
5624
|
/**
|
|
5576
5625
|
* Fires whenever a command begins its retrying routines.
|
|
5577
5626
|
* This is called on the trailing edge after Cypress has internally
|
|
@@ -5662,10 +5711,13 @@ declare namespace Cypress {
|
|
|
5662
5711
|
}
|
|
5663
5712
|
|
|
5664
5713
|
interface EnqueuedCommand {
|
|
5714
|
+
id: string
|
|
5665
5715
|
name: string
|
|
5666
5716
|
args: any[]
|
|
5667
5717
|
type: string
|
|
5668
5718
|
chainerId: string
|
|
5719
|
+
injected: boolean
|
|
5720
|
+
userInvocationStack?: string
|
|
5669
5721
|
fn(...args: any[]): any
|
|
5670
5722
|
}
|
|
5671
5723
|
|
|
@@ -5704,6 +5756,8 @@ declare namespace Cypress {
|
|
|
5704
5756
|
}
|
|
5705
5757
|
|
|
5706
5758
|
interface LogConfig extends Timeoutable {
|
|
5759
|
+
/** Unique id for the log, in the form of '<origin>-<number>' */
|
|
5760
|
+
id: string
|
|
5707
5761
|
/** The JQuery element for the command. This will highlight the command in the main window when debugging */
|
|
5708
5762
|
$el: JQuery
|
|
5709
5763
|
/** The scope of the log entry. If child, will appear nested below parents, prefixed with '-' */
|
|
@@ -5712,9 +5766,12 @@ declare namespace Cypress {
|
|
|
5712
5766
|
name: string
|
|
5713
5767
|
/** Override *name* for display purposes only */
|
|
5714
5768
|
displayName: string
|
|
5769
|
+
/** additional information to include in the log */
|
|
5715
5770
|
message: any
|
|
5716
5771
|
/** Set to false if you want to control the finishing of the command in the log yourself */
|
|
5717
5772
|
autoEnd: boolean
|
|
5773
|
+
/** Set to true to immediately finish the log */
|
|
5774
|
+
end: boolean
|
|
5718
5775
|
/** Return an object that will be printed in the dev tools console */
|
|
5719
5776
|
consoleProps(): ObjectLike
|
|
5720
5777
|
}
|