-
Notifications
You must be signed in to change notification settings - Fork 3
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
Integration and unit tests using Cypress #1
Conversation
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.
One suggestion for the README, and otherwise just a few questions. The tests themselves are fine, and look good. Thanks for the contribution 😀 🍰 🎉 !
cypress/integration/actions_spec.js
Outdated
todos: [] | ||
} | ||
const result = actions.add()(state) | ||
cy.wrap(result).should('deep.equal', { |
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.
Out of curiousity, why cy.wrap
over expect
? It looks like cypress bundles with chai's expect, so I'm curious if it's the convention of cypress, support for cy.wrap is better, or just personal preference.
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.
same thing, I changed it to simple expect
, no preference
@@ -0,0 +1,39 @@ | |||
/// <reference types="cypress" /> |
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.
What's this?
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.
README.md
Outdated
To run tests in the interactive mode, start the server and then open Cypress | ||
|
||
``` | ||
npm start & |
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.
I prefer not suggesting running a process in the background, simply because not everyone has a lot of sh experience. Is it possible to use your start-server-and-test
package to do something like: start-server-and-test start http://localhost:8080 test
?
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.
I changed the npm test
command and updated the README
Great feedback, I think I addressed it all in two commits |
package.json
Outdated
"babel-loader": "^8.0.0-beta.0", | ||
"css-loader": "^0.28.11", | ||
"cypress": "^2.1.0", | ||
"cypress-hyperapp-unit-test": "0.0.0-development", |
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.
hmm, this does not look right, the version is incorrect
Awesome @bahmutov thanks for the contribution 👍 💯 🥇 |
Here is an example mounting Hyperapp view function as a component and then driving it via Cypress. Also unit testing actions.
cypress-hyperapp-unit-test
The integration test checks if
TestItem
renders class, responds to click.Also added
npm run ci
command that can run the tests on CI by starting the server, waiting for it to respond, run Cypress, then shutdown the server.