softwear-lib 0.0.16 → 0.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/softwear/lib/spec.rb +45 -1
- data/lib/softwear/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ac2c8d7b7161999addf91016caab6f44f3b4dad
|
4
|
+
data.tar.gz: 9d2b1bd4545bcbf451dbc73297a346baf6073bf9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c688a01c3e57392e957a1aca79910fd7e80e274af1ba3ca62cfb9df06bc5a55b1b98a52f27b99149ec90659e51d968afb64b1842b70a6ae5e17b804d271192c
|
7
|
+
data.tar.gz: 416b4b8ab059bf372c23a02430864e5842661bb4e52d15fd23be1bce90295186bba1082911d290d045ba13d4ff04a8025361a10bd489d1567d99686a6fc10263
|
data/lib/softwear/lib/spec.rb
CHANGED
@@ -44,6 +44,50 @@ module Softwear::Lib
|
|
44
44
|
# Restore existing default
|
45
45
|
page.evaluate_script('window.confirm = function() { return true; }')
|
46
46
|
end
|
47
|
+
|
48
|
+
def eventually_fill_in(field, options={})
|
49
|
+
page.should have_css('#' + field)
|
50
|
+
fill_in field, options
|
51
|
+
end
|
52
|
+
|
53
|
+
def within_row(num, &block)
|
54
|
+
if RSpec.current_example.metadata[:js]
|
55
|
+
within("table.index tbody tr:nth-child(#{num})", &block)
|
56
|
+
else
|
57
|
+
within(:xpath, all('table.index tbody tr')[num-1].path, &block)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def column_text(num)
|
62
|
+
if RSpec.current_example.metadata[:js]
|
63
|
+
find("td:nth-child(#{num})").text
|
64
|
+
else
|
65
|
+
all('td')[num-1].text
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def find_label_by_text(text)
|
70
|
+
label = find_label(text)
|
71
|
+
counter = 0
|
72
|
+
|
73
|
+
# Because JavaScript testing is prone to errors...
|
74
|
+
while label.nil? && counter < 10
|
75
|
+
sleep(1)
|
76
|
+
counter += 1
|
77
|
+
label = find_label(text)
|
78
|
+
end
|
79
|
+
|
80
|
+
if label.nil?
|
81
|
+
raise "Could not find label by text #{text}"
|
82
|
+
end
|
83
|
+
|
84
|
+
label
|
85
|
+
end
|
86
|
+
|
87
|
+
def find_label(text)
|
88
|
+
first(:xpath, "//label[text()[contains(.,'#{text}')]]")
|
89
|
+
end
|
90
|
+
|
47
91
|
end
|
48
92
|
|
49
93
|
module Select2
|
@@ -65,7 +109,7 @@ module Softwear::Lib
|
|
65
109
|
select_select2_result(value)
|
66
110
|
end
|
67
111
|
|
68
|
-
def
|
112
|
+
def select2(value, options)
|
69
113
|
label = find_label_by_text(options[:from])
|
70
114
|
|
71
115
|
within label.first(:xpath,'.//..') do
|
data/lib/softwear/lib/version.rb
CHANGED