wist 0.1.6 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/wist.rb +21 -11
- data/test/tests/wist_test.rb +16 -0
- data/wist.gemspec +1 -1
- 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: 0cc764cb16ae3e69fbd83e69683b71f3376624ef
|
4
|
+
data.tar.gz: e3cec4ee9c95beca47ff8998ed9d711deb2820c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c2162229c88a9cc9edf5258fbf7393066e9ec6bb5a1e8bf9c5503251d27687aab33dda8acda3dff39e5332380763f9bfc75fc21a00e42aeb00757132e16b48b
|
7
|
+
data.tar.gz: 5ac8dd9a14280305772a95e88f6388564857f5551a2cbf20b791ec07246abfeae35c030cb8050a7afc2f9b1734abe9c4fbf59a76167ce657c39dbc034f566116
|
data/Gemfile.lock
CHANGED
data/lib/wist.rb
CHANGED
@@ -16,18 +16,15 @@ module Wist
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def wait_until(timeout: Capybara.default_wait_time)
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
false
|
19
|
+
do_instantly do
|
20
|
+
Selenium::WebDriver::Wait.new(timeout: timeout).until do
|
21
|
+
begin
|
22
|
+
yield
|
23
|
+
rescue
|
24
|
+
false
|
25
|
+
end
|
27
26
|
end
|
28
27
|
end
|
29
|
-
|
30
|
-
Capybara.default_wait_time = old_timeout
|
31
28
|
end
|
32
29
|
|
33
30
|
def click(selector)
|
@@ -170,6 +167,19 @@ module Wist
|
|
170
167
|
end
|
171
168
|
|
172
169
|
def has_css_instant?(selector)
|
173
|
-
|
170
|
+
do_instantly { has_css?(selector) }
|
171
|
+
end
|
172
|
+
|
173
|
+
def do_instantly
|
174
|
+
old_time = Capybara.default_wait_time
|
175
|
+
Capybara.default_wait_time = 0
|
176
|
+
|
177
|
+
begin
|
178
|
+
yield
|
179
|
+
rescue => e
|
180
|
+
raise(e)
|
181
|
+
ensure
|
182
|
+
Capybara.default_wait_time = old_time
|
183
|
+
end
|
174
184
|
end
|
175
185
|
end
|
data/test/tests/wist_test.rb
CHANGED
@@ -165,4 +165,20 @@ class WistTest < CapybaraTestCase
|
|
165
165
|
assert_equal(true, has_css_instant?('body'))
|
166
166
|
assert_equal(false, has_css_instant?('#sdklfjk'))
|
167
167
|
end
|
168
|
+
|
169
|
+
def test_do_instantly
|
170
|
+
old_time = Capybara.default_wait_time
|
171
|
+
new_time = nil
|
172
|
+
|
173
|
+
begin
|
174
|
+
do_instantly do
|
175
|
+
new_time = Capybara.default_wait_time
|
176
|
+
raise
|
177
|
+
end
|
178
|
+
rescue
|
179
|
+
end
|
180
|
+
|
181
|
+
assert_equal(0, new_time)
|
182
|
+
assert_equal(old_time, Capybara.default_wait_time)
|
183
|
+
end
|
168
184
|
end
|
data/wist.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lihan Li
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|