100% found this document useful (1 vote)
2K views2 pages

Cypress Testing Cheat Sheet PDF

This document provides a cheat sheet for Cypress, an open source framework for testing web applications. It lists basic commands, element interactions, variables and aliases, errors, extensions, installation instructions, learning resources, and popular Cypress repositories. The cheat sheet is intended to serve as a quick reference guide for common Cypress tasks and functionality.

Uploaded by

Sudipta Dutta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
2K views2 pages

Cypress Testing Cheat Sheet PDF

This document provides a cheat sheet for Cypress, an open source framework for testing web applications. It lists basic commands, element interactions, variables and aliases, errors, extensions, installation instructions, learning resources, and popular Cypress repositories. The cheat sheet is intended to serve as a quick reference guide for common Cypress tasks and functionality.

Uploaded by

Sudipta Dutta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Cypressio Cheat Sheet

by Narayanan Palani (Narayanan Palani) via cheatography.com/32112/cs/22731/

Basic Commands Extensions (cont)

Launch npx cypress open cypres​s-s​kip​-an​d-o​‐ https:​//w​ww.n​pm​js.c​om​/pa​cka​ge/​cyp​res​s-s​‐


CypressIO nly-ui kip​-an​d-o​nly-ui
Launch URL cy.vis​it(url) cypres​s-w​atc​h-a​‐ https:​//w​ww.n​pm​js.c​om​/pa​cka​ge/​cyp​res​s-w​‐

Launch URL Update baseUrl in cypr​ess.json (as a prefix) nd-​reload atc​h-a​nd-​reload


with prefix and use cy.vis​it(url) cypres​s-t​est​ing​-li​‐ https:​//w​ww.n​pm​js.c​om​/pa​cka​ge/​@te​sti​ng-​lib​‐
Make HTTP cy.req​ues​t(url) brary rar​y/c​ypress
Request cypres​s-f​ile​-upload https:​//w​ww.n​pm​js.c​om​/pa​cka​ge/​cyp​res​s-f​ile​-
upload
Element Intera​ctions
Locator Strategy
Click Event .click()
Double Click Event .dblcl​ick() CSS Selectors cy.get​‐
(se​lector)
Right Click Event .right​click()
Xpath (cyp​res​s.x​path extension to be installed from cy.xpa​‐
Input on Text Box Fields .type(​text)
https:​//g​ith​ub.c​om​/cy​pre​ss-​io/​cyp​res​s-x​path) th(​sel​‐
Clear Event .clear()
ector)
Check on Checkboxes .check()
Uncheck on Checkboxes .uncheck() Variable and Aliases

Select from Dropdowns .selec​t(v​alue) Variable const,​let,var


Mouse-Down .trigg​er(​'mo​use​down') Aliases .as('n​ame​The​Ali​ases')
Mouse-Up .trigg​er(​'mo​useup') Run commands before each test before​Each()
Mouse-​Leave .trigg​er(​'mo​use​leave')
Errors
Mouse-Move .trigg​er(​'mo​use​move')
Error This is the type of the error (e.g. Assert​ion​Error, Cypres​‐
Mouse-Over .trigg​er(​'mo​use​over')
name sError)
Focus on an object .focus()
Error This generally tells you what went wrong. It can vary in
Debug on a click event .debug​().c​lick()
Message length. Some are short like in the example, while some
Force Click .click({ force: true }) are long, and may tell you exactly how to fix the error.
Learn Some error messages contain a Learn more link that will
Instal​laton of cypres​s-t​est​-te​chn​iques
More take you to relevant Cypress docume​nta​tion.
Basic Tools Nodejs (version 10 or above)​,Gi​tba​sh,​Visual Studio
View Clicking this toggles the visibility of the stack trace. Stack
Needed Code (or any IDE)
Stack traces vary in length.
Step1 npm install Trace
Step2 npm link Print to Click this to print the full error to your DevTools console.
Step3 npm link cypres​s-c​ucu​mbe​r-p​rep​roc​essor console This will usually allow you to click on lines in the stack
button trace and open files in your DevTools
Step4 npm install through

Extensions

Cypress Image https:​//w​ww.n​pm​js.c​om​/pa​cka​ge/​cyp​res​s-i​‐


Snapshot mag​e-s​napshot
Percy (Visual Testing & https:​//d​ocs.pe​rcy.io​/do​cs/​cypress
Review)

By Narayanan Palani Published 10th May, 2020. Sponsored by CrosswordCheats.com


(Narayanan Palani) Last updated 10th May, 2020. Learn to solve cryptic crosswords!
cheatography.com/narayanan- Page 1 of 2. http://crosswordcheats.com
palani/
Cypressio Cheat Sheet
by Narayanan Palani (Narayanan Palani) via cheatography.com/32112/cs/22731/

Learn

Cypress Docume​‐ https:​//d​ocs.cy​pre​ss.i​o/​gui​des​/ov​erv​iew​/wh​y-c​‐


ntation ypr​ess.html
Cypress Test https:​//w​ww.u​de​my.c​om​/co​urs​e/c​ypr​essio
Techniques
Test Automation https:​//w​ww.u​de​my.c​om​/co​urs​e/i​stq​b-a​dva​‐
Engine​ering nced/

Record and Playback

Cypress https:​//c​hro​me.g​oo​gle.co​m/w​ebs​tor​e/d​eta​il/​cyp​res​s-r​eco​‐
Recorder rde​r/g​lca​pdc​acd​fko​kcm​icl​lhc​jig​eodacab
Cypress https:​//c​hro​me.g​oo​gle.co​m/w​ebs​tor​e/d​eta​il/​cyp​res​s-s​cen​‐
Scenario ari​o-r​eco​rde​r/f​mpg​oob​cio​nmf​nea​dja​pda​bmj​fkm​fek​b?hl=en
Recorder

Browser support

Cypress 4.0.0 Google Chrome​,Ca​nary, Mozilla Firefox, Microsoft


or above Edge(C​hromium Based)​,El​ectron
Cypress 3.8.3 Google Chrome and Electron
or below

Framework Reposi​tories

Cypress Test https:​//g​ith​ub.c​om​/na​ray​ana​npa​lan​i/c​ypr​ess​-te​‐


Techniques st-​tec​hniques
Cypress Testing https:​//g​ith​ub.c​om​/te​sti​ng-​lib​rar​y/c​ypr​ess​-te​sti​‐
Library ng-​library
Cypress Axe (Acces​‐ https:​//g​ith​ub.c​om​/av​ans​laa​rs/​cyp​res​s-axe
sib​ility)
Cypress Code https:​//g​ith​ub.c​om​/cy​pre​ss-​io/​cod​e-c​overage
Coverage
Cypress Example API https:​//g​ith​ub.c​om​/cy​pre​ss-​io/​cyp​res​s-e​xam​‐
Testing ple​-ap​i-t​esting
Cypress Lighthouse https:​//g​ith​ub.c​om​/mf​rac​het​/cy​pre​ss-​audit
Audit

By Narayanan Palani Published 10th May, 2020. Sponsored by CrosswordCheats.com


(Narayanan Palani) Last updated 10th May, 2020. Learn to solve cryptic crosswords!
cheatography.com/narayanan- Page 2 of 2. http://crosswordcheats.com
palani/

You might also like