Skip to content

Commit 3f9a332

Browse files
committed
upgraded cypress so i could run locally
1 parent b92a229 commit 3f9a332

14 files changed

+37
-14
lines changed

packages/vue2/tests/app/server.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ app.all('/sleep', (req, res) => setTimeout(() => res.send(''), 2000))
175175
app.post('/redirect', (req, res) => res.redirect(303, '/dump/get'))
176176
app.get('/location', ({ res }) => inertia.location(res, '/dump/get'))
177177
app.post('/redirect-external', (req, res) => inertia.location(res, '/non-inertia'))
178-
app.post('/disconnect', (req, res) => res.connection.destroy())
178+
app.post('/disconnect', (req, res) => res.socket.destroy())
179179
app.post('/json', (req, res) => res.json({ foo: 'bar' }))
180180

181181
app.all('*', (req, res) => inertia.render(req, res))

packages/vue2/tests/cypress.config.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const { defineConfig } = require('cypress')
2+
3+
module.exports = defineConfig({
4+
video: false,
5+
screenshotOnRunFailure: false,
6+
retries: {
7+
runMode: 4,
8+
openMode: 2,
9+
},
10+
e2e: {
11+
// We've imported your old cypress plugins here.
12+
// You may want to clean this up later by importing these.
13+
setupNodeEvents(on, config) {
14+
return require('./cypress/plugins/index.js')(on, config)
15+
},
16+
baseUrl: 'http://localhost:13715',
17+
},
18+
})

packages/vue2/tests/cypress.json

-9
This file was deleted.

packages/vue2/tests/cypress/integration/events.test.js packages/vue2/tests/cypress/e2e/events.cy.js

+8
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,14 @@ describe('Events', () => {
562562

563563
describe('exception', () => {
564564
it('gets fired when an unexpected situation occurs (e.g. network disconnect)', () => {
565+
cy.on('uncaught:exception', (err, runnable) => {
566+
if (err.message.includes('Network Error')) {
567+
return false
568+
}
569+
570+
return true
571+
})
572+
565573
const assertExceptionObject = (detail) => {
566574
expect(detail).to.be.an('object')
567575
expect(detail).to.have.property('exception')

packages/vue2/tests/cypress/integration/plugin.test.js packages/vue2/tests/cypress/e2e/plugin.cy.js

+5
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@ describe('Plugin', () => {
44
cy.visit('/')
55

66
cy.window().then((window) => {
7+
cy.task('what the')
8+
cy.log('--------------------------')
79
const inertiaRoot = window.testing.vue.$children[0]
810
const page = inertiaRoot.$children[0]
911

12+
cy.log('page.$page', page.$page)
13+
cy.log('page.$inertia.page', page.$inertia.page)
14+
1015
expect(page.$page).to.deep.equal(page.$inertia.page)
1116
})
1217
})

packages/vue2/tests/package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,22 @@
55
"gui": "start-server-and-test server:run http://localhost:13715 cypress:open",
66
"cypress:open": "CYPRESS_FAIL_FAST_PLUGIN=false cypress open",
77
"server:run": "vite build app && node app/server.js",
8+
"watch": "vite build app --watch",
89
"test": "npm run ci",
910
"test:gui": "npm run gui"
1011
},
1112
"devDependencies": {
1213
"@vitejs/plugin-vue2": "^2.2.0",
1314
"body-parser": "^1.19.0",
1415
"css-loader": "^5.0.1",
15-
"cypress": "^6.2.1",
16-
"cypress-fail-fast": "^2.3.1",
16+
"cypress": "^13.13.0",
17+
"cypress-fail-fast": "^7.1.0",
1718
"cypress-repeat": "^2.2.1",
1819
"eslint": "^7.17.0",
19-
"eslint-plugin-cypress": "^2.11.2",
20+
"eslint-plugin-cypress": "^3.3.0",
2021
"express": "^4.17.1",
2122
"multer": "^1.4.2",
22-
"start-server-and-test": "^1.11.5",
23+
"start-server-and-test": "^2.0.4",
2324
"vite": "^4.0.4",
2425
"vue": "^2.7.14"
2526
},

0 commit comments

Comments
 (0)