watir-rspec 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/README.md +8 -8
- data/lib/watir/rspec/cli.rb +8 -8
- data/lib/watir/rspec/helper.rb +2 -2
- data/lib/watir/rspec/matchers.rb +3 -3
- data/lib/watir/rspec/version.rb +1 -1
- data/spec/watir/rspec/matchers/base_matcher_spec.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17aea3a055c86e44d544fc3afca4290e951b60fe
|
4
|
+
data.tar.gz: 78034a62b03accd0bed96ed385f8f36757c3536e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5dfa485af98c2e3302ba14a1ebff06fd52d92513dbffb82ac8f092e44cfaaa5f19161e10ee2c760ab67d54b562ceebbbe514c4a7e0cfb6ac307f4fb7ac288730
|
7
|
+
data.tar.gz: 47d2bedea996603336f9693ad7fbde25f17c8867314c8414238851570edfedb3edc2c39da373843367ae38501313af7353c409bace69ad47be27270bfd476a7b
|
data/CHANGES.md
CHANGED
data/README.md
CHANGED
@@ -40,16 +40,16 @@ describe "Google" do
|
|
40
40
|
before { goto "http://google.com" }
|
41
41
|
|
42
42
|
it "has search box" do
|
43
|
-
text_field(:
|
43
|
+
expect(text_field(name: "q")).to be_present
|
44
44
|
end
|
45
45
|
|
46
46
|
it "allows to search" do
|
47
|
-
text_field(:
|
48
|
-
button(:
|
49
|
-
results = div(:
|
50
|
-
results.
|
51
|
-
results.lis(:
|
52
|
-
results.
|
47
|
+
text_field(name: "q").set "watir"
|
48
|
+
button(id: "gbqfb").click
|
49
|
+
results = div(id: "ires")
|
50
|
+
expect(results).to be_present.within(2)
|
51
|
+
expect(results.lis(class: "g").map(&:text)).to be_any { |text| text =~ /watir/ }
|
52
|
+
expect(results).to be_present.during(1)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
````
|
@@ -62,7 +62,7 @@ to the files created during tests.
|
|
62
62
|
```ruby
|
63
63
|
uploaded_file_path = Watir::RSpec.file_path("uploaded.txt")
|
64
64
|
File.open(uploaded_file_path, "w") {|file| file.write "Generated File Input"}
|
65
|
-
file_field(:
|
65
|
+
file_field(name: "upload-file").set uploaded_file_path
|
66
66
|
```
|
67
67
|
|
68
68
|
### Rails
|
data/lib/watir/rspec/cli.rb
CHANGED
@@ -8,7 +8,7 @@ module Watir
|
|
8
8
|
def execute
|
9
9
|
@options = {}
|
10
10
|
parser = OptionParser.new do |opts|
|
11
|
-
opts.banner = "Install watir-rspec configuration into spec_helper file.
|
11
|
+
opts.banner = "Install watir-rspec configuration into spec_helper.rb file.
|
12
12
|
|
13
13
|
Usage: watir-rspec [options] install"
|
14
14
|
|
@@ -66,11 +66,11 @@ RSpec.configure do |config|
|
|
66
66
|
# Include RSpec::Helper into each of your example group for making it possible to
|
67
67
|
# write in your examples instead of:
|
68
68
|
# @browser.goto "localhost"
|
69
|
-
# @browser.text_field(:
|
69
|
+
# @browser.text_field(name: "first_name").set "Bob"
|
70
70
|
#
|
71
71
|
# like this:
|
72
72
|
# goto "localhost"
|
73
|
-
# text_field(:
|
73
|
+
# text_field(name: "first_name").set "Bob"
|
74
74
|
#
|
75
75
|
# This needs that you've used @browser as an instance variable name in
|
76
76
|
# before :all block.
|
@@ -78,12 +78,12 @@ RSpec.configure do |config|
|
|
78
78
|
|
79
79
|
# Include RSpec::Matchers into each of your example group for making it possible to
|
80
80
|
# use #within with some of RSpec matchers for easier asynchronous testing:
|
81
|
-
# @browser.text_field(:
|
82
|
-
# @browser.text_field(:
|
83
|
-
# @browser.text_field(:
|
81
|
+
# expect(@browser.text_field(name: "first_name")).to exist.within(2)
|
82
|
+
# expect(@browser.text_field(name: "first_name")).to be_present.within(2)
|
83
|
+
# expect(@browser.text_field(name: "first_name")).to be_visible.within(2)
|
84
84
|
#
|
85
85
|
# You can also use #during to test if something stays the same during the specified period:
|
86
|
-
# @browser.text_field(:
|
86
|
+
# expect(@browser.text_field(name: "first_name")).to exist.during(2)
|
87
87
|
config.include Watir::RSpec::Matchers#{rails_filter}
|
88
88
|
end
|
89
89
|
]
|
@@ -113,7 +113,7 @@ Make sure you run the watir-rspec command within your projects' directory.]
|
|
113
113
|
end
|
114
114
|
|
115
115
|
def rails_filter
|
116
|
-
", :
|
116
|
+
", type: :request" if using_rails?
|
117
117
|
end
|
118
118
|
|
119
119
|
def using_rails?
|
data/lib/watir/rspec/helper.rb
CHANGED
@@ -13,9 +13,9 @@ module Watir
|
|
13
13
|
|
14
14
|
# Will dispatch all missing methods to the {#browser} instance.
|
15
15
|
# @example Makes it possible to use Watir::Browser methods without specifying the browser instance in the specs like this:
|
16
|
-
# it "
|
16
|
+
# it "text field is present" do
|
17
17
|
# # notice that we're calling Watir::Browser#text_field here directly
|
18
|
-
# text_field(:
|
18
|
+
# expect(text_field(id: "foo")).to be_present
|
19
19
|
# end
|
20
20
|
def method_missing(name, *args)
|
21
21
|
if browser.respond_to?(name)
|
data/lib/watir/rspec/matchers.rb
CHANGED
@@ -3,10 +3,10 @@ module Watir
|
|
3
3
|
# All matchers defined in here have the ability to be used for asynchronous
|
4
4
|
# testing.
|
5
5
|
#
|
6
|
-
#
|
6
|
+
# #within matcher means that the expected result should happen
|
7
7
|
# within the specified time period.
|
8
8
|
#
|
9
|
-
#
|
9
|
+
# Also less used #during matcher which means that the expected
|
10
10
|
# result should be true for the whole specified time period.
|
11
11
|
#
|
12
12
|
# @example Wait for 2 seconds until element is present (element exists and is visible)
|
@@ -18,7 +18,7 @@ module Watir
|
|
18
18
|
# @example Wait for 2 seconds until element exists
|
19
19
|
# expect(text_field).to exist.within(2)
|
20
20
|
#
|
21
|
-
# @example
|
21
|
+
# @example Verify that container is visible for the whole time during 2 seconds
|
22
22
|
# button.click
|
23
23
|
# expect(text_field).to be_visible.during(2)
|
24
24
|
module Matchers
|
data/lib/watir/rspec/version.rb
CHANGED
@@ -28,7 +28,7 @@ describe Watir::RSpec::Matchers::BaseMatcher do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
context "#within" do
|
31
|
-
around { |example|
|
31
|
+
around { |example| expect_to_take_at_least(0.1) { example.run }}
|
32
32
|
|
33
33
|
it "#matches?" do
|
34
34
|
object = double("element")
|
@@ -102,7 +102,7 @@ describe Watir::RSpec::Matchers::BaseMatcher do
|
|
102
102
|
end
|
103
103
|
|
104
104
|
context "#during" do
|
105
|
-
around { |example|
|
105
|
+
around { |example| expect_to_take_at_least(0.1) { example.run }}
|
106
106
|
|
107
107
|
it "#matches?" do
|
108
108
|
object = double("element", foo?: true)
|
@@ -173,7 +173,7 @@ describe Watir::RSpec::Matchers::BaseMatcher do
|
|
173
173
|
end
|
174
174
|
end
|
175
175
|
|
176
|
-
def
|
176
|
+
def expect_to_take_at_least(seconds)
|
177
177
|
t = Time.now
|
178
178
|
yield
|
179
179
|
expect(Time.now - t).to be >= seconds
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: watir-rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jarmo Pertman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|