Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a code generator for Cypress testing tool

I have been studying Cypress testing tool. I have huge front end flow to test . Writing so much JS code will be tough .

So i want to know if there is a code generator that records/generates code tests.

I know a tool Snaptest - snaptest.io . However this tool generates code in NightWatchJS and Chromeless only . the Cypress framework is disabled .

i found this - https://github.com/cypress-io/generator-node-cypress But i am not sure what this does .

So i want to know if there is any alternate recorder/generator for generating code to use in Cypress .

Suggestions ? Thanks .

like image 527
Skadoosh Avatar asked Aug 29 '18 08:08

Skadoosh


People also ask

Does Cypress require coding knowledge?

With Cypress you use JavaScript to write tests. If you have been coding with JavaScript only for a couple of months, you'll still be able to use Cypress. Cypress provides great error messages which clearly explain why your test did not work. Cypress does not require any configuration.

What code does cypress use?

JavaScript is a widely used language among front-end developers. The fact that Cypress is purely based on JavaScript indicates how this tool is designed to meet the needs of front-end developers in particular. Naturally, one needs to be proficient in JavaScript before getting started with Cypress testing.

What language are Cypress tests written in?

4 Cypress tests are only written in JavaScript. While you can compile down to JavaScript from any other language, ultimately the test code is executed inside the browser itself. There are no language or driver bindings - there is and will only ever be just JavaScript.

Can you write your tests in any language with Cypress?

Cypress tests anything that runs in the context of a browser. It is back end, front end, language and framework agnostic. You'll write your tests in JavaScript, but beyond that Cypress works everywhere.


2 Answers

Yes, it looks like there is a good attempt to create a scenario recorder and it works to a great extent:

https://chrome.google.com/webstore/detail/cypress-scenario-recorder/fmpgoobcionmfneadjapdabmjfkmfekb/related?hl=en

like image 124
Hussein El Motayam Avatar answered Sep 27 '22 21:09

Hussein El Motayam


2021 Update

There have been generators available for a while that the other answers mention. I originally answered this in August 2018, at which time there were no generators available. I still stand by my advice below.

Original answer

To answer your question:

No

To provide you unsolicited advice:

Testing a huge flow throughout your front end is an anti-pattern in Cypress. They (and I) recommend breaking that up into a spec for each page, then only add small tests to that spec for the actions that you perform on that page. You will also want to mock, stub, or otherwise programmatically set up and tear down the required state for that spec to run.

See this page and watch the linked YouTube video to get a better idea. https://docs.cypress.io/guides/references/best-practices.html#Organizing-Tests-Logging-In-Controlling-State

I have a long history of using selenium with page objects and workflows. I fought this idea for a while when I started using Cypress but have drank the kool-aid and find it is MUCH better this way.

like image 44
Brendan Avatar answered Sep 27 '22 23:09

Brendan