Philipp Schrader | ba072d9 | 2024-02-21 17:00:37 -0800 | [diff] [blame] | 1 | import {defineConfig} from 'cypress'; |
Philipp Schrader | 175a93c | 2023-02-19 13:13:40 -0800 | [diff] [blame] | 2 | |
Philipp Schrader | ba072d9 | 2024-02-21 17:00:37 -0800 | [diff] [blame] | 3 | export default defineConfig({ |
Philipp Schrader | 175a93c | 2023-02-19 13:13:40 -0800 | [diff] [blame] | 4 | e2e: { |
| 5 | specPattern: ['*.cy.js'], |
| 6 | supportFile: false, |
| 7 | setupNodeEvents(on, config) { |
| 8 | on('before:browser:launch', (browser = {}, launchOptions) => { |
| 9 | launchOptions.args.push('--disable-gpu-shader-disk-cache'); |
Philipp Schrader | 54cae03 | 2023-02-26 15:08:31 -0800 | [diff] [blame] | 10 | launchOptions.args.push('--enable-logging'); |
| 11 | launchOptions.args.push('--v=stderr'); |
Philipp Schrader | e2e27ff | 2024-02-25 22:08:55 -0800 | [diff] [blame] | 12 | |
| 13 | // Point the browser at a video file to use as a webcam. This lets us |
| 14 | // validate things like QR code scanning. |
| 15 | launchOptions.args.push('--use-fake-ui-for-media-stream'); |
| 16 | launchOptions.args.push('--use-fake-device-for-media-stream'); |
| 17 | const fakeCameraVideo = `${process.env.TEST_UNDECLARED_OUTPUTS_DIR}/fake_camera.mjpeg`; |
| 18 | launchOptions.args.push(`--use-file-for-fake-video-capture=${fakeCameraVideo}`); |
| 19 | |
Philipp Schrader | 54cae03 | 2023-02-26 15:08:31 -0800 | [diff] [blame] | 20 | return launchOptions; |
Philipp Schrader | 175a93c | 2023-02-19 13:13:40 -0800 | [diff] [blame] | 21 | }); |
| 22 | |
| 23 | // Lets users print to the console: |
| 24 | // cy.task('log', 'message here'); |
| 25 | on('task', { |
| 26 | log(message) { |
| 27 | console.log(message); |
| 28 | return null; |
| 29 | }, |
| 30 | }); |
| 31 | }, |
| 32 | }, |
| 33 | }); |