Testing an Angular page with Behat
How about testing these Angular pages? In the previous recipes, I set up Behat and showed how to use this tool to not only test your site but also to help you write code. I will now show how easy it is to test it using Behat over other tools such as Protractor, since with Behat, we get the benefit of Gherkin-based tests that can both test the UI and do Integration-level tests.
Getting ready
In the previous recipes, I installed Behat. I will go over it again, so a base Laravel install should be enough.
How to do it...
Install Behat using composer; your
composer.json
will look like this:Run
composer update
, or if you are impatient like me, runrm -rf vendor composer.lock
, and thencomposer install
Run Behat
init
to set things up:>vendor/bin/behat --init
Make a
behat.yml
file at the root of your app like this:Run Behat again to set up these files (
-s
tells it what suite to use, and--init
will set up the context class for us):>vendor/bin/behat --init ...