diff --git a/packages/server/test/support/fixtures/projects/ts-proj/cypress/plugins/index.ts b/packages/server/test/support/fixtures/projects/ts-proj/cypress/plugins/index.ts index ead516c976e9..a728da18c1f9 100644 --- a/packages/server/test/support/fixtures/projects/ts-proj/cypress/plugins/index.ts +++ b/packages/server/test/support/fixtures/projects/ts-proj/cypress/plugins/index.ts @@ -1 +1,17 @@ -export default () => {} +// Copied an example from https://docs.cypress.io/api/plugins/browser-launch-api.html#Use-fake-video-for-webcam-testing + +/// + +export default (on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions) => { + on('before:browser:launch', (browser, launchOptions) => { + if (browser.family === 'chromium' && browser.name !== 'electron') { + // Mac/Linux + //launchOptions.args.push('--use-file-for-fake-video-capture=cypress/fixtures/my-video.y4m') + + // Windows + // launchOptions.args.push('--use-file-for-fake-video-capture=c:\\path\\to\\video\\my-video.y4m') + } + + return launchOptions + }) +} diff --git a/packages/server/test/support/fixtures/projects/ts-proj/cypress/support/commands.ts b/packages/server/test/support/fixtures/projects/ts-proj/cypress/support/commands.ts index ca4d256f3eb1..176bf41439f4 100644 --- a/packages/server/test/support/fixtures/projects/ts-proj/cypress/support/commands.ts +++ b/packages/server/test/support/fixtures/projects/ts-proj/cypress/support/commands.ts @@ -1,25 +1,6 @@ -// *********************************************** -// This example commands.js shows you how to -// create various custom commands and overwrite -// existing commands. -// -// For more comprehensive examples of custom -// commands please read more here: -// https://on.cypress.io/custom-commands -// *********************************************** -// -// -// -- This is a parent command -- -// Cypress.Commands.add("login", (email, password) => { ... }) -// -// -// -- This is a child command -- -// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) -// -// -// -- This is a dual command -- -// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) -// -// -// -- This will overwrite an existing command -- -// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) +/// + +// Copied an example command from https://on.cypress.io/custom-commands +Cypress.Commands.add('clickLink', (label: string | number | RegExp) => { + cy.get('a').contains(label).click() +})