C / C++ / C# / Java / CoffeeScript / JavaScript / Node / Angular / Vue / Cycle.js / functional
EveryScape
virtual tours
MathWorks
MatLab on the web
Kensho
finance dashboards
$ npm install -D jest
const add = require('./add')
describe('addition', () => {
it('adds numbers', () => {
expect(add(1, 2)).toBe(3)
})
})
$ npm test
$ npm install -D cypress
Tip: cache "node_modules" folder on CI
this looks close
it('is focused on new item', () => {
cy.visit(url)
cy.focused()
})
that's result of "cy.focused()"
it('is focused on new item', () => {
cy.visit(url)
cy.focused().should('have.class', 'new-todo')
})
I know exactly what happens
it('is focused on new item', () => {
cy.visit(url)
cy.focused().should('have.class', 'new-todo')
})
Every command
outputs detailed info
in DevTools
and many more ...
The first time one of your
tests fails in Cypress
will be one of your best days
as a developer
zero elements found
cy.get('#todo-list')
.find('li')
.first()
.type('foo')
Trying to type into a list item element
80 commands + events + utilities (lodash, moment, jQuery) + assertions
Every command is described in excruciating detail
cy.viewport('iphone-6')
const url = 'http://todomvc.com/examples/vue/'
cy.visit(url)
{
"baseUrl: "http://todomvc.com/examples/aurelia/"
}
cy.visit('/')
cypress.json
$ export CYPRESS_baseUrl=http://todomvc.com/examples/typescript-react/
$ $(npm bin)/cypress run
Cypress is VERY FAST
var webdriverio = require('webdriverio');
var options = { desiredCapabilities: { browserName: 'chrome' } };
var client = webdriverio.remote(options);
client
.init()
.url('https://duckduckgo.com/')
.setValue('#search_form_input_homepage', 'WebdriverIO')
.click('#search_button_homepage')
.getTitle().then(function(title) {
console.log('Title is: ' + title);
// outputs:
// "Title is: WebdriverIO (Software) at DuckDuckGo"
})
.end();
Wait<WebDriver> wait = new FluentWait<WebDriver>(driver)
.withTimeout(30, SECONDS)
.pollingEvery(5, SECONDS)
.ignoring(NoSuchElementException.class);
Timeouts, timeouts everywhere!
Test continues as soon as DOM updates
This week đŸ¤”
This week đŸ¤”
See, share, and fix failing tests.
$ npm install -D cypress