SlideShare a Scribd company logo
FROM SCRATCHFROM SCRATCH
a complete guide to e2e testing
https://www.cypress.io/
cypress.io https://www.cypress.io/
cypress.io https://www.cypress.io/
ES UN FRAMEWORK DE TESTINGES UN FRAMEWORK DE TESTING
ESCRITO POR COMPLETO EN JAVASCRIPTESCRITO POR COMPLETO EN JAVASCRIPT
ORIENTADO A DESARROLLADORES/ QA ENGORIENTADO A DESARROLLADORES/ QA ENG
PARA AUTOMATIZAR TEST EN EL NAVEGADORPARA AUTOMATIZAR TEST EN EL NAVEGADOR
SIMULA EL USO DEL NAVEGADOR ACOMO UNSIMULA EL USO DEL NAVEGADOR ACOMO UN
USUARIO REAL LO HARIAUSUARIO REAL LO HARIA
OPEN-SOURCEOPEN-SOURCE
cypress.io https://www.cypress.io/
 Lenguajes de Scripting
Automation
Machine Learning
BlockChain
Beers
Lucas Borella
cypress.io https://www.cypress.io/
Y que mejor forma de ver una herramienta
nueva que con un pantallazo de sus cualidades
cypress.io https://www.cypress.io/
GOTO TEST RUNNER UI
cypress.io https://www.cypress.io/
https://www.cypress.io/features
FEATURESFEATURES
TIME TRAVELTIME TRAVEL
HOT RELOADHOT RELOAD
NATIVE ACCESSNATIVE ACCESS
DEBUGGINGDEBUGGING
AUTOMATICAUTOMATIC
WAITINGWAITING
NETWORKNETWORK
TRAFFICTRAFFIC
CONTOLCONTOL
cypress.io https://www.cypress.io/
https://www.cypress.io/how-it-works
ARQUITECTURAARQUITECTURA
CYPRESS IN BROWSERCYPRESS IN BROWSER CYPRESS IN NODECYPRESS IN NODE
SE MANTIENEN EN CONSTANTE COMUNICACIONSE MANTIENEN EN CONSTANTE COMUNICACION
PARA OBTENER UN FLUJO CONTROLADO DEPARA OBTENER UN FLUJO CONTROLADO DE
NUESTROS TESTS AUTOMATIZADOSNUESTROS TESTS AUTOMATIZADOS
cypress.io https://www.cypress.io/
AHORA QUE ENTRAMOS EN CONTEXTOAHORA QUE ENTRAMOS EN CONTEXTO
Y TENEMOS UN PANORAMA MAS CLAROY TENEMOS UN PANORAMA MAS CLARO
DE CYPRESSDE CYPRESS
LES PRESENTOLES PRESENTO
NUESTRO TEST BUNNYNUESTRO TEST BUNNY
https://github.com/cross13/magic-bunny
cypress.io https://www.cypress.io/
https://github.com/cross13/magic-bunny
$ git clone https://github.com/cross13/magic-bunny.git
$ cd magic-bunny/
$ npm install
1
2
3
$ npm run start1 $ npm run server1
GOTO TERMINAL
cypress.io https://www.cypress.io/
ASI QUE... POR DONDE EMPEZAMOSASI QUE... POR DONDE EMPEZAMOS
(QA) TESTS CASES (QA) TESTS CASES 
cypress.io https://www.cypress.io/
TEST CASE LOGIN PAGE:TEST CASE LOGIN PAGE:
1. Ingresar a http://localhost:3000/login.
2. Chequear el título de nuestra página.
3. Completar el campo username con un usuario válido.
4. Completar el campo password con la password para el
usuario válido.
5. Hacer click en el boton de login
6. Chequear mensages de éxito
7. Corroborar url dentro del app una vez logueado
HAPPY PATHHAPPY PATH
cypress.io https://www.cypress.io/
INSTALACION INICIALINSTALACION INICIAL
$ mkdir magic-bunny-automation && cd ./magic-bunny-automation
$ npm init
$ npm install cypress --save-dev
1
2
3
................
cypress.io https://www.cypress.io/
GOTO TERMINAL
cypress.io https://www.cypress.io/
CYPRESS STRUCTURECYPRESS STRUCTURE
{
"baseUrl": "http://localhost:3000",
"requestTimeout": 7000,
"pageLoadTimeout": 60000,
"defaultCommandTimeout": 5000,
"trashAssetsBeforeRuns": true,
"viewportHeight": 960,
"viewportWidth": 1360,
"env": {
"API_URL": "http://localhost:8080"
}
}
1
2
3
4
5
6
7
8
9
10
11
12
cypress.json //config file
cypress.io https://www.cypress.io/
GOTO VSCODE / TEST RUNNER UI
UN TEST SIMPLEUN TEST SIMPLE
cypress.io https://www.cypress.io/
UN TEST SIMPLEUN TEST SIMPLE
/// <reference types="Cypress" />
context('Login Page', () => {
beforeEach(() => {
cy.visit('/');
})
it('should have the correct title', () => {
cy.get('.Login-Title')
.should('have.text', 'Magic App')
.should('be.visible');
});
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
cypress.io https://www.cypress.io/
ELEGIR EL MEJOR SELECTORELEGIR EL MEJOR SELECTOR
UNIQUENESSUNIQUENESS
Con una serie de estrategias cypress calcula automaticamente el mejor
selector disponible en el DOM para referenciar al elemento objetivo
data-cy
data-test
data-testid
id
class
tag
attributes
nth-child
cypress.io https://www.cypress.io/
EJERCICIO DE SELECTORESEJERCICIO DE SELECTORES
GOTO TEST RUNNER / VSCODE
cypress.io https://www.cypress.io/
CONCEPTO IMPORTANTECONCEPTO IMPORTANTE
RETRY-ABILITYRETRY-ABILITY
https://docs.cypress.io/guides/core-concepts/retry-
ability.html#Commands-vs-assertions
cypress.io https://www.cypress.io/
EJERCICIO DE RETRY-ABILITYEJERCICIO DE RETRY-ABILITY
GOTO VSCODE / TEST RUNNER UI
cypress.io https://www.cypress.io/
UI UI 
/// <reference types="Cypress" />
context('Login Page', () => {
beforeEach(() => {
cy.visit('/');
})
it('Should render the correct login page', () => {
cy.get('.Login-Title').should('have.text', 'Magic App').should('be.visible');
cy.get('.Login-username').should('have.attr', 'placeholder', 'Username');
cy.get('.Login-password').should('have.attr', 'placeholder', 'Password');
cy.get('.Login-submit').should('contain', 'Login');
});
it('should allow to type inside the inputs', () => {
cy.get('.Login-username').type('myuser');
cy.get('.Login-username').invoke('val').should((text) => {
expect(text).to.eq('myuser');
});
cy.get('.Login-password').type('mypassword');
cy.get('.Login-password').invoke('val').should((text) => {
expect(text).to.eq('mypassword');
});
});
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
cypress.io https://www.cypress.io/
UI <-> API UI <-> API 
/// <reference types="Cypress" />
context('Login Page', () => {
beforeEach(() => {
cy.visit('/');
})
it('should login', () => {
cy.get('.Login-username').type('admin');
cy.get('.Login-password').type('123456');
cy.get('.Login-submit').click();
});
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
cypress.io https://www.cypress.io/
STYLESTYLE
it('should show the error msg on a failed login with the correct style', () => {
cy.get('.Login-username').type('fail-user');
cy.get('.Login-password').type('fail-password');
cy.get('.Login-submit').click();
cy.get('.Login-error').contains('Wrong Crendentials');
cy.get('.Login-error').should('have.css', 'background-color')
.and('eq', 'rgb(181, 67, 36)');
cy.get('.Login-error').should('have.css', 'color')
.and('eq', 'rgb(255, 255, 255)');
});
1
2
3
4
5
6
7
8
9
10
cypress.io https://www.cypress.io/
UN POCO MAS COMPLEJOUN POCO MAS COMPLEJO
it('should login', () => {
cy.server().route('POST', '/login').as('postLogin');
cy.clearLocalStorage().then((ls) => {
expect(ls.getItem('myUser')).to.be.null
});
cy.get('.Login-username').type('admin');
cy.get('.Login-password').type('123456');
cy.get('.Login-submit').click();
cy.wait('@postLogin').its('status').should('be', 200);
cy.url().should('include', '/magic').then(() => {
expect(localStorage.getItem('myUser')).not.empty;
cy.log(localStorage.getItem('myUser'));
});
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
cypress.io https://www.cypress.io/
USE NETWORK REQUEST TO AVOID SCREENSUSE NETWORK REQUEST TO AVOID SCREENS
it('should authenticate with the api', () => {
cy.fixture('login').then((user) => {
cy.request('POST', Cypress.env('API_URL') + '/login', user)
.then((xhr) => {
expect(xhr.body).not.empty;
expect(xhr.body.token).not.empty;
localStorage.setItem('myUser', xhr.body);
})
});
})
1
2
3
4
5
6
7
8
9
10
cypress.io https://www.cypress.io/
CREAR COMANDOSCREAR COMANDOS
Cypress.Commands.add('login', (username, password) => {
cy.server().route('POST', '/login').as('postLogin');
cy.clearLocalStorage().then((ls) => {
expect(ls.getItem('myUser')).to.be.null
});
cy.get('.Login-username').type('admin');
cy.get('.Login-password').type('123456');
cy.get('.Login-submit').click();
cy.wait('@postLogin').its('status').should('be', 200);
cy.url().should('include', '/magic').then(() => {
expect(localStorage.getItem('myUser')).not.empty;
cy.log(localStorage.getItem('myUser'));
});
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
cy.login('admin')1
cypress.io https://www.cypress.io/
HOOKSHOOKS
describe('Hooks', function() {
before(function() {
// runs once before all tests in the block
})
after(function() {
// runs once after all tests in the block
})
beforeEach(function() {
// runs before each test in the block
})
afterEach(function() {
// runs after each test in the block
})
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
cypress.io https://www.cypress.io/
DEBUGGING TESTSDEBUGGING TESTS
https://docs.cypress.io/guides/guides/debugging.html#Debug-just-like-you-
always-do
cypress.io https://www.cypress.io/
DEBUGGEAR PROMISES ?DEBUGGEAR PROMISES ?
cypress.io https://www.cypress.io/
THE END, ALL TESTS THE END, ALL TESTS PASSPASS
Links de interes
https://docs.cypress.io/api/api/table-of-contents.html
Github
https://github.com/cross13/magic-bunny
https://github.com/cross13/magic-bunny-automation
https://www.cypress.io/blog/
https://docs.cypress.io/guides/references/best-practices.html#article

More Related Content

PDF
Infinum Android Talks #20 - Making your Android apps fast like Blue Runner an...
PDF
Definitive Guide to Working With Exceptions in Java
PPT
Griffon: Swing just got fun again
DOCX
Comparing PVS-Studio for C# and a built-in Visual Studio analyzer, using the ...
PDF
Bugs found in GCC with the help of PVS-Studio
PDF
Checking PVS-Studio with Clang
PDF
Static Analysis: From Getting Started to Integration
PDF
Windmill Testing certification
Infinum Android Talks #20 - Making your Android apps fast like Blue Runner an...
Definitive Guide to Working With Exceptions in Java
Griffon: Swing just got fun again
Comparing PVS-Studio for C# and a built-in Visual Studio analyzer, using the ...
Bugs found in GCC with the help of PVS-Studio
Checking PVS-Studio with Clang
Static Analysis: From Getting Started to Integration
Windmill Testing certification

What's hot (6)

PPTX
Best Coding Practices For Android Application Development
PDF
Finding bugs in the code of LLVM project with the help of PVS-Studio
PDF
200819 NAVER TECH CONCERT 05_모르면 손해보는 Android 디버깅/분석 꿀팁 대방출
PPTX
Audit your reactive applications
PDF
Errors detected in the Visual C++ 2012 libraries
PDF
Smoke Tests @ DevOps-Hamburg 06.02.2017
Best Coding Practices For Android Application Development
Finding bugs in the code of LLVM project with the help of PVS-Studio
200819 NAVER TECH CONCERT 05_모르면 손해보는 Android 디버깅/분석 꿀팁 대방출
Audit your reactive applications
Errors detected in the Visual C++ 2012 libraries
Smoke Tests @ DevOps-Hamburg 06.02.2017
Ad

Similar to Argentesting 2019 - Cypress una completa experiencia de testing end to end (20)

PDF
The state of server-side Swift
PDF
TC39, their process and some ECMAScript features
PPTX
Dmytro Kochergin “Autotest with CYPRESS”
PDF
capybara testing certification
PPT
Java script Tutorial - QaTrainingHub
PPT
Online gas booking project in java
PPT
Sauce Labs Beta Program Overview
PPTX
[ApacheCon 2016] Advanced Apache Cordova
PDF
Agile delivery for Bangladesh Outsourcing Provider Industry
ZIP
Test
PPTX
Follow your code: Node tracing
PDF
Presentation security automation (Selenium Camp)
PDF
Samuel Asher Rivello - PureMVC Hands On Part 2
PPTX
Selenium-online-training
PDF
How to Record Scripts in JMeter? JMeter Script Recording Tutorial | Edureka
PDF
Sap tutorial
PDF
Sap tutorial[1](1)
ODP
Integration Testing in Python
PDF
Stop Being Lazy and Test Your Software
PPT
AppengineJS
The state of server-side Swift
TC39, their process and some ECMAScript features
Dmytro Kochergin “Autotest with CYPRESS”
capybara testing certification
Java script Tutorial - QaTrainingHub
Online gas booking project in java
Sauce Labs Beta Program Overview
[ApacheCon 2016] Advanced Apache Cordova
Agile delivery for Bangladesh Outsourcing Provider Industry
Test
Follow your code: Node tracing
Presentation security automation (Selenium Camp)
Samuel Asher Rivello - PureMVC Hands On Part 2
Selenium-online-training
How to Record Scripts in JMeter? JMeter Script Recording Tutorial | Edureka
Sap tutorial
Sap tutorial[1](1)
Integration Testing in Python
Stop Being Lazy and Test Your Software
AppengineJS
Ad

More from Argentesting (20)

PDF
Análisis de Aplicaciones móviles - aspectos de seguridad
PPTX
Argentesting 2019 - Cambiando el paradigma de la automatización
PPTX
Argentesting 2019 - Cómo convertirse en un tester ágil
PPTX
Argentesting 2019 - Desentrañando selenium
PPTX
Argentesting 2019 - Introducción al testing en DevOps
PPTX
Argentesting 2019 - En la era de la disrupción ¿Cómo estamos imaginando el fu...
PDF
Argentesting 2019 - Por que-python-esta-buenisimo
PPTX
Argentesting 2019 - Testing de accesibilidad: un valor agregado cómo profesio...
PPTX
Argentesting 2019 - Testing exploratorio basado en sesiones
PDF
Argentesting 2019 - Ser ágiles, hacer ágiles. la historia de un proyecto exitoso
PPTX
Argentesting 2019 - En la era de la disrupción ¿Cómo estamos imaginando el fu...
PPTX
Argentesting 2019 - Introducción al testing en DevOps
PDF
Argentesting 2019 - Cómo ser más productivo utilizando la línea de comando pa...
PDF
Argentesting 2019 - Analizando la seguridad en aplicaciones móviles
PDF
Argentesting 2019 - Accesibilidad, donde las especialidades convergen
PPTX
Argentesting 2019 - Automatizar al infinito y más allá, trae sus inconvenientes
PPTX
Argentesting 2019 - Cómo la 4ta revolución industrial afectará al testing
PPTX
Argentesting 2019 - Caso de éxito de pruebas automatizadas en industria autom...
PPTX
Argentesting 2019 - Lippia, un framework multipropósito
PPTX
Argentesting 2019 - Machine learning en testing priorizacion de casos de pr...
Análisis de Aplicaciones móviles - aspectos de seguridad
Argentesting 2019 - Cambiando el paradigma de la automatización
Argentesting 2019 - Cómo convertirse en un tester ágil
Argentesting 2019 - Desentrañando selenium
Argentesting 2019 - Introducción al testing en DevOps
Argentesting 2019 - En la era de la disrupción ¿Cómo estamos imaginando el fu...
Argentesting 2019 - Por que-python-esta-buenisimo
Argentesting 2019 - Testing de accesibilidad: un valor agregado cómo profesio...
Argentesting 2019 - Testing exploratorio basado en sesiones
Argentesting 2019 - Ser ágiles, hacer ágiles. la historia de un proyecto exitoso
Argentesting 2019 - En la era de la disrupción ¿Cómo estamos imaginando el fu...
Argentesting 2019 - Introducción al testing en DevOps
Argentesting 2019 - Cómo ser más productivo utilizando la línea de comando pa...
Argentesting 2019 - Analizando la seguridad en aplicaciones móviles
Argentesting 2019 - Accesibilidad, donde las especialidades convergen
Argentesting 2019 - Automatizar al infinito y más allá, trae sus inconvenientes
Argentesting 2019 - Cómo la 4ta revolución industrial afectará al testing
Argentesting 2019 - Caso de éxito de pruebas automatizadas en industria autom...
Argentesting 2019 - Lippia, un framework multipropósito
Argentesting 2019 - Machine learning en testing priorizacion de casos de pr...

Recently uploaded (20)

PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Cloud computing and distributed systems.
PPTX
Spectroscopy.pptx food analysis technology
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Electronic commerce courselecture one. Pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPT
Teaching material agriculture food technology
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
The Rise and Fall of 3GPP – Time for a Sabbatical?
Chapter 3 Spatial Domain Image Processing.pdf
Cloud computing and distributed systems.
Spectroscopy.pptx food analysis technology
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Understanding_Digital_Forensics_Presentation.pptx
MIND Revenue Release Quarter 2 2025 Press Release
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Electronic commerce courselecture one. Pdf
NewMind AI Weekly Chronicles - August'25 Week I
Teaching material agriculture food technology
Dropbox Q2 2025 Financial Results & Investor Presentation
Per capita expenditure prediction using model stacking based on satellite ima...
Network Security Unit 5.pdf for BCA BBA.
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Encapsulation_ Review paper, used for researhc scholars
Digital-Transformation-Roadmap-for-Companies.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows

Argentesting 2019 - Cypress una completa experiencia de testing end to end