sw2at-capybara 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f0e1ec747896b153771a6e937ad57d81b1005c07
4
- data.tar.gz: 612f7089c773f1c253d343b007c5dda26a1e5a82
3
+ metadata.gz: 38a6cb7cfe558fa94a1658c1259c6cba185cf30e
4
+ data.tar.gz: ddeb05e519afe2f1d30e27ae8100e17c6ff6f5f8
5
5
  SHA512:
6
- metadata.gz: 2adb397119002086ee71cbfbbe269865f36c1f2f9f17197f59e4cd6f4e684bd0aae828b05b41e78eea391c0da1313268fb66b912ecb1bbbad7c7b03503a647dd
7
- data.tar.gz: 88ae551c9482a7793abfc8c5215b873b5491042f4b6858f16458812420f15d22d566126441565f8acc227c388de68cdcc746b63da577ccb5d6aa3178bb22302c
6
+ metadata.gz: 849596d3a0ef435f75bb5452cd3bf021485f94e9b6fdd16f71a39a41644fb04623ddb899d75e3c9e5394e6dbf324267b51a0bea00e68ef79e4d5e0695f2762ec
7
+ data.tar.gz: 9b9732b1750c00813c740be93112ab1bc47fdeabb3711c231aaabc782bc6f79b8479cbd41855d7442382b00be825d9ed812a33940e630878ee83986f63200945
data/README.md CHANGED
@@ -1,13 +1,130 @@
1
- sw2at-capybara
2
- ==============
1
+ # sw2at-capybara
2
+ ## SWAT(Simple Way to Automate Tests) - Capybara Extension
3
3
 
4
- sw2at-capybara is a suite of methods, which help to make test automation easier, faster and more stable.
4
+ sw2at-capybara is a suite of helpers, which help to make test automation easier and faster, improve their maintenance and stability.
5
+
6
+ A little about sw2at-capybara
7
+ -----------------
8
+
9
+ sw2at-capybara has steps like Cucumber does, but here it's not something mandatory, it's up to you.
10
+ Why do we use steps? The answer is simple, it helps us to print a good console output what helps us to debug issues better, and it allows you to understand what's happening when you look at the console and browser window. On the other hand the steps can be written by someone who knows nothing about programming, it might be a QA or even customer (see an example below).
11
+
12
+ ```ruby
13
+
14
+ it 'should do its job' do
15
+
16
+ step 'Go somewhere' do
17
+ # pending
18
+ end
19
+
20
+ step 'Click some button' do
21
+ # pending
22
+ end
23
+
24
+ step 'Type some value' do
25
+ # pending
26
+ end
27
+
28
+ step 'Save the value' do
29
+ # pending
30
+ end
31
+
32
+ step 'Ensure that the result is saved' do
33
+ # pending
34
+ end
35
+ end
36
+ ```
5
37
 
6
38
  Installation
7
39
  -----------------
8
40
 
9
- gem install sw2at-capybara
41
+ Add to your Gemfile
42
+ ```ruby
43
+ gem 'sw2at-capybara'
44
+ ```
45
+
46
+ Run bundle install
47
+
48
+ bundle install
49
+
50
+ Using
51
+ -----------------
52
+
53
+ Add the following to your spec_helper.rb
54
+ ```ruby
55
+ require 'capybara'
56
+ require 'rspec/core/formatters/base_text_formatter'
57
+ config.formatter = RSpec::Core::Formatters::BaseTextFormatter # if you don't use any custom formatters.
58
+
59
+ Swat::Capybara.setup(config, { default_pause: 0.5,
60
+ min_pause: 0.3,
61
+ tries: 10,
62
+ default_selector: 'body',
63
+ output: { enabled: true, started: ?>, step: ?. }
64
+ })
65
+ ```
66
+ So your spec_helper.rb might look like the following:
67
+
68
+ ```ruby
69
+ ENV['RAILS_ENV'] = 'test'
70
+ require File.expand_path('../../config/environment', __FILE__)
71
+ require 'pry'
72
+ require 'capybara'
73
+
74
+ RSpec.configure do |config|
75
+
76
+ Capybara.default_driver = :selenium
77
+ config.include Capybara::DSL, type: :feature
78
+
79
+ Swat::Capybara.setup(config, {
80
+ tries: 10,
81
+ default_selector: 'body',
82
+ })
83
+ end
84
+ ```
85
+
86
+ Examples
87
+ -----------------
88
+ See a simple swat-capybara example[ here](https://github.com/tw4qa/swat-capybara-example).
89
+
90
+ How it looks
91
+ -----------------
92
+ ```ruby
93
+ describe 'Google Search', type: :feature do
94
+
95
+ before :all do
96
+ @google_url = 'http://google.com'
97
+ @key_to_search_by = 'swat-capybara'
98
+ @results_we_should_see = ['sw2at/swat.gemspec at master', 'The Capybara Cave', 'https://github.com/tw4qa/sw2at']
99
+ end
10
100
 
101
+ it 'should show us a good search result' do
102
+
103
+ step 'Go to Google' do
104
+ visit @google_url
105
+ end
106
+
107
+ step 'Type key string' do
108
+ safe_find('#lst-ib').set(@key_to_search_by)
109
+ end
110
+
111
+ step 'Click Search button' do
112
+ safe_click('button[type="submit"]')
113
+ end
114
+
115
+ step 'Ensure that the page contains all those results' do
116
+ @results_we_should_see.each do |text|
117
+ sub_step "Check '#{text}' presence" do
118
+ check_text text
119
+ end
120
+ end
121
+ end
122
+ end
123
+ end
124
+ ```
125
+
126
+ ![alt tag](https://github.com/tw4qa/swat-capybara-example/blob/master/console_log.png)
127
+
11
128
  Contributing to sw2at-capybara
12
129
  -----------------
13
130
 
@@ -23,4 +140,3 @@ Copyright
23
140
  -----------------
24
141
  Copyright (c) 2015 Vitaly Tarasenko. See LICENSE.txt for
25
142
  further details.
26
-
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
@@ -13,9 +13,12 @@ module Swat
13
13
  RSpec::Core::Formatters.register self, :example_started, :example_passed, :example_failed, :start, :stop
14
14
 
15
15
  START_MESSAGE = <<STM
16
- -------------------------------
17
- [ SW2AT-CAPYBARA initialized ]
18
- -------------------------------
16
+
17
+ _|_|_| _| _| _|_| _|_|_|_|_|
18
+ _| _| _| _| _| _|
19
+ _|_| _| _| _| _|_|_|_| _|
20
+ _| _| _| _| _| _| _|
21
+ _|_|_| _| _| _| _| _|
19
22
  STM
20
23
 
21
24
  def initialize(arg)
@@ -31,7 +34,8 @@ STM
31
34
 
32
35
  def example_started(notification)
33
36
  @started = Time.now
34
- @swat_logger.puts "\n[FEATURE] #{notification.example.description}".yellow
37
+ example_type = notification.example.metadata[:type].to_s.upcase
38
+ @swat_logger.puts "\n[#{example_type}] #{notification.example.description}".yellow
35
39
  end
36
40
 
37
41
  def example_passed(notification)
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: sw2at-capybara 0.0.2 ruby lib
5
+ # stub: sw2at-capybara 0.0.3 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "sw2at-capybara"
9
- s.version = "0.0.2"
9
+ s.version = "0.0.3"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Vitaly Tarasenko"]
14
- s.date = "2015-06-22"
14
+ s.date = "2015-06-26"
15
15
  s.description = " Gem helps to create capybara tests for pages with a very dynamic content. "
16
16
  s.email = "vetal.tarasenko@gmail.com"
17
17
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sw2at-capybara
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vitaly Tarasenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-22 00:00:00.000000000 Z
11
+ date: 2015-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec