cypress: where automated ui testing isn't just for qa · 2019-06-14 · jill manager bob qa...

111
Justin James Justin James Justin James Cypress: Where Automated UI Testing Isn't Just for QA

Upload: others

Post on 28-May-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

Justin JamesJustin JamesJustin James

Cypress: Where

Automated UI

Testing Isn't

Just for QA

Page 2: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

KatieDeveloper

BobQA

Acme Consulting

Page 3: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

BillClient

World class coffee

Page 4: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

1 day

Page 5: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

1 day

after another bad release

Page 6: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

1 day

after another bad release

Jill gets a call

Page 7: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

BillClient

JillManager

taking too long to deliver!

Page 8: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BillClient

you have too many bugs!

Page 9: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BillClient

I am losing money!!!

oh no! we are so sorry!

Page 10: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BillClient

I will get this fixed

Page 11: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

houston, we havea problem!

Page 12: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

Bill is angry!

Page 13: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

we are taking

too long!

Page 14: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

we have too

many bugs!

Page 15: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

we need to

fix this ASAP!

Page 16: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

why is stuff escaping QA?

we are doing the best we can

Page 17: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

we havelimited resources!!!

Page 18: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

takes days JUST totest happy path

Page 19: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

developers needs to test better!

Page 20: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

woah, Bob!!

Page 21: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

we are testing

as much as we can

Page 22: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

we are just as constrained!

Page 23: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

can we automate the testing?

maybe!

Page 24: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

IF

we can find a tool

Page 25: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

ISN'Tdeveloper focused

Page 26: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

DOESN'Tcreate brittle tests

Page 27: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

ISN'Tslow to create tests

Page 28: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

ISN'T slow to run tests

Page 29: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

so far we haven't found anything

Page 30: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

Bob, we might be able to help

Page 31: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

been hearing a lot about Cypress

Page 32: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

they tout it as faster

Page 33: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

brittle resistant

Page 34: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

and easy to create tests

Page 35: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

however, automating tests,

will take longer

Page 36: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

but,will reduce QA time

Page 37: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

while,

increasing confidence in our releases

Page 38: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

BUUUUTTTT,what will I do!!

Page 39: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

I LIKE and NEED my job

Page 40: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

there will be plentyof work for you

Page 41: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

stress testing

Page 42: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

exception testing

Page 43: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

security testing

Page 44: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

accessibility testing

Page 45: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

using UI in weird and unexpected ways

Page 46: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

writing tests

Page 47: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

that is a lot of work ☺

Page 48: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

Jill,we need you

to give us time

Page 49: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

done!

Page 50: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

JillManager

BobQA

KatieDeveloper

lets do this

before we lose Bill

Page 51: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

Let Your Nerd Be Heard

Who Am I?

Page 52: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

Testing

Pyramid

Page 53: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

UI

Testing

Pyramid

Page 54: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path
Page 55: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path
Page 56: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path
Page 57: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path
Page 58: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path
Page 59: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path
Page 60: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

DEMO TIME

Page 61: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

some things you can do

Page 62: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

Things to Do

Page 63: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path
Page 64: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path
Page 65: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

<><>

cy.visit('/unknown').location('pathname').should('eq', '/unknown');

Visit Url And Verify Path

Page 66: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

<><>

cy.get('.addBtn').should('contain', 'Add');

Get Element

Page 67: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

<><>

cy.get('[data-cy="addBtn"]')

Get Element With Data-Cy Attribute

Page 68: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

<><>

cy.get('[data-cy="addBtn"]').click();

Click Element

Page 69: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

<><>

cy.get('[data-cy="todoInput"]').type('Todo Test Item');

Type Into Input Field

Page 70: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

<><>

cy.get('[data-cy="todoInput"]').type('Todo Test Item{enter}');

Type Into Input Field

Page 71: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

<><>

cy.get('[data-cy="todoInput"]').clear();

Clear Input Field

Page 72: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

<><>

cy.get('[data-cy="todoItems').should('have.length', 2);

Check Length Of Elements

Page 73: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

<><>

cy.get('[data-cy="todoItems"]:first')

cy.get('[data-cy="todoItems"]').eq(1)

Get Element By Position

Page 74: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

<><>

cy.get('[data-cy="leftMenu"]:first').should('have.attr', 'href').and('include', '/unknown');

Verify Href Value

Page 75: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

<><>

cy.get('[data-cy="emailValidation"]').should('be.visible')

Element Visible

Page 76: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

<><>

cy.get('[data-cy="emailValidation"]').should('not.be.visible')

Element Not Visible

Page 77: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

<><>

cy.get('[data-cy="signupBtn"]').should('not.be.disabled');

Element Enabled

Page 78: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

<><>

cy.get('[data-cy="signupBtn"').should('be.disabled');

Element Disabled

Page 79: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

<><>

cy.server();cy.route({

url: '/user/identity',status: 200,method: 'GET',response: {},

}).as('identity');

Mock XHR Response

Page 80: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

<><>

cy.wait('@identity');

Wait For XHR Call

Page 81: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

DEMO TIME

Page 82: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

How Do I Get Started?

Page 83: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path
Page 84: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

<>

{"viewportWidth": 1000,"viewportHeight": 600,"baseUrl": "http://localhost:4200","blacklistHosts": ["*fonts.googleapis.com"]

}

Configure View Port Size

Page 85: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path
Page 86: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path
Page 87: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path
Page 88: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path
Page 89: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

<><>

cy.percySnapshot();

cy.percySnapshot('Screenshot Name');

Take Screenshot

Page 90: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

DEMO TIME

Page 91: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path
Page 92: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path
Page 93: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path
Page 94: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

<><>

cy.visit('/unknown');

cy.injectAxe();

cy.checkA11y();

Accessibility Testing using Axe

Page 95: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

<><>

cy.visit('/unknown');

cy.injectAxe();

cy.checkA11y();

Accessibility Testing using Axe

Page 96: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

<><>

cy.visit('/unknown');

cy.injectAxe();

cy.checkA11y();

Accessibility Testing using Axe

Page 97: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

<><>

cy.visit('/unknown');

cy.injectAxe();

cy.checkA11y();

Accessibility Testing using Axe

Page 98: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

DEMO TIME

Page 99: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path
Page 100: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

CI/CD For The Win

Page 101: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

Process

Page 102: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path
Page 104: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path
Page 105: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path
Page 106: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path
Page 107: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path
Page 108: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

Tomorrow

Page 110: Cypress: Where Automated UI Testing Isn't Just for QA · 2019-06-14 · Jill Manager Bob QA Katie Developer takes days JUST to test happy path

Connecting After PresentationConnecting After Presentation