cypress 3.3.0 → 3.3.1
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/errors.js +4 -4
- package/lib/exec/spawn.js +3 -3
- package/lib/exec/xvfb.js +4 -4
- package/lib/tasks/verify.js +12 -5
- package/lib/util.js +2 -2
- package/package.json +1 -1
- package/types/index.d.ts +32 -0
package/lib/errors.js
CHANGED
@@ -5,9 +5,9 @@ var _templateObject = _taggedTemplateLiteral(['\n Search for an existing issu
|
|
5
5
|
_templateObject3 = _taggedTemplateLiteral(['\n\n Reasons this may happen:\n\n - node was installed as \'root\' or with \'sudo\'\n - the cypress npm package as \'root\' or with \'sudo\'\n\n Please check that you have the appropriate user permissions.\n '], ['\\n\n Reasons this may happen:\n\n - node was installed as \'root\' or with \'sudo\'\n - the cypress npm package as \'root\' or with \'sudo\'\n\n Please check that you have the appropriate user permissions.\n ']),
|
6
6
|
_templateObject4 = _taggedTemplateLiteral(['\n\n We expected the binary to be installed here: ', '\n\n Reasons it may be missing:\n\n - You\'re caching \'node_modules\' but are not caching this path: ', '\n - You ran \'npm install\' at an earlier build step but did not persist: ', '\n\n Properly caching the binary will fix this error and avoid downloading and unzipping Cypress.\n\n Alternatively, you can run \'cypress install\' to download the binary again.\n\n ', '\n '], ['\\n\n We expected the binary to be installed here: ', '\n\n Reasons it may be missing:\n\n - You\'re caching \'node_modules\' but are not caching this path: ', '\n - You ran \'npm install\' at an earlier build step but did not persist: ', '\n\n Properly caching the binary will fix this error and avoid downloading and unzipping Cypress.\n\n Alternatively, you can run \'cypress install\' to download the binary again.\n\n ', '\n ']),
|
7
7
|
_templateObject5 = _taggedTemplateLiteral(['\n There was a problem spawning Xvfb.\n\n This is likely a problem with your system, permissions, or installation of Xvfb.\n '], ['\n There was a problem spawning Xvfb.\n\n This is likely a problem with your system, permissions, or installation of Xvfb.\n ']),
|
8
|
-
_templateObject6 = _taggedTemplateLiteral(['\n Install
|
8
|
+
_templateObject6 = _taggedTemplateLiteral(['\n Install Xvfb and run Cypress again.\n\n Read our documentation on dependencies for more information:\n\n ', '\n\n If you are using Docker, we provide containers with all required dependencies installed.\n '], ['\n Install Xvfb and run Cypress again.\n\n Read our documentation on dependencies for more information:\n\n ', '\n\n If you are using Docker, we provide containers with all required dependencies installed.\n ']),
|
9
9
|
_templateObject7 = _taggedTemplateLiteral(['\n This command failed with the following output:\n\n ', '\n\n '], ['\n This command failed with the following output:\n\n ', '\n\n ']),
|
10
|
-
_templateObject8 = _taggedTemplateLiteral(['\n Cypress failed to start after spawning a new
|
10
|
+
_templateObject8 = _taggedTemplateLiteral(['\n Cypress failed to start after spawning a new Xvfb server.\n\n The error logs we received were:\n\n ', '\n\n ', '\n\n ', '\n\n This is usually caused by a missing library or dependency.\n\n The error above should indicate which dependency is missing.\n\n ', '\n\n If you are using Docker, we provide containers with all required dependencies installed.\n '], ['\n Cypress failed to start after spawning a new Xvfb server.\n\n The error logs we received were:\n\n ', '\n\n ', '\n\n ', '\n\n This is usually caused by a missing library or dependency.\n\n The error above should indicate which dependency is missing.\n\n ', '\n\n If you are using Docker, we provide containers with all required dependencies installed.\n ']),
|
11
11
|
_templateObject9 = _taggedTemplateLiteral(['\n This is usually caused by a missing library or dependency.\n\n The error below should indicate which dependency is missing.\n\n ', '\n\n If you are using Docker, we provide containers with all required dependencies installed.\n '], ['\n This is usually caused by a missing library or dependency.\n\n The error below should indicate which dependency is missing.\n\n ', '\n\n If you are using Docker, we provide containers with all required dependencies installed.\n ']),
|
12
12
|
_templateObject10 = _taggedTemplateLiteral(['\n See discussion and possible solutions at\n ', '\n '], ['\n See discussion and possible solutions at\n ', '\n ']),
|
13
13
|
_templateObject11 = _taggedTemplateLiteral(['\n Please search Cypress documentation for possible solutions:\n\n ', '\n\n Check if there is a GitHub issue describing this crash:\n\n ', '\n\n Consider opening a new issue.\n '], ['\n Please search Cypress documentation for possible solutions:\n\n ', '\n\n Check if there is a GitHub issue describing this crash:\n\n ', '\n\n Consider opening a new issue.\n ']),
|
@@ -76,12 +76,12 @@ var notInstalledCI = function notInstalledCI(executable) {
|
|
76
76
|
};
|
77
77
|
|
78
78
|
var nonZeroExitCodeXvfb = {
|
79
|
-
description: '
|
79
|
+
description: 'Xvfb exited with a non zero exit code.',
|
80
80
|
solution: stripIndent(_templateObject5)
|
81
81
|
};
|
82
82
|
|
83
83
|
var missingXvfb = {
|
84
|
-
description: 'Your system is missing the dependency:
|
84
|
+
description: 'Your system is missing the dependency: Xvfb',
|
85
85
|
solution: stripIndent(_templateObject6, chalk.blue(requiredDependenciesUrl))
|
86
86
|
};
|
87
87
|
|
package/lib/exec/spawn.js
CHANGED
@@ -50,7 +50,7 @@ function getStdio(needsXvfb) {
|
|
50
50
|
if (needsStderrPiped(needsXvfb)) {
|
51
51
|
// returning pipe here so we can massage stderr
|
52
52
|
// and remove garbage from Xlib and libuv
|
53
|
-
// due to starting the
|
53
|
+
// due to starting the Xvfb process on linux
|
54
54
|
return ['inherit', 'inherit', 'pipe'];
|
55
55
|
}
|
56
56
|
|
@@ -68,7 +68,7 @@ module.exports = {
|
|
68
68
|
executable = path.resolve(util.getEnv('CYPRESS_RUN_BINARY'));
|
69
69
|
}
|
70
70
|
|
71
|
-
debug('needs to start own
|
71
|
+
debug('needs to start own Xvfb?', needsXvfb);
|
72
72
|
|
73
73
|
// always push cwd into the args
|
74
74
|
args = [].concat(args, '--cwd', process.cwd());
|
@@ -224,7 +224,7 @@ module.exports = {
|
|
224
224
|
|
225
225
|
// if we are on linux and there's already a DISPLAY
|
226
226
|
// set, then we may need to rerun cypress after
|
227
|
-
// spawning our own
|
227
|
+
// spawning our own Xvfb server
|
228
228
|
var linuxWithDisplayEnv = util.isPossibleLinuxWithIncorrectDisplay();
|
229
229
|
|
230
230
|
return userFriendlySpawn(linuxWithDisplayEnv);
|
package/lib/exec/xvfb.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
var _templateObject = _taggedTemplateLiteral(['\n DISPLAY environment variable is set to ', ' on Linux\n Assuming this DISPLAY points at working X11 server,\n Cypress will not spawn own
|
3
|
+
var _templateObject = _taggedTemplateLiteral(['\n DISPLAY environment variable is set to ', ' on Linux\n Assuming this DISPLAY points at working X11 server,\n Cypress will not spawn own Xvfb\n\n NOTE: if the X11 server is NOT working, Cypress will exit without explanation,\n see ', '\n Solution: Unset the DISPLAY variable and try again:\n DISPLAY= npx cypress run ...\n '], ['\n DISPLAY environment variable is set to ', ' on Linux\n Assuming this DISPLAY points at working X11 server,\n Cypress will not spawn own Xvfb\n\n NOTE: if the X11 server is NOT working, Cypress will exit without explanation,\n see ', '\n Solution: Unset the DISPLAY variable and try again:\n DISPLAY= npx cypress run ...\n ']);
|
4
4
|
|
5
5
|
function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
6
6
|
|
@@ -35,7 +35,7 @@ module.exports = {
|
|
35
35
|
_xvfb: xvfb, // expose for testing
|
36
36
|
|
37
37
|
start: function start() {
|
38
|
-
debug('Starting
|
38
|
+
debug('Starting Xvfb');
|
39
39
|
|
40
40
|
return xvfb.startAsync().return(null).catch({ nonZeroExitCode: true }, throwFormErrorText(errors.nonZeroExitCodeXvfb)).catch(function (err) {
|
41
41
|
if (err.known) {
|
@@ -46,7 +46,7 @@ module.exports = {
|
|
46
46
|
});
|
47
47
|
},
|
48
48
|
stop: function stop() {
|
49
|
-
debug('Stopping
|
49
|
+
debug('Stopping Xvfb');
|
50
50
|
|
51
51
|
return xvfb.stopAsync().return(null).catch(function () {
|
52
52
|
// noop
|
@@ -68,7 +68,7 @@ module.exports = {
|
|
68
68
|
}
|
69
69
|
|
70
70
|
debug('undefined DISPLAY environment variable');
|
71
|
-
debug('Cypress will spawn its own
|
71
|
+
debug('Cypress will spawn its own Xvfb');
|
72
72
|
|
73
73
|
return true;
|
74
74
|
},
|
package/lib/tasks/verify.js
CHANGED
@@ -78,7 +78,7 @@ var runSmokeTest = function runSmokeTest(binaryDir, options) {
|
|
78
78
|
|
79
79
|
var needsXvfb = xvfb.isNeeded();
|
80
80
|
|
81
|
-
debug('needs
|
81
|
+
debug('needs Xvfb?', needsXvfb);
|
82
82
|
|
83
83
|
/**
|
84
84
|
* Spawn Cypress running smoke test to check if all operating system
|
@@ -88,8 +88,6 @@ var runSmokeTest = function runSmokeTest(binaryDir, options) {
|
|
88
88
|
var random = _.random(0, 1000);
|
89
89
|
var args = ['--smoke-test', '--ping=' + random];
|
90
90
|
|
91
|
-
process.env.ELECTRON_ENABLE_LOGGING = true;
|
92
|
-
|
93
91
|
if (options.dev) {
|
94
92
|
executable = 'node';
|
95
93
|
args.unshift(path.resolve(__dirname, '..', '..', '..', 'scripts', 'start.js'));
|
@@ -101,7 +99,16 @@ var runSmokeTest = function runSmokeTest(binaryDir, options) {
|
|
101
99
|
debug('using Cypress executable %s', executable);
|
102
100
|
debug('smoke test command:', smokeTestCommand);
|
103
101
|
|
104
|
-
|
102
|
+
var env = _.extend({}, process.env, {
|
103
|
+
ELECTRON_ENABLE_LOGGING: true
|
104
|
+
});
|
105
|
+
|
106
|
+
var stdioOptions = _.extend({}, {
|
107
|
+
env: env,
|
108
|
+
timeout: options.smokeTestTimeout
|
109
|
+
});
|
110
|
+
|
111
|
+
return Promise.resolve(util.exec(executable, args, stdioOptions)).catch(onSmokeTestError(smokeTestCommand, linuxWithDisplayEnv)).then(function (result) {
|
105
112
|
// TODO: when execa > 1.1 is released
|
106
113
|
// change this to `result.all` for both stderr and stdout
|
107
114
|
var smokeTestReturned = result.stdout;
|
@@ -136,7 +143,7 @@ var runSmokeTest = function runSmokeTest(binaryDir, options) {
|
|
136
143
|
|
137
144
|
// if we are on linux and there's already a DISPLAY
|
138
145
|
// set, then we may need to rerun cypress after
|
139
|
-
// spawning our own
|
146
|
+
// spawning our own Xvfb server
|
140
147
|
var linuxWithDisplayEnv = util.isPossibleLinuxWithIncorrectDisplay();
|
141
148
|
|
142
149
|
return userFriendlySpawn(linuxWithDisplayEnv);
|
package/lib/util.js
CHANGED
@@ -49,7 +49,7 @@ function normalizeModuleOptions() {
|
|
49
49
|
|
50
50
|
/**
|
51
51
|
* Returns true if the platform is Linux. We do a lot of different
|
52
|
-
* stuff on Linux (like
|
52
|
+
* stuff on Linux (like Xvfb) and it helps to has readable code
|
53
53
|
*/
|
54
54
|
var isLinux = function isLinux() {
|
55
55
|
return os.platform() === 'linux';
|
@@ -71,7 +71,7 @@ var isPossibleLinuxWithIncorrectDisplay = function isPossibleLinuxWithIncorrectD
|
|
71
71
|
};
|
72
72
|
|
73
73
|
var logBrokenGtkDisplayWarning = function logBrokenGtkDisplayWarning() {
|
74
|
-
debug('Cypress exited due to a broken gtk display because of a potential invalid DISPLAY env... retrying after starting
|
74
|
+
debug('Cypress exited due to a broken gtk display because of a potential invalid DISPLAY env... retrying after starting Xvfb');
|
75
75
|
|
76
76
|
// if we get this error, we are on Linux and DISPLAY is set
|
77
77
|
logger.warn(stripIndent(_templateObject, logSymbols.warning, process.env.DISPLAY));
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
@@ -3593,6 +3593,22 @@ declare namespace Cypress {
|
|
3593
3593
|
* @see https://on.cypress.io/assertions
|
3594
3594
|
*/
|
3595
3595
|
(chainer: 'contain', value: string): Chainable<Subject>
|
3596
|
+
/**
|
3597
|
+
* Assert that at least one element of the selection is focused.
|
3598
|
+
* @example
|
3599
|
+
* cy.get('#result').should('have.focus')
|
3600
|
+
* cy.get('#result').should('be.focused')
|
3601
|
+
* @see https://on.cypress.io/assertions
|
3602
|
+
*/
|
3603
|
+
(chainer: 'have.focus'): Chainable<Subject>
|
3604
|
+
/**
|
3605
|
+
* Assert that at least one element of the selection is focused.
|
3606
|
+
* @example
|
3607
|
+
* cy.get('#result').should('be.focused')
|
3608
|
+
* cy.get('#result').should('have.focus')
|
3609
|
+
* @see https://on.cypress.io/assertions
|
3610
|
+
*/
|
3611
|
+
(chainer: 'be.focused'): Chainable<Subject>
|
3596
3612
|
/**
|
3597
3613
|
* Assert that the selection is not empty. Note that this overrides the built-in chai assertion. If the object asserted against is not a jQuery object, the original implementation will be called.
|
3598
3614
|
* @example
|
@@ -3749,6 +3765,22 @@ declare namespace Cypress {
|
|
3749
3765
|
* @see https://on.cypress.io/assertions
|
3750
3766
|
*/
|
3751
3767
|
(chainer: 'not.be.visible'): Chainable<Subject>
|
3768
|
+
/**
|
3769
|
+
* Assert that no element of the selection is focused.
|
3770
|
+
* @example
|
3771
|
+
* cy.get('#result').should('not.have.focus')
|
3772
|
+
* cy.get('#result').should('not.be.focused')
|
3773
|
+
* @see https://on.cypress.io/assertions
|
3774
|
+
*/
|
3775
|
+
(chainer: 'not.have.focus'): Chainable<Subject>
|
3776
|
+
/**
|
3777
|
+
* Assert that no element of the selection is focused.
|
3778
|
+
* @example
|
3779
|
+
* cy.get('#result').should('not.be.focused')
|
3780
|
+
* cy.get('#result').should('not.have.focus')
|
3781
|
+
* @see https://on.cypress.io/assertions
|
3782
|
+
*/
|
3783
|
+
(chainer: 'not.be.focused'): Chainable<Subject>
|
3752
3784
|
/**
|
3753
3785
|
* Assert that the selection does not contain the given text, using `:contains()`. If the object asserted against is not a jQuery object, or if `contain` is not called as a function, the original implementation will be called.
|
3754
3786
|
* @example
|