Introduction to Cypress
I’m Gil Tayar, and I’ll be your host for this here Cypress course.
What is Cypress?
It’s a test automation tool, similar to Selenium WebDriver, WebDriverIO, TestCafe, and others.
There’s a lot of buzz around Cypress today, and, given the passionate community built around it, the buzz will probably be with us in the future. We’ll be learning the basics of this wonderful tool and giving you the ability to work and expand your knowledge around it.
But why is this tool generating so much interest?
Because it’s different.
It’s different than the current king of the hill, which is Selenium. It’s not better, because it’s very difficult to be better than Selenium (or its derivatives, like WebdriverIO). It’s different.
Why is it different?
Because it was built by frontend developers, and for frontend developers. And this can be seen by some design decisions that were taken when building this tool.
Second, this tool is Chrome-only.
You can’t run your test in Firefox, or Safari. Definitely not in IE. Chrome only.
Again, natural for frontend developers, as they have long understood that all modern browsers today are mostly compatible. And from their point of view, you test in one browser, you test in all of them.
Yes, yes, I know there are exceptions, but for that, you can write a small set of Selenium tests just to check the edge cases.
Third, this is not an automation tool — it’s a testing tool.
You can’t just write a script that automates things. It has to be a test. And, by the way, the test runner is only Mocha.
Why this insistence on tests?
Because that is what they wanted to build: a testing tool for frontend developers. And it not only comes with a test runner, but also with mocking capabilities, and lots of validation rules — all geared towards testing frontend applications.
Fourth, it’s fast!
Developers don’t like test suites that take hours to run. They want a tool that runs their tests, on their app, in a few minutes.
The way they made it fast it to make the test code itself run in the browser, just like the app code itself. Once the test code runs in the browser, it can do automation things — like clicking, finding elements, and getting the text of an element — much faster than if they run out of process of the browser.
So, yes, Cypress was built for frontend developers, but that doesn’t mean that test automation engineers can’t benefit from it!
They can, and they should. It’s a wonderful tool to use, as long as you are aware of its limitations:
- Only Chrome
- Only Mocha
But it’s time to stop talking, time to start showing. The next lesson will be all about installing Cypress.
And like everything about Cypress, you’ll see that it’s easy peasy!