Testing With Capybara
Skill Level: Beginner
Time Limit: 30 minutes
The aim of this challenge is to introduce you to acceptance testing. Your job will be to create automated tests using Capybara & Cucumber that mimic a user logging into the site and navigating to a special page.
NOTE: To login, your username must be the same as your password.
Capybara helps us test web applications by simulating how a real user would interact with an app.
- Clone the repo to your computer and bundle its gems
- Run the application
bundle exec rackup -p 4567then navigate to
localhost:4567in your browser and see what the app does
- Then run your cucumber tests
- View the cucumber
login.featurethat's been created for you
- Fill out the login
step_definitionsso that they pass
- Then complete the
logout.featureand its steps to test logging out a user
- Review the considerations below and refactor the features or step definitions as needed.
- What needs to be tested to ensure that the user authentication functionality of this app works correctly?
- Besides the faulty password scheme, what's the other glaring authentication problem with this application?
- Cucumber is not a big fan of duplicating
step_definitions, do you think you might reuse some of the steps from
login_stepsfor your new scenarios.