Writing your first Cucumber test
In this section, you’ll build a Cucumber feature file for a part of the Spec Logo application that we’ve already built.
Warning on Gherkin code samples
If you’re reading an electronic version of this book, be careful when copying and pasting feature definitions. You may find extra line breaks are inserted into your code that Cucumber won’t recognise. Before running your tests, please look through your pasted code snippets and remove any line breaks that shouldn’t be there.
Let’s get started!
- Before running any Cucumber tests, it’s important to ensure that your build output is up to date by running
npm run build
. Your Cucumber specs are going to run against the code built in thedist
directory, not your source in thesrc
directory.
Use package.json scripts to your advantage
You could also modify your package.json
scripts to invoke a build before Cucumber specs are run, or to...