nickbolles / cypress-nuxt Goto Github PK
View Code? Open in Web Editor NEWCypress plugin to make unit tests with nuxt simple
Cypress plugin to make unit tests with nuxt simple
Not sure if nuxt exposes this, and if we can restart cypress when it changes, but it'd be nice. It's tripped me up a few times today.
Good evening,
I started an application with Nuxt. I set up Cypress to perform e2e tests.
The problem is that to run my tests, the server needs to be launched, but since "nuxt-ts" launches the server but the process remains active, so I am not able to detect when the server has finished initializing.
Any idea how I can work around this problem?
I haven't seen a Cypress module for Nuxt, but I know that on Vue 2/3, it works fine (https://cli.vuejs.org/core-plugins/e2e-cypress.html)
Thank you
Hi, really cool that you made this.
I'm trying to use this in my project, we are using yarn workspaces
.
Do I understand this right, that cypress-nuxt
and cypress
itself should share the package.json
with the nuxt project, otherwise we would have to carry over all the dependencies into a separated cypress
project.
Here is an (outdated) example of our file hierarchy: https://github.com/JoeSchr/graphile-starter/tree/master/%40app
@app/server
=> nuxt
@app/e2e
=> cypress
Hey, thanks for developing this package!
Can you please help me out to figure out the problem I'm having?
I did exactly the same steps but I'm getting always this error:
cy.visit() failed trying to load:
http://localhost:3000/
The response we received from your web server was:500: Server Error
Obviously, I can open the homepage, but the test always fails. ( I spin up nuxt before running cypress open )
cypress.json:
{
"baseUrl": "http://localhost:3000"
}
cypress/integration/test.spec.js:
describe('The Home Page', () => {
it('should visit the home page', () => {
cy.visit('/')
})
})
cypress/plugins/index.js:
const cypressNuxt = require('cypress-nuxt')
module.exports = async (on, config) => {
on('file:preprocessor', await cypressNuxt.plugin())
return config
}
Allway getting this as the result:
I can open the URL in a different tab and the home page opens correctly.
devDependencies:
"cypress": "^5.6.0",
"cypress-nuxt": "^1.3.1",
If I will start without nuxt cypress open, I will get this:
Which means that actually, nuxt is running correctly on localhost:3000 on my previous problem, but why it's not reaching the home page ๐ค
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.