-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatically retry verify and run commands on Linux if suspect DISPLAY problem #4165
Changes from all commits
142a830
ff9e26e
5a9f586
6bb8e1d
8b329d0
51d5389
a7a74a7
8d0d9fc
7747152
04b5891
4ad307c
8c2c367
fa00621
66a2d83
2b50102
cc9c06b
afacdc1
859c1bf
4aa038b
8850c04
080d3b2
ac5915d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
exports['errors .errors.formErrorText calls solution if a function 1'] = ` | ||
description | ||
|
||
a solution | ||
|
||
---------- | ||
|
||
Platform: test platform (Foo-OsVersion) | ||
Cypress Version: 1.2.3 | ||
` | ||
|
||
exports['errors .errors.formErrorText returns fully formed text message 1'] = ` | ||
Your system is missing the dependency: XVFB | ||
|
||
|
@@ -16,18 +27,54 @@ Cypress Version: 1.2.3 | |
` | ||
|
||
exports['errors individual has the following errors 1'] = [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the names of the errors are now sorted before snapshotting |
||
"nonZeroExitCodeXvfb", | ||
"missingXvfb", | ||
"missingApp", | ||
"notInstalledCI", | ||
"missingDependency", | ||
"versionMismatch", | ||
"CYPRESS_RUN_BINARY", | ||
"binaryNotExecutable", | ||
"unexpected", | ||
"failedDownload", | ||
"failedUnzip", | ||
"invalidCacheDirectory", | ||
"invalidDisplayError", | ||
"missingApp", | ||
"missingDependency", | ||
"missingXvfb", | ||
"nonZeroExitCodeXvfb", | ||
"notInstalledCI", | ||
"removed", | ||
"CYPRESS_RUN_BINARY", | ||
"smokeTestFailure" | ||
"smokeTestFailure", | ||
"unexpected", | ||
"versionMismatch" | ||
] | ||
|
||
exports['invalid display error'] = ` | ||
Cypress failed to start. | ||
|
||
First, we have tried to start Cypress using your DISPLAY settings | ||
but encountered the following problem: | ||
|
||
---------- | ||
|
||
prev message | ||
|
||
---------- | ||
|
||
Then we started our own XVFB and tried to start Cypress again, but | ||
got the following error: | ||
|
||
---------- | ||
|
||
current message | ||
|
||
---------- | ||
|
||
This is usually caused by a missing library or dependency. | ||
|
||
The error above should indicate which dependency is missing. | ||
|
||
[34mhttps://on.cypress.io/required-dependencies[39m | ||
|
||
If you are using Docker, we provide containers with all required dependencies installed. | ||
|
||
---------- | ||
|
||
Platform: test platform (Foo-OsVersion) | ||
Cypress Version: 1.2.3 | ||
` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,6 +95,9 @@ https://on.cypress.io/installing-cypress | |
exports['invalid cache directory 1'] = ` | ||
Error: Cypress cannot write to the cache directory due to file permissions | ||
|
||
See discussion and possible solutions at | ||
https://github.com/cypress-io/cypress/issues/1281 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. filled missing solution for this error, pointing at the GH issue |
||
|
||
---------- | ||
|
||
Failed to access /invalid/cache/dir: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,7 +159,7 @@ Error: Cypress verification timed out. | |
|
||
This command failed with the following output: | ||
|
||
/cache/Cypress/1.2.3/Cypress.app/Contents/MacOS/Cypress --smoke-test --ping=222 | ||
/cache/Cypress/1.2.3/Cypress.app/Contents/MacOS/Cypress --smoke-test --ping=222 --enable-logging | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. when verifying Cypress enable logging so we can tell if this is display error |
||
|
||
---------- | ||
|
||
|
@@ -181,7 +181,7 @@ Error: Cypress verification failed. | |
|
||
This command failed with the following output: | ||
|
||
/cache/Cypress/1.2.3/Cypress.app/Contents/MacOS/Cypress --smoke-test --ping=222 | ||
/cache/Cypress/1.2.3/Cypress.app/Contents/MacOS/Cypress --smoke-test --ping=222 --enable-logging | ||
|
||
---------- | ||
|
||
|
@@ -203,7 +203,7 @@ Error: Cypress verification failed. | |
|
||
This command failed with the following output: | ||
|
||
/cache/Cypress/1.2.3/Cypress.app/Contents/MacOS/Cypress --smoke-test --ping=222 | ||
/cache/Cypress/1.2.3/Cypress.app/Contents/MacOS/Cypress --smoke-test --ping=222 --enable-logging | ||
|
||
---------- | ||
|
||
|
@@ -384,3 +384,38 @@ Platform: darwin (Foo-OsVersion) | |
Cypress Version: 1.2.3 | ||
|
||
` | ||
|
||
exports['tried to verify twice, on the first try got the DISPLAY error'] = ` | ||
Cypress failed to start. | ||
|
||
First, we have tried to start Cypress using your DISPLAY settings | ||
but encountered the following problem: | ||
|
||
---------- | ||
|
||
[some noise here] Gtk: cannot open display: 987 | ||
|
||
---------- | ||
|
||
Then we started our own XVFB and tried to start Cypress again, but | ||
got the following error: | ||
|
||
---------- | ||
|
||
some other error | ||
|
||
---------- | ||
|
||
This is usually caused by a missing library or dependency. | ||
|
||
The error above should indicate which dependency is missing. | ||
|
||
[34mhttps://on.cypress.io/required-dependencies[39m | ||
|
||
If you are using Docker, we provide containers with all required dependencies installed. | ||
|
||
---------- | ||
|
||
Platform: linux (Foo-OsVersion) | ||
Cypress Version: 1.2.3 | ||
` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,20 @@ const os = require('os') | |
const chalk = require('chalk') | ||
const { stripIndent, stripIndents } = require('common-tags') | ||
const { merge } = require('ramda') | ||
const la = require('lazy-ass') | ||
const is = require('check-more-types') | ||
|
||
const util = require('./util') | ||
const state = require('./tasks/state') | ||
|
||
const issuesUrl = 'https://github.com/cypress-io/cypress/issues' | ||
const docsUrl = 'https://on.cypress.io' | ||
const requiredDependenciesUrl = `${docsUrl}/required-dependencies` | ||
|
||
// TODO it would be nice if all error objects could be enforced via types | ||
// to only have description + solution properties | ||
|
||
const hr = '----------' | ||
|
||
// common errors Cypress application can encounter | ||
const failedDownload = { | ||
description: 'The Cypress App could not be downloaded.', | ||
|
@@ -21,7 +27,7 @@ const failedUnzip = { | |
solution: stripIndent` | ||
Search for an existing issue or open a GitHub issue at | ||
|
||
${chalk.blue(issuesUrl)} | ||
${chalk.blue(util.issuesUrl)} | ||
`, | ||
} | ||
|
||
|
@@ -102,6 +108,39 @@ const smokeTestFailure = (smokeTestCommand, timedOut) => { | |
} | ||
} | ||
|
||
const invalidDisplayError = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a complex error that has both the display error and the follow-up error |
||
description: 'Cypress failed to start.', | ||
solution (msg, prevMessage) { | ||
return stripIndent` | ||
First, we have tried to start Cypress using your DISPLAY settings | ||
but encountered the following problem: | ||
|
||
${hr} | ||
|
||
${prevMessage} | ||
|
||
${hr} | ||
|
||
Then we started our own XVFB and tried to start Cypress again, but | ||
got the following error: | ||
|
||
${hr} | ||
|
||
${msg} | ||
|
||
${hr} | ||
|
||
This is usually caused by a missing library or dependency. | ||
|
||
The error above should indicate which dependency is missing. | ||
|
||
${chalk.blue(requiredDependenciesUrl)} | ||
|
||
If you are using Docker, we provide containers with all required dependencies installed. | ||
` | ||
}, | ||
} | ||
|
||
const missingDependency = { | ||
description: 'Cypress failed to start.', | ||
// this message is too Linux specific | ||
|
@@ -118,7 +157,10 @@ const missingDependency = { | |
|
||
const invalidCacheDirectory = { | ||
description: 'Cypress cannot write to the cache directory due to file permissions', | ||
solution: '', | ||
solution: stripIndent` | ||
See discussion and possible solutions at | ||
${chalk.blue(util.getGitHubIssueUrl(1281))} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. at least give the relevant issue url |
||
`, | ||
} | ||
|
||
const versionMismatch = { | ||
|
@@ -135,7 +177,7 @@ const unexpected = { | |
|
||
Check if there is a GitHub issue describing this crash: | ||
|
||
${chalk.blue(issuesUrl)} | ||
${chalk.blue(util.issuesUrl)} | ||
|
||
Consider opening a new issue. | ||
`, | ||
|
@@ -191,10 +233,8 @@ function addPlatformInformation (info) { | |
/** | ||
* Forms nice error message with error and platform information, | ||
* and if possible a way to solve it. Resolves with a string. | ||
*/ | ||
function formErrorText (info, msg) { | ||
const hr = '----------' | ||
|
||
*/ | ||
function formErrorText (info, msg, prevMessage) { | ||
return addPlatformInformation(info) | ||
.then((obj) => { | ||
const formatted = [] | ||
|
@@ -205,20 +245,41 @@ function formErrorText (info, msg) { | |
) | ||
} | ||
|
||
add(` | ||
${obj.description} | ||
la(is.unemptyString(obj.description), | ||
'expected error description to be text', obj.description) | ||
|
||
${obj.solution} | ||
// assuming that if there the solution is a function it will handle | ||
// error message and (optional previous error message) | ||
if (is.fn(obj.solution)) { | ||
const text = obj.solution(msg, prevMessage) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if error solution property is a function, let it form the full error text |
||
|
||
`) | ||
la(is.unemptyString(text), 'expected solution to be text', text) | ||
|
||
if (msg) { | ||
add(` | ||
${hr} | ||
${obj.description} | ||
|
||
${msg} | ||
${text} | ||
|
||
`) | ||
} else { | ||
la(is.unemptyString(obj.solution), | ||
'expected error solution to be text', obj.solution) | ||
|
||
add(` | ||
${obj.description} | ||
|
||
${obj.solution} | ||
|
||
`) | ||
|
||
if (msg) { | ||
add(` | ||
${hr} | ||
|
||
${msg} | ||
|
||
`) | ||
} | ||
} | ||
|
||
add(` | ||
|
@@ -248,23 +309,24 @@ const raise = (text) => { | |
} | ||
|
||
const throwFormErrorText = (info) => { | ||
return (msg) => { | ||
return formErrorText(info, msg) | ||
return (msg, prevMessage) => { | ||
return formErrorText(info, msg, prevMessage) | ||
.then(raise) | ||
} | ||
} | ||
|
||
module.exports = { | ||
raise, | ||
// formError, | ||
formErrorText, | ||
throwFormErrorText, | ||
hr, | ||
errors: { | ||
nonZeroExitCodeXvfb, | ||
missingXvfb, | ||
missingApp, | ||
notInstalledCI, | ||
missingDependency, | ||
invalidDisplayError, | ||
versionMismatch, | ||
binaryNotExecutable, | ||
unexpected, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added ability to have error solution being a function, not just static text