wist 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -3
- data/Gemfile.lock +20 -25
- data/lib/wist.rb +20 -6
- data/test/test_helper.rb +4 -3
- data/test/tests/wist_test.rb +1 -1
- data/wist.gemspec +1 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92c7a729771ad5443f5138500cf840ee4e95d3e9
|
4
|
+
data.tar.gz: 64e03b847b5957264cf8c494d85506102f67ee51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66ba3eaa0f21c10b9b191eda29e9894ef5a0f31731721146bfd06e63461957b7f8504004ef7e7dbabab730c91a9e541c8a63bc50c761e19e6eda2cb51e37b057
|
7
|
+
data.tar.gz: 9c9b800713baedad2fbe8924392fdff34514ff1dfe187e98b5e84abd8415295f4108c082ca4ca622366693757846c461fc73cc43314a08fce9c59778edffb75f
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,15 +1,7 @@
|
|
1
|
-
GIT
|
2
|
-
remote: git://github.com/lihanli/tconsole.git
|
3
|
-
revision: fbc06123705a72d5b5c4509d7d471262cf68c170
|
4
|
-
specs:
|
5
|
-
tconsole (1.3.0.pre2)
|
6
|
-
chattyproc (~> 1.0.0)
|
7
|
-
term-ansicolor (~> 1.0.7)
|
8
|
-
|
9
1
|
PATH
|
10
2
|
remote: .
|
11
3
|
specs:
|
12
|
-
wist (0.2.
|
4
|
+
wist (0.2.4)
|
13
5
|
capybara
|
14
6
|
selenium-webdriver
|
15
7
|
|
@@ -17,25 +9,31 @@ GEM
|
|
17
9
|
remote: http://rubygems.org/
|
18
10
|
specs:
|
19
11
|
ansi (1.4.3)
|
12
|
+
builder (3.2.2)
|
20
13
|
capybara (2.2.1)
|
21
14
|
mime-types (>= 1.16)
|
22
15
|
nokogiri (>= 1.3.3)
|
23
16
|
rack (>= 1.0.0)
|
24
17
|
rack-test (>= 0.5.4)
|
25
18
|
xpath (~> 2.0)
|
26
|
-
|
27
|
-
childprocess (0.5.3)
|
19
|
+
childprocess (0.5.5)
|
28
20
|
ffi (~> 1.0, >= 1.0.11)
|
29
21
|
cliver (0.3.2)
|
30
22
|
coderay (1.0.9)
|
31
|
-
ffi (1.9.
|
23
|
+
ffi (1.9.6)
|
32
24
|
method_source (0.8.2)
|
33
25
|
mime-types (2.2)
|
34
26
|
mini_portile (0.5.3)
|
27
|
+
minitest (5.4.3)
|
28
|
+
minitest-reporters (1.0.7)
|
29
|
+
ansi
|
30
|
+
builder
|
31
|
+
minitest (>= 5.0)
|
32
|
+
ruby-progressbar
|
35
33
|
multi_json (1.9.2)
|
36
34
|
nokogiri (1.6.1)
|
37
35
|
mini_portile (~> 0.5.0)
|
38
|
-
poltergeist (1.5.
|
36
|
+
poltergeist (1.5.1)
|
39
37
|
capybara (~> 2.1)
|
40
38
|
cliver (~> 0.3.1)
|
41
39
|
multi_json (~> 1.0)
|
@@ -48,18 +46,16 @@ GEM
|
|
48
46
|
rack-test (0.6.2)
|
49
47
|
rack (>= 1.0)
|
50
48
|
rake (10.1.0)
|
51
|
-
|
52
|
-
|
53
|
-
|
49
|
+
ruby-progressbar (1.7.0)
|
50
|
+
rubyzip (1.1.6)
|
51
|
+
selenium-webdriver (2.43.0)
|
52
|
+
childprocess (~> 0.5)
|
54
53
|
multi_json (~> 1.0)
|
55
54
|
rubyzip (~> 1.0)
|
56
|
-
websocket (~> 1.0
|
55
|
+
websocket (~> 1.0)
|
57
56
|
slop (3.4.6)
|
58
|
-
|
59
|
-
|
60
|
-
ansi
|
61
|
-
websocket (1.0.7)
|
62
|
-
websocket-driver (0.3.2)
|
57
|
+
websocket (1.2.1)
|
58
|
+
websocket-driver (0.4.0)
|
63
59
|
xpath (2.0.0)
|
64
60
|
nokogiri (~> 1.3)
|
65
61
|
|
@@ -68,9 +64,8 @@ PLATFORMS
|
|
68
64
|
|
69
65
|
DEPENDENCIES
|
70
66
|
capybara (= 2.2.1)
|
71
|
-
|
67
|
+
minitest-reporters
|
68
|
+
poltergeist (= 1.5.1)
|
72
69
|
pry
|
73
70
|
rake
|
74
|
-
tconsole!
|
75
|
-
turn
|
76
71
|
wist!
|
data/lib/wist.rb
CHANGED
@@ -7,6 +7,11 @@ module Wist
|
|
7
7
|
Capybara::Selenium::Driver.new(app, browser: :chrome)
|
8
8
|
end
|
9
9
|
|
10
|
+
class << self
|
11
|
+
attr_accessor(:rspec)
|
12
|
+
end
|
13
|
+
self.rspec = defined?(RSpec)
|
14
|
+
|
10
15
|
module Helpers
|
11
16
|
module_function
|
12
17
|
|
@@ -15,6 +20,14 @@ module Wist
|
|
15
20
|
end
|
16
21
|
end
|
17
22
|
|
23
|
+
def wist_assert(value, expected)
|
24
|
+
if Wist.rspec
|
25
|
+
value.should == expected
|
26
|
+
else
|
27
|
+
assert_equal(expected, value)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
18
31
|
def wait_until(timeout: false)
|
19
32
|
do_instantly do
|
20
33
|
Selenium::WebDriver::Wait.new(timeout: timeout || @old_wait_time).until do
|
@@ -46,7 +59,7 @@ module Wist
|
|
46
59
|
def verify_tweet_button(text)
|
47
60
|
share_button_src = nil
|
48
61
|
wait_until { share_button_src = find('.twitter-share-button')[:src] }
|
49
|
-
|
62
|
+
wist_assert(CGI.parse(URI.parse(share_button_src.gsub('#', '?')).query)['text'][0], text)
|
50
63
|
end
|
51
64
|
|
52
65
|
def driver
|
@@ -64,7 +77,7 @@ module Wist
|
|
64
77
|
def alert_accept(expected_msg = false)
|
65
78
|
page.execute_script "window.alert = function(msg) { window.lastAlertMsg = msg; }"
|
66
79
|
yield
|
67
|
-
|
80
|
+
wist_assert(get_js('window.lastAlertMsg'), expected_msg) if expected_msg
|
68
81
|
end
|
69
82
|
|
70
83
|
def get_js(code)
|
@@ -143,11 +156,11 @@ module Wist
|
|
143
156
|
end
|
144
157
|
|
145
158
|
def assert_text(text, el)
|
146
|
-
|
159
|
+
wist_assert(el.text, text)
|
147
160
|
end
|
148
161
|
|
149
162
|
def assert_text_include(text, el)
|
150
|
-
|
163
|
+
wist_assert(el.text.include?(text), true)
|
151
164
|
end
|
152
165
|
|
153
166
|
def parent(el)
|
@@ -162,8 +175,9 @@ module Wist
|
|
162
175
|
end
|
163
176
|
|
164
177
|
%w(has has_no).each do |prefix|
|
165
|
-
define_method("assert_#{prefix}_css") do
|
166
|
-
|
178
|
+
define_method("assert_#{prefix}_css") do |selector, opt = {}|
|
179
|
+
opt[:visible] = true if opt[:visible].nil?
|
180
|
+
wist_assert(send("#{prefix}_css?", selector, opt), true)
|
167
181
|
end
|
168
182
|
end
|
169
183
|
|
data/test/test_helper.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
require 'wist'
|
2
2
|
require 'capybara/poltergeist'
|
3
3
|
require 'pry'
|
4
|
-
|
5
|
-
|
4
|
+
require "minitest/autorun"
|
5
|
+
require "minitest/reporters"
|
6
|
+
Minitest::Reporters.use!
|
6
7
|
|
7
|
-
class CapybaraTestCase < Test
|
8
|
+
class CapybaraTestCase < Minitest::Test
|
8
9
|
include Capybara::DSL
|
9
10
|
include Wist
|
10
11
|
|
data/test/tests/wist_test.rb
CHANGED
data/wist.gemspec
CHANGED
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
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.4
|
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-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: selenium-webdriver
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
description:
|
@@ -44,7 +44,7 @@ executables: []
|
|
44
44
|
extensions: []
|
45
45
|
extra_rdoc_files: []
|
46
46
|
files:
|
47
|
-
- .gitignore
|
47
|
+
- ".gitignore"
|
48
48
|
- Gemfile
|
49
49
|
- Gemfile.lock
|
50
50
|
- MIT-LICENSE
|
@@ -70,17 +70,17 @@ require_paths:
|
|
70
70
|
- lib
|
71
71
|
required_ruby_version: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
77
|
requirements:
|
78
|
-
- -
|
78
|
+
- - ">="
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
82
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.
|
83
|
+
rubygems_version: 2.2.2
|
84
84
|
signing_key:
|
85
85
|
specification_version: 4
|
86
86
|
summary: capybara helpers
|