cypress 9.5.0 → 9.5.3
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 +1 -1
- package/lib/exec/info.js +54 -42
- package/lib/exec/open.js +34 -27
- package/lib/exec/spawn.js +14 -7
- package/lib/exec/versions.js +4 -1
- package/lib/tasks/download.js +2 -2
- package/lib/tasks/install.js +148 -208
- package/lib/tasks/state.js +5 -1
- package/lib/util.js +4 -0
- package/package.json +9 -3
- package/types/cypress-eventemitter.d.ts +1 -1
- package/types/cypress-npm-api.d.ts +2 -2
- package/types/cypress.d.ts +46 -46
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
@@ -79,7 +79,7 @@ const binaryNotExecutable = executable => {
|
|
79
79
|
|
80
80
|
Please check that you have the appropriate user permissions.
|
81
81
|
|
82
|
-
You can also try clearing the cache with 'cypress cache clear' and reinstalling.
|
82
|
+
You can also try clearing the cache with 'cypress cache clear' and reinstalling.
|
83
83
|
`
|
84
84
|
};
|
85
85
|
};
|
package/lib/exec/info.js
CHANGED
@@ -18,7 +18,8 @@ const _ = require('lodash'); // color for numbers and show values
|
|
18
18
|
|
19
19
|
const g = chalk.green; // color for paths
|
20
20
|
|
21
|
-
const p = chalk.cyan;
|
21
|
+
const p = chalk.cyan;
|
22
|
+
const red = chalk.red; // urls
|
22
23
|
|
23
24
|
const link = chalk.blue.underline; // to be exported
|
24
25
|
|
@@ -50,52 +51,63 @@ const formatCypressVariables = () => {
|
|
50
51
|
return maskSensitiveVariables(vars);
|
51
52
|
};
|
52
53
|
|
53
|
-
methods.start = (options = {}) => {
|
54
|
+
methods.start = async (options = {}) => {
|
54
55
|
const args = ['--mode=info'];
|
55
|
-
|
56
|
+
await spawn.start(args, {
|
56
57
|
dev: options.dev
|
57
|
-
})
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
console.log();
|
71
|
-
console.log('Learn More: %s', link('https://on.cypress.io/proxy-configuration'));
|
72
|
-
console.log();
|
73
|
-
}
|
74
|
-
}).then(() => {
|
75
|
-
const cyVars = formatCypressVariables();
|
76
|
-
|
77
|
-
if (_.isEmpty(cyVars)) {
|
78
|
-
console.log('Environment Variables: none detected');
|
79
|
-
} else {
|
80
|
-
console.log('Environment Variables:');
|
81
|
-
|
82
|
-
_.forEach(cyVars, (value, key) => {
|
83
|
-
console.log('%s: %s', key, g(value));
|
84
|
-
});
|
85
|
-
}
|
86
|
-
}).then(() => {
|
58
|
+
});
|
59
|
+
console.log();
|
60
|
+
const proxyVars = methods.findProxyEnvironmentVariables();
|
61
|
+
|
62
|
+
if (_.isEmpty(proxyVars)) {
|
63
|
+
console.log('Proxy Settings: none detected');
|
64
|
+
} else {
|
65
|
+
console.log('Proxy Settings:');
|
66
|
+
|
67
|
+
_.forEach(proxyVars, (value, key) => {
|
68
|
+
console.log('%s: %s', key, g(value));
|
69
|
+
});
|
70
|
+
|
87
71
|
console.log();
|
88
|
-
console.log('
|
89
|
-
console.log('Browser Profiles:', p(util.getApplicationDataFolder('browsers')));
|
90
|
-
console.log('Binary Caches: %s', p(state.getCacheDir()));
|
91
|
-
}).then(() => {
|
72
|
+
console.log('Learn More: %s', link('https://on.cypress.io/proxy-configuration'));
|
92
73
|
console.log();
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
74
|
+
}
|
75
|
+
|
76
|
+
const cyVars = formatCypressVariables();
|
77
|
+
|
78
|
+
if (_.isEmpty(cyVars)) {
|
79
|
+
console.log('Environment Variables: none detected');
|
80
|
+
} else {
|
81
|
+
console.log('Environment Variables:');
|
82
|
+
|
83
|
+
_.forEach(cyVars, (value, key) => {
|
84
|
+
console.log('%s: %s', key, g(value));
|
97
85
|
});
|
98
|
-
}
|
86
|
+
}
|
87
|
+
|
88
|
+
console.log();
|
89
|
+
console.log('Application Data:', p(util.getApplicationDataFolder()));
|
90
|
+
console.log('Browser Profiles:', p(util.getApplicationDataFolder('browsers')));
|
91
|
+
console.log('Binary Caches: %s', p(state.getCacheDir()));
|
92
|
+
console.log();
|
93
|
+
const osVersion = await util.getOsVersionAsync();
|
94
|
+
const buildInfo = util.pkgBuildInfo();
|
95
|
+
const isStable = buildInfo && buildInfo.stable;
|
96
|
+
console.log('Cypress Version: %s', g(util.pkgVersion()), isStable ? g('(stable)') : red('(pre-release)'));
|
97
|
+
console.log('System Platform: %s (%s)', g(os.platform()), g(osVersion));
|
98
|
+
console.log('System Memory: %s free %s', g(prettyBytes(os.totalmem())), g(prettyBytes(os.freemem())));
|
99
|
+
|
100
|
+
if (!buildInfo) {
|
101
|
+
console.log();
|
102
|
+
console.log('This is the', red('development'), '(un-built) Cypress CLI.');
|
103
|
+
} else if (!isStable) {
|
104
|
+
console.log();
|
105
|
+
console.log('This is a', red('pre-release'), 'build of Cypress.');
|
106
|
+
console.log('Build info:');
|
107
|
+
console.log(' Commit SHA:', g(buildInfo.commitSha));
|
108
|
+
console.log(' Commit Branch:', g(buildInfo.commitBranch));
|
109
|
+
console.log(' Commit Date:', g(buildInfo.commitDate));
|
110
|
+
}
|
99
111
|
};
|
100
112
|
|
101
113
|
module.exports = methods;
|
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
@@ -109,19 +109,23 @@ module.exports = {
|
|
109
109
|
const envOverrides = util.getEnvOverrides(options);
|
110
110
|
const electronArgs = [];
|
111
111
|
const node11WindowsFix = isPlatform('win32');
|
112
|
+
let startScriptPath;
|
112
113
|
|
113
114
|
if (options.dev) {
|
114
|
-
// if we're in dev then reset
|
115
|
+
executable = 'node'; // if we're in dev then reset
|
115
116
|
// the launch cmd to be 'npm run dev'
|
116
|
-
|
117
|
-
|
118
|
-
debug('in dev mode the args became %o', args);
|
117
|
+
|
118
|
+
startScriptPath = path.resolve(__dirname, '..', '..', '..', 'scripts', 'start.js'), debug('in dev mode the args became %o', args);
|
119
119
|
}
|
120
120
|
|
121
121
|
if (!options.dev && verify.needsSandbox()) {
|
122
122
|
electronArgs.push('--no-sandbox');
|
123
123
|
} // strip dev out of child process options
|
124
124
|
|
125
|
+
/**
|
126
|
+
* @type {import('child_process').ForkOptions}
|
127
|
+
*/
|
128
|
+
|
125
129
|
|
126
130
|
let stdioOptions = _.pick(options, 'env', 'detached', 'stdio'); // figure out if we're going to be force enabling or disabling colors.
|
127
131
|
// also figure out whether we should force stdout and stderr into thinking
|
@@ -148,8 +152,7 @@ module.exports = {
|
|
148
152
|
|
149
153
|
if (stdioOptions.env.ELECTRON_RUN_AS_NODE) {
|
150
154
|
// Since we are running electron as node, we need to add an entry point file.
|
151
|
-
|
152
|
-
args = [serverEntryPoint, ...args];
|
155
|
+
startScriptPath = path.join(state.getBinaryPkgPath(path.dirname(executable)), '..', 'index.js');
|
153
156
|
} else {
|
154
157
|
// Start arguments with "--" so Electron knows these are OUR
|
155
158
|
// arguments and does not try to sanitize them. Otherwise on Windows
|
@@ -158,8 +161,12 @@ module.exports = {
|
|
158
161
|
args = [...electronArgs, '--', ...args];
|
159
162
|
}
|
160
163
|
|
161
|
-
|
164
|
+
if (startScriptPath) {
|
165
|
+
args.unshift(startScriptPath);
|
166
|
+
}
|
167
|
+
|
162
168
|
debug('spawn args %o %o', args, _.omit(stdioOptions, 'env'));
|
169
|
+
debug('spawning Cypress with executable: %s', executable);
|
163
170
|
const child = cp.spawn(executable, args, stdioOptions);
|
164
171
|
|
165
172
|
function resolveOn(event) {
|
package/lib/exec/versions.js
CHANGED
@@ -43,8 +43,11 @@ const getVersions = () => {
|
|
43
43
|
debug('binary versions %o', versions);
|
44
44
|
return versions;
|
45
45
|
}).then(binaryVersions => {
|
46
|
+
const buildInfo = util.pkgBuildInfo();
|
47
|
+
let packageVersion = util.pkgVersion();
|
48
|
+
if (!buildInfo) packageVersion += ' (development)';else if (!buildInfo.stable) packageVersion += ' (pre-release)';
|
46
49
|
const versions = {
|
47
|
-
package:
|
50
|
+
package: packageVersion,
|
48
51
|
binary: binaryVersions.binary || 'not installed',
|
49
52
|
electronVersion: binaryVersions.electronVersion || 'not found',
|
50
53
|
electronNodeVersion: binaryVersions.electronNodeVersion || 'not found'
|
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/install.js
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
const _ = require('lodash');
|
4
4
|
|
5
|
-
const
|
5
|
+
const arch = require('arch');
|
6
6
|
|
7
|
-
const
|
7
|
+
const os = require('os');
|
8
8
|
|
9
9
|
const path = require('path');
|
10
10
|
|
@@ -43,95 +43,17 @@ const {
|
|
43
43
|
|
44
44
|
const verbose = require('../VerboseRenderer');
|
45
45
|
|
46
|
-
const
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
return;
|
51
|
-
}
|
52
|
-
|
53
|
-
debug('found npm argv json %o', json);
|
54
|
-
|
55
|
-
try {
|
56
|
-
return JSON.parse(json).original || [];
|
57
|
-
} catch (e) {
|
58
|
-
return [];
|
59
|
-
}
|
60
|
-
}; // attempt to discover the version specifier used to install Cypress
|
61
|
-
// for example: "^5.0.0", "https://cdn.cypress.io/...", ...
|
62
|
-
|
63
|
-
|
64
|
-
const getVersionSpecifier = (startDir = path.resolve(__dirname, '../..')) => {
|
65
|
-
const argv = getNpmArgv();
|
66
|
-
|
67
|
-
if ((process.env.npm_package_resolved || '').endsWith('cypress.tgz')) {
|
68
|
-
return process.env.npm_package_resolved;
|
69
|
-
}
|
70
|
-
|
71
|
-
if (argv) {
|
72
|
-
const tgz = _.find(argv, t => t.endsWith('cypress.tgz'));
|
73
|
-
|
74
|
-
if (tgz) {
|
75
|
-
return tgz;
|
76
|
-
}
|
77
|
-
}
|
78
|
-
|
79
|
-
const getVersionSpecifierFromPkg = dir => {
|
80
|
-
debug('looking for versionSpecifier %o', {
|
81
|
-
dir
|
82
|
-
});
|
83
|
-
|
84
|
-
const tryParent = () => {
|
85
|
-
const parentPath = path.resolve(dir, '..');
|
86
|
-
|
87
|
-
if (parentPath === dir) {
|
88
|
-
debug('reached FS root with no versionSpecifier found');
|
89
|
-
return;
|
90
|
-
}
|
91
|
-
|
92
|
-
return getVersionSpecifierFromPkg(parentPath);
|
93
|
-
};
|
94
|
-
|
95
|
-
return fs.readJSON(path.join(dir, 'package.json')).catch(() => ({})).then(pkg => {
|
96
|
-
const specifier = _.chain(['dependencies', 'devDependencies', 'optionalDependencies']).map(prop => _.get(pkg, `${prop}.cypress`)).compact().first().value();
|
97
|
-
|
98
|
-
return specifier || tryParent();
|
99
|
-
});
|
100
|
-
}; // recurse through parent directories until package.json with `cypress` is found
|
101
|
-
|
102
|
-
|
103
|
-
return getVersionSpecifierFromPkg(startDir).then(versionSpecifier => {
|
104
|
-
debug('finished looking for versionSpecifier', {
|
105
|
-
versionSpecifier
|
106
|
-
});
|
107
|
-
return versionSpecifier;
|
108
|
-
});
|
109
|
-
};
|
110
|
-
|
111
|
-
const betaNpmUrlRe = /^\/beta\/npm\/(?<version>[0-9.]+)\/(?<platformSlug>.+?)\/(?<artifactSlug>.+?)\/cypress\.tgz$/; // convert a prerelease NPM package .tgz URL to the corresponding binary .zip URL
|
112
|
-
|
113
|
-
const getBinaryUrlFromPrereleaseNpmUrl = npmUrl => {
|
114
|
-
let parsed;
|
115
|
-
|
116
|
-
try {
|
117
|
-
parsed = url.parse(npmUrl);
|
118
|
-
} catch (e) {
|
119
|
-
return;
|
120
|
-
}
|
121
|
-
|
122
|
-
const matches = betaNpmUrlRe.exec(parsed.pathname);
|
123
|
-
|
124
|
-
if (parsed.hostname !== 'cdn.cypress.io' || !matches) {
|
125
|
-
return;
|
126
|
-
}
|
46
|
+
const {
|
47
|
+
buildInfo,
|
48
|
+
version
|
49
|
+
} = require('../../package.json');
|
127
50
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
};
|
51
|
+
function _getBinaryUrlFromBuildInfo({
|
52
|
+
commitSha,
|
53
|
+
commitBranch
|
54
|
+
}) {
|
55
|
+
return `https://cdn.cypress.io/beta/binary/${version}/${os.platform()}-${arch()}/${commitBranch}-${commitSha}/cypress.zip`;
|
56
|
+
}
|
135
57
|
|
136
58
|
const alreadyInstalledMsg = () => {
|
137
59
|
if (!util.isPostInstall()) {
|
@@ -235,37 +157,64 @@ const validateOS = () => {
|
|
235
157
|
return platformInfo.match(/(darwin|linux|win32)-x64/);
|
236
158
|
});
|
237
159
|
};
|
160
|
+
/**
|
161
|
+
* Returns the version to install - either a string like `1.2.3` to be fetched
|
162
|
+
* from the download server or a file path or HTTP URL.
|
163
|
+
*/
|
164
|
+
|
165
|
+
|
166
|
+
function getVersionOverride({
|
167
|
+
envVarVersion,
|
168
|
+
buildInfo
|
169
|
+
}) {
|
170
|
+
// let this environment variable reset the binary version we need
|
171
|
+
if (envVarVersion) {
|
172
|
+
return envVarVersion;
|
173
|
+
}
|
238
174
|
|
239
|
-
|
240
|
-
|
175
|
+
if (buildInfo && !buildInfo.stable) {
|
176
|
+
logger.log(chalk.yellow(stripIndent`
|
177
|
+
${logSymbols.warning} Warning: You are installing a pre-release build of Cypress.
|
241
178
|
|
242
|
-
|
243
|
-
force: false
|
244
|
-
});
|
179
|
+
Bugs may be present which do not exist in production builds.
|
245
180
|
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
const envVarVersion = util.getEnv('CYPRESS_INSTALL_BINARY', trimAndRemoveDoubleQuotes);
|
256
|
-
debug('using environment variable CYPRESS_INSTALL_BINARY "%s"', envVarVersion);
|
257
|
-
|
258
|
-
if (envVarVersion === '0') {
|
259
|
-
debug('environment variable CYPRESS_INSTALL_BINARY = 0, skipping install');
|
260
|
-
logger.log(stripIndent`
|
261
|
-
${chalk.yellow('Note:')} Skipping binary installation: Environment variable CYPRESS_INSTALL_BINARY = 0.`);
|
262
|
-
logger.log();
|
263
|
-
return Promise.resolve();
|
264
|
-
}
|
181
|
+
This build was created from:
|
182
|
+
* Commit SHA: ${buildInfo.commitSha}
|
183
|
+
* Commit Branch: ${buildInfo.commitBranch}
|
184
|
+
* Commit Timestamp: ${buildInfo.commitDate}
|
185
|
+
`));
|
186
|
+
logger.log();
|
187
|
+
return _getBinaryUrlFromBuildInfo(buildInfo);
|
188
|
+
}
|
189
|
+
}
|
265
190
|
|
266
|
-
|
191
|
+
function getEnvVarVersion() {
|
192
|
+
if (!util.getEnv('CYPRESS_INSTALL_BINARY')) return; // because passed file paths are often double quoted
|
193
|
+
// and might have extra whitespace around, be robust and trim the string
|
194
|
+
|
195
|
+
const trimAndRemoveDoubleQuotes = true;
|
196
|
+
const envVarVersion = util.getEnv('CYPRESS_INSTALL_BINARY', trimAndRemoveDoubleQuotes);
|
197
|
+
debug('using environment variable CYPRESS_INSTALL_BINARY "%s"', envVarVersion);
|
198
|
+
return envVarVersion;
|
199
|
+
}
|
200
|
+
|
201
|
+
const start = async (options = {}) => {
|
202
|
+
debug('installing with options %j', options);
|
203
|
+
const envVarVersion = getEnvVarVersion();
|
204
|
+
|
205
|
+
if (envVarVersion === '0') {
|
206
|
+
debug('environment variable CYPRESS_INSTALL_BINARY = 0, skipping install');
|
207
|
+
logger.log(stripIndent`
|
208
|
+
${chalk.yellow('Note:')} Skipping binary installation: Environment variable CYPRESS_INSTALL_BINARY = 0.`);
|
209
|
+
logger.log();
|
210
|
+
return;
|
267
211
|
}
|
268
212
|
|
213
|
+
_.defaults(options, {
|
214
|
+
force: false,
|
215
|
+
buildInfo
|
216
|
+
});
|
217
|
+
|
269
218
|
if (util.getEnv('CYPRESS_CACHE_FOLDER')) {
|
270
219
|
const envCache = util.getEnv('CYPRESS_CACHE_FOLDER');
|
271
220
|
logger.log(stripIndent`
|
@@ -276,16 +225,22 @@ const start = (options = {}) => {
|
|
276
225
|
logger.log();
|
277
226
|
}
|
278
227
|
|
279
|
-
const
|
228
|
+
const pkgVersion = util.pkgVersion();
|
229
|
+
const versionOverride = getVersionOverride({
|
230
|
+
envVarVersion,
|
231
|
+
buildInfo: options.buildInfo
|
232
|
+
});
|
233
|
+
const versionToInstall = versionOverride || pkgVersion;
|
234
|
+
debug('version in package.json is %s, version to install is %s', pkgVersion, versionToInstall);
|
235
|
+
const installDir = state.getVersionDir(pkgVersion, options.buildInfo);
|
280
236
|
const cacheDir = state.getCacheDir();
|
281
237
|
const binaryDir = state.getBinaryDir(pkgVersion);
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
}).catch({
|
238
|
+
|
239
|
+
if (!(await validateOS())) {
|
240
|
+
return throwFormErrorText(errors.invalidOS)();
|
241
|
+
}
|
242
|
+
|
243
|
+
await fs.ensureDirAsync(cacheDir).catch({
|
289
244
|
code: 'EACCES'
|
290
245
|
}, err => {
|
291
246
|
return throwFormErrorText(errors.invalidCacheDirectory)(stripIndent`
|
@@ -293,24 +248,11 @@ const start = (options = {}) => {
|
|
293
248
|
|
294
249
|
${err.message}
|
295
250
|
`);
|
296
|
-
})
|
297
|
-
|
298
|
-
|
299
|
-
if (!binaryUrlOverride && versionSpecifier) {
|
300
|
-
const computedBinaryUrl = getBinaryUrlFromPrereleaseNpmUrl(versionSpecifier);
|
301
|
-
|
302
|
-
if (computedBinaryUrl) {
|
303
|
-
debug('computed binary url from version specifier %o', {
|
304
|
-
computedBinaryUrl,
|
305
|
-
needVersion
|
306
|
-
});
|
307
|
-
binaryUrlOverride = computedBinaryUrl;
|
308
|
-
}
|
309
|
-
}
|
310
|
-
|
311
|
-
needVersion = binaryUrlOverride || needVersion;
|
312
|
-
debug('installed version is', binaryVersion, 'version needed is', needVersion);
|
251
|
+
});
|
252
|
+
const binaryPkg = await state.getBinaryPkgAsync(binaryDir);
|
253
|
+
const binaryVersion = await state.getBinaryPkgVersion(binaryPkg);
|
313
254
|
|
255
|
+
const shouldInstall = () => {
|
314
256
|
if (!binaryVersion) {
|
315
257
|
debug('no binary installed under cli version');
|
316
258
|
return true;
|
@@ -327,92 +269,90 @@ const start = (options = {}) => {
|
|
327
269
|
return true;
|
328
270
|
}
|
329
271
|
|
330
|
-
if (binaryVersion ===
|
272
|
+
if (binaryVersion === versionToInstall || !util.isSemver(versionToInstall)) {
|
331
273
|
// our version matches, tell the user this is a noop
|
332
274
|
alreadyInstalledMsg();
|
333
275
|
return false;
|
334
276
|
}
|
335
277
|
|
336
278
|
return true;
|
337
|
-
}
|
338
|
-
// noop if we've been told not to download
|
339
|
-
if (!shouldInstall) {
|
340
|
-
debug('Not downloading or installing binary');
|
341
|
-
return;
|
342
|
-
}
|
279
|
+
}; // noop if we've been told not to download
|
343
280
|
|
344
|
-
if (needVersion !== pkgVersion) {
|
345
|
-
logger.log(chalk.yellow(stripIndent`
|
346
|
-
${logSymbols.warning} Warning: Forcing a binary version different than the default.
|
347
281
|
|
348
|
-
|
282
|
+
if (!shouldInstall()) {
|
283
|
+
return debug('Not downloading or installing binary');
|
284
|
+
}
|
349
285
|
|
350
|
-
|
286
|
+
if (envVarVersion) {
|
287
|
+
logger.log(chalk.yellow(stripIndent`
|
288
|
+
${logSymbols.warning} Warning: Forcing a binary version different than the default.
|
351
289
|
|
352
|
-
|
353
|
-
`));
|
354
|
-
logger.log();
|
355
|
-
} // see if version supplied is a path to a binary
|
290
|
+
The CLI expected to install version: ${chalk.green(pkgVersion)}
|
356
291
|
|
292
|
+
Instead we will install version: ${chalk.green(versionToInstall)}
|
357
293
|
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
294
|
+
These versions may not work properly together.
|
295
|
+
`));
|
296
|
+
logger.log();
|
297
|
+
}
|
362
298
|
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
if (exists && path.extname(possibleFile) === '.zip') {
|
369
|
-
return possibleFile;
|
370
|
-
}
|
299
|
+
const getLocalFilePath = async () => {
|
300
|
+
// see if version supplied is a path to a binary
|
301
|
+
if (await fs.pathExistsAsync(versionToInstall)) {
|
302
|
+
return path.extname(versionToInstall) === '.zip' ? versionToInstall : false;
|
303
|
+
}
|
371
304
|
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
305
|
+
const possibleFile = util.formAbsolutePath(versionToInstall);
|
306
|
+
debug('checking local file', possibleFile, 'cwd', process.cwd()); // if this exists return the path to it
|
307
|
+
// else false
|
308
|
+
|
309
|
+
if ((await fs.pathExistsAsync(possibleFile)) && path.extname(possibleFile) === '.zip') {
|
310
|
+
return possibleFile;
|
311
|
+
}
|
312
|
+
|
313
|
+
return false;
|
314
|
+
};
|
315
|
+
|
316
|
+
const pathToLocalFile = await getLocalFilePath();
|
317
|
+
|
318
|
+
if (pathToLocalFile) {
|
319
|
+
const absolutePath = path.resolve(versionToInstall);
|
320
|
+
debug('found local file at', absolutePath);
|
321
|
+
debug('skipping download');
|
322
|
+
const rendererOptions = getRendererOptions();
|
323
|
+
return new Listr([unzipTask({
|
324
|
+
progress: {
|
325
|
+
throttle: 100,
|
326
|
+
onProgress: null
|
327
|
+
},
|
328
|
+
zipFilePath: absolutePath,
|
329
|
+
installDir,
|
330
|
+
rendererOptions
|
331
|
+
})], {
|
332
|
+
rendererOptions
|
333
|
+
}).run();
|
334
|
+
}
|
335
|
+
|
336
|
+
if (options.force) {
|
337
|
+
debug('Cypress already installed at', installDir);
|
338
|
+
debug('but the installation was forced');
|
339
|
+
}
|
340
|
+
|
341
|
+
debug('preparing to download and unzip version ', versionToInstall, 'to path', installDir);
|
342
|
+
const downloadDir = os.tmpdir();
|
343
|
+
await downloadAndUnzip({
|
344
|
+
version: versionToInstall,
|
345
|
+
installDir,
|
346
|
+
downloadDir
|
347
|
+
}); // delay 1 sec for UX, unless we are testing
|
348
|
+
|
349
|
+
await Promise.delay(1000);
|
350
|
+
displayCompletionMsg();
|
410
351
|
};
|
411
352
|
|
412
353
|
module.exports = {
|
413
354
|
start,
|
414
|
-
|
415
|
-
_getBinaryUrlFromPrereleaseNpmUrl: getBinaryUrlFromPrereleaseNpmUrl
|
355
|
+
_getBinaryUrlFromBuildInfo
|
416
356
|
};
|
417
357
|
|
418
358
|
const unzipTask = ({
|
package/lib/tasks/state.js
CHANGED
@@ -79,7 +79,11 @@ const getBinaryDir = (version = util.pkgVersion()) => {
|
|
79
79
|
return path.join(getVersionDir(version), getPlatFormBinaryFolder());
|
80
80
|
};
|
81
81
|
|
82
|
-
const getVersionDir = (version = util.pkgVersion()) => {
|
82
|
+
const getVersionDir = (version = util.pkgVersion(), buildInfo = util.pkgBuildInfo()) => {
|
83
|
+
if (buildInfo && !buildInfo.stable) {
|
84
|
+
version = ['beta', version, buildInfo.commitBranch, buildInfo.commitSha].join('-');
|
85
|
+
}
|
86
|
+
|
83
87
|
return path.join(getCacheDir(), version);
|
84
88
|
};
|
85
89
|
/**
|
package/lib/util.js
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "cypress",
|
3
|
-
"version": "9.5.
|
3
|
+
"version": "9.5.3",
|
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",
|
@@ -64,6 +64,12 @@
|
|
64
64
|
"node": ">=12.0.0"
|
65
65
|
},
|
66
66
|
"types": "types",
|
67
|
+
"buildInfo": {
|
68
|
+
"commitBranch": "develop",
|
69
|
+
"commitSha": "51ec479d53ce16c91ca9907d745212ce9f6642be",
|
70
|
+
"commitDate": "2022-03-28T19:23:42.000Z",
|
71
|
+
"stable": true
|
72
|
+
},
|
67
73
|
"description": "Cypress.io end to end testing tool",
|
68
74
|
"homepage": "https://github.com/cypress-io/cypress",
|
69
75
|
"license": "MIT",
|
@@ -89,4 +95,4 @@
|
|
89
95
|
"test",
|
90
96
|
"testing"
|
91
97
|
]
|
92
|
-
}
|
98
|
+
}
|
@@ -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
@@ -3347,7 +3347,7 @@ declare namespace Cypress {
|
|
3347
3347
|
(chainer: 'be.a', type: string): Chainable<Subject>
|
3348
3348
|
/**
|
3349
3349
|
* Asserts that the target is a number or a date greater than the given number or date n respectively.
|
3350
|
-
* However, it
|
3350
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
3351
3351
|
* @example
|
3352
3352
|
* cy.wrap(6).should('be.above', 5)
|
3353
3353
|
* @see http://chaijs.com/api/bdd/#method_above
|
@@ -3367,7 +3367,7 @@ declare namespace Cypress {
|
|
3367
3367
|
(chainer: 'be.an', value: string): Chainable<Subject>
|
3368
3368
|
/**
|
3369
3369
|
* 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
|
3370
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
3371
3371
|
* @example
|
3372
3372
|
* cy.wrap(6).should('be.at.least', 5)
|
3373
3373
|
* @see http://chaijs.com/api/bdd/#method_least
|
@@ -3376,7 +3376,7 @@ declare namespace Cypress {
|
|
3376
3376
|
(chainer: 'be.at.least', value: number | Date): Chainable<Subject>
|
3377
3377
|
/**
|
3378
3378
|
* 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
|
3379
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
3380
3380
|
* @example
|
3381
3381
|
* cy.wrap(4).should('be.below', 5)
|
3382
3382
|
* @see http://chaijs.com/api/bdd/#method_below
|
@@ -3392,7 +3392,7 @@ declare namespace Cypress {
|
|
3392
3392
|
*/
|
3393
3393
|
(chainer: 'be.arguments'): Chainable<Subject>
|
3394
3394
|
/**
|
3395
|
-
* Asserts that the target is a number that’s within a given +/- `delta` range of the given number `expected`. However, it
|
3395
|
+
* 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
3396
|
* @example
|
3397
3397
|
* cy.wrap(5.1).should('be.approximately', 5, 0.5)
|
3398
3398
|
* @alias closeTo
|
@@ -3401,7 +3401,7 @@ declare namespace Cypress {
|
|
3401
3401
|
*/
|
3402
3402
|
(chainer: 'be.approximately', value: number, delta: number): Chainable<Subject>
|
3403
3403
|
/**
|
3404
|
-
* Asserts that the target is a number that’s within a given +/- `delta` range of the given number `expected`. However, it
|
3404
|
+
* 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
3405
|
* @example
|
3406
3406
|
* cy.wrap(5.1).should('be.closeTo', 5, 0.5)
|
3407
3407
|
* @see http://chaijs.com/api/bdd/#method_closeto
|
@@ -3435,7 +3435,7 @@ declare namespace Cypress {
|
|
3435
3435
|
(chainer: 'be.false'): Chainable<Subject>
|
3436
3436
|
/**
|
3437
3437
|
* Asserts that the target is a number or a date greater than the given number or date n respectively.
|
3438
|
-
* However, it
|
3438
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
3439
3439
|
* @example
|
3440
3440
|
* cy.wrap(6).should('be.greaterThan', 5)
|
3441
3441
|
* @alias above
|
@@ -3445,7 +3445,7 @@ declare namespace Cypress {
|
|
3445
3445
|
(chainer: 'be.greaterThan', value: number): Chainable<Subject>
|
3446
3446
|
/**
|
3447
3447
|
* Asserts that the target is a number or a date greater than the given number or date n respectively.
|
3448
|
-
* However, it
|
3448
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
3449
3449
|
* @example
|
3450
3450
|
* cy.wrap(6).should('be.gt', 5)
|
3451
3451
|
* @alias above
|
@@ -3455,7 +3455,7 @@ declare namespace Cypress {
|
|
3455
3455
|
(chainer: 'be.gt', value: number): Chainable<Subject>
|
3456
3456
|
/**
|
3457
3457
|
* 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
|
3458
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
3459
3459
|
* @example
|
3460
3460
|
* cy.wrap(6).should('be.gte', 5)
|
3461
3461
|
* @alias least
|
@@ -3465,7 +3465,7 @@ declare namespace Cypress {
|
|
3465
3465
|
(chainer: 'be.gte', value: number): Chainable<Subject>
|
3466
3466
|
/**
|
3467
3467
|
* 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
|
3468
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
3469
3469
|
* @example
|
3470
3470
|
* cy.wrap(4).should('be.lessThan', 5)
|
3471
3471
|
* @alias below
|
@@ -3475,7 +3475,7 @@ declare namespace Cypress {
|
|
3475
3475
|
(chainer: 'be.lessThan', value: number): Chainable<Subject>
|
3476
3476
|
/**
|
3477
3477
|
* 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
|
3478
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
3479
3479
|
* @example
|
3480
3480
|
* cy.wrap(4).should('be.lt', 5)
|
3481
3481
|
* @alias below
|
@@ -3485,7 +3485,7 @@ declare namespace Cypress {
|
|
3485
3485
|
(chainer: 'be.lt', value: number): Chainable<Subject>
|
3486
3486
|
/**
|
3487
3487
|
* 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
|
3488
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
3489
3489
|
* @example
|
3490
3490
|
* cy.wrap(4).should('be.lte', 5)
|
3491
3491
|
* @alias most
|
@@ -3494,7 +3494,7 @@ declare namespace Cypress {
|
|
3494
3494
|
*/
|
3495
3495
|
(chainer: 'be.lte', value: number): Chainable<Subject>
|
3496
3496
|
/**
|
3497
|
-
* Asserts that the target is loosely (`==`) equal to `true`. However, it
|
3497
|
+
* 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
3498
|
* @example
|
3499
3499
|
* cy.wrap(1).should('be.ok')
|
3500
3500
|
* @see http://chaijs.com/api/bdd/#method_ok
|
@@ -3535,7 +3535,7 @@ declare namespace Cypress {
|
|
3535
3535
|
(chainer: 'be.NaN'): Chainable<Subject>
|
3536
3536
|
/**
|
3537
3537
|
* 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
|
3538
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
3539
3539
|
* @example
|
3540
3540
|
* cy.wrap(6).should('be.within', 5, 10)
|
3541
3541
|
* @see http://chaijs.com/api/bdd/#method_within
|
@@ -3544,8 +3544,8 @@ declare namespace Cypress {
|
|
3544
3544
|
(chainer: 'be.within', start: number, end: number): Chainable<Subject>
|
3545
3545
|
(chainer: 'be.within', start: Date, end: Date): Chainable<Subject>
|
3546
3546
|
/**
|
3547
|
-
* When one argument is provided, `.change` asserts that the given function `subject` returns a different value when it
|
3548
|
-
* However, it
|
3547
|
+
* 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.
|
3548
|
+
* However, it's often best to assert that `subject` is equal to its expected value.
|
3549
3549
|
* @example
|
3550
3550
|
* let dots = ''
|
3551
3551
|
* function addDot() { dots += '.' }
|
@@ -3575,8 +3575,8 @@ declare namespace Cypress {
|
|
3575
3575
|
*/
|
3576
3576
|
(chainer: 'contain', value: any): Chainable<Subject>
|
3577
3577
|
/**
|
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.
|
3578
|
+
* 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.
|
3579
|
+
* `.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
3580
|
* @example
|
3581
3581
|
* let val = 1
|
3582
3582
|
* function subtractTwo() { val -= 2 }
|
@@ -3606,7 +3606,7 @@ declare namespace Cypress {
|
|
3606
3606
|
*/
|
3607
3607
|
(chainer: 'deep.equal', value: Subject): Chainable<Subject>
|
3608
3608
|
/**
|
3609
|
-
* Asserts that the target is not strictly (`===`) equal to either `null` or `undefined`. However, it
|
3609
|
+
* 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
3610
|
* @example
|
3611
3611
|
* cy.wrap(1).should('exist')
|
3612
3612
|
* @see http://chaijs.com/api/bdd/#method_exist
|
@@ -3825,10 +3825,10 @@ declare namespace Cypress {
|
|
3825
3825
|
*/
|
3826
3826
|
(chainer: 'include.members' | 'include.ordered.members' | 'include.deep.ordered.members', value: any[]): Chainable<Subject>
|
3827
3827
|
/**
|
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
|
3828
|
+
* When one argument is provided, `.increase` asserts that the given function `subject` returns a greater number when it's
|
3829
|
+
* invoked after invoking the target function compared to when it's invoked beforehand.
|
3830
3830
|
* `.increase` also causes all `.by` assertions that follow in the chain to assert how much greater of a number is returned.
|
3831
|
-
*
|
3831
|
+
* it's often best to assert that the return value increased by the expected amount, rather than asserting it increased by any amount.
|
3832
3832
|
*
|
3833
3833
|
* When two arguments are provided, `.increase` asserts that the value of the given object `subject`’s `prop` property is greater after
|
3834
3834
|
* invoking the target function compared to beforehand.
|
@@ -3875,7 +3875,7 @@ declare namespace Cypress {
|
|
3875
3875
|
(chainer: 'satisfy', fn: (val: any) => boolean): Chainable<Subject>
|
3876
3876
|
/**
|
3877
3877
|
* 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
|
3878
|
+
* 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
3879
|
* @example
|
3880
3880
|
* function badFn() { throw new TypeError('Illegal salmon!') }
|
3881
3881
|
* cy.wrap(badFn).should('throw')
|
@@ -3887,7 +3887,7 @@ declare namespace Cypress {
|
|
3887
3887
|
(chainer: 'throw', value?: string | RegExp): Chainable<Subject>
|
3888
3888
|
/**
|
3889
3889
|
* 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
|
3890
|
+
* 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
3891
|
* @example
|
3892
3892
|
* function badFn() { throw new TypeError('Illegal salmon!') }
|
3893
3893
|
* cy.wrap(badFn).should('throw')
|
@@ -3956,7 +3956,7 @@ declare namespace Cypress {
|
|
3956
3956
|
(chainer: 'not.be.a', type: string): Chainable<Subject>
|
3957
3957
|
/**
|
3958
3958
|
* Asserts that the target is a not number or not a date greater than the given number or date n respectively.
|
3959
|
-
* However, it
|
3959
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
3960
3960
|
* @example
|
3961
3961
|
* cy.wrap(6).should('not.be.above', 10)
|
3962
3962
|
* @see http://chaijs.com/api/bdd/#method_above
|
@@ -3976,7 +3976,7 @@ declare namespace Cypress {
|
|
3976
3976
|
(chainer: 'not.be.an', value: string): Chainable<Subject>
|
3977
3977
|
/**
|
3978
3978
|
* 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
|
3979
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
3980
3980
|
* @example
|
3981
3981
|
* cy.wrap(6).should('not.be.at.least', 10)
|
3982
3982
|
* @see http://chaijs.com/api/bdd/#method_least
|
@@ -3985,7 +3985,7 @@ declare namespace Cypress {
|
|
3985
3985
|
(chainer: 'not.be.at.least', value: number | Date): Chainable<Subject>
|
3986
3986
|
/**
|
3987
3987
|
* 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
|
3988
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
3989
3989
|
* @example
|
3990
3990
|
* cy.wrap(4).should('not.be.below', 1)
|
3991
3991
|
* @see http://chaijs.com/api/bdd/#method_below
|
@@ -4001,7 +4001,7 @@ declare namespace Cypress {
|
|
4001
4001
|
*/
|
4002
4002
|
(chainer: 'not.be.arguments'): Chainable<Subject>
|
4003
4003
|
/**
|
4004
|
-
* Asserts that the target is a not number that’s within a given +/- `delta` range of the given number `expected`. However, it
|
4004
|
+
* 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
4005
|
* @example
|
4006
4006
|
* cy.wrap(5.1).should('not.be.approximately', 6, 0.5)
|
4007
4007
|
* @alias closeTo
|
@@ -4010,7 +4010,7 @@ declare namespace Cypress {
|
|
4010
4010
|
*/
|
4011
4011
|
(chainer: 'not.be.approximately', value: number, delta: number): Chainable<Subject>
|
4012
4012
|
/**
|
4013
|
-
* Asserts that the target is not a number that’s within a given +/- `delta` range of the given number `expected`. However, it
|
4013
|
+
* 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
4014
|
* @example
|
4015
4015
|
* cy.wrap(5.1).should('not.be.closeTo', 6, 0.5)
|
4016
4016
|
* @see http://chaijs.com/api/bdd/#method_closeto
|
@@ -4044,7 +4044,7 @@ declare namespace Cypress {
|
|
4044
4044
|
(chainer: 'not.be.false'): Chainable<Subject>
|
4045
4045
|
/**
|
4046
4046
|
* Asserts that the target is a not number or a date greater than the given number or date n respectively.
|
4047
|
-
* However, it
|
4047
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
4048
4048
|
* @example
|
4049
4049
|
* cy.wrap(6).should('be.greaterThan', 7)
|
4050
4050
|
* @alias above
|
@@ -4054,7 +4054,7 @@ declare namespace Cypress {
|
|
4054
4054
|
(chainer: 'not.be.greaterThan', value: number): Chainable<Subject>
|
4055
4055
|
/**
|
4056
4056
|
* Asserts that the target is a not number or a date greater than the given number or date n respectively.
|
4057
|
-
* However, it
|
4057
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
4058
4058
|
* @example
|
4059
4059
|
* cy.wrap(6).should('not.be.gt', 7)
|
4060
4060
|
* @alias above
|
@@ -4064,7 +4064,7 @@ declare namespace Cypress {
|
|
4064
4064
|
(chainer: 'not.be.gt', value: number): Chainable<Subject>
|
4065
4065
|
/**
|
4066
4066
|
* 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
|
4067
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
4068
4068
|
* @example
|
4069
4069
|
* cy.wrap(6).should('not.be.gte', 7)
|
4070
4070
|
* @alias least
|
@@ -4074,7 +4074,7 @@ declare namespace Cypress {
|
|
4074
4074
|
(chainer: 'not.be.gte', value: number): Chainable<Subject>
|
4075
4075
|
/**
|
4076
4076
|
* 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
|
4077
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
4078
4078
|
* @example
|
4079
4079
|
* cy.wrap(4).should('not.be.lessThan', 3)
|
4080
4080
|
* @alias below
|
@@ -4084,7 +4084,7 @@ declare namespace Cypress {
|
|
4084
4084
|
(chainer: 'not.be.lessThan', value: number): Chainable<Subject>
|
4085
4085
|
/**
|
4086
4086
|
* 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
|
4087
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
4088
4088
|
* @example
|
4089
4089
|
* cy.wrap(4).should('not.be.lt', 3)
|
4090
4090
|
* @alias below
|
@@ -4094,7 +4094,7 @@ declare namespace Cypress {
|
|
4094
4094
|
(chainer: 'not.be.lt', value: number): Chainable<Subject>
|
4095
4095
|
/**
|
4096
4096
|
* 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
|
4097
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
4098
4098
|
* @example
|
4099
4099
|
* cy.wrap(4).should('not.be.lte', 3)
|
4100
4100
|
* @alias most
|
@@ -4103,7 +4103,7 @@ declare namespace Cypress {
|
|
4103
4103
|
*/
|
4104
4104
|
(chainer: 'not.be.lte', value: number): Chainable<Subject>
|
4105
4105
|
/**
|
4106
|
-
* Asserts that the target is not loosely (`==`) equal to `true`. However, it
|
4106
|
+
* 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
4107
|
* @example
|
4108
4108
|
* cy.wrap(0).should('not.be.ok')
|
4109
4109
|
* @see http://chaijs.com/api/bdd/#method_ok
|
@@ -4144,7 +4144,7 @@ declare namespace Cypress {
|
|
4144
4144
|
(chainer: 'not.be.NaN'): Chainable<Subject>
|
4145
4145
|
/**
|
4146
4146
|
* 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
|
4147
|
+
* However, it's often best to assert that the target is equal to its expected value.
|
4148
4148
|
* @example
|
4149
4149
|
* cy.wrap(3).should('not.be.within', 5, 10)
|
4150
4150
|
* @see http://chaijs.com/api/bdd/#method_within
|
@@ -4153,8 +4153,8 @@ declare namespace Cypress {
|
|
4153
4153
|
(chainer: 'not.be.within', start: number, end: number): Chainable<Subject>
|
4154
4154
|
(chainer: 'not.be.within', start: Date, end: Date): Chainable<Subject>
|
4155
4155
|
/**
|
4156
|
-
* When one argument is provided, `.change` asserts that the given function `subject` returns a different value when it
|
4157
|
-
* However, it
|
4156
|
+
* 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.
|
4157
|
+
* However, it's often best to assert that `subject` is equal to its expected value.
|
4158
4158
|
* @example
|
4159
4159
|
* let dots = ''
|
4160
4160
|
* function addDot() { dots += '.' }
|
@@ -4184,8 +4184,8 @@ declare namespace Cypress {
|
|
4184
4184
|
*/
|
4185
4185
|
(chainer: 'not.contain', value: any): Chainable<Subject>
|
4186
4186
|
/**
|
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.
|
4187
|
+
* 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.
|
4188
|
+
* `.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
4189
|
* @example
|
4190
4190
|
* let val = 1
|
4191
4191
|
* function subtractTwo() { val -= 2 }
|
@@ -4214,7 +4214,7 @@ declare namespace Cypress {
|
|
4214
4214
|
*/
|
4215
4215
|
(chainer: 'not.deep.equal', value: Subject): Chainable<Subject>
|
4216
4216
|
/**
|
4217
|
-
* Asserts that the target is not strictly (`===`) equal to either `null` or `undefined`. However, it
|
4217
|
+
* 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
4218
|
* @example
|
4219
4219
|
* cy.wrap(null).should('not.exist')
|
4220
4220
|
* @see http://chaijs.com/api/bdd/#method_exist
|
@@ -4409,10 +4409,10 @@ declare namespace Cypress {
|
|
4409
4409
|
*/
|
4410
4410
|
(chainer: 'not.include.members' | 'not.include.ordered.members' | 'not.include.deep.ordered.members', value: any[]): Chainable<Subject>
|
4411
4411
|
/**
|
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
|
4412
|
+
* When one argument is provided, `.increase` asserts that the given function `subject` returns a greater number when it's
|
4413
|
+
* invoked after invoking the target function compared to when it's invoked beforehand.
|
4414
4414
|
* `.increase` also causes all `.by` assertions that follow in the chain to assert how much greater of a number is returned.
|
4415
|
-
*
|
4415
|
+
* it's often best to assert that the return value increased by the expected amount, rather than asserting it increased by any amount.
|
4416
4416
|
*
|
4417
4417
|
* When two arguments are provided, `.increase` asserts that the value of the given object `subject`’s `prop` property is greater after
|
4418
4418
|
* invoking the target function compared to beforehand.
|
@@ -4459,7 +4459,7 @@ declare namespace Cypress {
|
|
4459
4459
|
(chainer: 'not.satisfy', fn: (val: any) => boolean): Chainable<Subject>
|
4460
4460
|
/**
|
4461
4461
|
* 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
|
4462
|
+
* 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
4463
|
* @example
|
4464
4464
|
* function badFn() { console.log('Illegal salmon!') }
|
4465
4465
|
* cy.wrap(badFn).should('not.throw')
|
@@ -4471,7 +4471,7 @@ declare namespace Cypress {
|
|
4471
4471
|
(chainer: 'not.throw', value?: string | RegExp): Chainable<Subject>
|
4472
4472
|
/**
|
4473
4473
|
* 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
|
4474
|
+
* 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
4475
|
* @example
|
4476
4476
|
* function badFn() { console.log('Illegal salmon!') }
|
4477
4477
|
* cy.wrap(badFn).should('not.throw')
|