diff --git a/Makefile.local b/Makefile.local --- a/Makefile.local +++ b/Makefile.local @@ -92,7 +92,7 @@ bash -c "trap 'trap - SIGINT SIGTERM ERR EXIT && \ jobs -p | xargs -r kill' SIGINT SIGTERM ERR EXIT; \ python3 swh/web/manage.py runserver --nostatic --settings=$(SETTINGS_TEST) & \ - sleep 10 && $(YARN) run cypress run --config numTestsKeptInMemory=0 && \ + sleep 10 && $(YARN) run cypress run -b /tmp/chromium-latest-linux/latest/chrome --config numTestsKeptInMemory=0 && \ $(YARN) mochawesome && $(YARN) nyc-report" test-frontend: export CYPRESS_SKIP_SLOW_TESTS=1 diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js --- a/cypress/plugins/index.js +++ b/cypress/plugins/index.js @@ -7,7 +7,7 @@ const axios = require('axios'); const {execFileSync} = require('child_process'); -const fs = require('fs'); +// const fs = require('fs'); const sqlite3 = require('sqlite3').verbose(); let buildId = process.env.CYPRESS_PARALLEL_BUILD_ID; @@ -50,17 +50,23 @@ module.exports = (on, config) => { require('@cypress/code-coverage/task')(on, config); // produce JSON files prior launching browser in order to dynamically generate tests - on('before:browser:launch', function(browser, launchOptions) { - return new Promise((resolve) => { - const p1 = axios.get(`${config.baseUrl}/tests/data/content/code/extensions/`); - const p2 = axios.get(`${config.baseUrl}/tests/data/content/code/filenames/`); - Promise.all([p1, p2]) - .then(function(responses) { - fs.writeFileSync('cypress/fixtures/source-file-extensions.json', JSON.stringify(responses[0].data)); - fs.writeFileSync('cypress/fixtures/source-file-names.json', JSON.stringify(responses[1].data)); - resolve(); - }); - }); + // on('before:browser:launch', function(browser, launchOptions) { + // return new Promise((resolve) => { + // const p1 = axios.get(`${config.baseUrl}/tests/data/content/code/extensions/`); + // const p2 = axios.get(`${config.baseUrl}/tests/data/content/code/filenames/`); + // Promise.all([p1, p2]) + // .then(function(responses) { + // fs.writeFileSync('cypress/fixtures/source-file-extensions.json', JSON.stringify(responses[0].data)); + // fs.writeFileSync('cypress/fixtures/source-file-names.json', JSON.stringify(responses[1].data)); + // resolve(); + // }); + // }); + // }); + on('before:browser:launch', (browser = {}, launchOptions) => { + if (browser.family === 'chromium' && browser.name !== 'electron') { + launchOptions.args.push('--disable-gpu'); + } + return launchOptions; }); on('task', { getSwhTestsData: async() => {