Fix mixed use of both XVFB and Xvfb to all be Xvfb (#4262)

This commit is contained in:
Jennifer Shehane
2019-05-21 21:03:59 +06:30
committed by Zach Bloomquist
parent 031ae7087b
commit cacd122c67
10 changed files with 29 additions and 26 deletions

View File

@@ -10,9 +10,9 @@ Cypress Version: 1.2.3
`
exports['errors .errors.formErrorText returns fully formed text message 1'] = `
Your system is missing the dependency: XVFB
Your system is missing the dependency: Xvfb
Install XVFB and run Cypress again.
Install Xvfb and run Cypress again.
Read our documentation on dependencies for more information:
@@ -47,7 +47,7 @@ exports['errors individual has the following errors 1'] = [
exports['invalid display error'] = `
Cypress verification failed.
Cypress failed to start after spawning a new XVFB server.
Cypress failed to start after spawning a new Xvfb server.
The error logs we received were:

View File

@@ -364,7 +364,7 @@ It looks like this is your first time using Cypress: 1.2.3
✖ Verifying Cypress can run /cache/Cypress/1.2.3/Cypress.app
STRIPPED
Error: XVFB exited with a non zero exit code.
Error: Xvfb exited with a non zero exit code.
There was a problem spawning Xvfb.
@@ -384,7 +384,7 @@ Cypress Version: 1.2.3
exports['tried to verify twice, on the first try got the DISPLAY error'] = `
Cypress verification failed.
Cypress failed to start after spawning a new XVFB server.
Cypress failed to start after spawning a new Xvfb server.
The error logs we received were:

View File

@@ -75,7 +75,7 @@ const notInstalledCI = (executable) => {
}
const nonZeroExitCodeXvfb = {
description: 'XVFB exited with a non zero exit code.',
description: 'Xvfb exited with a non zero exit code.',
solution: stripIndent`
There was a problem spawning Xvfb.
@@ -84,9 +84,9 @@ const nonZeroExitCodeXvfb = {
}
const missingXvfb = {
description: 'Your system is missing the dependency: XVFB',
description: 'Your system is missing the dependency: Xvfb',
solution: stripIndent`
Install XVFB and run Cypress again.
Install Xvfb and run Cypress again.
Read our documentation on dependencies for more information:
@@ -113,7 +113,7 @@ const invalidSmokeTestDisplayError = {
description: 'Cypress verification failed.',
solution (msg) {
return stripIndent`
Cypress failed to start after spawning a new XVFB server.
Cypress failed to start after spawning a new Xvfb server.
The error logs we received were:

View File

@@ -51,7 +51,7 @@ function getStdio (needsXvfb) {
if (needsStderrPiped(needsXvfb)) {
// returning pipe here so we can massage stderr
// and remove garbage from Xlib and libuv
// due to starting the XVFB process on linux
// due to starting the Xvfb process on linux
return ['inherit', 'inherit', 'pipe']
}
@@ -67,7 +67,7 @@ module.exports = {
executable = path.resolve(util.getEnv('CYPRESS_RUN_BINARY'))
}
debug('needs to start own XVFB?', needsXvfb)
debug('needs to start own Xvfb?', needsXvfb)
// always push cwd into the args
args = [].concat(args, '--cwd', process.cwd())
@@ -227,7 +227,7 @@ module.exports = {
// if we are on linux and there's already a DISPLAY
// set, then we may need to rerun cypress after
// spawning our own XVFB server
// spawning our own Xvfb server
const linuxWithDisplayEnv = util.isPossibleLinuxWithIncorrectDisplay()
return userFriendlySpawn(linuxWithDisplayEnv)

View File

@@ -22,7 +22,7 @@ module.exports = {
_xvfb: xvfb, // expose for testing
start () {
debug('Starting XVFB')
debug('Starting Xvfb')
return xvfb.startAsync()
.return(null)
@@ -37,7 +37,7 @@ module.exports = {
},
stop () {
debug('Stopping XVFB')
debug('Stopping Xvfb')
return xvfb.stopAsync()
.return(null)
@@ -57,7 +57,7 @@ module.exports = {
const message = stripIndent`
DISPLAY environment variable is set to ${process.env.DISPLAY} on Linux
Assuming this DISPLAY points at working X11 server,
Cypress will not spawn own XVFB
Cypress will not spawn own Xvfb
NOTE: if the X11 server is NOT working, Cypress will exit without explanation,
see ${issueUrl}
@@ -71,7 +71,7 @@ module.exports = {
}
debug('undefined DISPLAY environment variable')
debug('Cypress will spawn its own XVFB')
debug('Cypress will spawn its own Xvfb')
return true
},

View File

@@ -68,7 +68,7 @@ const runSmokeTest = (binaryDir, options) => {
const needsXvfb = xvfb.isNeeded()
debug('needs XVFB?', needsXvfb)
debug('needs Xvfb?', needsXvfb)
/**
* Spawn Cypress running smoke test to check if all operating system
@@ -138,7 +138,7 @@ const runSmokeTest = (binaryDir, options) => {
// if we are on linux and there's already a DISPLAY
// set, then we may need to rerun cypress after
// spawning our own XVFB server
// spawning our own Xvfb server
const linuxWithDisplayEnv = util.isPossibleLinuxWithIncorrectDisplay()
return userFriendlySpawn(linuxWithDisplayEnv)

View File

@@ -36,7 +36,7 @@ function normalizeModuleOptions (options = {}) {
/**
* Returns true if the platform is Linux. We do a lot of different
* stuff on Linux (like XVFB) and it helps to has readable code
* stuff on Linux (like Xvfb) and it helps to has readable code
*/
const isLinux = () => {
return os.platform() === 'linux'
@@ -58,7 +58,7 @@ const isPossibleLinuxWithIncorrectDisplay = () => {
}
const logBrokenGtkDisplayWarning = () => {
debug('Cypress exited due to a broken gtk display because of a potential invalid DISPLAY env... retrying after starting XVFB')
debug('Cypress exited due to a broken gtk display because of a potential invalid DISPLAY env... retrying after starting Xvfb')
// if we get this error, we are on Linux and DISPLAY is set
logger.warn(stripIndent`

View File

@@ -153,7 +153,7 @@ describe('lib/exec/spawn', function () {
expect(xvfb.start).to.have.been.calledOnce
expect(xvfb.stop).to.have.been.calledOnce
expect(cp.spawn).to.have.been.calledTwice
// second code should be 0 after successfully running with XVFB
// second code should be 0 after successfully running with Xvfb
expect(code).to.equal(0)
})
})

View File

@@ -33,11 +33,13 @@ describe('lib/exec/xvfb', function () {
context('#start', function () {
it('passes', function () {
sinon.stub(xvfb._xvfb, 'startAsync').resolves()
return xvfb.start()
})
it('fails with error message', function () {
const message = 'nope'
sinon.stub(xvfb._xvfb, 'startAsync').rejects(new Error(message))
return xvfb.start()
@@ -51,6 +53,7 @@ describe('lib/exec/xvfb', function () {
it('fails when xvfb exited with non zero exit code', function () {
const e = new Error('something bad happened')
e.nonZeroExitCode = true
sinon.stub(xvfb._xvfb, 'startAsync').rejects(e)
@@ -62,7 +65,7 @@ describe('lib/exec/xvfb', function () {
.catch((err) => {
expect(err.known).to.be.true
expect(err.message).to.include('something bad happened')
expect(err.message).to.include('XVFB exited with a non zero exit code.')
expect(err.message).to.include('Xvfb exited with a non zero exit code.')
})
})
})

View File

@@ -285,7 +285,7 @@ context('lib/tasks/verify', () => {
})
})
describe('smoke test retries on bad display with our XVFB', () => {
describe('smoke test retries on bad display with our Xvfb', () => {
let restore
beforeEach(() => {
@@ -307,7 +307,7 @@ context('lib/tasks/verify', () => {
restore()
})
it('successfully retries with our XVFB on Linux', () => {
it('successfully retries with our Xvfb on Linux', () => {
// initially we think the user has everything set
xvfb.isNeeded.returns(false)
sinon.stub(util, 'isPossibleLinuxWithIncorrectDisplay').returns(true)
@@ -340,7 +340,7 @@ context('lib/tasks/verify', () => {
})
})
it('fails on both retries with our XVFB on Linux', () => {
it('fails on both retries with our Xvfb on Linux', () => {
// initially we think the user has everything set
xvfb.isNeeded.returns(false)
@@ -378,7 +378,7 @@ context('lib/tasks/verify', () => {
})
.catch((e) => {
expect(util.exec).to.have.been.calledTwice
// second time around we should have called XVFB
// second time around we should have called Xvfb
expect(xvfb.start).to.have.been.calledOnce
expect(xvfb.stop).to.have.been.calledOnce