-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
code to reproduce issue cypress-io/cypress#22825
- Loading branch information
0 parents
commit 2142cd5
Showing
14 changed files
with
9,701 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/**/node_modules/ | ||
/cypress/screenshots | ||
/test-output |
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,30 @@ | ||
const cypress = require('cypress') | ||
const fs = require('fs') | ||
const path = require('path') | ||
|
||
cypressRun(6001, 4001) | ||
|
||
async function cypressRun(cypressPort) { | ||
const runOptions = { | ||
testingType: 'component', | ||
// each run needs a unique port since we're running multiple cypress.run instances on the same machine | ||
port: cypressPort, | ||
spec: path.resolve('./src/MyComponent.spec.js'), | ||
browser: 'chrome', // chrome sometimes fails to connect: https://github.com/cypress-io/cypress/issues/8986 | ||
headless: true, // chrome supports headless or headed: https://docs.cypress.io/guides/guides/launching-browsers.html#Electron-Browser | ||
// headed: true, // if failing to start, set this to true, so can see if error in chrome runner | ||
quiet: false, | ||
config: { | ||
reporter: 'junit', | ||
reporterOptions: { | ||
mochaFile: `test-output/[hash].xml`, | ||
}, | ||
watchForFileChanges: false, | ||
screenshotOnRunFailure: true, | ||
video: false, | ||
videoUploadOnPasses: false, | ||
trashAssetsBeforeRuns: false, | ||
}, | ||
} | ||
await cypress.run(runOptions) | ||
} |
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,22 @@ | ||
const { defineConfig } = require('cypress') | ||
|
||
const webpackConfig = require('./webpack.config.js') | ||
// const webpackPreprocessor = require('@cypress/webpack-preprocessor') // if I uninstall this package, I get a different error. | ||
const supportFile = './cypress/support/cypressSupportFile.js' | ||
|
||
module.exports = defineConfig({ | ||
video: false, | ||
videoUploadOnPasses: false, | ||
viewportHeight: 700, | ||
viewportWidth: 1200, | ||
defaultCommandTimeout: 6000, | ||
component: { | ||
supportFile, | ||
specPattern: 'src/**/*spec.js', | ||
devServer: { | ||
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,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> |
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,21 @@ | ||
// import './commands' | ||
// import 'cypress-plugin-tab' | ||
// import 'cypress-commands' | ||
|
||
/** | ||
* Workaround for the "Automatic publicPath is not supported in this browser" fail | ||
* | ||
* See https://github.com/cypress-io/cypress/issues/18435 for more | ||
* details. Should be removed when cypress switches to webpack 5. | ||
*/ | ||
const scripts = document.getElementsByTagName('script') | ||
scripts[scripts.length - 1].src = ' ' // yes, thats a single space and not the empty string | ||
|
||
Cypress.on('uncaught:exception', err => { | ||
// ignore certain errors when testing | ||
const isEmptyErrorMsg = err.message == null || err.message.trim() === '' | ||
if (isEmptyErrorMsg) throw new Error('NO ERROR MESSAGE: ' + err.reason?.toString() + err.toString()) | ||
|
||
// don't fail test for failing to initialize WebGL--for some reason | ||
if (/Failed to initialize WebGL/i.test(err.message)) return false | ||
}) |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.