blackboxd 0.1.5 → 0.1.6

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