Created
April 11, 2021 16:51
-
-
Save LinuxlinkedBD/d7b2659c52062c42af499e24d984c1fe to your computer and use it in GitHub Desktop.
Cypress installation on Ubuntu 20.04 LTS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If you need complete Cypress setup, ping me on below contacts: | |
Telegram: linuxlinked | |
email: [email protected] | |
WhatsApp: +8801720903155 | |
Skype:live:.cid.c0dc316b9d727d5e | |
YouTube: https://youtu.be/3h-Zp9BLlrc | |
######################################################################################################################################## | |
#!/bin/sh | |
#Cypress Installation Steps: | |
mkdir project | |
cd /project/path | |
# Run this command. This will install Cypress locally as a dev dependency for your project | |
npm install cypress | |
#Run shortcut using npm bin | |
$(npm bin)/cypress open | |
OR | |
npm run cypress:open | |
#Sample Cypress Script: Filename of the automated script: facebook_login.js | |
describe('Login to Facebook', function() { | |
// ---- Login to Facebook ---- // | |
it('login successful', function() { | |
cy.visit('https://www.facebook.com/') | |
cy.get('input[name="email"]').type('[email protected]') | |
cy.get('input[name="pass"]').type('test_pass') | |
cy.get('label[id="loginbutton"]').click({ multiple: true, force: true}) | |
cy.wait(4000) | |
}); | |
}); | |
#Adding npm scripts: While there’s nothing wrong with writing out the full path to the Cypress executable each time, it’s much easier and clearer to add Cypress commands to the scripts field in your package.json file. | |
{ | |
"scripts": { | |
"cypress:open": "cypress open" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ycypress$ sudo yarn cypress info
00h00m00s 0/0: : ERROR: [Errno 2] No such file or directory: 'cypress'
ycypress$ sudo yarn cypress open
00h00m00s 0/0: : ERROR: [Errno 2] No such file or directory: 'cypress'