wist 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3112671f26405f4c839b28cef0a2b6f7c6eb8f48
4
- data.tar.gz: 8a8174b542d4fd09d73d28300af07dabd8ddd999
3
+ metadata.gz: 4aa5f441eb74f8fae874d4e3493410d32fdb11a1
4
+ data.tar.gz: eea7f1657d43671176f1ce373daf62f0742d190e
5
5
  SHA512:
6
- metadata.gz: cc2f1d98dea77c4025989044ba114b19d96deeda8134c130877e012497f2d0a5f3f6f864fdccba937edb13ee5eaaf434939872b8a426e8b4f18f7b7cd0fe0d58
7
- data.tar.gz: f6003c1fd3892a3e8e0854ab1be25ac1872b70d3adbb4407cbff7d51f30a1125d2ce3c4d577308c07ce49f5b3ba0d14442c9582f72b5c3d58d70f67a07afacbb
6
+ metadata.gz: 565621550f29574538d051cbf9176682894b97a1379fc54914cdf26eb8a694bf856e49fdb28b7873346516163c595b22fd5505a7a0eba85ba0b6b611db3ddffb
7
+ data.tar.gz: 18b403d2a1634b5beb53e6bd54cda75ef42842ac2e4e6ddc740604f5467e14ae12e4bccfcb88dff8ecf7e06c9b512bc20e4c2a6c78532323f6ef365656a809e4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- wist (0.3.0)
4
+ wist (0.3.1)
5
5
  capybara
6
6
  selenium-webdriver
7
7
 
data/lib/wist.rb CHANGED
@@ -128,14 +128,21 @@ module Wist
128
128
  klass.split(' ').include?(class_name)
129
129
  end
130
130
 
131
+ def process_el_or_selector(el_or_selector)
132
+ if el_or_selector.is_a?(String)
133
+ find(el_or_selector, visible: true)
134
+ else
135
+ el_or_selector
136
+ end
137
+ end
138
+
131
139
  def wait_for_new_url(element_to_click = nil)
132
140
  old_url = current_url
133
141
 
134
142
  if element_to_click.nil?
135
143
  yield
136
144
  else
137
- element_to_click = find(element_to_click, visible: true) if element_to_click.is_a?(String)
138
- element_to_click.click
145
+ process_el_or_selector(element_to_click).click
139
146
  end
140
147
 
141
148
  sleep 1
@@ -180,8 +187,8 @@ module Wist
180
187
  raise "visit #{url} failed" unless status == 'success'
181
188
  end
182
189
 
183
- def assert_text(text, el)
184
- wist_assert(el.text, text)
190
+ def assert_text(text, el_or_selector)
191
+ wist_assert(process_el_or_selector(el_or_selector).text, text)
185
192
  end
186
193
 
187
194
  def assert_text_include(text, el)
@@ -98,6 +98,10 @@ class WistTest < CapybaraTestCase
98
98
  verify_test_page(1)
99
99
  end
100
100
 
101
+ def test_process_el_or_selector
102
+ assert_equal(process_el_or_selector('body'), process_el_or_selector(find('body')))
103
+ end
104
+
101
105
  def test_wait_for_new_url_with_block
102
106
  wait_for_new_url { click('#wait_for_new_url_test') }
103
107
  verify_test_page(1)
@@ -219,4 +223,4 @@ class WistTest < CapybaraTestCase
219
223
  assert_el_has_link('#switch_window_test', 'foo')
220
224
  end
221
225
  end
222
- end
226
+ end
data/wist.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'wist'
3
- gem.version = '0.3.0'
3
+ gem.version = '0.3.1'
4
4
  gem.summary = 'capybara helpers'
5
5
  gem.author = 'Lihan Li'
6
6
  gem.email = 'frankieteardrop@gmail.com'
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.3.0
4
+ version: 0.3.1
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-07-22 00:00:00.000000000 Z
11
+ date: 2015-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara