diff --git a/cli/types/cypress.d.ts b/cli/types/cypress.d.ts index 5e81ca3b6b..6bd7b57ce4 100644 --- a/cli/types/cypress.d.ts +++ b/cli/types/cypress.d.ts @@ -2858,7 +2858,7 @@ declare namespace Cypress { * Override default config options for E2E Testing runner. * @default {} */ - e2e: CoreConfigOptions + e2e: Omit /** * An array of objects defining the certificates @@ -2869,6 +2869,8 @@ declare namespace Cypress { * Handle Cypress plugins */ setupNodeEvents: (on: PluginEvents, config: PluginConfigOptions) => Promise | PluginConfigOptions + + indexHtmlFile: string } /** @@ -2971,7 +2973,7 @@ declare namespace Cypress { /** * Config options that can be assigned on cypress.config.{ts|js} file */ - type UserConfigOptions = Omit, 'baseUrl' | 'excludeSpecPattern' | 'supportFile' | 'specPattern'> + type UserConfigOptions = Omit, 'baseUrl' | 'excludeSpecPattern' | 'supportFile' | 'specPattern' | 'indexHtmlFile'> /** * Takes ComponentDevServerOpts to track the signature of the devServerConfig for the provided `devServer`, diff --git a/cli/types/tests/cypress-tests.ts b/cli/types/tests/cypress-tests.ts index 52f4bef5ca..f313467f6b 100644 --- a/cli/types/tests/cypress-tests.ts +++ b/cli/types/tests/cypress-tests.ts @@ -37,6 +37,7 @@ namespace CypressConfigTests { Cypress.config({ e2e: { baseUrl: null }}) // $ExpectType void Cypress.config({ e2e: { baseUrl: '.', }}) // $ExpectType void Cypress.config({ component: { baseUrl: '.', devServer: () => ({} as any) } }) // $ExpectError + Cypress.config({ e2e: { indexHtmlFile: 'index.html' } }) // $ExpectError Cypress.config('taskTimeout') // $ExpectType number Cypress.config('includeShadowDom') // $ExpectType boolean diff --git a/npm/webpack-dev-server/index-template.html b/npm/angular/cypress/support/component-index.html similarity index 97% rename from npm/webpack-dev-server/index-template.html rename to npm/angular/cypress/support/component-index.html index ebc248c6d5..b698582429 100644 --- a/npm/webpack-dev-server/index-template.html +++ b/npm/angular/cypress/support/component-index.html @@ -9,4 +9,4 @@
- + \ No newline at end of file diff --git a/npm/vite-dev-server/index.html b/npm/design-system/cypress/support/component-index.html similarity index 81% rename from npm/vite-dev-server/index.html rename to npm/design-system/cypress/support/component-index.html index 0471b25388..b698582429 100644 --- a/npm/vite-dev-server/index.html +++ b/npm/design-system/cypress/support/component-index.html @@ -1,12 +1,12 @@ - + - AUT Frame + Components App
- + \ No newline at end of file diff --git a/npm/react/cypress/support/component-index.html b/npm/react/cypress/support/component-index.html new file mode 100644 index 0000000000..b698582429 --- /dev/null +++ b/npm/react/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/npm/react/examples/craco/cypress/support/component-index.html b/npm/react/examples/craco/cypress/support/component-index.html new file mode 100644 index 0000000000..b698582429 --- /dev/null +++ b/npm/react/examples/craco/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/npm/react/examples/find-webpack/cypress/support/component-index.html b/npm/react/examples/find-webpack/cypress/support/component-index.html new file mode 100644 index 0000000000..b698582429 --- /dev/null +++ b/npm/react/examples/find-webpack/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/npm/react/plugins/next/index-template.html b/npm/react/examples/nextjs-webpack-5/cypress/support/component-index.html similarity index 97% rename from npm/react/plugins/next/index-template.html rename to npm/react/examples/nextjs-webpack-5/cypress/support/component-index.html index ec059c3d78..9cecea5cbb 100644 --- a/npm/react/plugins/next/index-template.html +++ b/npm/react/examples/nextjs-webpack-5/cypress/support/component-index.html @@ -10,4 +10,4 @@
- + \ No newline at end of file diff --git a/npm/react/examples/nextjs/cypress/support/component-index.html b/npm/react/examples/nextjs/cypress/support/component-index.html new file mode 100644 index 0000000000..9cecea5cbb --- /dev/null +++ b/npm/react/examples/nextjs/cypress/support/component-index.html @@ -0,0 +1,13 @@ + + + + + + + Components App +
+ + +
+ + \ No newline at end of file diff --git a/npm/react/examples/react-scripts-folder/cypress/support/component-index.html b/npm/react/examples/react-scripts-folder/cypress/support/component-index.html new file mode 100644 index 0000000000..b698582429 --- /dev/null +++ b/npm/react/examples/react-scripts-folder/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/npm/react/examples/react-scripts-typescript/cypress/support/component-index.html b/npm/react/examples/react-scripts-typescript/cypress/support/component-index.html new file mode 100644 index 0000000000..b698582429 --- /dev/null +++ b/npm/react/examples/react-scripts-typescript/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/npm/react/examples/react-scripts/cypress/support/component-index.html b/npm/react/examples/react-scripts/cypress/support/component-index.html new file mode 100644 index 0000000000..b698582429 --- /dev/null +++ b/npm/react/examples/react-scripts/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/npm/react/examples/sass-and-ts/cypress/support/component-index.html b/npm/react/examples/sass-and-ts/cypress/support/component-index.html new file mode 100644 index 0000000000..b698582429 --- /dev/null +++ b/npm/react/examples/sass-and-ts/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/npm/react/examples/snapshots/cypress/support/component-index.html b/npm/react/examples/snapshots/cypress/support/component-index.html new file mode 100644 index 0000000000..b698582429 --- /dev/null +++ b/npm/react/examples/snapshots/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/npm/react/examples/using-babel-typescript/cypress/support/component-index.html b/npm/react/examples/using-babel-typescript/cypress/support/component-index.html new file mode 100644 index 0000000000..b698582429 --- /dev/null +++ b/npm/react/examples/using-babel-typescript/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/npm/react/examples/using-babel/cypress/support/component-index.html b/npm/react/examples/using-babel/cypress/support/component-index.html new file mode 100644 index 0000000000..b698582429 --- /dev/null +++ b/npm/react/examples/using-babel/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/npm/react/examples/visual-sudoku/cypress/support/component-index.html b/npm/react/examples/visual-sudoku/cypress/support/component-index.html new file mode 100644 index 0000000000..b698582429 --- /dev/null +++ b/npm/react/examples/visual-sudoku/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/npm/react/examples/visual-testing-with-applitools/cypress/support/component-index.html b/npm/react/examples/visual-testing-with-applitools/cypress/support/component-index.html new file mode 100644 index 0000000000..b698582429 --- /dev/null +++ b/npm/react/examples/visual-testing-with-applitools/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/npm/react/examples/visual-testing-with-happo/cypress/support/component-index.html b/npm/react/examples/visual-testing-with-happo/cypress/support/component-index.html new file mode 100644 index 0000000000..b698582429 --- /dev/null +++ b/npm/react/examples/visual-testing-with-happo/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/npm/react/examples/visual-testing-with-percy/cypress/support/component-index.html b/npm/react/examples/visual-testing-with-percy/cypress/support/component-index.html new file mode 100644 index 0000000000..b698582429 --- /dev/null +++ b/npm/react/examples/visual-testing-with-percy/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/npm/react/examples/webpack-file/cypress/support/component-index.html b/npm/react/examples/webpack-file/cypress/support/component-index.html new file mode 100644 index 0000000000..b698582429 --- /dev/null +++ b/npm/react/examples/webpack-file/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/npm/react/examples/webpack-options/cypress/support/component-index.html b/npm/react/examples/webpack-options/cypress/support/component-index.html new file mode 100644 index 0000000000..b698582429 --- /dev/null +++ b/npm/react/examples/webpack-options/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/npm/react/plugins/babel/index.d.ts b/npm/react/plugins/babel/index.d.ts index 9f624bf50e..8b7136c913 100644 --- a/npm/react/plugins/babel/index.d.ts +++ b/npm/react/plugins/babel/index.d.ts @@ -8,12 +8,6 @@ declare namespace CypressBabelDevServer { * @returns modified final configuration */ setWebpackConfig?(config:Configuration): Configuration - - /** - * Path to an index.html file that will serve as the template in - * which your components will be rendered. - */ - indexHtmlFile?: string } /** diff --git a/npm/react/plugins/babel/index.js b/npm/react/plugins/babel/index.js index 4963dff563..c966a3ce44 100644 --- a/npm/react/plugins/babel/index.js +++ b/npm/react/plugins/babel/index.js @@ -6,7 +6,6 @@ function devServer (cypressDevServerConfig, devServerConfig = {}) { return startDevServer({ options: cypressDevServerConfig, webpackConfig: getBabelWebpackConfig(cypressDevServerConfig.config, devServerConfig), - indexHtmlFile: devServerConfig.indexHtmlFile, }) } diff --git a/npm/react/plugins/craco/index.d.ts b/npm/react/plugins/craco/index.d.ts index 15840c6425..d3b6f1b735 100644 --- a/npm/react/plugins/craco/index.d.ts +++ b/npm/react/plugins/craco/index.d.ts @@ -4,12 +4,6 @@ declare namespace CypressCracoDevServer { * The object exported of your craco.config.js file */ cracoConfig: any - - /** - * Path to an index.html file that will serve as the template in - * which your components will be rendered. - */ - indexHtmlFile?: string } /** diff --git a/npm/react/plugins/craco/index.js b/npm/react/plugins/craco/index.js index 6f5b72d313..1cdff6b6a7 100644 --- a/npm/react/plugins/craco/index.js +++ b/npm/react/plugins/craco/index.js @@ -2,13 +2,12 @@ const { startDevServer } = require('@cypress/webpack-dev-server') const { createWebpackDevConfig } = require('@craco/craco') const { getLegacyDevServer } = require('../utils/legacy-setup-dev-server') -function devServer (cypressDevServerConfig, cracoConfig, indexHtmlFile) { +function devServer (cypressDevServerConfig, cracoConfig) { process.env.FAST_REFRESH = 'false' return startDevServer({ options: cypressDevServerConfig, webpackConfig: createWebpackDevConfig(cracoConfig), - indexHtmlFile, }) } @@ -21,6 +20,6 @@ module.exports = getLegacyDevServer(devServer, (config) => { // New signature // - Note that this also includes a change to the second argument! -module.exports.devServer = (cypressDevServerConfig, { cracoConfig, indexHtmlFile }) => { - return devServer(cypressDevServerConfig, cracoConfig, indexHtmlFile) +module.exports.devServer = (cypressDevServerConfig, { cracoConfig }) => { + return devServer(cypressDevServerConfig, cracoConfig) } diff --git a/npm/react/plugins/load-webpack/index.d.ts b/npm/react/plugins/load-webpack/index.d.ts index faeaad34b6..54bf097613 100644 --- a/npm/react/plugins/load-webpack/index.d.ts +++ b/npm/react/plugins/load-webpack/index.d.ts @@ -4,12 +4,6 @@ declare namespace CypressWebpackDevServer { * Location of the weppack.config Cypress should use */ webpackFilename?: string - - /** - * Path to an index.html file that will serve as the template in - * which your components will be rendered. - */ - indexHtmlFile?: string } /** diff --git a/npm/react/plugins/load-webpack/index.js b/npm/react/plugins/load-webpack/index.js index 59ba6b0f5e..3c135132ce 100644 --- a/npm/react/plugins/load-webpack/index.js +++ b/npm/react/plugins/load-webpack/index.js @@ -15,7 +15,7 @@ function normalizeWebpackPath (config, webpackConfigPath) { * **Important:** `webpackFilename` path is relative to the project root (cypress.config.{ts|js} location) * @type {(on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions, options: { webpackFilename: string }) => Cypress.PluginConfigOptions} */ -function devServer (cypressDevServerConfig, { webpackFilename, indexHtmlFile }) { +function devServer (cypressDevServerConfig, { webpackFilename }) { const webpackConfig = tryLoadWebpackConfig(normalizeWebpackPath(cypressDevServerConfig.config, webpackFilename)) if (!webpackConfig) { @@ -25,7 +25,6 @@ function devServer (cypressDevServerConfig, { webpackFilename, indexHtmlFile }) return startDevServer({ options: cypressDevServerConfig, webpackConfig, - indexHtmlFile, }) } diff --git a/npm/react/plugins/next/index.d.ts b/npm/react/plugins/next/index.d.ts index 4e722dce8e..9c720e1b29 100644 --- a/npm/react/plugins/next/index.d.ts +++ b/npm/react/plugins/next/index.d.ts @@ -1,11 +1,5 @@ declare namespace CypressNextDevServer { - interface CypressNextDevServerConfig { - /** - * Path to an index.html file that will serve as the template in - * which your components will be rendered. - */ - indexHtmlFile?: string - } + interface CypressNextDevServerConfig {} /** * Sets up a Cypress component testing environment for your NextJs application diff --git a/npm/react/plugins/next/index.js b/npm/react/plugins/next/index.js index 7022fb181a..03e0628d15 100644 --- a/npm/react/plugins/next/index.js +++ b/npm/react/plugins/next/index.js @@ -1,8 +1,7 @@ -const path = require('path') const findNextWebpackConfig = require('./findNextWebpackConfig') const { getLegacyDevServer } = require('../utils/legacy-setup-dev-server') -async function devServer (cypressDevServerConfig, { indexHtmlFile } = {}) { +async function devServer (cypressDevServerConfig) { const webpackConfig = await findNextWebpackConfig(cypressDevServerConfig.config) // require('webpack') now points to nextjs bundled version @@ -11,7 +10,6 @@ async function devServer (cypressDevServerConfig, { indexHtmlFile } = {}) { return startDevServer({ options: cypressDevServerConfig, webpackConfig, - indexHtmlFile: indexHtmlFile || path.resolve(__dirname, 'index-template.html'), }) } diff --git a/npm/react/plugins/react-scripts/index.d.ts b/npm/react/plugins/react-scripts/index.d.ts index a932778c6d..cbaeaba7e9 100644 --- a/npm/react/plugins/react-scripts/index.d.ts +++ b/npm/react/plugins/react-scripts/index.d.ts @@ -4,12 +4,6 @@ declare namespace CypressCRADevServer { * Location of the weppack.config Cypress should use */ webpackConfigPath?: string - - /** - * Path to an index.html file that will serve as the template in - * which your components will be rendered. - */ - indexHtmlFile?: string } /** diff --git a/npm/react/plugins/react-scripts/index.js b/npm/react/plugins/react-scripts/index.js index 870f347266..45a23de6fd 100644 --- a/npm/react/plugins/react-scripts/index.js +++ b/npm/react/plugins/react-scripts/index.js @@ -4,14 +4,12 @@ const { getLegacyDevServer } = require('../utils/legacy-setup-dev-server') function devServer (cypressDevServerConfig, { webpackConfigPath, - indexHtmlFile, } = {}) { return startDevServer({ options: cypressDevServerConfig, webpackConfig: findReactScriptsWebpackConfig(cypressDevServerConfig.config, { webpackConfigPath: webpackConfigPath || 'react-scripts/config/webpack.config', }), - indexHtmlFile, }) } diff --git a/npm/vite-dev-server/cypress.config.legacy.ts b/npm/vite-dev-server/cypress.config.legacy.ts index 07587dc95d..d0b3669a8b 100644 --- a/npm/vite-dev-server/cypress.config.legacy.ts +++ b/npm/vite-dev-server/cypress.config.legacy.ts @@ -5,7 +5,6 @@ export default defineConfig({ 'video': false, 'fixturesFolder': false, 'component': { - 'supportFile': './cypress/support.js', specPattern: '**/smoke.cy.ts', // startDevServer is the legacy distribution that was renamed // to devServer to align with Cypress 10.0 configuration pitons. diff --git a/npm/vite-dev-server/cypress.config.ts b/npm/vite-dev-server/cypress.config.ts index a9d068847a..2ea7c47adc 100644 --- a/npm/vite-dev-server/cypress.config.ts +++ b/npm/vite-dev-server/cypress.config.ts @@ -5,7 +5,6 @@ export default defineConfig({ 'video': false, 'fixturesFolder': false, 'component': { - 'supportFile': './cypress/support.js', devServer, }, }) diff --git a/npm/vite-dev-server/cypress/index.html b/npm/vite-dev-server/cypress/index.html deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/npm/vite-dev-server/cypress/support/component-index.html b/npm/vite-dev-server/cypress/support/component-index.html new file mode 100644 index 0000000000..b698582429 --- /dev/null +++ b/npm/vite-dev-server/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/npm/vite-dev-server/cypress/support.js b/npm/vite-dev-server/cypress/support/component.js similarity index 100% rename from npm/vite-dev-server/cypress/support.js rename to npm/vite-dev-server/cypress/support/component.js diff --git a/npm/vite-dev-server/cypress/styles.css b/npm/vite-dev-server/cypress/support/styles.css similarity index 100% rename from npm/vite-dev-server/cypress/styles.css rename to npm/vite-dev-server/cypress/support/styles.css diff --git a/npm/vite-dev-server/src/index.ts b/npm/vite-dev-server/src/index.ts index 8efc2d43e8..8fe6333a1a 100644 --- a/npm/vite-dev-server/src/index.ts +++ b/npm/vite-dev-server/src/index.ts @@ -31,7 +31,5 @@ export const startDevServer = async ({ options, viteConfig = {} }: StartDevServe } export function devServer (cypressDevServerConfig: Cypress.DevServerConfig, devServerConfig?: CypressViteDevServerConfig) { - const { indexHtmlFile, ...viteConfig } = devServerConfig ?? {} - - return startDevServer({ options: cypressDevServerConfig, viteConfig, indexHtmlFile }) + return startDevServer({ options: cypressDevServerConfig, viteConfig: devServerConfig }) } diff --git a/npm/vite-dev-server/src/plugins/cypress.ts b/npm/vite-dev-server/src/plugins/cypress.ts index ed5b1553e4..b25cd249f3 100644 --- a/npm/vite-dev-server/src/plugins/cypress.ts +++ b/npm/vite-dev-server/src/plugins/cypress.ts @@ -30,7 +30,7 @@ export const Cypress = ( const supportFilePath = options.config.supportFile const devServerEvents = options.devServerEvents const specs = options.specs - const indexHtmlFile = options.config.devServerConfig?.indexHtmlFile + const indexHtmlFile = options.config.indexHtmlFile let specsPathsSet = getSpecsPathsSet(specs) let loader @@ -46,7 +46,7 @@ export const Cypress = ( base = config.base }, async transformIndexHtml () { - const indexHtmlPath = indexHtmlFile ? resolve(projectRoot, indexHtmlFile) : resolve(__dirname, '..', '..', 'index.html') + const indexHtmlPath = resolve(projectRoot, indexHtmlFile) debug('resolved the indexHtmlPath as', indexHtmlPath, 'from', indexHtmlFile) const indexHtmlContent = await readFile(indexHtmlPath, { encoding: 'utf8' }) diff --git a/npm/vite-dev-server/src/types.ts b/npm/vite-dev-server/src/types.ts index af601a8ee9..8b280f466a 100644 --- a/npm/vite-dev-server/src/types.ts +++ b/npm/vite-dev-server/src/types.ts @@ -1,20 +1,10 @@ import type { InlineConfig } from 'vite' -export type CypressViteDevServerConfig = Omit & { - /** - * Path to an index.html file that will serve as the template in - * which your components will be rendered. - */ - indexHtmlFile?: string -} +export type CypressViteDevServerConfig = Omit export interface StartDevServer { /* this is the Cypress dev server configuration object */ options: Cypress.DevServerConfig /* Base webpack config object used for loading component testing */ viteConfig?: CypressViteDevServerConfig - /* base html template to render in AUT */ - template?: string - /* base html template to render in AUT */ - indexHtmlFile?: string } diff --git a/npm/vue/cypress/support/component-index.html b/npm/vue/cypress/support/component-index.html new file mode 100644 index 0000000000..b698582429 --- /dev/null +++ b/npm/vue/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/npm/vue/examples/code-coverage/cypress/support/component-index.html b/npm/vue/examples/code-coverage/cypress/support/component-index.html new file mode 100644 index 0000000000..b698582429 --- /dev/null +++ b/npm/vue/examples/code-coverage/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/npm/vue/examples/vue-cli/cypress/support/component-index.html b/npm/vue/examples/vue-cli/cypress/support/component-index.html new file mode 100644 index 0000000000..b698582429 --- /dev/null +++ b/npm/vue/examples/vue-cli/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/npm/webpack-dev-server/src/index.ts b/npm/webpack-dev-server/src/index.ts index e80dc9bb46..d4ea02bc44 100644 --- a/npm/webpack-dev-server/src/index.ts +++ b/npm/webpack-dev-server/src/index.ts @@ -61,16 +61,11 @@ export async function startDevServer (startDevServerArgs: StartDevServer, exitPr export interface CypressWebpackDevServerConfig{ /* support passing a path to the user's webpack config */ webpackConfig?: WebpackConfigurationWithDevServer - /* base html template to render in AUT */ - indexHtmlFile?: string - /** @deprecated base html template to render in AUT */ - template?: string } export function devServer (cypressDevServerConfig: Cypress.DevServerConfig, devServerConfig?: CypressWebpackDevServerConfig) { return startDevServer({ options: cypressDevServerConfig, webpackConfig: devServerConfig?.webpackConfig, - indexHtmlFile: devServerConfig?.indexHtmlFile || devServerConfig?.template, }) } diff --git a/npm/webpack-dev-server/src/makeWebpackConfig.ts b/npm/webpack-dev-server/src/makeWebpackConfig.ts index b505d920bc..71d23998c1 100644 --- a/npm/webpack-dev-server/src/makeWebpackConfig.ts +++ b/npm/webpack-dev-server/src/makeWebpackConfig.ts @@ -46,7 +46,7 @@ export interface UserWebpackDevServerOptions { interface MakeWebpackConfigOptions extends CypressCTOptionsPluginOptionsWithEmitter, UserWebpackDevServerOptions { devServerPublicPathRoute: string isOpenMode: boolean - indexHtmlFile?: string + indexHtmlFile: string } const OsSeparatorRE = RegExp(`\\${path.sep}`, 'g') diff --git a/npm/webpack-dev-server/src/startServer.ts b/npm/webpack-dev-server/src/startServer.ts index ba88b28e38..1a799aceee 100644 --- a/npm/webpack-dev-server/src/startServer.ts +++ b/npm/webpack-dev-server/src/startServer.ts @@ -17,12 +17,12 @@ export interface WebpackConfigurationWithDevServer extends webpack.Configuration const debug = Debug('cypress:webpack-dev-server:start') -export async function start ({ webpackConfig: userWebpackConfig, indexHtmlFile, options, ...userOptions }: StartDevServer, exitProcess = process.exit): Promise { +export async function start ({ webpackConfig: userWebpackConfig, options, ...userOptions }: StartDevServer, exitProcess = process.exit): Promise { if (!userWebpackConfig) { debug('User did not pass in any webpack configuration') } - const { projectRoot, devServerPublicPathRoute, isTextTerminal } = options.config + const { projectRoot, devServerPublicPathRoute, isTextTerminal, indexHtmlFile } = options.config const webpackConfig = await makeWebpackConfig(userWebpackConfig || {}, { files: options.specs, @@ -41,6 +41,7 @@ export async function start ({ webpackConfig: userWebpackConfig, indexHtmlFile, // When compiling in run mode // Stop the clock early, no need to run all the tests on a failed build + if (isTextTerminal) { compiler.hooks.done.tap('cyCustomErrorBuild', function (stats) { if (stats.hasErrors()) { diff --git a/npm/webpack-dev-server/src/webpack.config.js b/npm/webpack-dev-server/src/webpack.config.js index 8b95f56ab9..17d2ba64ee 100644 --- a/npm/webpack-dev-server/src/webpack.config.js +++ b/npm/webpack-dev-server/src/webpack.config.js @@ -5,7 +5,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin') * @param {string} [template] - base template to use * @returns {import('webpack').Configuration} */ -module.exports = function makeDefaultConfig (indexHtmlFile) { +module.exports = function makeDefaultConfig (template) { return { mode: 'development', optimization: { @@ -17,8 +17,6 @@ module.exports = function makeDefaultConfig (indexHtmlFile) { filename: '[name].js', path: path.resolve(__dirname, 'dist'), }, - plugins: [new HtmlWebpackPlugin({ - template: indexHtmlFile || path.resolve(__dirname, '..', 'index-template.html'), - })], + plugins: [new HtmlWebpackPlugin({ template })], } } diff --git a/npm/webpack-dev-server/test/component-index.html b/npm/webpack-dev-server/test/component-index.html new file mode 100644 index 0000000000..b698582429 --- /dev/null +++ b/npm/webpack-dev-server/test/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/npm/webpack-dev-server/test/e2e.spec.ts b/npm/webpack-dev-server/test/e2e.spec.ts index cbb8fe9111..b412e7c642 100644 --- a/npm/webpack-dev-server/test/e2e.spec.ts +++ b/npm/webpack-dev-server/test/e2e.spec.ts @@ -56,6 +56,7 @@ const config = { supportFile: '', isTextTerminal: true, devServerPublicPathRoute: root, + indexHtmlFile: path.join(__dirname, 'component-index.html'), } as any as Cypress.ResolvedConfigOptions & Cypress.RuntimeConfigOptions describe('#startDevServer', () => { diff --git a/npm/webpack-dev-server/test/unit/makeWebpackConfig.spec.ts b/npm/webpack-dev-server/test/unit/makeWebpackConfig.spec.ts index 1cf05d6a62..f73fdeef64 100644 --- a/npm/webpack-dev-server/test/unit/makeWebpackConfig.spec.ts +++ b/npm/webpack-dev-server/test/unit/makeWebpackConfig.spec.ts @@ -16,6 +16,7 @@ describe('makeWebpackConfig', () => { supportFile: '/support.js', projectRoot: '.', files: [], + indexHtmlFile: 'index.html', }) // plugins contain circular deps which cannot be serialized in a snapshot. diff --git a/packages/app/cypress/support/component-index.html b/packages/app/cypress/support/component-index.html new file mode 100644 index 0000000000..b698582429 --- /dev/null +++ b/packages/app/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/packages/config/__snapshots__/index.spec.ts.js b/packages/config/__snapshots__/index.spec.ts.js index 3b0695fca5..d8457253c9 100644 --- a/packages/config/__snapshots__/index.spec.ts.js +++ b/packages/config/__snapshots__/index.spec.ts.js @@ -23,7 +23,8 @@ exports['src/index .getDefaultValues returns list of public config keys 1'] = { "chromeWebSecurity": true, "clientCertificates": [], "component": { - "specPattern": "**/*.cy.{js,jsx,ts,tsx}" + "specPattern": "**/*.cy.{js,jsx,ts,tsx}", + "indexHtmlFile": "cypress/support/component-index.html" }, "defaultCommandTimeout": 4000, "downloadsFolder": "cypress/downloads", diff --git a/packages/config/src/options.ts b/packages/config/src/options.ts index 3fa5fca0a7..5df9d99c5b 100644 --- a/packages/config/src/options.ts +++ b/packages/config/src/options.ts @@ -8,7 +8,9 @@ export type BreakingOptionErrorKey = | 'INTEGRATION_FOLDER_REMOVED' | 'CONFIG_FILE_INVALID_ROOT_CONFIG' | 'CONFIG_FILE_INVALID_ROOT_CONFIG_E2E' + | 'CONFIG_FILE_INVALID_ROOT_CONFIG_COMPONENT' | 'CONFIG_FILE_INVALID_TESTING_TYPE_CONFIG_COMPONENT' + | 'CONFIG_FILE_INVALID_TESTING_TYPE_CONFIG_E2E' | 'EXPERIMENTAL_COMPONENT_TESTING_REMOVED' | 'EXPERIMENTAL_SAMESITE_REMOVED' | 'EXPERIMENTAL_NETWORK_STUBBING_REMOVED' @@ -148,6 +150,7 @@ const resolvedOptions: Array = [ // runner-ct overrides defaultValue: { specPattern: defaultSpecPattern.component, + indexHtmlFile: 'cypress/support/component-index.html', }, validation: isValidConfig, canUpdateDuringTestTime: false, @@ -641,10 +644,22 @@ export const breakingRootOptions: Array = [ isWarning: false, testingTypes: ['component', 'e2e'], }, + { + name: 'indexHtmlFile', + errorKey: 'CONFIG_FILE_INVALID_ROOT_CONFIG_COMPONENT', + isWarning: false, + testingTypes: ['component'], + }, ] export const testingTypeBreakingOptions: { e2e: Array, component: Array } = { - e2e: [], + e2e: [ + { + name: 'indexHtmlFile', + errorKey: 'CONFIG_FILE_INVALID_TESTING_TYPE_CONFIG_E2E', + isWarning: false, + }, + ], component: [ { name: 'baseUrl', diff --git a/packages/errors/__snapshot-html__/CONFIG_FILE_INVALID_ROOT_CONFIG_COMPONENT.html b/packages/errors/__snapshot-html__/CONFIG_FILE_INVALID_ROOT_CONFIG_COMPONENT.html new file mode 100644 index 0000000000..a2e8b2fe13 --- /dev/null +++ b/packages/errors/__snapshot-html__/CONFIG_FILE_INVALID_ROOT_CONFIG_COMPONENT.html @@ -0,0 +1,48 @@ + + + + + + + + + + + +
The indexHtmlFile configuration option is now invalid when set from the root of the config object in Cypress version 10.0.0.
+
+It is now configured separately as a testing type property: component.indexHtmlFile
+
+{
+  component: {
+    indexHtmlFile: '...',
+  }
+}
+
+https://on.cypress.io/migration-guide
+
\ No newline at end of file diff --git a/packages/errors/__snapshot-html__/CONFIG_FILE_INVALID_TESTING_TYPE_CONFIG_E2E.html b/packages/errors/__snapshot-html__/CONFIG_FILE_INVALID_TESTING_TYPE_CONFIG_E2E.html new file mode 100644 index 0000000000..1dfb573ebd --- /dev/null +++ b/packages/errors/__snapshot-html__/CONFIG_FILE_INVALID_TESTING_TYPE_CONFIG_E2E.html @@ -0,0 +1,48 @@ + + + + + + + + + + + +
The e2e.indexHtmlFile configuration option is not valid for e2e testing.
+
+Please remove this option or add this as a component testing type property: component.indexHtmlFile
+
+{
+  e2e: {
+    indexHtmlFile: '...',
+  }
+}
+
+https://on.cypress.io/migration-guide
+
\ No newline at end of file diff --git a/packages/errors/src/errors.ts b/packages/errors/src/errors.ts index 19b0e26ea7..46fa8fb782 100644 --- a/packages/errors/src/errors.ts +++ b/packages/errors/src/errors.ts @@ -1286,6 +1286,24 @@ export const AllCypressErrors = { https://on.cypress.io/migration-guide` }, + CONFIG_FILE_INVALID_ROOT_CONFIG_COMPONENT: (errShape: BreakingErrResult) => { + const code = errPartial` + { + component: { + ${fmt.off(errShape.name)}: '...', + } + }` + + return errTemplate`\ + The ${fmt.highlight(errShape.name)} configuration option is now invalid when set from the root of the config object in ${fmt.cypressVersion(`10.0.0`)}. + + It is now configured separately as a testing type property: ${fmt.highlightSecondary(`component.${errShape.name}`)} + + ${fmt.code(code)} + + https://on.cypress.io/migration-guide` + }, + // TODO: add path to config file CONFIG_FILE_INVALID_TESTING_TYPE_CONFIG_COMPONENT: (errShape: BreakingErrResult) => { const code = errPartial` @@ -1305,6 +1323,24 @@ export const AllCypressErrors = { https://on.cypress.io/migration-guide` }, + CONFIG_FILE_INVALID_TESTING_TYPE_CONFIG_E2E: (errShape: BreakingErrResult) => { + const code = errPartial` + { + e2e: { + ${fmt.off(errShape.name)}: '...', + } + }` + + return errTemplate`\ + The ${fmt.highlight(`e2e.${errShape.name}`)} configuration option is not valid for e2e testing. + + Please remove this option or add this as a component testing type property: ${fmt.highlightSecondary(`component.${errShape.name}`)} + + ${fmt.code(code)} + + https://on.cypress.io/migration-guide` + }, + CONFIG_FILE_DEV_SERVER_IS_NOT_A_FUNCTION: (configFilePath: string, setupNodeEvents: any) => { const code = errPartial` { diff --git a/packages/errors/test/unit/visualSnapshotErrors_spec.ts b/packages/errors/test/unit/visualSnapshotErrors_spec.ts index 82a718ee3b..bc4eb17a3d 100644 --- a/packages/errors/test/unit/visualSnapshotErrors_spec.ts +++ b/packages/errors/test/unit/visualSnapshotErrors_spec.ts @@ -1087,11 +1087,21 @@ describe('visual error templates', () => { default: [{ name: 'baseUrl', configFile: '/path/to/cypress.config.js.ts' }], } }, + CONFIG_FILE_INVALID_ROOT_CONFIG_COMPONENT: () => { + return { + default: [{ name: 'indexHtmlFile', configFile: '/path/to/cypress.config.js.ts' }], + } + }, CONFIG_FILE_INVALID_TESTING_TYPE_CONFIG_COMPONENT: () => { return { default: [{ name: 'baseUrl', configFile: '/path/to/cypress.config.js.ts' }], } }, + CONFIG_FILE_INVALID_TESTING_TYPE_CONFIG_E2E: () => { + return { + default: [{ name: 'indexHtmlFile', configFile: '/path/to/cypress.config.js.ts' }], + } + }, CONFIG_FILE_DEV_SERVER_IS_NOT_A_FUNCTION: () => { return { default: ['/path/to/config.ts', {}], diff --git a/packages/frontend-shared/cypress/support/component-index.html b/packages/frontend-shared/cypress/support/component-index.html new file mode 100644 index 0000000000..b698582429 --- /dev/null +++ b/packages/frontend-shared/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/packages/graphql/schemas/schema.graphql b/packages/graphql/schemas/schema.graphql index 80ccab9b2a..34fc5a476b 100644 --- a/packages/graphql/schemas/schema.graphql +++ b/packages/graphql/schemas/schema.graphql @@ -501,8 +501,10 @@ enum ErrorTypeEnum { CONFIG_FILE_DEV_SERVER_IS_NOT_A_FUNCTION CONFIG_FILE_INVALID_DEV_START_EVENT CONFIG_FILE_INVALID_ROOT_CONFIG + CONFIG_FILE_INVALID_ROOT_CONFIG_COMPONENT CONFIG_FILE_INVALID_ROOT_CONFIG_E2E CONFIG_FILE_INVALID_TESTING_TYPE_CONFIG_COMPONENT + CONFIG_FILE_INVALID_TESTING_TYPE_CONFIG_E2E CONFIG_FILE_MIGRATION_NEEDED CONFIG_FILE_NOT_FOUND CONFIG_FILE_REQUIRE_ERROR diff --git a/packages/launchpad/cypress.config.ts b/packages/launchpad/cypress.config.ts index 28bcd6e035..b59e4188a6 100644 --- a/packages/launchpad/cypress.config.ts +++ b/packages/launchpad/cypress.config.ts @@ -27,6 +27,7 @@ export default defineConfig({ ], }, }, + indexHtmlFile: 'cypress/component/support/component-index.html', }, 'e2e': { baseUrl: 'http://localhost:5555', diff --git a/packages/launchpad/cypress/component/support/component-index.html b/packages/launchpad/cypress/component/support/component-index.html new file mode 100644 index 0000000000..b698582429 --- /dev/null +++ b/packages/launchpad/cypress/component/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/packages/scaffold-config/src/frameworks.ts b/packages/scaffold-config/src/frameworks.ts index 75ac91a77d..1f8fa4ee70 100644 --- a/packages/scaffold-config/src/frameworks.ts +++ b/packages/scaffold-config/src/frameworks.ts @@ -43,9 +43,6 @@ export const FRONTEND_FRAMEWORKS = [ module.exports = { component: { devServer, - devServerConfig: { - indexHtmlFile: 'cypress/support/component-index.html', - }, }, }` }, @@ -57,9 +54,6 @@ export const FRONTEND_FRAMEWORKS = [ export default defineConfig({ component: { devServer, - devServerConfig: { - indexHtmlFile: 'cypress/support/component-index.html', - }, }, })` }, @@ -93,9 +87,6 @@ export const FRONTEND_FRAMEWORKS = [ module.exports = { component: { devServer, - devServerConfig: { - indexHtmlFile: 'cypress/support/component-index.html', - }, }, }` }, @@ -107,9 +98,6 @@ export const FRONTEND_FRAMEWORKS = [ export default defineConfig({ component: { devServer, - devServerConfig: { - indexHtmlFile: 'cypress/support/component-index.html', - }, }, })` }, @@ -150,7 +138,6 @@ export const FRONTEND_FRAMEWORKS = [ devServer, devServerConfig: { webpackConfig, - indexHtmlFile: 'cypress/support/component-index.html', }, }, } @@ -167,7 +154,6 @@ export const FRONTEND_FRAMEWORKS = [ devServer, devServerConfig: { webpackConfig, - indexHtmlFile: 'cypress/support/component-index.html', }, }, })` @@ -209,7 +195,6 @@ export const FRONTEND_FRAMEWORKS = [ devServer, devServerConfig: { webpackConfig, - indexHtmlFile: 'cypress/support/component-index.html', }, }, } @@ -226,7 +211,6 @@ export const FRONTEND_FRAMEWORKS = [ devServer, devServerConfig: { webpackConfig, - indexHtmlFile: 'cypress/support/component-index.html', }, }, })` @@ -268,7 +252,6 @@ export const FRONTEND_FRAMEWORKS = [ devServer, devServerConfig: { webpackConfig, - indexHtmlFile: 'cypress/support/component-index.html', }, }, } @@ -285,7 +268,6 @@ export const FRONTEND_FRAMEWORKS = [ devServer, devServerConfig: { webpackConfig, - indexHtmlFile: 'cypress/support/component-index.html', }, }, })` @@ -327,7 +309,6 @@ export const FRONTEND_FRAMEWORKS = [ devServer, devServerConfig: { webpackConfig, - indexHtmlFile: 'cypress/support/component-index.html', }, }, } @@ -344,7 +325,6 @@ export const FRONTEND_FRAMEWORKS = [ devServer, devServerConfig: { webpackConfig, - indexHtmlFile: 'cypress/support/component-index.html', }, }, })` @@ -386,7 +366,6 @@ export const FRONTEND_FRAMEWORKS = [ devServer, devServerConfig: { webpackConfig, - indexHtmlFile: 'cypress/support/component-index.html', }, }, }` @@ -400,7 +379,6 @@ export const FRONTEND_FRAMEWORKS = [ component: { devServer, devServerConfig: { - indexHtmlFile: 'cypress/support/component-index.html', // optionally provide your Vite config overrides. }, }, @@ -424,7 +402,6 @@ export const FRONTEND_FRAMEWORKS = [ devServer, devServerConfig: { webpackConfig, - indexHtmlFile: 'cypress/support/component-index.html', }, }, })` @@ -439,7 +416,6 @@ export const FRONTEND_FRAMEWORKS = [ component: { devServer, devServerConfig: { - indexHtmlFile: 'cypress/support/component-index.html', // optionally provide your Vite config overrides. }, }, @@ -482,7 +458,6 @@ export const FRONTEND_FRAMEWORKS = [ devServer, devServerConfig: { webpackConfig, - indexHtmlFile: 'cypress/support/component-index.html', }, }, }` @@ -496,7 +471,6 @@ export const FRONTEND_FRAMEWORKS = [ component: { devServer, devServerConfig: { - indexHtmlFile: 'cypress/support/component-index.html', // optionally provide your Vite config overrides. }, }, @@ -518,7 +492,6 @@ export const FRONTEND_FRAMEWORKS = [ devServer, devServerConfig: { webpackConfig, - indexHtmlFile: 'cypress/support/component-index.html', }, }, })` @@ -533,7 +506,6 @@ export const FRONTEND_FRAMEWORKS = [ component: { devServer, devServerConfig: { - indexHtmlFile: 'cypress/support/component-index.html', // optionally provide your Vite config overrides. }, }, @@ -576,7 +548,6 @@ export const FRONTEND_FRAMEWORKS = [ devServer, devServerConfig: { webpackConfig, - indexHtmlFile: 'cypress/support/component-index.html', }, }, }` @@ -590,7 +561,6 @@ export const FRONTEND_FRAMEWORKS = [ component: { devServer, devServerConfig: { - indexHtmlFile: 'cypress/support/component-index.html', // optionally provide your Vite config overrides. }, }, @@ -611,7 +581,6 @@ export const FRONTEND_FRAMEWORKS = [ component: { devServer, devServerConfig: { - indexHtmlFile: 'cypress/support/component-index.html', webpackConfig, }, }, @@ -627,7 +596,6 @@ export const FRONTEND_FRAMEWORKS = [ component: { devServer, devServerConfig: { - indexHtmlFile: 'cypress/support/component-index.html', // optionally provide your Vite config overrides. }, }, @@ -697,9 +665,6 @@ export const FRONTEND_FRAMEWORKS = [ return devServer(cypressDevServerConfig, { webpackConfig, ...devServerConfig }) }, - devServerConfig: { - indexHtmlFile: 'cypress/support/component-index.html', - }, }, })` }, @@ -716,9 +681,6 @@ export const FRONTEND_FRAMEWORKS = [ return devServer(cypressDevServerConfig, { webpackConfig, ...devServerConfig }) }, - devServerConfig: { - indexHtmlFile: 'cypress/support/component-index.html', - }, }, })` }, diff --git a/system-tests/__snapshots__/config_spec.js b/system-tests/__snapshots__/config_spec.js index ada911bef7..6e0b660382 100644 --- a/system-tests/__snapshots__/config_spec.js +++ b/system-tests/__snapshots__/config_spec.js @@ -386,4 +386,34 @@ The componentFolder configuration option is now invalid when set on the config o +` + +exports['e2e config throws an error if indexHtml is set on the root level 1'] = ` +The indexHtmlFile configuration option is now invalid when set from the root of the config object in Cypress version 10.0.0. + +It is now configured separately as a testing type property: component.indexHtmlFile + +{ + component: { + indexHtmlFile: '...', + } +} + +https://on.cypress.io/migration-guide + +` + +exports['e2e config throws an error if indexHtml is set on the e2e level 1'] = ` +The e2e.indexHtmlFile configuration option is not valid for e2e testing. + +Please remove this option or add this as a component testing type property: component.indexHtmlFile + +{ + e2e: { + indexHtmlFile: '...', + } +} + +https://on.cypress.io/migration-guide + ` diff --git a/system-tests/projects/create-react-app-configured/cypress.config.js b/system-tests/projects/create-react-app-configured/cypress.config.js index 201bb1aa54..ac538e88a9 100644 --- a/system-tests/projects/create-react-app-configured/cypress.config.js +++ b/system-tests/projects/create-react-app-configured/cypress.config.js @@ -3,8 +3,5 @@ const { devServer } = require('@cypress/react/plugins/react-scripts') module.exports = { component: { devServer, - devServerConfig: { - indexHtmlFile: 'cypress/support/component-index.html', - }, }, } diff --git a/system-tests/projects/create-react-app-custom-index-html/cypress.config.js b/system-tests/projects/create-react-app-custom-index-html/cypress.config.js index 201bb1aa54..1e12bd30e3 100644 --- a/system-tests/projects/create-react-app-custom-index-html/cypress.config.js +++ b/system-tests/projects/create-react-app-custom-index-html/cypress.config.js @@ -3,8 +3,6 @@ const { devServer } = require('@cypress/react/plugins/react-scripts') module.exports = { component: { devServer, - devServerConfig: { - indexHtmlFile: 'cypress/support/component-index.html', - }, + indexHtmlFile: 'cypress/support/custom-component-index.html', }, } diff --git a/system-tests/projects/create-react-app-custom-index-html/cypress/support/component-index.html b/system-tests/projects/create-react-app-custom-index-html/cypress/support/custom-component-index.html similarity index 100% rename from system-tests/projects/create-react-app-custom-index-html/cypress/support/component-index.html rename to system-tests/projects/create-react-app-custom-index-html/cypress/support/custom-component-index.html diff --git a/system-tests/projects/cypress-in-cypress/cypress/support/component-index.html b/system-tests/projects/cypress-in-cypress/cypress/support/component-index.html new file mode 100644 index 0000000000..b698582429 --- /dev/null +++ b/system-tests/projects/cypress-in-cypress/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/system-tests/projects/invalid-root-level-config/invalid-e2e-indexHtmlFile-config.js b/system-tests/projects/invalid-root-level-config/invalid-e2e-indexHtmlFile-config.js new file mode 100644 index 0000000000..ca711fbb38 --- /dev/null +++ b/system-tests/projects/invalid-root-level-config/invalid-e2e-indexHtmlFile-config.js @@ -0,0 +1,5 @@ +module.exports = { + e2e: { + indexHtmlFile: 'cypress/support/component-index.html', + }, +} diff --git a/system-tests/projects/invalid-root-level-config/invalid-indexHtmlFile-config.js b/system-tests/projects/invalid-root-level-config/invalid-indexHtmlFile-config.js new file mode 100644 index 0000000000..d805c80bfe --- /dev/null +++ b/system-tests/projects/invalid-root-level-config/invalid-indexHtmlFile-config.js @@ -0,0 +1,4 @@ +module.exports = { + indexHtmlFile: 'cypress/support/component-index.html', + e2e: {}, +} diff --git a/system-tests/projects/nextjs-configured/cypress/support/component-index.html b/system-tests/projects/nextjs-configured/cypress/support/component-index.html new file mode 100644 index 0000000000..9cecea5cbb --- /dev/null +++ b/system-tests/projects/nextjs-configured/cypress/support/component-index.html @@ -0,0 +1,13 @@ + + + + + + + Components App +
+ + +
+ + \ No newline at end of file diff --git a/system-tests/projects/nuxtjs-vue2-configured/cypress.config.js b/system-tests/projects/nuxtjs-vue2-configured/cypress.config.js index 6fbbf1f31e..10a31355c4 100644 --- a/system-tests/projects/nuxtjs-vue2-configured/cypress.config.js +++ b/system-tests/projects/nuxtjs-vue2-configured/cypress.config.js @@ -9,8 +9,5 @@ module.exports = defineConfig({ return devServer(cypressDevServerConfig, { webpackConfig, ...devServerConfig }) }, - devServerConfig: { - indexHtmlFile: 'cypress/support/component-index.html' - }, }, }) \ No newline at end of file diff --git a/system-tests/projects/react-vite-ts-configured/cypress.config.ts b/system-tests/projects/react-vite-ts-configured/cypress.config.ts index c44e402a9e..16b84a757d 100644 --- a/system-tests/projects/react-vite-ts-configured/cypress.config.ts +++ b/system-tests/projects/react-vite-ts-configured/cypress.config.ts @@ -5,7 +5,6 @@ export default defineConfig({ component: { devServer, devServerConfig: { - indexHtmlFile: 'cypress/support/component-index.html', // optionally provide your Vite config overrides. }, }, diff --git a/system-tests/projects/simple-ct/cypress/support/component-index.html b/system-tests/projects/simple-ct/cypress/support/component-index.html new file mode 100644 index 0000000000..b698582429 --- /dev/null +++ b/system-tests/projects/simple-ct/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/system-tests/projects/vite-ct/cypress.config.js b/system-tests/projects/vite-ct/cypress.config.js index ff9f344184..1a70250fa9 100644 --- a/system-tests/projects/vite-ct/cypress.config.js +++ b/system-tests/projects/vite-ct/cypress.config.js @@ -7,5 +7,6 @@ module.exports = { return startDevServer({ options: cypressDevServerConfig }) }, + indexHtmlFile: 'cypress/component/support/component-index.html', }, } diff --git a/system-tests/projects/vite-ct/cypress/component/support/component-index.html b/system-tests/projects/vite-ct/cypress/component/support/component-index.html new file mode 100644 index 0000000000..b698582429 --- /dev/null +++ b/system-tests/projects/vite-ct/cypress/component/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/system-tests/projects/vue3-vite-ts-configured/cypress.config.ts b/system-tests/projects/vue3-vite-ts-configured/cypress.config.ts index c44e402a9e..16b84a757d 100644 --- a/system-tests/projects/vue3-vite-ts-configured/cypress.config.ts +++ b/system-tests/projects/vue3-vite-ts-configured/cypress.config.ts @@ -5,7 +5,6 @@ export default defineConfig({ component: { devServer, devServerConfig: { - indexHtmlFile: 'cypress/support/component-index.html', // optionally provide your Vite config overrides. }, }, diff --git a/system-tests/projects/vue3-vite-ts-custom-index-html/cypress.config.ts b/system-tests/projects/vue3-vite-ts-custom-index-html/cypress.config.ts index 212c60fbaa..c1b386a866 100644 --- a/system-tests/projects/vue3-vite-ts-custom-index-html/cypress.config.ts +++ b/system-tests/projects/vue3-vite-ts-custom-index-html/cypress.config.ts @@ -4,9 +4,9 @@ import { devServer } from '@cypress/vite-dev-server' export default defineConfig({ component: { devServer, - // optionally provide your Vite config overrides. devServerConfig: { - indexHtmlFile: 'cypress/support/component-index.html', + // optionally provide your Vite config overrides. }, + indexHtmlFile: 'cypress/support/custom-component-index.html' }, }) diff --git a/system-tests/projects/vue3-vite-ts-custom-index-html/cypress/support/component-index.html b/system-tests/projects/vue3-vite-ts-custom-index-html/cypress/support/custom-component-index.html similarity index 100% rename from system-tests/projects/vue3-vite-ts-custom-index-html/cypress/support/component-index.html rename to system-tests/projects/vue3-vite-ts-custom-index-html/cypress/support/custom-component-index.html diff --git a/system-tests/projects/vuecli5vue3-configured/cypress.config.js b/system-tests/projects/vuecli5vue3-configured/cypress.config.js index 71040b9ad3..e66b630de9 100644 --- a/system-tests/projects/vuecli5vue3-configured/cypress.config.js +++ b/system-tests/projects/vuecli5vue3-configured/cypress.config.js @@ -6,7 +6,6 @@ module.exports = { devServer, devServerConfig: { webpackConfig, - indexHtmlFile: 'cypress/support/component-index.html', }, }, } \ No newline at end of file diff --git a/system-tests/projects/vueclivue2-configured/cypress.config.js b/system-tests/projects/vueclivue2-configured/cypress.config.js index c21bd5f933..318e21861d 100644 --- a/system-tests/projects/vueclivue2-configured/cypress.config.js +++ b/system-tests/projects/vueclivue2-configured/cypress.config.js @@ -6,7 +6,6 @@ module.exports = { devServer, devServerConfig: { webpackConfig, - indexHtmlFile: 'cypress/support/component-index.html', }, }, } diff --git a/system-tests/projects/vueclivue3-configured/cypress.config.js b/system-tests/projects/vueclivue3-configured/cypress.config.js index c21bd5f933..318e21861d 100644 --- a/system-tests/projects/vueclivue3-configured/cypress.config.js +++ b/system-tests/projects/vueclivue3-configured/cypress.config.js @@ -6,7 +6,6 @@ module.exports = { devServer, devServerConfig: { webpackConfig, - indexHtmlFile: 'cypress/support/component-index.html', }, }, } diff --git a/system-tests/projects/vueclivue3-custom-index-html/cypress.config.js b/system-tests/projects/vueclivue3-custom-index-html/cypress.config.js index c21bd5f933..e90e04bc1a 100644 --- a/system-tests/projects/vueclivue3-custom-index-html/cypress.config.js +++ b/system-tests/projects/vueclivue3-custom-index-html/cypress.config.js @@ -6,7 +6,7 @@ module.exports = { devServer, devServerConfig: { webpackConfig, - indexHtmlFile: 'cypress/support/component-index.html', }, + indexHtmlFile: 'cypress/support/custom-component-index.html', }, } diff --git a/system-tests/projects/vueclivue3-custom-index-html/cypress/support/component-index.html b/system-tests/projects/vueclivue3-custom-index-html/cypress/support/custom-component-index.html similarity index 100% rename from system-tests/projects/vueclivue3-custom-index-html/cypress/support/component-index.html rename to system-tests/projects/vueclivue3-custom-index-html/cypress/support/custom-component-index.html diff --git a/system-tests/projects/webpack-dev-server/cypress/support/component-index.html b/system-tests/projects/webpack-dev-server/cypress/support/component-index.html new file mode 100644 index 0000000000..b698582429 --- /dev/null +++ b/system-tests/projects/webpack-dev-server/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/system-tests/test/config_spec.js b/system-tests/test/config_spec.js index 7122facfb8..c11b64c66c 100644 --- a/system-tests/test/config_spec.js +++ b/system-tests/test/config_spec.js @@ -170,6 +170,29 @@ describe('e2e config', () => { }) }) + it('throws an error if indexHtml is set on the root level', async function () { + await Fixtures.scaffoldProject('invalid-root-level-config') + + return systemTests.exec(this, { + project: 'invalid-root-level-config', + configFile: 'invalid-indexHtmlFile-config.js', + expectedExitCode: 1, + snapshot: true, + }) + }) + + it('throws an error if indexHtml is set on the e2e level', async function () { + await Fixtures.scaffoldProject('invalid-root-level-config') + + return systemTests.exec(this, { + project: 'invalid-root-level-config', + configFile: 'invalid-e2e-indexHtmlFile-config.js', + testingType: 'e2e', + expectedExitCode: 1, + snapshot: true, + }) + }) + it('throws an error if testFiles is set on the config file', async function () { await Fixtures.scaffoldProject('invalid-root-level-config')