wist 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wist.rb +12 -5
- data/test/test.js +4 -0
- data/test/test0.html +2 -0
- data/test/tests/wist_test.rb +7 -2
- data/wist.gemspec +2 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c192acd0d89e49e0336d0225fc15b66c32ab82a
|
4
|
+
data.tar.gz: a84a7e169f92e5d61c4dd912d4d7dc675543f2f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62ce97f8ea34acc5bf4eb314f49e373a6faeba1003eb910be607aab4d275a591f7a5ee78e9758491646c7bc2ec09ac520bcc5e12bf09a75458c8600ab61ab617
|
7
|
+
data.tar.gz: 28d90462182499176f036e5c7d5a80c1a497cc467a8d3a852f1a5049ddf1404f6719ebdebfeaaa97f7ebf44621281c4aa808d3fa7a93e9ada28ef84b8efe9674
|
data/lib/wist.rb
CHANGED
@@ -15,8 +15,8 @@ module Wist
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
def wait_until
|
19
|
-
Selenium::WebDriver::Wait.new(timeout:
|
18
|
+
def wait_until(timeout: Capybara.default_wait_time)
|
19
|
+
Selenium::WebDriver::Wait.new(timeout: timeout).until do
|
20
20
|
begin
|
21
21
|
yield
|
22
22
|
rescue
|
@@ -113,9 +113,9 @@ module Wist
|
|
113
113
|
end
|
114
114
|
|
115
115
|
%w(first all).each do |finder|
|
116
|
-
define_method(:"#{finder}_with_wait") do |
|
117
|
-
has_css?(
|
118
|
-
page.send(finder.to_sym,
|
116
|
+
define_method(:"#{finder}_with_wait") do |*args|
|
117
|
+
has_css?(*args)
|
118
|
+
page.send(finder.to_sym, *args)
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
@@ -144,4 +144,11 @@ module Wist
|
|
144
144
|
def parent(el)
|
145
145
|
el.first(:xpath, './/..')
|
146
146
|
end
|
147
|
+
|
148
|
+
def click_by_text(selector, text, text_include: true, downcase: true)
|
149
|
+
all_with_wait(selector, visible: true).find do |el|
|
150
|
+
el_text = downcase ? el.text.downcase : el.text
|
151
|
+
text_include ? el_text.include?(text) : el_text == text
|
152
|
+
end.click
|
153
|
+
end
|
147
154
|
end
|
data/test/test.js
CHANGED
data/test/test0.html
CHANGED
data/test/tests/wist_test.rb
CHANGED
@@ -113,11 +113,11 @@ class WistTest < CapybaraTestCase
|
|
113
113
|
|
114
114
|
def test_finder_with_wait
|
115
115
|
click('#finder_with_wait')
|
116
|
-
assert_equal('finder_with_wait', first_with_wait('.done')[:id])
|
116
|
+
assert_equal('finder_with_wait', first_with_wait('.done', visible: true)[:id])
|
117
117
|
|
118
118
|
refresh
|
119
119
|
click('#finder_with_wait')
|
120
|
-
assert_equal('finder_with_wait', all_with_wait('.done')[0][:id])
|
120
|
+
assert_equal('finder_with_wait', all_with_wait('.done', visible: true)[0][:id])
|
121
121
|
end
|
122
122
|
|
123
123
|
def test_visit_with_retries
|
@@ -142,4 +142,9 @@ class WistTest < CapybaraTestCase
|
|
142
142
|
def test_parent
|
143
143
|
assert_text('parent', parent(find('#test_parent', visible: false)))
|
144
144
|
end
|
145
|
+
|
146
|
+
def test_click_by_text
|
147
|
+
click_by_text('button', 'click by text')
|
148
|
+
assert_text('clicked', find('#click_by_text'))
|
149
|
+
end
|
145
150
|
end
|
data/wist.gemspec
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = 'wist'
|
3
|
-
gem.version = '0.1.
|
3
|
+
gem.version = '0.1.2'
|
4
4
|
gem.summary = 'capybara helpers'
|
5
5
|
gem.author = 'Lihan Li'
|
6
6
|
gem.email = 'frankieteardrop@gmail.com'
|
7
7
|
gem.homepage = 'http://github.com/lihanli/wist'
|
8
|
+
gem.license = 'MIT'
|
8
9
|
|
9
10
|
gem.add_dependency 'capybara'
|
10
11
|
gem.add_dependency 'selenium-webdriver'
|
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.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lihan Li
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -61,7 +61,8 @@ files:
|
|
61
61
|
- test/tests/wist_test.rb
|
62
62
|
- wist.gemspec
|
63
63
|
homepage: http://github.com/lihanli/wist
|
64
|
-
licenses:
|
64
|
+
licenses:
|
65
|
+
- MIT
|
65
66
|
metadata: {}
|
66
67
|
post_install_message:
|
67
68
|
rdoc_options: []
|