Cypress.io

Finally a real stable front-end testing framework

Lee Blazek

Today!

  • About Me
  • Who are you?
  • End-to-end testing
    • What is it?
    • Current support
    • What can it replace?
    • Basic usage
    • Alternates
    • gotchas
    • future features
  • Demos
    • cypress.io kitchensink
    • other?

About Me

React, Angular, JS, Mean Stack, Front-end, Node api's, with a side of iOS

What other people say about me

- Jeeze... This guy is the Happy Gilmore of javascript + Web Development

What about you?

Automated testing a users actions in the browser. Usually connected to database, or mock DB.  Some times stubbed api calls

- ME

End to End Testing

What is it?

Current Support

Most all testing frameworks

are selenium based:

  1. Protractor (JS on top)
  2. Nightmare (JS on top)
  3. Nightwatch (JS on top)
  4. RSpec (ruby on top)
  5. other?

In one way or another you can test

  1. Chrome
  2. Firefox
  3. IE
  4. Safari
  5. some times mobile devices

 

Cypress.io

 

Replace Other request libraries

  • No more Selenium!!
  • No more sleeps!!
  • Interactive GUI for writing and debugging
  • Time travel!!
  • Cli for headless
  • built in screen shots
  • built in video
  • Docker Image to help with CI/CD

Basic Usage


describe('My First Test', function() {
  it('finds the content "type"', function() {

    // Navigate browser to page
    cy.visit('https://example.cypress.io')

    cy.contains('about').click()

    // NOTE: contains is for getting HTML element 
    // by the text inside it(all text!)
    cy.contains('type').should('exist')

    cy.contains('about').click()
    
    // NOTE: get is to get elements by css
    cy.get('h1').should('not.exist')
  })
})

Gotcha's

  1. Cookies are cleared between tests by default(but you can persist easily)
  2. Local and session storage are persisted by default(but you can clear easily)
  3. Can't Stub ES6 fetch out of the box, but there are work arounds
  4. Chrome and Electron Only
  5. No multi-window or tabs
  6.  Still some selector issues but its 95% reliable, and consistent in errors
  7. https://docs.cypress.io/guides/references/trade-offs.html#Inside-the-browser

 

 

NOTE!!

When Running any E2E test suite don't reload the site in between in each unless you need too. I can double to quadruple your run times

Future Features

(don't try these at home kids)

DEMO's

Lee Blazek

  • www.berzek.io
  • info@berzerk.io
  • linkedin: www.linkedin.com/in/leeblazek
  • https://github.com/berzerk-interactive

Cypress.io(2018)

By Lee Blazek

Cypress.io(2018)

  • 353