X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/ac975ab3e027c2b7bca986f218e6e81c45f292cb..3836b03c452312671a8799215c79542867e43338:/cypress/plugins/index.js diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js index b11d5528..132f9b0d 100644 --- a/cypress/plugins/index.js +++ b/cypress/plugins/index.js @@ -16,10 +16,29 @@ // This function is called when a project is opened or re-opened (e.g. due to // the project's config changing) +const fs = require('fs'); +const path = require('path'); + /** * @type {Cypress.PluginConfig} */ module.exports = (on, config) => { // `on` is used to hook into various events Cypress emits // `config` is the resolved Cypress config + on("before:browser:launch", (browser = {}, launchOptions) => { + const downloadDirectory = path.join(__dirname, "..", "downloads"); + if (browser.family === 'chromium' && browser.name !== 'electron') { + launchOptions.preferences.default["download"] = { + default_directory: downloadDirectory + }; + } + return launchOptions; + }); + + on('task', { + clearDownload({ filename }) { + fs.unlinkSync(filename); + return null; + } + }); }