From 74c5452590afc27b4242949d1b6565a9a105c1f6 Mon Sep 17 00:00:00 2001 From: Ryan Duffy Date: Sat, 10 Sep 2022 14:07:19 -0700 Subject: [PATCH 1/7] Update browser launch options for env key --- content/api/plugins/browser-launch-api.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/content/api/plugins/browser-launch-api.md b/content/api/plugins/browser-launch-api.md index b4db037704..08e7e17eb5 100644 --- a/content/api/plugins/browser-launch-api.md +++ b/content/api/plugins/browser-launch-api.md @@ -48,10 +48,11 @@ following properties: | `preferences` | `object` | An object describing browser preferences. Differs between browsers. See [Changing browser preferences](#Changing-browser-preferences) for details. | | `args` | `string[]` | An array of strings that will be passed as command-line args when the browser is launched. Has no effect on Electron. See [Modify browser launch arguments](#Modify-browser-launch-arguments) for details. | | `extensions` | `string[]` | An array of paths to folders containing unpacked WebExtensions to be loaded before the browser starts. Note: Electron currently only supports Chrome DevTools extensions. See [Add browser extensions](#Add-browser-extensions) for details. | +| `env` | `object` | An object of environment variables set before launching the browser. See [Configure browser environment](#Configure-browser-environment) for details. | ## Usage -### Modify browser launch arguments, preferences, and extensions +### Modify browser launch arguments, preferences, extensions, and environment Using the [setupNodeEvents](/guides/tooling/plugins-guide#Using-a-plugin) function you can tap into the `before:browser:launch` event and modify how @@ -120,6 +121,24 @@ on('before:browser:launch', (browser, launchOptions) => { ::: +#### Configure browser environment: + + +This option is not supported when targeting electron + + +:::cypress-plugin-example + +```js +on('before:browser:launch', (browser, launchOptions) => { + launchOptions.env.CUSTOM_ENV_VALUE = '1' + + return launchOptions +}) +``` + +::: + #### Changing browser preferences: Here are preferences available for the currently supported browsers: From 393b59d43c6d414bacb8932cb7f15b8f22abe2e9 Mon Sep 17 00:00:00 2001 From: Ryan Duffy Date: Sun, 11 Sep 2022 16:55:06 -0700 Subject: [PATCH 2/7] Update content/api/plugins/browser-launch-api.md Co-authored-by: Lachlan Miller --- content/api/plugins/browser-launch-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/api/plugins/browser-launch-api.md b/content/api/plugins/browser-launch-api.md index 08e7e17eb5..0134ad0a5f 100644 --- a/content/api/plugins/browser-launch-api.md +++ b/content/api/plugins/browser-launch-api.md @@ -48,7 +48,7 @@ following properties: | `preferences` | `object` | An object describing browser preferences. Differs between browsers. See [Changing browser preferences](#Changing-browser-preferences) for details. | | `args` | `string[]` | An array of strings that will be passed as command-line args when the browser is launched. Has no effect on Electron. See [Modify browser launch arguments](#Modify-browser-launch-arguments) for details. | | `extensions` | `string[]` | An array of paths to folders containing unpacked WebExtensions to be loaded before the browser starts. Note: Electron currently only supports Chrome DevTools extensions. See [Add browser extensions](#Add-browser-extensions) for details. | -| `env` | `object` | An object of environment variables set before launching the browser. See [Configure browser environment](#Configure-browser-environment) for details. | +| `env` | `object` | An object of environment variables to pass to the launched browser. See [Configure browser environment](#Configure-browser-environment) for details. | ## Usage From 5e063f7c909074ddbc496eb1206b1740edcd020e Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Mon, 12 Sep 2022 11:06:38 -0500 Subject: [PATCH 3/7] Update content/api/plugins/browser-launch-api.md --- content/api/plugins/browser-launch-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/api/plugins/browser-launch-api.md b/content/api/plugins/browser-launch-api.md index 0134ad0a5f..2e60d61c1f 100644 --- a/content/api/plugins/browser-launch-api.md +++ b/content/api/plugins/browser-launch-api.md @@ -124,7 +124,7 @@ on('before:browser:launch', (browser, launchOptions) => { #### Configure browser environment: -This option is not supported when targeting electron +This option is not supported when targeting Electron. :::cypress-plugin-example From fb7d9b2c559f649a35393d098f1f11dfeb3b14fa Mon Sep 17 00:00:00 2001 From: Adam Murray Date: Wed, 21 Sep 2022 10:16:03 -0500 Subject: [PATCH 4/7] feat(plugins): add chrome recorder extension to plugin list --- content/_data/plugins.json | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/content/_data/plugins.json b/content/_data/plugins.json index 906279a290..2d1cb6e2a3 100644 --- a/content/_data/plugins.json +++ b/content/_data/plugins.json @@ -342,6 +342,13 @@ "link": "https://github.com/nils-hoyer/cypress-fail-on-console-error", "keywords": ["console", "error", "fail"], "badge": "community" + }, + { + "name": "Cypress Chrome Recorder Extension", + "description": "Official Cypress extension for Chrome DevTools that allows you to export tests directly from the Recorder panel.", + "link": "https://chrome.google.com/webstore/detail/cypress-chrome-recorder/fellcphjglholofndfmmjmheedhomgin", + "keywords": ["recording", "chrome", "extension", "devtools"], + "badge": "official" } ] }, @@ -608,7 +615,13 @@ "name": "cypress-forced-colors", "description": "Cypress commands to enable and disable browser forced colors mode", "link": "https://github.com/ling1726/cypress-forced-colors", - "keywords": ["forced colors", "high contrast", "high contrast mode", "contrast", "testing"], + "keywords": [ + "forced colors", + "high contrast", + "high contrast mode", + "contrast", + "testing" + ], "badge": "community" }, { @@ -650,12 +663,12 @@ "link": "https://picklejs.com", "keywords": ["cucumber", "collection", "actions", "commands"], "badge": "community" - }, + }, { "name": "Pact Cypress Adapter", "description": "Simple commands to generate Pact contracts from your existing Cypress tests, maintained by the Pactflow team", "link": "https://github.com/pactflow/pact-cypress-adapter", - "keywords": ["pact","pactflow", "contract testing", "commands"], + "keywords": ["pact", "pactflow", "contract testing", "commands"], "badge": "community" } ] @@ -961,10 +974,7 @@ "name": "Cypress Chrome Recorder", "description": "Tool for exporting Cypress Tests from Google Chrome DevTools' Recordings", "link": "https://github.com/cypress-io/cypress-chrome-recorder", - "keywords": [ - "visual testing", - "recorder" - ], + "keywords": ["visual testing", "recorder"], "badge": "experimental" } ] From ef719f4df4fdfc38fceeb2ee3263d311cfc848c9 Mon Sep 17 00:00:00 2001 From: Adam Murray Date: Wed, 21 Sep 2022 15:03:50 -0500 Subject: [PATCH 5/7] Update content/_data/plugins.json Co-authored-by: Paul Jaffre --- content/_data/plugins.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/_data/plugins.json b/content/_data/plugins.json index 2d1cb6e2a3..9b13e2bb29 100644 --- a/content/_data/plugins.json +++ b/content/_data/plugins.json @@ -345,7 +345,7 @@ }, { "name": "Cypress Chrome Recorder Extension", - "description": "Official Cypress extension for Chrome DevTools that allows you to export tests directly from the Recorder panel.", + "description": "Official Cypress extension for Chrome DevTools that allows you to export Cypress tests directly from the Recorder panel.", "link": "https://chrome.google.com/webstore/detail/cypress-chrome-recorder/fellcphjglholofndfmmjmheedhomgin", "keywords": ["recording", "chrome", "extension", "devtools"], "badge": "official" From 2173300cc1b863b8fe4f52824be1af9a77a15a2d Mon Sep 17 00:00:00 2001 From: Lachlan Miller Date: Thu, 22 Sep 2022 14:26:07 +1000 Subject: [PATCH 6/7] docs: add dev server function config API (#4699) * docs: add dev server function config API * update docs --- .../component-framework-configuration.md | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/content/guides/component-testing/component-framework-configuration.md b/content/guides/component-testing/component-framework-configuration.md index 73a33b3c32..af54219aec 100644 --- a/content/guides/component-testing/component-framework-configuration.md +++ b/content/guides/component-testing/component-framework-configuration.md @@ -215,6 +215,15 @@ module.exports = defineConfig({ devServer: { framework: 'react', bundler: 'vite', + // optionally pass in vite config + viteConfig: require('./webpack.config'), + // or a function - the result is merged with + // any `vite.config` file that is detected + viteConfig: async () => { + // ... do things ... + const modifiedConfig = await injectCustomConfig(baseConfig) + return modifiedConfig + }, }, }, }) @@ -225,12 +234,22 @@ module.exports = defineConfig({ ```ts import { defineConfig } from 'cypress' +import customViteConfig from './customConfig' export default defineConfig({ component: { devServer: { framework: 'react', bundler: 'vite', + // optionally pass in vite config + viteConfig: customViteConfig, + // or a function - the result is merged with + // any `vite.config` file that is detected + viteConfig: async () => { + // ... do things ... + const modifiedConfig = await injectCustomConfig(baseConfig) + return modifiedConfig + }, }, }, }) @@ -260,6 +279,13 @@ module.exports = { bundler: 'webpack', // optionally pass in webpack config webpackConfig: require('./webpack.config'), + // or a function - the result is merged with any + // webpack.config that is found + webpackConfig: async () => { + // ... do things ... + const modifiedConfig = await injectCustomConfig(baseConfig) + return modifiedConfig + }, }, }, } @@ -279,6 +305,13 @@ export default defineConfig({ bundler: 'webpack', // optionally pass in webpack config webpackConfig, + // or a function - the result is merged with any + // webpack.config that is found + webpackConfig: async () => { + // ... do things ... + const modifiedConfig = await injectCustomConfig(baseConfig) + return modifiedConfig + }, }, }, }) @@ -472,6 +505,13 @@ module.exports = { bundler: 'webpack', // optionally pass in webpack config webpackConfig: require('./webpack.config'), + // or a function - the result is merged with any + // webpack.config that is found + webpackConfig: async () => { + // ... do things ... + const modifiedConfig = await injectCustomConfig(baseConfig) + return modifiedConfig + }, }, }, } @@ -491,6 +531,11 @@ export default defineConfig({ bundler: 'webpack', // optionally pass in webpack config webpackConfig, + webpackConfig: async () => { + // ... do things ... + const modifiedConfig = await injectCustomConfig(baseConfig) + return modifiedConfig + }, }, }, }) @@ -675,6 +720,12 @@ module.exports = { bundler: 'webpack', // optionally pass in webpack config webpackConfig: require('./webpack.config'), + // or a function - the result is merged with the base config + webpackConfig: async () => { + // ... do things ... + const modifiedConfig = await injectCustomConfig(baseConfig) + return modifiedConfig + }, }, }, } From e39e3f1106a07a00ac34b7843512c124706ee284 Mon Sep 17 00:00:00 2001 From: Paul Jaffre Date: Thu, 22 Sep 2022 15:43:08 -0400 Subject: [PATCH 7/7] add variation of bundled-tools redirect --- netlify.toml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/netlify.toml b/netlify.toml index 4af6967cfe..59c08f8175 100644 --- a/netlify.toml +++ b/netlify.toml @@ -148,6 +148,12 @@ to = "/guides/references/bundled-libraries" status = 301 force = true + +[[redirects]] + from = "/guides/references/bundled-tools.html" + to = "/guides/references/bundled-libraries" + status = 301 + force = true [[redirects]] from = "/guides/component-testing/props-vue"