-
Notifications
You must be signed in to change notification settings - Fork 10.3k
chore: Upgrade Cypress from v9 to v12 #37810
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4af2acc
275cce3
499d5f4
aea5d66
6ec0c80
3fb82e4
3c08b34
43d3e66
1ba432e
f65ce0c
6cab274
83c8405
f87a444
a76f50e
d4926a2
a6dd961
6bbae5d
422f5c6
2e68303
bd3d618
75def60
d03b139
baf8c53
6d00a75
eb4ce16
e2a1409
32e5b90
08cc49d
a3243b6
7cd422c
22125dc
738488c
60e9206
711683b
d34d6f4
439eec0
4157003
5c8aaa6
71b32d5
82c5a36
c55c243
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { defineConfig } from "cypress" | ||
import { addMatchImageSnapshotPlugin } from "@simonsmith/cypress-image-snapshot/plugin" | ||
|
||
export default defineConfig({ | ||
e2e: { | ||
baseUrl: `http://localhost:9000`, | ||
specPattern: `cypress/integration/**/*.{js,ts}`, | ||
projectId: `2193cm`, | ||
viewportWidth: 1440, | ||
viewportHeight: 900, | ||
retries: { | ||
runMode: 0, | ||
openMode: 0 | ||
}, | ||
videoUploadOnPasses: false, | ||
setupNodeEvents(on, config) { | ||
addMatchImageSnapshotPlugin(on, config) | ||
on("before:browser:launch", (browser = {} as Cypress.Browser, launchOptions) => { | ||
if (browser.family === "chromium" || browser.name === "chrome") { | ||
// Make retina screens run at 1x density so they match the versions in CI | ||
launchOptions.args.push("--force-device-scale-factor=1") | ||
} | ||
return launchOptions | ||
}) | ||
}, | ||
}, | ||
env: { | ||
requireSnapshots: true, | ||
} | ||
}) |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import { parseSrcset } from "srcset" | ||
|
||
const testConfig = { | ||
retries: { | ||
runMode: 2, | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import "gatsby-cypress" | ||
import { addMatchImageSnapshotCommand } from "@simonsmith/cypress-image-snapshot/command" | ||
import { register } from "@cypress/snapshot" | ||
|
||
addMatchImageSnapshotCommand({ | ||
customDiffDir: `/__diff_output__`, | ||
customDiffConfig: { | ||
threshold: 0.1, | ||
}, | ||
failureThreshold: 0.08, | ||
failureThresholdType: `percent`, | ||
}) | ||
|
||
register() |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"lib": ["es5", "dom"], | ||
"types": ["cypress", "node"] | ||
}, | ||
"include": ["**/*.ts"] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,13 +19,15 @@ | |
}, | ||
"devDependencies": { | ||
"@cypress/snapshot": "^2.1.7", | ||
"@simonsmith/cypress-image-snapshot": "^6.0.1", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cypress-image-snapshot doesn't work with Cypress 12 and this is a fork |
||
"@types/simonsmith__cypress-image-snapshot": "npm:@types/cypress-image-snapshot", | ||
"cross-env": "^7.0.3", | ||
"cypress": "^9.7.0", | ||
"cypress-image-snapshot": "^4.0.1", | ||
"cypress": "^12.9.0", | ||
"gatsby-cypress": "next", | ||
"prettier": "^2.8.7", | ||
"srcset": "^5.0.0", | ||
"start-server-and-test": "^1.15.3" | ||
"start-server-and-test": "^2.0.0", | ||
"typescript": "^5.0.2" | ||
}, | ||
"keywords": [ | ||
"gatsby" | ||
|
@@ -39,8 +41,8 @@ | |
"test": "cross-env CYPRESS_SUPPORT=y npm run build && npm run start-server-and-test", | ||
"start-server-and-test": "start-server-and-test serve http://localhost:9000 cy:run", | ||
"serve": "gatsby serve", | ||
"cy:open": "cypress open", | ||
"cy:run": "node ../../scripts/cypress-run-with-conditional-record-flag.js --browser chrome" | ||
"cy:open": "cypress open --browser chrome --e2e", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cypress now also has component testing so this tells it to directly open the e2e test suite with the chrome browser |
||
"cy:run": "node ../../scripts/cypress-run-with-conditional-record-flag.js --browser chrome --e2e" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { defineConfig } from "cypress" | ||
import { addMatchImageSnapshotPlugin } from "@simonsmith/cypress-image-snapshot/plugin" | ||
import { gatsbyConfigUtils } from "./cypress/utils/gatsby-config" | ||
import { blockResourcesUtils } from "./cypress/utils/block-resources" | ||
|
||
export default defineConfig({ | ||
e2e: { | ||
baseUrl: `http://localhost:8000`, | ||
specPattern: `cypress/integration/**/*.{js,ts}`, | ||
projectId: `nusozx`, | ||
experimentalRunAllSpecs: true, | ||
chromeWebSecurity: false, | ||
defaultCommandTimeout: 30000, | ||
retries: 2, | ||
videoUploadOnPasses: false, | ||
setupNodeEvents(on, config) { | ||
addMatchImageSnapshotPlugin(on, config) | ||
on(`task`, { | ||
...blockResourcesUtils, | ||
...gatsbyConfigUtils, | ||
}) | ||
on(`before:browser:launch`, (browser = {} as Cypress.Browser, launchOptions) => { | ||
if (browser.family === `chromium` || browser.name === `chrome`) { | ||
// Make retina screens run at 1x density so they match the versions in CI | ||
launchOptions.args.push(`--force-device-scale-factor=1`) | ||
} | ||
return launchOptions | ||
}) | ||
}, | ||
}, | ||
env: { | ||
requireSnapshots: true, | ||
} | ||
}) |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,15 +27,18 @@ after(() => { | |
const errorPlaceholder = `false` | ||
const errorReplacement = `true` | ||
|
||
describe(`testing error overlay and ability to automatically recover runtime errors cause by content changes (page queries variant)`, () => { | ||
it(`displays content initially (no errors yet)`, () => { | ||
describe(`testing error overlay and ability to automatically recover runtime errors cause by content changes (page queries variant)`, { testIsolation: false } , () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New default in Cypress 12 is test isolation but these tests kinda rely on them so we opt-out |
||
before(() => { | ||
cy.visit(`/error-handling/page-query-result-runtime-error/`, { | ||
// Hacky way to disable "uncaught:exception" message in error message itself | ||
// See https://github.com/cypress-io/cypress/issues/254#issuecomment-292190924 | ||
onBeforeLoad: win => { | ||
win.onerror = null | ||
}, | ||
}).waitForRouteChange() | ||
}) | ||
|
||
it(`displays content initially (no errors yet)`, () => { | ||
cy.findByTestId(`hot`).should(`contain.text`, `Working`) | ||
cy.findByTestId(`results`).should(`contain.text`, `"hasError": false`) | ||
}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused import