wist 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +1 -2
- data/Gemfile.lock +36 -45
- data/Rakefile +2 -4
- data/lib/wist.rb +0 -21
- data/test/test_helper.rb +2 -2
- data/test/tests/wist_test.rb +0 -17
- data/wist.gemspec +1 -1
- metadata +4 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f403e9d1c710e821f19cfd772215424dbba8b5e59bf20ed7fa2d805590cd36ec
|
4
|
+
data.tar.gz: bd3d923432d35fef5ed3ebb207f6d694131f1492c5f7bac617c28eb02d81fe99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '080bdc0fa6c0e13e6dc37c59c2905533ada9f847b305578272257ad72dcba50cfacf5e4c1fc151af3e91a225accc09fb3a2c5be8bf8c76a7bed1fd8eb798c931'
|
7
|
+
data.tar.gz: '0073750638256f8ffb666ae198c9a7c5df318d629027d583a091c0a9a1cdd221f774fb9a5d5465d6dd804dcd447bf18ba997c473c2bbea12c26008758a98909b'
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
wist (0.
|
4
|
+
wist (0.5.0)
|
5
5
|
capybara
|
6
6
|
common_assert
|
7
7
|
selenium-webdriver
|
@@ -9,68 +9,59 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: http://rubygems.org/
|
11
11
|
specs:
|
12
|
+
addressable (2.6.0)
|
13
|
+
public_suffix (>= 2.0.2, < 4.0)
|
12
14
|
ansi (1.5.0)
|
13
15
|
builder (3.2.2)
|
14
|
-
capybara (
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
rack
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
16
|
+
capybara (3.22.0)
|
17
|
+
addressable
|
18
|
+
mini_mime (>= 0.1.3)
|
19
|
+
nokogiri (~> 1.8)
|
20
|
+
rack (>= 1.6.0)
|
21
|
+
rack-test (>= 0.6.3)
|
22
|
+
regexp_parser (~> 1.5)
|
23
|
+
xpath (~> 3.2)
|
24
|
+
childprocess (1.0.1)
|
25
|
+
rake (< 13.0)
|
26
|
+
coderay (1.1.2)
|
24
27
|
common_assert (0.0.1)
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
mini_portile (0.6.2)
|
28
|
+
method_source (0.9.2)
|
29
|
+
mini_mime (1.0.1)
|
30
|
+
mini_portile2 (2.4.0)
|
29
31
|
minitest (5.5.1)
|
30
32
|
minitest-reporters (1.0.11)
|
31
33
|
ansi
|
32
34
|
builder
|
33
35
|
minitest (>= 5.0)
|
34
36
|
ruby-progressbar
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
slop (~> 3.4)
|
47
|
-
rack (1.6.4)
|
48
|
-
rack-test (0.6.3)
|
49
|
-
rack (>= 1.0)
|
50
|
-
rake (10.1.0)
|
37
|
+
nokogiri (1.10.3)
|
38
|
+
mini_portile2 (~> 2.4.0)
|
39
|
+
pry (0.12.2)
|
40
|
+
coderay (~> 1.1.0)
|
41
|
+
method_source (~> 0.9.0)
|
42
|
+
public_suffix (3.1.0)
|
43
|
+
rack (2.0.7)
|
44
|
+
rack-test (1.1.0)
|
45
|
+
rack (>= 1.0, < 3)
|
46
|
+
rake (12.3.2)
|
47
|
+
regexp_parser (1.5.1)
|
51
48
|
ruby-progressbar (1.7.1)
|
52
|
-
rubyzip (1.
|
53
|
-
selenium-webdriver (
|
54
|
-
childprocess (
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
slop (3.4.6)
|
59
|
-
websocket (1.2.2)
|
60
|
-
websocket-driver (0.4.0)
|
61
|
-
xpath (2.0.0)
|
62
|
-
nokogiri (~> 1.3)
|
49
|
+
rubyzip (1.2.3)
|
50
|
+
selenium-webdriver (3.142.3)
|
51
|
+
childprocess (>= 0.5, < 2.0)
|
52
|
+
rubyzip (~> 1.2, >= 1.2.2)
|
53
|
+
xpath (3.2.0)
|
54
|
+
nokogiri (~> 1.8)
|
63
55
|
|
64
56
|
PLATFORMS
|
65
57
|
ruby
|
66
58
|
|
67
59
|
DEPENDENCIES
|
68
|
-
capybara (=
|
60
|
+
capybara (= 3.22.0)
|
69
61
|
minitest-reporters
|
70
|
-
poltergeist (= 1.5.1)
|
71
62
|
pry
|
72
63
|
rake
|
73
64
|
wist!
|
74
65
|
|
75
66
|
BUNDLED WITH
|
76
|
-
1.
|
67
|
+
1.16.5
|
data/Rakefile
CHANGED
@@ -6,9 +6,7 @@ Rake::TestTask.new('test') do |t|
|
|
6
6
|
end
|
7
7
|
|
8
8
|
task 'test:all' do
|
9
|
-
|
10
|
-
|
11
|
-
%w(chrome poltergeist).each do |browser|
|
9
|
+
%w(selenium_chrome_headless).each do |browser|
|
12
10
|
ENV['BROWSER'] = browser
|
13
11
|
Rake::Task['test'].execute
|
14
12
|
end
|
@@ -19,4 +17,4 @@ task :build do
|
|
19
17
|
`rm -rf build`
|
20
18
|
`mkdir build`
|
21
19
|
`mv *.gem build`
|
22
|
-
end
|
20
|
+
end
|
data/lib/wist.rb
CHANGED
@@ -46,13 +46,6 @@ module Wist
|
|
46
46
|
find(*args).click
|
47
47
|
end
|
48
48
|
|
49
|
-
def set_cookie(k, v)
|
50
|
-
page.execute_script <<-eos
|
51
|
-
(function (e,t,n){var r=new Date;r.setDate(r.getDate()+n);var i=escape(t)+(n==null?"":"; expires="+r.toUTCString());document.cookie=e+"="+i}
|
52
|
-
(#{k.to_json}, #{v.to_json}));
|
53
|
-
eos
|
54
|
-
end
|
55
|
-
|
56
49
|
def set_value_and_trigger_evts(selector, val)
|
57
50
|
find(selector).set(val)
|
58
51
|
page.execute_script("$('#{selector}').focusout().blur().change().trigger('input')")
|
@@ -156,20 +149,6 @@ module Wist
|
|
156
149
|
end
|
157
150
|
end
|
158
151
|
|
159
|
-
def visit_with_retries(url, retries: 5, wait_time: 10)
|
160
|
-
raise 'only works with poltergeist' unless Capybara.javascript_driver == :poltergeist
|
161
|
-
status = nil
|
162
|
-
|
163
|
-
retries.times do |i|
|
164
|
-
status = visit(url)['status']
|
165
|
-
break if status == 'success'
|
166
|
-
puts "visiting #{url} failed, attempting retry #{i + 1}/#{retries} in #{wait_time} second(s)"
|
167
|
-
sleep wait_time
|
168
|
-
end
|
169
|
-
|
170
|
-
raise "visit #{url} failed" unless status == 'success'
|
171
|
-
end
|
172
|
-
|
173
152
|
def assert_text(text, el_or_selector)
|
174
153
|
common_assert_equal(process_el_or_selector(el_or_selector).text, text)
|
175
154
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'wist'
|
2
|
-
require 'capybara/poltergeist'
|
3
2
|
require 'pry'
|
4
3
|
require "minitest/autorun"
|
5
4
|
require "minitest/reporters"
|
5
|
+
require 'capybara/minitest'
|
6
6
|
Minitest::Reporters.use!(Minitest::Reporters::SpecReporter.new)
|
7
7
|
|
8
8
|
class CapybaraTestCase < Minitest::Test
|
@@ -17,4 +17,4 @@ class CapybaraTestCase < Minitest::Test
|
|
17
17
|
def teardown
|
18
18
|
Capybara.reset_sessions!
|
19
19
|
end
|
20
|
-
end
|
20
|
+
end
|
data/test/tests/wist_test.rb
CHANGED
@@ -126,12 +126,6 @@ class WistTest < CapybaraTestCase
|
|
126
126
|
assert_equal('changed', get_val('#test_set_value_and_trigger_evts'))
|
127
127
|
end
|
128
128
|
|
129
|
-
def test_set_cookie
|
130
|
-
return if Capybara.javascript_driver == :chrome
|
131
|
-
set_cookie('foo', 'bar')
|
132
|
-
assert_equal('bar', page.evaluate_script("$.cookie('foo')"))
|
133
|
-
end
|
134
|
-
|
135
129
|
def test_set_input_and_press_enter
|
136
130
|
alert_accept('enter pressed') do
|
137
131
|
set_input_and_press_enter('#test_set_input_and_press_enter', 'bar')
|
@@ -154,17 +148,6 @@ class WistTest < CapybaraTestCase
|
|
154
148
|
assert_equal('finder_with_wait', all_with_wait('.done', visible: true)[0][:id])
|
155
149
|
end
|
156
150
|
|
157
|
-
def test_visit_with_retries
|
158
|
-
return unless Capybara.javascript_driver == :poltergeist
|
159
|
-
|
160
|
-
assert_raise RuntimeError do
|
161
|
-
visit_with_retries('a.bc', retries: 2, wait_time: 1)
|
162
|
-
end
|
163
|
-
|
164
|
-
visit_with_retries("file://#{Dir.pwd}/test/test0.html")
|
165
|
-
verify_test_page(0)
|
166
|
-
end
|
167
|
-
|
168
151
|
def test_assert_text
|
169
152
|
assert_text('foo', find('#click_test'))
|
170
153
|
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.5.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:
|
11
|
+
date: 2019-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -94,16 +94,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
94
|
version: '0'
|
95
95
|
requirements: []
|
96
96
|
rubyforge_project:
|
97
|
-
rubygems_version: 2.
|
97
|
+
rubygems_version: 2.7.6
|
98
98
|
signing_key:
|
99
99
|
specification_version: 4
|
100
100
|
summary: capybara helpers
|
101
|
-
test_files:
|
102
|
-
- test/jquery.cookie.js
|
103
|
-
- test/jquery.js
|
104
|
-
- test/test.css
|
105
|
-
- test/test.js
|
106
|
-
- test/test0.html
|
107
|
-
- test/test1.html
|
108
|
-
- test/test_helper.rb
|
109
|
-
- test/tests/wist_test.rb
|
101
|
+
test_files: []
|