CAPYBARA-RUBY-FOR-STUDIES
SUMMARY
Repository with examples of automation using capybara + cucumber + siteprims + rspec
Capybara: Helps you test web applications by simulating how a real user would interact with your app. It is agnostic about the driver running your tests and comes with Rack::Test and Selenium support built in. WebKit is supported through an external gem.
Cucumber: Is a tool that supports Behaviour-Driven Development (BDD) - a software development process that aims to enhance software quality and reduce maintenance costs.
RSpec: Tests are not just scripts that verify your application code. They’re also specifications (or specs, for short): detailed explanations of how the application is supposed to behave, expressed in plain English.
SitePrism: Gives you a simple, clean and semantic DSL for describing your site using the Page Object Model pattern, for use with Capybara in automated acceptance testing.
Table of Contents
Índice
README
.
Prerequisites
Configuration
Mac:
Update ruby version and install (if required)
Windows:
Install (if required)
- Chocolatey
- Ruby via chocolatey
- DevKit via chocolatey
- Chromedriver via chocolatey
- Geckodriver via chocolatey
Ubuntu:
Install (if required)
Installation
Clone
-
Clone this repo to your local machine using
https://github.com/uLucasFraga/capybara_for_studies.git
-
Install all dependencies (Gemfile)
bundle install
Tips
- Use Gemfile to install the project dependencies
Features
- file example
.feature
# language: en
# encode: UTF-8
Feature: Add or remove a new product to cart
- Add a new product to cart
- Remove a product from the cart
Background: Standard user login
Given the standard user is logged
Scenario: Add a new product for your cart
When he adds a new product to the cart
Then he can see the new product in the list
How to run tests
create and configure file .env
- Create file
.evn
in/capybara_ruby_for_studies
- Configure file
.env
with:
example:
SAUCEDEMO=https://www.saucedemo.com
STANDARD=standard_user
LOCKED_OUT=locked_out_user
PROBLEM=problem_user
PERFORMANCE_GLITCH=performance_glitch_user
USER_ERROR=error_login_user
PASSWORD=secret_sauce
ERROR_PASSWORD=sauce_secret
Run tests
run all tests with the bundle
$ bundle exec cucumber
run tests with chrome, firefox or chrome_headless
$ bundle exec cucumber -p chrome
$ bundle exec cucumber -p firefox
$ bundle exec cucumber -p chrome_headless
run tests with chrome, firefox or chrome_headless + tag
$ bundle exec cucumber -p chrome -t @regression
$ bundle exec cucumber -p firefox -t @regression
$ bundle exec cucumber -p chrome_headless -t @regression
run tests with the cucumber
$ cucumber
Support
-
Twitter at
@ulucasfraga
-
Facebook at
Facebook: Lucas Fraga
-
Linkedin at
Linkedin: Lucas Fraga
-
E-mail:
lucass.fragaa@gmail.com
-
Skype:
live:lucass.fragaa
License
- MIT license
- Copyright 2018 © Lucas Fraga.