Answers for "getting started with cypress"

7

hot to start cypress

./node_modules/.bin/cypress run   // just cypress run wont work
Posted by: Guest on July-01-2020
6

hot to start cypress

npm install cypress                //takes about 3-5 minutes for entire process
./node_modules/.bin/cypress open   // just cypress run wont work
Posted by: Guest on June-25-2020
0

getting started with cypress

steps to make cypress to work
//	Creating a react-app

->	Install node.js from nodejs.org
->	Install npm using $npm install npm -g 
-> 	Install eslint support for cypress by $npm install eslint-plugin-cypress -g	

1.	Create a react app using $npx create-react-app {name_of_your_app}
2.	Install cypress by $npm install cypress --save-dev
	Enable @testing-library supported commands by -> npm install --save-dev @testing-library/cypress
3.	Open package.json folder and add the following under the "eject": "react-scripts eject"
	"eject": "react-scripts eject",
	"cypress": "cypress open"
4. 	In terminal type the following
	$node_modules/.bin/cypress open
	This opens a cypress test runner in your browser
5.	Head back to editor and open the Cypress folder
	<Directory structure of {name_of_your_app}>
	- cypress
	- node_modules
	- public
	- src
	- .gitignore
	- cypress.json
	- package-lock.json
	- package.json
	- README.md
6.	Open the cypress folder
	-cypress
	  -fixtures
	  -intergration
	  -plugins
	  -support
7. 	Open support folder
	- commands.js
	- index.js
8. 	Open the commands.js using an editor and at the end of the file type the following
	import "@testing-library/cypress/add-commands";
9.	In the cypress folder add file named 
	.eslintrc.json
	Inside the .eslintrc.json add the following line
	{
  	   "extends": ["plugin:cypress/recommended"]
	}
10. 	Open intergration folder which is inside the cypress directory
	and delete all the the tests provided which are examples
11.	Write new tests inside the intergration folder which is inside the
	cypress directory. Make sure the tests you write follow this format
	mytest_spec.js
12.	You can write the following as an example of mytest_spec.js
	describe("my applications tests", ()=>{
	  beforeEach(()=>{
		cy.visit("http://localhost:3000/");		
	  });
	  it("doesn't do much anyway", ()=>{
	  	expect(true).to.equal(true);
	  })
	})
13.	Head back to the cypress test runner we opened using the command 
	in point number 4 above. Click the mytest_spec.js and see the
	tests you wrote passing
Posted by: Guest on October-14-2021

Code answers related to "getting started with cypress"

Code answers related to "Javascript"

Browse Popular Code Answers by Language