1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 /// <reference types="cypress" />
6 // ***********************************************************
7 // This example plugins/index.js can be used to load plugins
9 // You can change the location of this file or turn off loading
10 // the plugins file with the 'pluginsFile' configuration option.
12 // You can read more here:
13 // https://on.cypress.io/plugins-guide
14 // ***********************************************************
16 // This function is called when a project is opened or re-opened (e.g. due to
17 // the project's config changing)
19 const fs = require('fs');
20 const path = require('path');
23 * @type {Cypress.PluginConfig}
25 module.exports = (on, config) => {
26 // `on` is used to hook into various events Cypress emits
27 // `config` is the resolved Cypress config
28 on("before:browser:launch", (browser = {}, launchOptions) => {
29 const downloadDirectory = path.join(__dirname, "..", "downloads");
30 if (browser.family === 'chromium' && browser.name !== 'electron') {
31 launchOptions.preferences.default["download"] = {
32 default_directory: downloadDirectory
39 clearDownload({ filename }) {
40 fs.unlinkSync(filename);