wist 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +9 -9
- data/lib/wist.rb +6 -3
- data/test/tests/wist_test.rb +18 -5
- 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: eb0235c7168ac2bd0d0bc5c741326a2b89352369
|
4
|
+
data.tar.gz: 1bd1d3788f70bfc7761cb168dd49ababc62544b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52070d633534d45594a25e2e02d4ab1fd4875026c326cf9e64e06a530be1abdf6ab14024ae03c2358e586f0a1c8c4473e438df1f49e575a9b1f79595813a1981
|
7
|
+
data.tar.gz: 83e60bab0ce9bb9c443c47c6f6889135f0d53a60fcbb06e76624300a5c695f83e35390791601c1db4aef2ab3d082fe6b9df93b93758313cc2bee470eedca82e6
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
wist (0.2.
|
4
|
+
wist (0.2.6)
|
5
5
|
capybara
|
6
6
|
selenium-webdriver
|
7
7
|
|
@@ -10,7 +10,7 @@ GEM
|
|
10
10
|
specs:
|
11
11
|
ansi (1.5.0)
|
12
12
|
builder (3.2.2)
|
13
|
-
capybara (2.
|
13
|
+
capybara (2.4.4)
|
14
14
|
mime-types (>= 1.16)
|
15
15
|
nokogiri (>= 1.3.3)
|
16
16
|
rack (>= 1.0.0)
|
@@ -22,8 +22,8 @@ GEM
|
|
22
22
|
coderay (1.0.9)
|
23
23
|
ffi (1.9.6)
|
24
24
|
method_source (0.8.2)
|
25
|
-
mime-types (2.
|
26
|
-
mini_portile (0.
|
25
|
+
mime-types (2.4.3)
|
26
|
+
mini_portile (0.6.2)
|
27
27
|
minitest (5.5.1)
|
28
28
|
minitest-reporters (1.0.11)
|
29
29
|
ansi
|
@@ -31,8 +31,8 @@ GEM
|
|
31
31
|
minitest (>= 5.0)
|
32
32
|
ruby-progressbar
|
33
33
|
multi_json (1.9.2)
|
34
|
-
nokogiri (1.6.
|
35
|
-
mini_portile (~> 0.
|
34
|
+
nokogiri (1.6.6.2)
|
35
|
+
mini_portile (~> 0.6.0)
|
36
36
|
poltergeist (1.5.1)
|
37
37
|
capybara (~> 2.1)
|
38
38
|
cliver (~> 0.3.1)
|
@@ -42,8 +42,8 @@ GEM
|
|
42
42
|
coderay (~> 1.0.5)
|
43
43
|
method_source (~> 0.8)
|
44
44
|
slop (~> 3.4)
|
45
|
-
rack (1.
|
46
|
-
rack-test (0.6.
|
45
|
+
rack (1.6.0)
|
46
|
+
rack-test (0.6.3)
|
47
47
|
rack (>= 1.0)
|
48
48
|
rake (10.1.0)
|
49
49
|
ruby-progressbar (1.7.1)
|
@@ -63,7 +63,7 @@ PLATFORMS
|
|
63
63
|
ruby
|
64
64
|
|
65
65
|
DEPENDENCIES
|
66
|
-
capybara (= 2.
|
66
|
+
capybara (= 2.4.4)
|
67
67
|
minitest-reporters
|
68
68
|
poltergeist (= 1.5.1)
|
69
69
|
pry
|
data/lib/wist.rb
CHANGED
@@ -66,9 +66,8 @@ module Wist
|
|
66
66
|
page.driver.browser
|
67
67
|
end
|
68
68
|
|
69
|
-
def switch_to_window_and_execute
|
70
|
-
|
71
|
-
within_window(driver.window_handles.last) do
|
69
|
+
def switch_to_window_and_execute(new_window_lambda)
|
70
|
+
within_window(window_opened_by(&new_window_lambda)) do
|
72
71
|
yield
|
73
72
|
driver.close
|
74
73
|
end
|
@@ -204,4 +203,8 @@ module Wist
|
|
204
203
|
Capybara.default_wait_time = @old_wait_time
|
205
204
|
end
|
206
205
|
end
|
206
|
+
|
207
|
+
def assert_el_has_link(selector, link)
|
208
|
+
wist_assert(get_js("$('#{selector}').attr('href')"), link)
|
209
|
+
end
|
207
210
|
end
|
data/test/tests/wist_test.rb
CHANGED
@@ -49,14 +49,19 @@ class WistTest < CapybaraTestCase
|
|
49
49
|
|
50
50
|
def test_switch_to_window_and_execute
|
51
51
|
return if Capybara.javascript_driver == :poltergeist
|
52
|
-
|
53
|
-
|
52
|
+
assert_num_windows = lambda do |num|
|
53
|
+
assert_equal(num, page.driver.browser.window_handles.size)
|
54
|
+
end
|
55
|
+
|
56
|
+
verify_test_page(0)
|
54
57
|
|
55
|
-
switch_to_window_and_execute do
|
56
|
-
verify_test_page
|
58
|
+
switch_to_window_and_execute(-> { click('#switch_window_test') }) do
|
59
|
+
verify_test_page(1)
|
60
|
+
assert_num_windows.(2)
|
57
61
|
end
|
58
62
|
|
59
|
-
|
63
|
+
assert_num_windows.(1)
|
64
|
+
verify_test_page(0)
|
60
65
|
end
|
61
66
|
|
62
67
|
def test_get_js
|
@@ -206,4 +211,12 @@ class WistTest < CapybaraTestCase
|
|
206
211
|
assert_equal(bool, get_js('confirmed'))
|
207
212
|
end
|
208
213
|
end
|
214
|
+
|
215
|
+
def test_assert_el_has_link
|
216
|
+
assert_el_has_link('#switch_window_test', 'test1.html')
|
217
|
+
|
218
|
+
assert_raises(Minitest::Assertion) do
|
219
|
+
assert_el_has_link('#switch_window_test', 'foo')
|
220
|
+
end
|
221
|
+
end
|
209
222
|
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.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lihan Li
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|