blackboxd 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/blackboxd.rb +142 -148
- 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: de90493a209af22f7246af30f4e5b2f0697051c4
|
4
|
+
data.tar.gz: e4957c79a7158b00646152b3ac9f60e50451ca7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5325702f41a04ab7165dab35a72300a6ccec83dcf9dfeea3956353a484a7f14cd36dce40c08dc2ca9971a67dc3a17781e5d6314d7859177a46a6ec10a38a9146
|
7
|
+
data.tar.gz: b84467d8ffe8b3f043a707d90d143e41db11c5c885f0d2f59f822b7f331b8ec944f77ff9584b79a4ce88f9b534cae4d3eb35b48de4061d66c680401cf88b82df
|
data/lib/blackboxd.rb
CHANGED
@@ -1,148 +1,142 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
#
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
#
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
# end
|
144
|
-
#
|
145
|
-
# Given /I accept alert/ do
|
146
|
-
# alert = @driver.switch_to.alert
|
147
|
-
# alert.accept
|
148
|
-
# end
|
1
|
+
Given /I click_on "(.*)" "(.*)"/ do |value, type|
|
2
|
+
steps %Q{
|
3
|
+
* I wait until "#{value}" "#{type}" renders
|
4
|
+
}
|
5
|
+
@driver.find_element(type.to_sym => value).click
|
6
|
+
end
|
7
|
+
|
8
|
+
When /I wait until "(.*)" "(.*)" renders/ do |value, type|
|
9
|
+
if value == "preferences-command" || value == "ui-inline-del" then
|
10
|
+
sleep 2
|
11
|
+
end
|
12
|
+
start_time = Time.now.to_i
|
13
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => @time)
|
14
|
+
wait.until {
|
15
|
+
element = @driver.find_element(type.to_sym => value )
|
16
|
+
element if element.displayed?
|
17
|
+
}
|
18
|
+
end_time = Time.now.to_i - start_time
|
19
|
+
puts (end_time.to_s + " seconds to render " + "<" + type + ">" + value.inspect + "</" + type + ">")
|
20
|
+
end
|
21
|
+
|
22
|
+
Given /I xpath "(.*)" "(.*)"/ do |what, how|
|
23
|
+
steps %Q{
|
24
|
+
* I wait for "#{what}" "#{how}" to render
|
25
|
+
}
|
26
|
+
@driver.find_element(:xpath, ".//" + how + "[text()='" + what + "']").click
|
27
|
+
end
|
28
|
+
|
29
|
+
When /I wait for "(.*)" "(.*)" to render/ do |what, how|
|
30
|
+
if what == "Insight" then
|
31
|
+
puts sleep 2
|
32
|
+
end
|
33
|
+
start_time = Time.now.to_i
|
34
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => @time)
|
35
|
+
wait.until {
|
36
|
+
element = @driver.find_element(:xpath, ".//" + how + "[text()='" + what + "']")
|
37
|
+
element if element.displayed?
|
38
|
+
}
|
39
|
+
end_time = Time.now.to_i - start_time
|
40
|
+
if end_time == 1
|
41
|
+
puts (end_time.to_s + " second to render " + "<" + how + ">" + what.inspect + "</" + how + ">")
|
42
|
+
else
|
43
|
+
puts (end_time.to_s + " seconds to render " + "<" + how + ">" + what.inspect + "</" + how + ">")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
Given /^I am on the (.+)/ do |page_name|
|
48
|
+
@driver.get(path_to(page_name))
|
49
|
+
if page_name == "login page"
|
50
|
+
@driver.get(path_to(page_name))
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
Given /I fill in "(.*)" with "(.*)"/ do |how, what|
|
55
|
+
if (@driver.all(:id, how).count >= 1 ) then
|
56
|
+
# @driver.find_element(:id, how).clear
|
57
|
+
@driver.find_element(:id, how).send_keys(what)
|
58
|
+
elsif (@driver.all(:class, how).count >=1) then
|
59
|
+
@driver.find_element(:class, how).clear
|
60
|
+
@driver.find_element(:class, how).send_keys(what)
|
61
|
+
elsif (@driver.all(:name, how).count >=1) then
|
62
|
+
@driver.find_element(:name, how).clear
|
63
|
+
@driver.find_element(:name, how).send_keys(what)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
Given /I should (NOT )?see "(.*)"/ do |visibility, what|
|
68
|
+
sleep 2
|
69
|
+
what = what.to_s.strip
|
70
|
+
if (visibility.to_s.strip == 'NOT') then
|
71
|
+
result = @driver.all(:xpath, "//*[text()='" + what + "']")
|
72
|
+
result.count.should == 0
|
73
|
+
else
|
74
|
+
start_time = Time.now.to_i
|
75
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => @time)
|
76
|
+
wait.until {
|
77
|
+
result = @driver.first(:xpath, "//*[text()='" + what + "']")
|
78
|
+
result.displayed?
|
79
|
+
}
|
80
|
+
end_time = Time.now.to_i - start_time
|
81
|
+
puts (end_time.to_s + " seconds to render => " + "#{result.text}" )
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
Given /I wait "(.*)"/ do |seconds|
|
86
|
+
sleep seconds.to_i
|
87
|
+
end
|
88
|
+
|
89
|
+
Given /I should (NOT )?be on "(.*)"/ do |visibility, value|
|
90
|
+
sleep 3
|
91
|
+
puts url = @driver.current_url.to_s
|
92
|
+
if (visibility.to_s.strip == 'NOT') then
|
93
|
+
url.should_not include value
|
94
|
+
else
|
95
|
+
url.should include value
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
Given /I maximize browser/ do
|
100
|
+
@driver.manage.window.maximize
|
101
|
+
end
|
102
|
+
|
103
|
+
Given /I refresh the page/ do
|
104
|
+
@driver.execute_script("$(document).ready(function(){
|
105
|
+
location.reload(true);
|
106
|
+
});")
|
107
|
+
sleep 4
|
108
|
+
end
|
109
|
+
|
110
|
+
Given /I mouseover "(.*)"/ do |value|
|
111
|
+
sleep 3
|
112
|
+
el = @driver.find_element(:class, value)
|
113
|
+
@driver.action.move_to(el).perform
|
114
|
+
sleep 2
|
115
|
+
end
|
116
|
+
|
117
|
+
Given /I press the "(.*)" key/ do |value|
|
118
|
+
@driver.action.send_keys(value.to_sym).perform
|
119
|
+
end
|
120
|
+
|
121
|
+
Given /I type in "(.*)"/ do |value|
|
122
|
+
@driver.action.send_keys(value).perform
|
123
|
+
end
|
124
|
+
|
125
|
+
Given /I scroll down "(.*)" times/ do |number|
|
126
|
+
number.to_i.times do
|
127
|
+
@driver.execute_script("window.scrollBy(0,1000)", "")
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
Given /I scroll up/ do
|
132
|
+
@driver.execute_script("window.scrollTop", "")
|
133
|
+
end
|
134
|
+
|
135
|
+
Given /I display page source/ do
|
136
|
+
puts @driver.page_source
|
137
|
+
end
|
138
|
+
|
139
|
+
Given /I accept alert/ do
|
140
|
+
alert = @driver.switch_to.alert
|
141
|
+
alert.accept
|
142
|
+
end
|