Show Menu
Cheatography

Cypressio cheat sheet helps in using right code examples for the automation frameworks. This cheat sheet is created for the participants of online training platform: https://engineers-hub.teachable.com/p/cypressio

Basic Commands

Launch CypressIO
npx cypress open
Launch URL
cy.vis­it(url)
Launch URL with prefix
Update baseUrl in cypres­s.json (as a prefix) and use cy.vis­it(url)
Make HTTP Request
cy.req­ues­t(url)

Element Intera­ctions

Click Event
.click()
Double Click Event
.dblcl­ick()
Right Click Event
.right­click()
Input on Text Box Fields
.type(­text)
Clear Event
.clear()
Check on Checkboxes
.check()
Uncheck on Checkboxes
.uncheck()
Select from Dropdowns
.selec­t(v­alue)
Mouse-Down
.trigg­er(­'mo­use­down')
Mouse-Up
.trigg­er(­'mo­useup')
Mouse-­Leave
.trigg­er(­'mo­use­leave')
Mouse-Move
.trigg­er(­'mo­use­move')
Mouse-Over
.trigg­er(­'mo­use­over')
Focus on an object
.focus()
Debug on a click event
.debug­().c­lick()
Force Click
.click({ force: true })

Instal­laton of cypres­s-t­est­-te­chn­iques

Basic Tools Needed
Nodejs (version 10 or above)­,Gi­tba­sh,­Visual Studio Code (or any IDE)
Step1
npm install
Step2
npm link
Step3
npm link cypres­s-c­ucu­mbe­r-p­rep­roc­essor
Step4
npm install through

Extensions

Cypress Image Snapshot
Percy (Visual Testing & Review)
cypres­s-s­kip­-an­d-o­nly-ui
cypres­s-w­atc­h-a­nd-­reload
cypres­s-t­est­ing­-li­brary
cypres­s-f­ile­-upload
Cypress Report­portal
Cypress Drag and Drop
Cypress iframe
Cypress Xpath
Cypress Lighthouse Audit
Cypress Dark (Theme)
Cypress Docker
Cypress Mochaw­esome Reporter
Cypress Terminal Report
Cypress Visual Regression
 

Locator Strategy

CSS Selectors
cy.get­(se­lector)
Xpath (cypres­s.xpath extension to be installed from https:­//g­ith­ub.c­om­/cy­pre­ss-­io/­cyp­res­s-x­path)
cy.xpa­th(­sel­ector)

Variable and Aliases

Variable
const,­let,var
Aliases
.as('n­ame­The­Ali­ases')
Run commands before each test
before­Each()

Errors

Error name
This is the type of the error (e.g. Assert­ion­Error, Cypres­sError)
Error Message
This generally tells you what went wrong. It can vary in length. Some are short like in the example, while some are long, and may tell you exactly how to fix the error.
Learn More
Some error messages contain a Learn more link that will take you to relevant Cypress docume­nta­tion.
View Stack Trace
Clicking this toggles the visibility of the stack trace. Stack traces vary in length.
Print to console button
Click this to print the full error to your DevTools console. This will usually allow you to click on lines in the stack trace and open files in your DevTools

Learn

Record and Playback

Browser support

Cypress 4.0.0 or above
Google Chrome­,Ca­nary, Mozilla Firefox, Microsoft Edge(C­hromium Based)­,El­ectron
Cypress 3.8.3 or below
Google Chrome and Electron

Framework Reposi­tories

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Selenium WebDriver Cheat Sheet Cheat Sheet
          ISTQB Test Automation Engineering Cheat Sheet

          More Cheat Sheets by Narayanan Palani

          Selenium WebDriver Cheat Sheet Cheat Sheet
          ISTQB Test Automation Engineering Cheat Sheet