browser_shooter 0.0.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,64 +1,79 @@
1
1
  # BrowserShooter
2
2
 
3
- Combined with Selenium RC this gem allows to program Selenium scripts combined with ScreenShots.
3
+ Combined with Selenium RC this gem allows to program Selenium scripts combined with screenshots.
4
4
 
5
5
  ## Use it
6
6
 
7
7
  ### Setup the servers
8
8
 
9
+ #### Starting the Selenium RC server
10
+
9
11
  1. Set up your VirtualMachines with your target SO and browsers installed. Java SE is also needed.
10
12
  2. Download the last version of [Selenium Server](http://seleniumhq.org/download/) (AKA Selenium Remote Control).
11
13
  3. Go to the console and start the Selenium Server:
12
14
 
13
15
  java -jar <your selenium server file>.jar
14
16
 
17
+
18
+ #### Pluging for IE screenshots
19
+
20
+ [Spnapsie](http://snapsie.sourceforge.net/)
21
+
15
22
  Repeat this steps in every VM.
16
23
 
17
- ### Config your BrowserShooter script
24
+ ### Setup the client
25
+
26
+ #### Install the gem
27
+
28
+ gem install "browsers_shooter"
29
+
30
+ #### Config your BrowserShooter script
18
31
 
19
32
  Create a YAML file like this:
20
33
 
21
- shoots_path: "/tmp/shoots"
22
-
23
- scripts:
24
- google:
25
- name: "google"
26
- url: "http://www.google.de"
27
- # commands are Selenium commands
28
- # except 'shot' command wich receive an optional param with the 'sufix' of the screenshot png
29
- # except 'pause' command wich use a Ruby 'sleep' command to pause
30
- commands: |
31
- open "/"
32
- window_maximize
33
- shot before
34
- type "id=lst-ib", "fernando guillen"
35
- click "name=btnG", wait_for :page
36
- pause 3
37
- shot after
38
-
39
- browsers:
40
- windows-firefox:
41
- name: "windows-firefox"
42
- host: 10.211.55.4
43
- port: 4444
44
- browser: "*firefox"
45
-
46
- windows-iexplore:
47
- name: "windows-iexploreproxy"
48
- host: 10.211.55.4
49
- port: 4444
50
- browser: "*iexploreproxy"
34
+ # myconfig.yml
35
+ shoots_path: "/tmp/shoots"
36
+
37
+ scripts:
38
+ google:
39
+ name: "google"
40
+ url: "http://www.google.de"
41
+ # commands are Selenium commands
42
+ # except 'shot' command which receive an optional param with the 'sufix' of the page screenshot png
43
+ # except 'shot_system' command which receive an optional param with the 'sufix' of the system screenshot png
44
+ # except 'pause' command which use a Ruby 'sleep' command to pause
45
+ commands: |
46
+ open "/"
47
+ window_maximize
48
+ shot before
49
+ type "id=lst-ib", "fernando guillen"
50
+ click "name=btnG", wait_for :page
51
+ pause 3
52
+ shot after
53
+
54
+ browsers:
55
+ windows-firefox:
56
+ name: "windows-firefox"
57
+ host: 10.211.55.4
58
+ port: 4444
59
+ browser: "*firefox"
60
+
61
+ windows-iexplore:
62
+ name: "windows-iexploreproxy"
63
+ host: 10.211.55.4
64
+ port: 4444
65
+ browser: "*iexploreproxy"
51
66
 
52
67
  Look in the `examples` folder for more complete examples.
53
68
 
54
69
 
55
- ### Run the BrowserShooter script
70
+ #### Run the BrowserShooter script
56
71
 
57
72
  $ browser_shooter ./my/config.yml
58
73
 
59
74
  The screenshots will be stored in:
60
75
 
61
- <shoots_path>/<time_stamp>/<script_name>_<browser_name>[_<sufix>].png
76
+ /<shoots_path>/<time_stamp>/<script_name>_<browser_name>[_<sufix>].png
62
77
 
63
78
  ## Status
64
79
 
data/examples/config1.yml CHANGED
@@ -9,7 +9,7 @@ scripts:
9
9
  window_maximize
10
10
  shot before
11
11
  type "id=lst-ib", "fernando guillen"
12
- click "name=btnG", wait_for :page
12
+ click "name=btnG"
13
13
  pause 3
14
14
  shot after
15
15
 
@@ -22,19 +22,6 @@ scripts:
22
22
  window_maximize
23
23
  shot
24
24
 
25
- brandengage:
26
- name: "brandengage"
27
- url: "http://staging.iframe.sponsorpay.com"
28
- commands: |
29
- open "/test/brandengage.html"
30
- window_maximize
31
- click "link=be_1372_dedicated"
32
- pause 5
33
- get_alert
34
- click "link=sp.showVideo();"
35
- pause 5
36
- shot
37
-
38
25
  browsers:
39
26
  windows-firefox:
40
27
  name: "windows-firefox"
@@ -46,10 +33,4 @@ browsers:
46
33
  name: "windows-iexploreproxy"
47
34
  host: 10.211.55.4
48
35
  port: 4444
49
- browser: "*iexploreproxy"
50
-
51
- linux-firefox:
52
- name: "linux-firefox"
53
- host: 10.211.55.5
54
- port: 4444
55
- browser: "*firefox"
36
+ browser: "*iexploreproxy"
@@ -0,0 +1,195 @@
1
+ shoots_path: "~/browser_shoots"
2
+
3
+ scripts:
4
+ dedicated_bareplayer:
5
+ name: "dedicated_bareplayer"
6
+ url: "http://staging.iframe.sponsorpay.com"
7
+ commands: |
8
+ window_maximize
9
+ window_focus
10
+ open "/test/widgets/dedicated_bareplayer.html?appid=3249"
11
+ pause 10
12
+ click "id=play-video-link"
13
+ pause 10
14
+ shot
15
+ shot_system
16
+
17
+ dedicated_playerandreward:
18
+ name: "dedicated_playerandreward"
19
+ url: "http://staging.iframe.sponsorpay.com"
20
+ commands: |
21
+ window_maximize
22
+ window_focus
23
+ open "/test/widgets/dedicated_playerandreward.html?appid=3249"
24
+ pause 10
25
+ click "id=play-video-link"
26
+ pause 10
27
+ shot
28
+ shot_system
29
+
30
+ lightbox_bareplayer:
31
+ name: "lightbox_bareplayer"
32
+ url: "http://staging.iframe.sponsorpay.com"
33
+ commands: |
34
+ window_maximize
35
+ window_focus
36
+ open "/test/widgets/lightbox_bareplayer.html?appid=3249"
37
+ pause 10
38
+ shot
39
+ shot_system
40
+
41
+ lightbox_playerandreward:
42
+ name: "lightbox_playerandreward"
43
+ url: "http://staging.iframe.sponsorpay.com"
44
+ commands: |
45
+ window_maximize
46
+ window_focus
47
+ open "/test/widgets/lightbox_playerandreward.html?appid=3249"
48
+ pause 10
49
+ shot
50
+ shot_system
51
+
52
+ banner:
53
+ name: "banner"
54
+ url: "http://staging.iframe.sponsorpay.com"
55
+ commands: |
56
+ window_maximize
57
+ window_focus
58
+ open "/test/banner.html"
59
+ pause 10
60
+ shot
61
+ shot_system
62
+
63
+ banner_iframe:
64
+ name: "banner_iframe"
65
+ url: "http://staging.iframe.sponsorpay.com"
66
+ commands: |
67
+ window_maximize
68
+ window_focus
69
+ open "/test/banner_iframe.html"
70
+ pause 10
71
+ shot
72
+ shot_system
73
+
74
+ bar:
75
+ name: "bar"
76
+ url: "http://staging.iframe.sponsorpay.com"
77
+ commands: |
78
+ window_maximize
79
+ window_focus
80
+ open "/test/bar.html"
81
+ pause 10
82
+ shot
83
+ shot_system
84
+
85
+ example_banner_integration:
86
+ name: "example_banner_integration"
87
+ url: "http://staging.iframe.sponsorpay.com"
88
+ commands: |
89
+ window_maximize
90
+ window_focus
91
+ open "/test/example_banner_integration.html"
92
+ pause 10
93
+ shot
94
+ shot_system
95
+
96
+ example_banner_integration:
97
+ name: "example_banner_integration"
98
+ url: "http://staging.iframe.sponsorpay.com"
99
+ commands: |
100
+ window_maximize
101
+ window_focus
102
+ open "/test/example_banner_integration.html"
103
+ pause 10
104
+ shot
105
+ shot_system
106
+
107
+ overlay:
108
+ name: "overlay"
109
+ url: "http://staging.iframe.sponsorpay.com"
110
+ commands: |
111
+ window_maximize
112
+ window_focus
113
+ open "/test/overlay.html"
114
+ pause 10
115
+ shot
116
+ shot_system
117
+
118
+ overlay_right:
119
+ name: "overlay_right"
120
+ url: "http://staging.iframe.sponsorpay.com"
121
+ commands: |
122
+ window_maximize
123
+ window_focus
124
+ open "/test/overlay_right.html"
125
+ pause 10
126
+ shot
127
+ shot_system
128
+
129
+ video_iframe:
130
+ name: "video_iframe"
131
+ url: "http://staging.iframe.sponsorpay.com"
132
+ commands: |
133
+ window_maximize
134
+ window_focus
135
+ open "/test/video_iframe.html"
136
+ pause 10
137
+ shot
138
+ shot_system
139
+
140
+ video_iframe:
141
+ name: "video_iframe"
142
+ url: "http://staging.iframe.sponsorpay.com"
143
+ commands: |
144
+ window_maximize
145
+ window_focus
146
+ open "/test/video_iframe.html"
147
+ pause 10
148
+ shot
149
+ shot_system
150
+
151
+ widget_integration:
152
+ name: "widget_integration"
153
+ url: "http://staging.iframe.sponsorpay.com"
154
+ commands: |
155
+ window_maximize
156
+ window_focus
157
+ open "/test/widget_integration.html"
158
+ pause 10
159
+ shot
160
+ shot_system
161
+
162
+ widget_integration_iframed:
163
+ name: "widget_integration_iframed"
164
+ url: "http://staging.iframe.sponsorpay.com"
165
+ commands: |
166
+ window_maximize
167
+ window_focus
168
+ open "/test/widget_integration_iframed.html"
169
+ pause 10
170
+ shot
171
+ shot_system
172
+
173
+ widgets_integration_iframed:
174
+ name: "widgets_integration_iframed"
175
+ url: "http://staging.iframe.sponsorpay.com"
176
+ commands: |
177
+ window_maximize
178
+ window_focus
179
+ open "/test/widgets_integration_iframed.html"
180
+ pause 10
181
+ shot
182
+ shot_system
183
+
184
+ browsers:
185
+ windows-firefox:
186
+ name: "windows-firefox"
187
+ host: 10.211.55.4
188
+ port: 4444
189
+ browser: "*firefox"
190
+
191
+ windows-iexplore:
192
+ name: "windows-iexploreproxy"
193
+ host: 10.211.55.4
194
+ port: 4444
195
+ browser: "*iexploreproxy"
@@ -22,11 +22,15 @@ class BrowserShooter
22
22
  end
23
23
 
24
24
  def run
25
+ BrowserShooter::Logger.log "Starting script running with version #{BrowserShooter::VERSION}..."
26
+
25
27
  config["scripts"].each_value do |script|
26
28
  config["browsers"].each_value do |browser|
27
29
  BrowserShooter::Driver.run_script_on_browser(script, browser, config["shoots_path"])
28
30
  end
29
31
  end
32
+
33
+ BrowserShooter::Logger.log "... script running ended."
30
34
  end
31
35
 
32
36
  def set_up_shoots_path( config )
@@ -12,6 +12,15 @@ class BrowserShooter
12
12
  sufix
13
13
  )
14
14
 
15
+ elsif( command.split[0].strip == "shot_system" )
16
+ sufix = command.split[1] ? command.split[1].strip : nil
17
+
18
+ BrowserShooter::Commander.shot_system(
19
+ client,
20
+ shoot_path,
21
+ sufix
22
+ )
23
+
15
24
  elsif( command.split[0].strip == "pause" )
16
25
  BrowserShooter::Commander.pause( command.split[1].strip.to_i )
17
26
 
@@ -32,6 +41,17 @@ class BrowserShooter
32
41
  end
33
42
  end
34
43
 
44
+ def self.shot_system( client, path, sufix = nil )
45
+ sufix = "_#{sufix}" unless sufix.nil?
46
+ path = "#{path}#{sufix}_system.png"
47
+
48
+ BrowserShooter::Logger.log "shooting system in '#{path}'"
49
+
50
+ File.open( "#{path}.screen.png", "wb" ) do |f|
51
+ f.write( Base64.decode64( client.capture_screenshot_to_string ) )
52
+ end
53
+ end
54
+
35
55
  def self.pause( seconds )
36
56
  BrowserShooter::Logger.log "pausing #{seconds} seconds"
37
57
  sleep seconds
@@ -12,7 +12,7 @@ class BrowserShooter
12
12
  :port => browser["port"],
13
13
  :browser => browser["browser"],
14
14
  :url => script["url"],
15
- :timeout_in_seconds => 20
15
+ :timeout_in_seconds => 40
16
16
  )
17
17
 
18
18
  client.start_new_browser_session
@@ -1,3 +1,3 @@
1
1
  class BrowserShooter
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 3
9
+ version: 0.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Fernando Guillen
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-01-06 00:00:00 +01:00
17
+ date: 2012-01-09 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -108,6 +108,7 @@ files:
108
108
  - browser_shoter.gemspec
109
109
  - examples/config1.yml
110
110
  - examples/config2.yml
111
+ - examples/config3.yml
111
112
  - lib/browser_shooter.rb
112
113
  - lib/browser_shooter/commander.rb
113
114
  - lib/browser_shooter/driver.rb