diff --git a/.gitignore b/.gitignore index 768101a79..101466aca 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ node_modules /dist __image_snapshots_local__ +tests/e2e/fixtures/qr-code-videos/video.y4m # Cordova files /www diff --git a/cypress.config.js b/cypress.config.js index f1348dca4..b30e0815f 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -1,3 +1,5 @@ +const path = require('path'); +const fs = require('fs'); const { defineConfig } = require('cypress'); // TODO: remove after fixing https://github.com/import-js/eslint-plugin-import/issues/1810 // eslint-disable-next-line import/no-unresolved @@ -17,6 +19,28 @@ module.exports = defineConfig({ experimentalRunAllSpecs: true, setupNodeEvents(on, config) { initPlugin(on, config); + + const videoPath = path.resolve('tests/e2e/fixtures/qr-code-videos/video.y4m'); + const defaultVideoPath = path.resolve('tests/e2e/fixtures/qr-code-videos/default.y4m'); + + on('before:browser:launch', (browser, launchOptions) => { + if (fs.existsSync(videoPath)) fs.unlinkSync(videoPath); + fs.linkSync(defaultVideoPath, videoPath); + + if (browser.family === 'chromium' && browser.name !== 'electron') { + launchOptions.args.push(`--use-file-for-fake-video-capture=${videoPath}`); + } + return launchOptions; + }); + + on('task', { + changeVideoSource(videoSource) { + const sourceVideoPath = path.join('tests/e2e/fixtures/qr-code-videos', videoSource); + fs.unlinkSync(videoPath); + fs.linkSync(sourceVideoPath, videoPath); + return null; + }, + }); }, }, }); diff --git a/src/components/AeInputAccount.vue b/src/components/AeInputAccount.vue index 5f4ef11c6..276ef1b51 100644 --- a/src/components/AeInputAccount.vue +++ b/src/components/AeInputAccount.vue @@ -64,7 +64,7 @@