Skip to content

Commit

Permalink
add unit test for xvfb options -screen
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed Jan 22, 2020
1 parent ee0d6fa commit 9ac5fe3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cli/lib/exec/xvfb.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,27 @@ const debugXvfb = require('debug')('cypress:xvfb')
const { throwFormErrorText, errors } = require('../errors')
const util = require('../util')

const xvfb = Promise.promisifyAll(new Xvfb({
const xvfbOptions = {
timeout: 30000, // milliseconds
xvfb_args: ['-screen', '0', '1280x1024x24'], // need to explicitly define screen otherwise electron will crash
// need to explicitly define screen otherwise electron will crash
// https://github.com/cypress-io/cypress/issues/6184
xvfb_args: ['-screen', '0', '1280x1024x24'],
onStderrData (data) {
if (debugXvfb.enabled) {
debugXvfb(data.toString())
}
},
}))
}

const xvfb = Promise.promisifyAll(new Xvfb(xvfbOptions))

module.exports = {
_debugXvfb: debugXvfb, // expose for testing

_xvfb: xvfb, // expose for testing

_xvfbOptions: xvfbOptions, // expose for testing

start () {
debug('Starting Xvfb')

Expand Down
6 changes: 6 additions & 0 deletions cli/test/lib/exec/xvfb_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ describe('lib/exec/xvfb', function () {
})
})

context('xvfbOptions', function () {
it('sets explicit screen', () => {
expect(xvfb._xvfbOptions).to.have.property('xvfb_args').that.includes('-screen')
})
})

context('#start', function () {
it('passes', function () {
sinon.stub(xvfb._xvfb, 'startAsync').resolves()
Expand Down

2 comments on commit 9ac5fe3

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 9ac5fe3 Jan 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 x64 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.8.3/win32-x64/appveyor-develop-9ac5fe3935a3ab3c527218721d881e70d4caf450-30290544/cypress.zip
npm install https://cdn.cypress.io/beta/binary/3.8.3/win32-x64/appveyor-develop-9ac5fe3935a3ab3c527218721d881e70d4caf450-30290544/cypress.zip

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 9ac5fe3 Jan 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 ia32 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.8.3/win32-ia32/appveyor-develop-9ac5fe3935a3ab3c527218721d881e70d4caf450-30290544/cypress.zip
npm install https://cdn.cypress.io/beta/binary/3.8.3/win32-ia32/appveyor-develop-9ac5fe3935a3ab3c527218721d881e70d4caf450-30290544/cypress.zip

Please sign in to comment.