How to use `--use-file-for-fake-video-capture` with `cypress run`
See original GitHub issueWhat would you like?
https://docs.cypress.io/api/plugins/browser-launch-api#Use-fake-video-for-webcam-testing I followed the docs to override default video input to test my app, it works well with Chrome but not with Electron.
To be exact, I test with a .mjpeg
file like so
cypress/plugins/index.ts
/// <reference types="cypress" />
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
/**
* @type {Cypress.PluginConfig}
*/
module.exports = (
on: Cypress.PluginEvents,
config: Cypress.PluginConfigOptions
) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
on(
'before:browser:launch',
(
browser = {
name: '',
family: 'chromium',
channel: '',
displayName: '',
version: '',
majorVersion: '',
path: '',
isHeaded: false,
isHeadless: false,
},
launchOptions
) => {
if (browser.family === 'chromium') {
launchOptions.args.push(
'--use-file-for-fake-video-capture=cypress/fixtures/assets/fake-video.mjpeg'
);
}
return launchOptions;
}
);
return config;
};
The supplied video is still this green pie chart, does Electron need extra config steps ?
It seems that Electron supports this feature so I’m curious about why it’s not working out of the box https://github.com/electron/electron/issues/4505
Why is this needed?
I need to test video upload both locally and in CI and it currently only works with cypress open
not cypress run
Other
No response
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Command Line - Cypress Documentation
What you'll learn How to run Cypress from the command line How to specify which spec files to run How to launch other...
Read more >cypress-io/cypress - Gitter
Hi, I have a problem. i have two cameras in a test flow. Videos and must go through both with different. Using fake-video...
Read more >How to run Cypress tests via CLI - YouTube
In this video we will learn to run cypress tests via command line interface.TOPICS COVERED:- running all tests in headless mode- running all ......
Read more >How to Run Cypress Tests in Chrome and Edge | BrowserStack
This article will demonstrate how to use Cypress browser website test cases on Google Chrome and Microsoft Edge with examples.
Read more >How can I get Cypress to run a specific folder of tests by ...
I think you're looking for --spec path/to/folder/*.js. You can run all the tests in a folder, or even in all subfolders of a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m going to close this issue for now, We appear to be passing the flag correctly to electron, but electron doesn’t appear to honor it.
Based on the issue you linked, it seems like
--use-file-for-fake-video-capture
should work in electron but it definitely doesn’t. It seems like it is an electron issue? We do pass the flag to electron, but it doesn’t seem to honor it.