wbench 0.4.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3a99e98258f2293683471f454c7e0f9e7dbbfc9b
4
- data.tar.gz: 78a484762385e2926fa49b47f0143e10bece9fa3
3
+ metadata.gz: b17e83ece2cbb293993ae57b6ca1c0e2df304853
4
+ data.tar.gz: 8b54e998322a6ea032b411c2a1bbed65ab5f56f2
5
5
  SHA512:
6
- metadata.gz: 1da1f3692c3f18b4bb41313db19107c56553dae54c3dc0685d1be3e2f5893f8c52b2e991c0e923da6f8bf1d8caffe40b8354ee1f56f397b946f37316b72b96ea
7
- data.tar.gz: 08ae38bf3f64536e2b2abdca96afe27b5516fc5322ab1a13321043db5c1936597563f2a22e0da00cc7867fbed5c7cc9bc13efcb2ed28cf9738a60dfd21580b2e
6
+ metadata.gz: 2911cefdf138f835c1d46d34d49bf4433f37ad46cf9e5248fba506ea6e9018da9087d5d7d459806c4e4a0d8a0891eb9496cbfce96d3a72ad0a19e2611f871284
7
+ data.tar.gz: e4239bb7299fc09cba399318c0e414e70d57aeb7add5a687937fb65ceeb99413b9d861dcf37d74eba4f550e55c60ce7b8351959e03b524e1e814d61c5b09fe33
data/README.md CHANGED
@@ -23,6 +23,18 @@ You can install chromedriver (on OSX) with homebrew:
23
23
  $ brew install chromedriver
24
24
  ```
25
25
 
26
+ If you are not using Homebrew on OSX, download the latest binary version of [chromedriver](http://chromedriver.storage.googleapis.com/index.html).
27
+ Then unpack the ZIP archive and copy the chromedriver binary to the /usr/bin directory:
28
+ ```bash
29
+ $ sudo cp /location/of/chromedriver/binary /usr/bin
30
+ ```
31
+ Test that chromedriver is working by typing "chromedriver":
32
+ ```bash
33
+ $ chromedriver
34
+ Starting ChromeDriver (v2.7.236836) on port 9515
35
+ ```
36
+ Note that you will NOT need the chromedriver-utility gem if you install the binary in this manner.
37
+
26
38
  Alternatively you can install firefox and use it with wbench. See [Running other browsers](#running-other-browsers) for more info.
27
39
 
28
40
  ## Usage
@@ -52,6 +64,17 @@ You can also pass the `-u/--user-agent` option to change the browsers user agent
52
64
  $ wbench -u "Mozilla/5.0 (iPhone; U; ..." https://www.desktoppr.co/
53
65
  ```
54
66
 
67
+ ### Color output
68
+
69
+ By default the output will be in color. Piping the results to another process
70
+ should correctly remove the coloring. If your terminal doesn't output color, or
71
+ you're getting funny symbols in your results then you can remove color from the
72
+ output using the `-c` flag.
73
+
74
+ ```bash
75
+ $ wbench -c https://www.desktoppr.co/
76
+ ```
77
+
55
78
  ### Server performance measuring
56
79
 
57
80
  Server response times will be reported if the application is a ruby/rack application that returns the `X-Runtime` http header. Without that header the server performance will not be able to be measured.
@@ -129,6 +152,20 @@ assets. This means that when the benchmark is run against the authenticated
129
152
  page, some assets may be loaded from the cache, and the result may appear
130
153
  quicker than an uncahed visit.
131
154
 
155
+
156
+ ### Custom event timings
157
+
158
+ Custom events are available to instrument through wbench. To do so use the native HTML5 function `window.performance.mark` like so:
159
+
160
+ ```javascript
161
+ if(typeof(window.performance) === 'object' && typeof(window.performance.mark) == 'function') {
162
+ window.performance.mark('my custom event');
163
+ }
164
+ ```
165
+
166
+ You can use the `onload` event handler to call the JavaScript above to instrument when certain elements (images for example) are loaded. Currently this only works in google chrome, so we need to protect against the function not being available.
167
+
168
+
132
169
  ### Gisting results
133
170
 
134
171
  You can install the [Github gist gem](https://github.com/defunkt/gist) and pipe in the results of wbench
@@ -92,5 +92,18 @@ window.WBench = {
92
92
 
93
93
  currentURL: function() {
94
94
  return window.location.href;
95
+ },
96
+
97
+ performanceTimings: function() {
98
+ resultTimings = window.performance.timing;
99
+
100
+ // Use user defined timings that are added via window.performance.mark('event name')
101
+ if(typeof(window.performance.getEntriesByType) === 'function') {
102
+ window.performance.getEntriesByType('mark').forEach(function(item) {
103
+ resultTimings[item.name] = Math.ceil(window.performance.timing.navigationStart + item.startTime);
104
+ });
105
+ };
106
+
107
+ return resultTimings;
95
108
  }
96
109
  }
@@ -10,7 +10,13 @@ module WBench
10
10
  selenium_options = { :browser => browser, :http_client => http_client }
11
11
 
12
12
  if options[:user_agent]
13
- add_selenium_args(selenium_options, "--user-agent='#{options[:user_agent]}'")
13
+ if browser == :firefox
14
+ profile = Selenium::WebDriver::Firefox::Profile.new
15
+ profile['general.useragent.override'] = options[:user_agent]
16
+ selenium_options[:profile] = profile
17
+ else
18
+ add_selenium_args(selenium_options, "--user-agent='#{options[:user_agent]}'")
19
+ end
14
20
  end
15
21
 
16
22
  SeleniumDriver.new(app, selenium_options)
@@ -12,7 +12,7 @@ module WBench
12
12
  private
13
13
 
14
14
  def timing_json
15
- @browser.evaluate_script('window.performance.timing')
15
+ @browser.evaluate_script('WBench.performanceTimings()')
16
16
  end
17
17
  end
18
18
  end
@@ -1,3 +1,3 @@
1
1
  module WBench
2
- VERSION = '0.4.0'
2
+ VERSION = '1.0.0'
3
3
  end
@@ -3,9 +3,9 @@
3
3
 
4
4
  def sites
5
5
  [
6
- #'https://www.google.com.au/',
7
- #'https://www.desktoppr.co/',
8
- #'http://www.giftoppr.co/',
9
- #'http://au.yahoo.com/'
6
+ 'https://www.google.com.au/',
7
+ 'https://www.desktoppr.co/',
8
+ 'http://www.giftoppr.co/',
9
+ 'http://au.yahoo.com/'
10
10
  ]
11
11
  end
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wbench
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mario Visic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-26 00:00:00.000000000 Z
11
+ date: 2014-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: selenium-webdriver
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: colorize
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: addressable
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  description: WBench is a tool that uses the HTML5 performance timing API to benchmark
@@ -75,9 +75,9 @@ executables:
75
75
  extensions: []
76
76
  extra_rdoc_files: []
77
77
  files:
78
- - .gitignore
79
- - .rspec
80
- - .rvmrc
78
+ - ".gitignore"
79
+ - ".rspec"
80
+ - ".rvmrc"
81
81
  - CONTRIBUTING.md
82
82
  - Gemfile
83
83
  - LICENSE.txt
@@ -119,17 +119,17 @@ require_paths:
119
119
  - lib
120
120
  required_ruby_version: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  required_rubygems_version: !ruby/object:Gem::Requirement
126
126
  requirements:
127
- - - '>='
127
+ - - ">="
128
128
  - !ruby/object:Gem::Version
129
129
  version: '0'
130
130
  requirements: []
131
131
  rubyforge_project:
132
- rubygems_version: 2.0.6
132
+ rubygems_version: 2.2.2
133
133
  signing_key:
134
134
  specification_version: 4
135
135
  summary: Benchmark website loading times