-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
88 changed files
with
19,466 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,191 @@ | ||
/// <reference path="../support/e2e.ts" /> | ||
|
||
describe('CJS ESM', () => { | ||
context('js', () => { | ||
context('cjs', () => { | ||
it('should load', () => { | ||
cy.scaffoldProject('react-webpack-cjs') | ||
cy.openProject('react-webpack-cjs') | ||
cy.startAppServer('component') | ||
|
||
cy.visitApp() | ||
cy.contains('App.cy').click() | ||
cy.waitForSpecToFinish() | ||
cy.get('.passed > .num').should('contain', 1) | ||
}) | ||
|
||
it('should load with import of webpack.config.js', () => { | ||
cy.scaffoldProject('react-webpack-cjs') | ||
cy.openProject('react-webpack-cjs', ['--config-file', 'cypress-webpack-import.config.js']) | ||
cy.startAppServer('component') | ||
|
||
cy.visitApp() | ||
cy.contains('App.cy').click() | ||
cy.waitForSpecToFinish() | ||
cy.get('.passed > .num').should('contain', 1) | ||
}) | ||
|
||
it('should load with custom dev-server', () => { | ||
cy.scaffoldProject('react-webpack-cjs') | ||
cy.openProject('react-webpack-cjs', ['--config-file', 'cypress-custom-dev-server.config.js']) | ||
cy.startAppServer('component') | ||
|
||
cy.visitApp() | ||
cy.contains('App.cy').click() | ||
cy.waitForSpecToFinish() | ||
cy.get('.passed > .num').should('contain', 1) | ||
}) | ||
|
||
it('should load with custom dev-server with import of webpack.config.js', () => { | ||
cy.scaffoldProject('react-webpack-cjs') | ||
cy.openProject('react-webpack-cjs', ['--config-file', 'cypress-custom-dev-server-webpack-import.config.js']) | ||
cy.startAppServer('component') | ||
|
||
cy.visitApp() | ||
cy.contains('App.cy').click() | ||
cy.waitForSpecToFinish() | ||
cy.get('.passed > .num').should('contain', 1) | ||
}) | ||
}) | ||
|
||
context('esm', () => { | ||
it('should load', () => { | ||
cy.scaffoldProject('react-webpack-esm') | ||
cy.openProject('react-webpack-esm') | ||
cy.startAppServer('component') | ||
|
||
cy.visitApp() | ||
cy.contains('App.cy').click() | ||
cy.waitForSpecToFinish() | ||
cy.get('.passed > .num').should('contain', 1) | ||
}) | ||
|
||
it('should load with import of webpack.config.js', () => { | ||
cy.scaffoldProject('react-webpack-esm') | ||
cy.openProject('react-webpack-esm', ['--config-file', 'cypress-webpack-import.config.js']) | ||
cy.startAppServer('component') | ||
|
||
cy.visitApp() | ||
cy.contains('App.cy').click() | ||
cy.waitForSpecToFinish() | ||
cy.get('.passed > .num').should('contain', 1) | ||
}) | ||
|
||
it('should load with custom dev-server', () => { | ||
cy.scaffoldProject('react-webpack-esm') | ||
cy.openProject('react-webpack-esm', ['--config-file', 'cypress-custom-dev-server.config.js']) | ||
cy.startAppServer('component') | ||
|
||
cy.visitApp() | ||
cy.contains('App.cy').click() | ||
cy.waitForSpecToFinish() | ||
cy.get('.passed > .num').should('contain', 1) | ||
}) | ||
|
||
it('should load with custom dev-server with import of webpack.config.js', () => { | ||
cy.scaffoldProject('react-webpack-esm') | ||
cy.openProject('react-webpack-esm', ['--config-file', 'cypress-custom-dev-server-webpack-import.config.js']) | ||
cy.startAppServer('component') | ||
|
||
cy.visitApp() | ||
cy.contains('App.cy').click() | ||
cy.waitForSpecToFinish() | ||
cy.get('.passed > .num').should('contain', 1) | ||
}) | ||
}) | ||
}) | ||
|
||
context('ts', () => { | ||
context('cjs', () => { | ||
it('should load', () => { | ||
cy.scaffoldProject('react-webpack-ts-cjs') | ||
cy.openProject('react-webpack-ts-cjs') | ||
cy.startAppServer('component') | ||
|
||
cy.visitApp() | ||
cy.contains('App.cy').click() | ||
cy.waitForSpecToFinish() | ||
cy.get('.passed > .num').should('contain', 1) | ||
}) | ||
|
||
it('should load with import of webpack.config.ts', () => { | ||
cy.scaffoldProject('react-webpack-ts-cjs') | ||
cy.openProject('react-webpack-ts-cjs', ['--config-file', 'cypress-webpack-import.config.ts']) | ||
cy.startAppServer('component') | ||
|
||
cy.visitApp() | ||
cy.contains('App.cy').click() | ||
cy.waitForSpecToFinish() | ||
cy.get('.passed > .num').should('contain', 1) | ||
}) | ||
|
||
it('should load with custom dev-server', () => { | ||
cy.scaffoldProject('react-webpack-ts-cjs') | ||
cy.openProject('react-webpack-ts-cjs', ['--config-file', 'cypress-custom-dev-server.config.ts']) | ||
cy.startAppServer('component') | ||
|
||
cy.visitApp() | ||
cy.contains('App.cy').click() | ||
cy.waitForSpecToFinish() | ||
cy.get('.passed > .num').should('contain', 1) | ||
}) | ||
|
||
it('should load with custom dev-server with import of webpack.config.js', () => { | ||
cy.scaffoldProject('react-webpack-ts-cjs') | ||
cy.openProject('react-webpack-ts-cjs', ['--config-file', 'cypress-custom-dev-server-webpack-import.config.ts']) | ||
cy.startAppServer('component') | ||
|
||
cy.visitApp() | ||
cy.contains('App.cy').click() | ||
cy.waitForSpecToFinish() | ||
cy.get('.passed > .num').should('contain', 1) | ||
}) | ||
}) | ||
|
||
context('esm', () => { | ||
it('should load', () => { | ||
cy.scaffoldProject('react-webpack-ts-esm') | ||
cy.openProject('react-webpack-ts-esm') | ||
cy.startAppServer('component') | ||
|
||
cy.visitApp() | ||
cy.contains('App.cy').click() | ||
cy.waitForSpecToFinish() | ||
cy.get('.passed > .num').should('contain', 1) | ||
}) | ||
|
||
it('should load with import of webpack.config.ts', () => { | ||
cy.scaffoldProject('react-webpack-ts-esm') | ||
cy.openProject('react-webpack-ts-esm', ['--config-file', 'cypress-webpack-import.config.ts']) | ||
cy.startAppServer('component') | ||
|
||
cy.visitApp() | ||
cy.contains('App.cy').click() | ||
cy.waitForSpecToFinish() | ||
cy.get('.passed > .num').should('contain', 1) | ||
}) | ||
|
||
it('should load with custom dev-server', () => { | ||
cy.scaffoldProject('react-webpack-ts-esm') | ||
cy.openProject('react-webpack-ts-esm', ['--config-file', 'cypress-custom-dev-server.config.ts']) | ||
cy.startAppServer('component') | ||
|
||
cy.visitApp() | ||
cy.contains('App.cy').click() | ||
cy.waitForSpecToFinish() | ||
cy.get('.passed > .num').should('contain', 1) | ||
}) | ||
|
||
it('should load with custom dev-server with import of webpack.config.js', () => { | ||
cy.scaffoldProject('react-webpack-ts-esm') | ||
cy.openProject('react-webpack-ts-esm', ['--config-file', 'cypress-custom-dev-server-webpack-import.config.ts']) | ||
cy.startAppServer('component') | ||
|
||
cy.visitApp() | ||
cy.contains('App.cy').click() | ||
cy.waitForSpecToFinish() | ||
cy.get('.passed > .num').should('contain', 1) | ||
}) | ||
}) | ||
}) | ||
}) |
13 changes: 13 additions & 0 deletions
13
system-tests/project-fixtures/react/cypress-vite-dev-server-function.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { defineConfig } from 'cypress' | ||
import defaultConfig from './cypress-vite.config' | ||
import {devServer as cypressViteDevServer} from '@cypress/vite-dev-server' | ||
|
||
export default defineConfig({ | ||
...defaultConfig, | ||
component: { | ||
devServer: (devServerOptions) => cypressViteDevServer({ | ||
...devServerOptions, | ||
framework: 'react' | ||
}) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
system-tests/project-fixtures/react/cypress-webpack-dev-server-function.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { defineConfig } from 'cypress' | ||
import defaultConfig from './cypress-webpack.config' | ||
import { devServer as cypressWebpackDevServer } from '@cypress/webpack-dev-server' | ||
|
||
export default defineConfig({ | ||
...defaultConfig, | ||
component: { | ||
devServer: (devServerOptions) => cypressWebpackDevServer({ | ||
...devServerOptions, | ||
framework: 'react', | ||
}), | ||
supportFile: false | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const {defineConfig} = require('vite') | ||
|
||
module.exports = defineConfig({ | ||
logLevel: 'silent' | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["@babel/env", "@babel/preset-react"] | ||
} |
16 changes: 16 additions & 0 deletions
16
system-tests/projects/react-webpack-cjs/cypress-custom-dev-server-webpack-import.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const { defineConfig } = require('cypress') | ||
const cypressWebpackDevServer = require('@cypress/webpack-dev-server').devServer | ||
const webpackConfig = require('./webpack.config') | ||
|
||
module.exports = defineConfig({ | ||
component: { | ||
devServer: (devServerOptions) => { | ||
return cypressWebpackDevServer({ | ||
...devServerOptions, | ||
framework: 'react', | ||
bundler: 'webpack', | ||
webpackConfig, | ||
}) | ||
}, | ||
}, | ||
}) |
14 changes: 14 additions & 0 deletions
14
system-tests/projects/react-webpack-cjs/cypress-custom-dev-server.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const { defineConfig } = require('cypress') | ||
const cypressWebpackDevServer = require('@cypress/webpack-dev-server').devServer | ||
|
||
module.exports = defineConfig({ | ||
component: { | ||
devServer: (devServerOptions) => { | ||
return cypressWebpackDevServer({ | ||
...devServerOptions, | ||
framework: 'react', | ||
bundler: 'webpack', | ||
}) | ||
}, | ||
}, | ||
}) |
12 changes: 12 additions & 0 deletions
12
system-tests/projects/react-webpack-cjs/cypress-webpack-import.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const { defineConfig } = require('cypress') | ||
const webpackConfig = require('./webpack.config.js') | ||
|
||
module.exports = defineConfig({ | ||
component: { | ||
devServer: { | ||
framework: 'react', | ||
bundler: 'webpack', | ||
webpackConfig, | ||
}, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const { defineConfig } = require('cypress') | ||
|
||
module.exports = defineConfig({ | ||
component: { | ||
devServer: { | ||
framework: 'react', | ||
bundler: 'webpack', | ||
}, | ||
}, | ||
}) |
5 changes: 5 additions & 0 deletions
5
system-tests/projects/react-webpack-cjs/cypress/fixtures/example.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "Using fixtures to represent data", | ||
"email": "hello@cypress.io", | ||
"body": "Fixtures are a great way to mock data for responses to routes" | ||
} |
25 changes: 25 additions & 0 deletions
25
system-tests/projects/react-webpack-cjs/cypress/support/commands.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// *********************************************** | ||
// 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) => { ... }) |
12 changes: 12 additions & 0 deletions
12
system-tests/projects/react-webpack-cjs/cypress/support/component-index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width,initial-scale=1.0"> | ||
<title>Components App</title> | ||
</head> | ||
<body> | ||
<div data-cy-root></div> | ||
</body> | ||
</html> |
27 changes: 27 additions & 0 deletions
27
system-tests/projects/react-webpack-cjs/cypress/support/component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// *********************************************************** | ||
// This example support/component.js is processed and | ||
// loaded automatically before your test files. | ||
// | ||
// This is a great place to put global configuration and | ||
// behavior that modifies Cypress. | ||
// | ||
// You can change the location of this file or turn off | ||
// automatically serving support files with the | ||
// 'supportFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/configuration | ||
// *********************************************************** | ||
|
||
// Import commands.js using ES2015 syntax: | ||
import './commands.js' | ||
|
||
// Alternatively you can use CommonJS syntax: | ||
// require('./commands') | ||
|
||
import { mount } from 'cypress/react' | ||
|
||
Cypress.Commands.add('mount', mount) | ||
|
||
// Example use: | ||
// cy.mount(<MyComponent />) |
Oops, something went wrong.