pickles 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 133b4adeb408fceb495f86eaa9331e277bb4c684
|
4
|
+
data.tar.gz: 11b8af9c0ff9438bcd04f96960beafee5d9b3f37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4254e7ac1c0c28bfc235d30791db7016d2087e2440fed0dbc849705577cc932844e71b4a51b10b20b1f73a156d2f62d12c82672dc2e695613ba133a72607f79
|
7
|
+
data.tar.gz: 7bb8bf6bb981989c6e56f4ea42d2feb4f88c744db9ea096a67d76b7e261cc5f05541ea7945b25509bedebc6e6dc117383b2e8b59860147ae69e1efae6e3e7d74
|
@@ -13,14 +13,21 @@ module NodeFinders
|
|
13
13
|
def find_node(locator, within: nil)
|
14
14
|
within ||= Capybara.current_session
|
15
15
|
|
16
|
+
options = { visible: false }
|
17
|
+
|
16
18
|
locator, index = Locator::Index.execute(locator)
|
19
|
+
locator, wait = Locator::Wait.execute(locator)
|
17
20
|
locator, xpath = Locator::Equal.execute(locator)
|
18
21
|
|
19
22
|
if index
|
20
23
|
xpath = "(#{xpath})[#{index}]"
|
21
24
|
end
|
22
25
|
|
23
|
-
|
26
|
+
if wait
|
27
|
+
options[:wait] = wait
|
28
|
+
end
|
29
|
+
|
30
|
+
_rescued_find([:xpath, xpath, options], locator, within: within, message: "find_node") do
|
24
31
|
raise Capybara::ElementNotFound,
|
25
32
|
"Unable to find node by locator #{locator}",
|
26
33
|
caller
|
@@ -124,12 +124,12 @@ module Waiter
|
|
124
124
|
|
125
125
|
module_function
|
126
126
|
|
127
|
-
def wait
|
127
|
+
def wait(errors = [Capybara::ElementNotFound])
|
128
128
|
wait_for_ajax
|
129
129
|
|
130
130
|
return unless block_given?
|
131
131
|
|
132
|
-
page.document.synchronize do
|
132
|
+
page.document.synchronize(Capybara.default_max_wait_time, errors: errors) do
|
133
133
|
yield
|
134
134
|
end
|
135
135
|
end
|
@@ -1,32 +1,22 @@
|
|
1
|
-
def wait_flags(text)
|
2
|
-
if text.starts_with?('>')
|
3
|
-
text = text[1..-1]
|
4
|
-
|
5
|
-
Waiter.wait_for_ajax
|
6
|
-
|
7
|
-
js_wait = true
|
8
|
-
end
|
9
|
-
|
10
|
-
if text.ends_with?('>')
|
11
|
-
text = text.chomp('>')
|
12
|
-
|
13
|
-
ajax_wait = true
|
14
|
-
end
|
15
|
-
|
16
|
-
[js_wait, text, ajax_wait]
|
17
|
-
end
|
18
|
-
|
19
1
|
def trigger(text, event, within)
|
20
2
|
|
21
|
-
|
3
|
+
locator, wait_time = Locator::Wait.execute(text)
|
22
4
|
|
23
|
-
if
|
24
|
-
Waiter.wait
|
5
|
+
if wait_time.nil? || wait_time > 0
|
6
|
+
Waiter.wait do
|
7
|
+
Pickles.trigger(
|
8
|
+
Pickles.find_node(text, within: within),
|
9
|
+
event
|
10
|
+
)
|
11
|
+
end
|
25
12
|
else
|
26
|
-
Pickles.
|
13
|
+
Pickles.trigger(
|
14
|
+
Pickles.find_node(text, within: within),
|
15
|
+
event
|
16
|
+
)
|
27
17
|
end
|
28
18
|
|
29
|
-
Waiter.wait_for_ajax
|
19
|
+
Waiter.wait_for_ajax
|
30
20
|
|
31
21
|
end
|
32
22
|
|
@@ -53,8 +43,6 @@ When /^I (?:click|navigate) "([^"]*)"( within (?:.*))?$/ do |click_text, within|
|
|
53
43
|
Waiter.wait_for_ajax
|
54
44
|
|
55
45
|
click_text.split(/,|->/).each do |text|
|
56
|
-
pry binding if text['pry']
|
57
|
-
|
58
46
|
trigger(text, 'click', within)
|
59
47
|
end
|
60
48
|
|
@@ -70,7 +58,6 @@ end
|
|
70
58
|
#
|
71
59
|
When /^I (?:click|navigate):( within (?:.*))?$/ do |within, table|
|
72
60
|
do_click = -> (event, text) do
|
73
|
-
pry binding if text['pry']
|
74
61
|
event = 'click' if event.strip.blank?
|
75
62
|
|
76
63
|
trigger(text, event, within)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pickles
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|