Installing Cypress on Homestead - Disable GPU
Hi I'm trying to install cypress on my development machine - a vagrant box running Homestead v 13.
I've installed Cypress using npm install cypress and it appears to install correctly
However when I run cypress with npx cypress open after a few seconds I get an error: ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.
I've checked the cypress requirements and have run:
apt-get install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb per the cypress guidance here: https://docs.cypress.io/guides/getting-started/installing-cypress#Linux-Prerequisites
Googling I've found similar issues but no clear fix - there is a recommendation to disable the GPU via the config : https://stackoverflow.com/questions/73443639/disabling-gpu-acceleration-in-cypress
I've placed this code:
module.exports = (on, config) => {
on('before:browser:launch', (browser = {}, launchOptions) => {
console.log(launchOptions.args)
if (browser.name == 'chrome') {
launchOptions.args.push('--disable-gpu')
}
return launchOptions
})
}
into cypress.config.js:
const { defineConfig } = require('cypress')
module.exports = defineConfig({
chromeWebSecurity: false,
retries: 2,
defaultCommandTimeout: 5000,
watchForFileChanges: false,
videosFolder: 'tests/cypress/videos',
screenshotsFolder: 'tests/cypress/screenshots',
fixturesFolder: 'tests/cypress/fixture',
e2e: {
setupNodeEvents(on, config) {
on('before:browser:launch', (browser = {}, launchOptions) => {
console.log(launchOptions.args)
if (browser.family == 'chromium') {
launchOptions.args.push('--disable-gpu')
}
return launchOptions
});
return require('./tests/cypress/plugins/index.js')(on, config)
},
baseUrl: 'http://wedleague.loc',
specPattern: 'tests/cypress/integration/**/*.cy.{js,jsx,ts,tsx}',
supportFile: 'tests/cypress/support/index.js',
},
})
module.exports = (on, config) => {
on('before:browser:launch', (browser = {}, launchOptions) => {
console.log(launchOptions.args)
if (browser.family == 'chromium') {
launchOptions.args.push('--disable-gpu')
}
return launchOptions
});
}
Wasnt sure where to place is - I'm at an early stage using Cypress but failing fast!!!
BTW i've tried using Dusk but it's extremely slow to run the basic tests so looking at alternatives (doing a new post for that issue! :)
Please or to participate in this conversation.