Start E2E testing with Cypress!
Unpopular Opinion: Stop unit testing.
Kyle Whitaker

E2E testing is 9.8x faster with Cypress
Kyle Whitaker

Level20
Principles
Experiment
1
3
2
Strategy Process
Corporate Development
Level20
Progressive's Strategy Group
"Growth Incubator"
NDAs
Define Opportunity
Scale & Spin Off
Discovery & Design
Develop & Limited Launch
6 months
24 months
Level20 Product Lifecycle
5
4
3
2
1
Product Strategist
Initiative Director
UX Designer
Full Stack Developer
Level20 Product Team
Data Science
Level20 Support Roles
Engine Team
Product Strategist
UX Designer
Full Stack Developer
Marketing
Operations
IT Security



level20.com

Level20
Principles
Experiment
1
3
2
My Progressive Experience
2015
Year
CVV2
2016
PPro SL
2017
PPro SL
S2
2018
S2
2019
S2
2020
Level20
Test Guru + Selenium
Angular Shallow Specs
Jasmine w/o TestBed
IT Intern
Unit Testing for Devs
Protractor E2E
Cypress
Why test?
CONFIDENCE
(mitigate risk)
Principle
Principle
Testing is hard.
The tooling should make it easy.
Test on Day 1
Principle
Test Automation Maturity
Write tests before coding
3
Write tests during coding
2
Write tests after coding
1
New 📱 who dis?
0
Principle
Requirements
Source Code
Test Code
Test Code
I choose E2E over all other forms of automated testing.
Unpopular Opinion
😈
Perfection is just procrastination.
Principle
Level20
Principles
Experiment
1
3
2






import { $, browser, ExpectedConditions as EC } from 'protractor';
import { getNewUser } from '../../core';
describe('Signup', () => {
it('success', async () => {
const user = getNewUser();
browser.get(browser.baseUrl);
await $('#signup-btn').click();
browser.wait(EC.urlContains('signup'), 2000, 'Expected to go to Signup page');
await $('#signup-name-input').sendKeys(user.name);
await $('#signup-phone-input').sendKeys(user.phone);
await $('#signup-email-input').sendKeys(user.email);
await $('#signup-password-input').sendKeys(user.password);
await $('#signup-submit-btn').click();
browser.wait(EC.urlContains('login'), 2000, 'Expected to go to Login page');
await $('#login-email-input').sendKeys(user.email);
await $('#login-password-input').sendKeys(user.password);
await $('#login-submit-btn').click();
browser.wait(EC.urlContains('home'), 5000, 'Expected to go to Home page');
const greetingText = await $('#home-greeting').getText();
expect(greetingText).toContain(user.name);
});
});


CICD OTB
Typescript OTB
Jasmine OTB
Manual waits
Debugging
Browser config
import { getNewUser } from '../../core';
describe('Signup', () => {
it('success', () => {
const user = getNewUser();
cy.visit('');
cy.get('#signup-btn').click();
cy.get('#signup-name-input').type(user.name);
cy.get('#signup-phone-input').type(user.phone);
cy.get('#signup-email-input').type(user.email);
cy.get('#signup-password-input').type(user.password);
cy.get('#signup-submit-btn').click();
cy.get('#login-email-input').type(user.email);
cy.get('#login-password-input').type(user.password);
cy.get('#login-submit-btn').click();
cy.url().should('contain', 'home');
cy.get('#home-greeting').should('contain', user.name);
});
});


Debugging
Auto waits
Multi browser
Single browser tab
Learning curve
Typescript config
Documentation
OTB
import { getNewUser } from '../../core';
describe('Signup', () => {
it('success', async () => {
const user = getNewUser();
page.goto('http://localhost:4200');
await page.click('#signup-btn');
await page.fill('#signup-name-input', user.name);
await page.fill('#signup-phone-input', user.phone);
await page.fill('#signup-email-input', user.email);
await page.fill('#signup-password-input', user.password);
await page.click('#signup-submit-btn');
await page.fill('#login-email-input', user.email);
await page.fill('#login-password-input', user.password);
await page.click('#login-submit-btn');
const greetingText = await page.innerText('#home-greeting');
expect(greetingText).toContain(user.name);
});
});

Multi Browser
Slow Mo
Jest-Playwright
Some manual waits
Integrations
Documentation

Typescript config
Test runner config
Stop using Protractor
Conclusion
✌️
Cypress is the best debugging experience, hands down
Conclusion
🐛
I love Cypress.
I cannot ignore Playwright.
Conclusion
😯
Best practices & good habits are the foundation, not some framework
Conclusion
🏃♀️
cypress
By Kyle Whitaker
cypress
- 98