Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/prashantsinght99/cypress
https://github.com/prashantsinght99/cypress
cypress javascript mocha
Last synced: 3 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/prashantsinght99/cypress
- Owner: PrashantSinghT99
- Created: 2024-04-26T07:07:53.000Z (8 months ago)
- Default Branch: master
- Last Pushed: 2024-05-27T08:02:42.000Z (7 months ago)
- Last Synced: 2024-12-25T18:41:33.262Z (3 days ago)
- Topics: cypress, javascript, mocha
- Language: JavaScript
- Homepage:
- Size: 18.6 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.text
Awesome Lists containing this project
README
npx cypress open : GUI MODE
npx cypress run : RUN ALL TESTS FROM TERMINAL IN HEADLESS MODE
npx cypress run --headed : RUN ALL TESTS FROM TERMINAL IN HEAD MODE (DEFAULT BROWSER ELECTRON)
npx cypress run --browser=chrome : RUN ALL TESTS FROM TERMINAL IN HEAD MODE (BY SETTING BROWSER)
npx cypress run --spec cypress\e2e\my.test.cy.js : RUN SPECIFIC TESTCASE
npx cypress run --config baseUrl=""
cypress run --env "token"="abc"
LOCATORS
ID
tag#id
tag.class
tag[attribute:"value"]
tag.class[attribute:"value"]
XPATH:
npm install -D cypress-xpath
commands.js
///
///
e2e.js
require('cypress-xpath');
cy.get("css locator")
cy.xpathimplicit explicit assertions
https://docs.cypress.io/guides/references/assertions
ALERTS
WINDOW:ALERT VALIDATION OF ALERT
WINDOW:CONFIRM: CLICKING ON CONFIRM
WINDOW:ALERT: CLICKING ON CANCEL
WINDOW:PROMPT: ENTER TEXT IN ALERT BY CAPTURING IT EARLIER
AUTHENTICATION USING URL/ AUTH OBJECTFRAMES
HOW TO GET FRAME AND DOCUMENT WITHIN IT AND WRAP IT TO PERFORM ACTIONS
HOW TO CREATE A CUSTOM COMMAND
HOW TO USE PLUGIN IN FRAMESMOUSE OPERATIONS:
MOUSE HOVER
DOUBLE CLICK
RIGHT CLICK
DRAG DROP
SCROLL TO A ELEMENTFILE UPLOAD:
HOW TO UPLOAD SINGLE FILE
HOW TO UPLOAD MULTIPLE FILE
HOW TO RENAME A FILE
HOW TO DRAG DROP A FILE UPLOAD
HOW TO UPLOAD FILE SHADOW DOMIMPORTANT PLUGINS:
CYPRESS XPATH PLUGIN: cypress-xpath
FILE UPLOAD PLUGIN: cypress-file-upload
DRAG AND DROP PLUGIN: cypress-drag-drop
IFRAME PLUGIN: cypress-iframeNAVIGATION:
cy.go("forward") or cy.go(1)
cy.go('back) or cy.go(-1)SCREENSHOT CAPTURING
screenshot() or via terminal run command videos and screenshot gets captured add video: true, in cypress.config.js
PERSERVE COOKIES
cy.getCookies()
cy.setCookie()
cy.clearCookies()
cy.clearLocalStorage()Cypress.Cookies.preserveOnce("sessionId","remember_");
IMPLICIT ASSERTIONS
.should("have.length", 5)
.should("be.visible");
.should("exist");
.should("include", "PrashantSingh").and("not.contain", "pst99")
.should("include", "PrashantSingh");
.should("contains", "prashantsinght99");
.should("eq", "https://prashantsinght99.github.io/PrashantSingh.github.io/");
.should("have.value", "prashant");
.should("have.text", "You successfully clicked an alert");
.should("have.contain", "Congratulations");.uncheck().should("not.be.checked")
.check().should("be.checked")
.check({ force: true }).should("be.checked");EXPLICIT ASSERTIONS
cy.get('.name > h1').then((element) => {
let actualname = element.text();
expect(expectedname).to.equal(actualname);
expect(expectedname).to.not.equal(notexpectedname);
assert.equal(actualname, expectedname);
assert.notEqual(actualname, notexpectedname);
expect(element).to.contains("I am a JS Alert");
})Direct
should('eq','')
should('contain','')
should('include','')should('be.visible')
should('be.checked')
should('exist')
should('be.disabled')
should('be.focused')should('have.length')
should('have.value')
should('have.text')
should('have.contain')