test_performance 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9bc564acefc41d0bff851d56b57ead3e7ad02d46
4
+ data.tar.gz: ee4bce05370713d9f94c713945598f49d35dc4b7
5
+ SHA512:
6
+ metadata.gz: 89c8cc39d8caf1e76c6286a1c8a88cf8d88c9064677e8c4063fa464b8e2e64105fd6c1240ce7c742a05937f54dc17b892c67e3565c1050a41a17402640f381c8
7
+ data.tar.gz: c95f4ae0c05b0e214b002b488ba7757d0ffc69c55c0de8578cc042938e06e2507f5f93cb624ea559e3388a6657ad67b63b46c754db11b5fbd32fc3b62bc039b2
data/.gitignore ADDED
@@ -0,0 +1,40 @@
1
+ # Ruby-Specific
2
+
3
+ /.bundle/
4
+ /.yardoc
5
+ /Gemfile.lock
6
+ /_yardoc/
7
+
8
+ # Ouput-Specific
9
+
10
+ /coverage/
11
+ /doc/
12
+ /pkg/
13
+ /spec/reports/
14
+ /tmp/
15
+ *.log
16
+ *.tmp
17
+ *.swp
18
+ *.bak
19
+
20
+ # IDE-Specific
21
+
22
+ .idea
23
+ .settings
24
+ .project
25
+ .classpath
26
+ *.iws
27
+
28
+ # Windows-Specific
29
+
30
+ Thumbs.db
31
+
32
+ # Mac OS-Specific
33
+
34
+ *.DS_Store
35
+ ._*
36
+
37
+ # Linux-Specific
38
+
39
+ .directory
40
+ .Trash-*
data/.hound.yml ADDED
@@ -0,0 +1,87 @@
1
+ AllCops:
2
+ Exclude:
3
+ - test_performance.gemspec
4
+ - test/*.rb
5
+ - spec/**/*
6
+
7
+ # Removing need for frozen string literal comment.
8
+ Style/FrozenStringLiteralComment:
9
+ Enabled: false
10
+
11
+ # Removing the preference for string single quotes.
12
+ Style/StringLiterals:
13
+ Enabled: false
14
+
15
+ # Missing top-level module documentation comment.
16
+ Style/Documentation:
17
+ Enabled: false
18
+
19
+ # Prefer reduce over inject.
20
+ Style/CollectionMethods:
21
+ PreferredMethods:
22
+ reduce: 'inject'
23
+
24
+ # Use each_with_object instead of inject.
25
+ Style/EachWithObject:
26
+ Enabled: false
27
+
28
+ # Prefer fail over raise.
29
+ Style/SignalException:
30
+ Enabled: false
31
+
32
+ # This never works for validations.
33
+ Style/AlignHash:
34
+ EnforcedLastArgumentHashStyle: ignore_implicit
35
+
36
+ # Align multi-line params with previous line.
37
+ Style/AlignParameters:
38
+ EnforcedStyle: with_fixed_indentation
39
+
40
+ # Indent `when` clause one step from `case`.
41
+ Style/CaseIndentation:
42
+ IndentOneStep: true
43
+
44
+ # Don't force bad var names for reduce/inject loops.
45
+ Style/SingleLineBlockParams:
46
+ Enabled: false
47
+
48
+ # For method chains, keep the dot with the method name.
49
+ Style/DotPosition:
50
+ EnforcedStyle: leading
51
+
52
+ # Stop nesting so hard.
53
+ Metrics/BlockNesting:
54
+ Max: 2
55
+
56
+ # Encourage short methods.
57
+ Metrics/MethodLength:
58
+ Max: 11
59
+
60
+ # Encourage fewer parameters.
61
+ Metrics/ParameterLists:
62
+ Max: 4
63
+
64
+ # Allow longer lines for this application. Some of the code simply
65
+ # reads better without worrying about line length.
66
+ Metrics/LineLength:
67
+ Max: 115
68
+
69
+ # The following three are being disabled for this application because the
70
+ # warnings are only triggering for the timestamp methods. I see no way (or
71
+ # need) to break them up and still keep them easily understandable at a
72
+ # glance.
73
+ Metrics/AbcSize:
74
+ Enabled: false
75
+
76
+ Metrics/PerceivedComplexity:
77
+ Enabled: false
78
+
79
+ Metrics/CyclomaticComplexity:
80
+ Enabled: false
81
+
82
+ # Increasing this only for this application. The culprit here is the
83
+ # PerformanceData class. However, breaking this functionality out into
84
+ # other classes makes little sense to me. Further, most of the reason
85
+ # for the overall length was due to satisfying other RuboCop warnings.
86
+ Metrics/ClassLength:
87
+ Max: 120
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,2 @@
1
+ inherit_from:
2
+ - .hound.yml
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.13.7
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at jeff.nyman@sproutsocial.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in test_performance.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Jeff Nyman
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,125 @@
1
+ # TestPerformance
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/test_performance.svg)](http://badge.fury.io/rb/test_performance)
4
+ [![License](http://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/jeffnyman/test_performance/blob/master/LICENSE.txt)
5
+
6
+ [![Dependency Status](https://gemnasium.com/jeffnyman/test_performance.png)](https://gemnasium.com/jeffnyman/test_performance)
7
+
8
+ This gem collects and summarizes metrics that have been specified as part of the [W3C Navigation web performance specifications](http://w3c.github.io/navigation-timing/). This requires you to be using Watir as well as a browser that supports the specification.
9
+
10
+ All of the metrics provided are those indicated by the [processing model](http://w3c.github.io/navigation-timing/#processing-model) of the public specification. All summary times provided are in milliseconds.
11
+
12
+ ## Installation
13
+
14
+ To get the latest stable release, add this line to your application's Gemfile:
15
+
16
+ ```ruby
17
+ gem 'test_performance'
18
+ ```
19
+
20
+ And then include it in your bundle:
21
+
22
+ $ bundle
23
+
24
+ You can also install TestPerformance just as you would any other gem:
25
+
26
+ $ gem install test_performance
27
+
28
+ ## Usage
29
+
30
+ The simplest use case is to use Watir driver instance, perform some actions in a browser via the API, and then call the `performance` method, as such:
31
+
32
+ ```ruby
33
+ require "test_performance"
34
+ require "watir"
35
+
36
+ browser = Watir::Browser.new
37
+ browser.goto "google.com"
38
+ p browser.performance
39
+ browser.close
40
+ ```
41
+
42
+ The output you get should look like this:
43
+
44
+ ```
45
+ {
46
+ :summary => {
47
+ :redirect=>0,
48
+ :app_cache=>0,
49
+ :dns=>0,
50
+ :tcp_connection=>982,
51
+ :tcp_connection_secure=>721,
52
+ :request=>1222,
53
+ :response=>4,
54
+ :dom_processing=>4293,
55
+ :response_time=>7298,
56
+ :time_to_first_byte=>2205,
57
+ :time_to_last_byte=>2209
58
+ },
59
+ :navigation => {
60
+ :type => 0,
61
+ :type_back_forward => 2,
62
+ :redirect_count => 0,
63
+ :type_reserved => 255,
64
+ :type_navigate => 0,
65
+ :type_reload => 1
66
+ },
67
+ :memory => {
68
+ :total_js_heap_size => 0,
69
+ :js_heap_size_limit => 0,
70
+ :used_js_heap_size => 0
71
+ },
72
+ :timing => {
73
+ :domain_lookup_start => 1303180421599,
74
+ :load_event_end => 0,
75
+ :connect_end => 1303180421642,
76
+ :response_end => 1303180421853,
77
+ :dom_loading => 1303180421840,
78
+ :navigation_start => 0,
79
+ :redirect_end => 0,
80
+ :unload_event_start => 0,
81
+ :secure_connection_start => 0,
82
+ :connect_start => 1303180421600,
83
+ :dom_content_loaded_event_end => 1303180421934,
84
+ :domain_lookup_end => 1303180421600,
85
+ :dom_interactive => 1303180421934,
86
+ :load_event_start => 0,
87
+ :request_start => 1303180421642,
88
+ :response_start => 1303180421838,
89
+ :dom_complete => 0,
90
+ :fetch_start => 1303180421598,
91
+ :dom_content_loaded_event_start => 1303180421934,
92
+ :redirect_start => 0,
93
+ :unload_event_end => 0
94
+ }
95
+ }
96
+ ```
97
+
98
+ ## Development
99
+
100
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec:all` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. To install this gem onto your local machine, run `bundle exec rake install`.
101
+
102
+ ## Contributing
103
+
104
+ Bug reports and pull requests are welcome on GitHub at [https://github.com/jeffnyman/test_performance](https://github.com/jeffnyman/test_performance). The testing ecosystem of Ruby is very large and this project is intended to be a welcoming arena for collaboration on yet another testing tool. As such, contributors are very much welcome but are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
105
+
106
+ To contribute to TestPerformance:
107
+
108
+ 1. [Fork the project](http://gun.io/blog/how-to-github-fork-branch-and-pull-request/).
109
+ 2. Create your feature branch. (`git checkout -b my-new-feature`)
110
+ 3. Commit your changes. (`git commit -am 'new feature'`)
111
+ 4. Push the branch. (`git push origin my-new-feature`)
112
+ 5. Create a new [pull request](https://help.github.com/articles/using-pull-requests).
113
+
114
+ ## Author
115
+
116
+ * [Jeff Nyman](http://testerstories.com)
117
+
118
+ ## Credits
119
+
120
+ This code is based upon the [watir-webdriver-performance](https://github.com/90kts/watir-webdriver-performance) gem. That gem has not been maintained in some time so I wanted to create a version that was updated for the latest changes in Watir as well as provide more modular code to allow for better evolution of the performance gathering as well as potentially providing this mechanism outside the context of Watir, hence the name change.
121
+
122
+ ## License
123
+
124
+ TestPerformance is distributed under the [MIT](http://www.opensource.org/licenses/MIT) license.
125
+ See the [LICENSE](https://github.com/jeffnyman/test_performance/blob/master/LICENSE.txt) file for details.
data/Rakefile ADDED
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+ require "rdoc/task"
4
+ require "rubocop/rake_task"
5
+ require "rspec/core/rake_task"
6
+
7
+ RuboCop::RakeTask.new
8
+
9
+ namespace :spec do
10
+ desc 'Clean all generated reports'
11
+ task :clean do
12
+ system('rm -rf spec/reports')
13
+ end
14
+
15
+ RSpec::Core::RakeTask.new(all: :clean) do |config|
16
+ options = %w(--color)
17
+ options += %w(--format documentation)
18
+ options += %w(--format html --out spec/reports/unit-test-report.html)
19
+
20
+ config.rspec_opts = options
21
+ end
22
+ end
23
+
24
+ Rake::RDocTask.new do |rdoc|
25
+ rdoc.rdoc_dir = 'doc'
26
+ rdoc.main = 'README.md'
27
+ rdoc.title = "TestPerformance #{TestPerformance::VERSION}"
28
+ rdoc.rdoc_files.include('README*', 'lib/**/*.rb')
29
+ end
30
+
31
+ task default: ['spec:all', :rubocop]
data/bin/console ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "test_performance"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ require "pry"
10
+ Pry.start
11
+
12
+ # require "irb"
13
+ # IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,195 @@
1
+ require "ostruct"
2
+ require "test_performance/version"
3
+
4
+ module Watir # TestPerformance
5
+ class PerformanceData
6
+ def initialize(data)
7
+ @data = data
8
+ end
9
+
10
+ def mapping
11
+ hash = {}
12
+ @data.each_key do |key|
13
+ next if key == '__fxdriver_unwrapped'
14
+
15
+ hash[key.to_sym] = {}
16
+
17
+ next unless @data[key].respond_to? :each
18
+
19
+ # BREAK OUT ALL IN THIS LOOP INTO METHOD?
20
+ # WOULD HAVE TO PASS hash AND key.
21
+ # WOULD HAVE TO RETURN hash.
22
+ data_mapper(hash, key)
23
+ # @data[key].each do |k, v|
24
+ # next if k == '__fxdriver_unwrapped'
25
+ # hash[key.to_sym][underscored(k).to_sym] = v
26
+ # end
27
+ end
28
+
29
+ hash[:summary] = {}
30
+
31
+ gather_summary_metrics(hash)
32
+
33
+ OpenStruct.new(hash)
34
+ end
35
+
36
+ private
37
+
38
+ def data_mapper(hash, key)
39
+ @data[key].each do |k, v|
40
+ next if k == '__fxdriver_unwrapped'
41
+ hash[key.to_sym][underscored(k).to_sym] = v
42
+ end
43
+ hash
44
+ end
45
+
46
+ def gather_summary_metrics(hash)
47
+ summary_redirect(hash)
48
+ summary_app_cache(hash)
49
+ summary_dns(hash)
50
+ summary_tcp_connection(hash)
51
+ summary_tcp_connection_secure(hash)
52
+ summary_request(hash)
53
+ summary_response(hash)
54
+ summary_dom_processing(hash)
55
+ summary_time_to_first_byte(hash)
56
+ summary_time_to_last_byte(hash)
57
+ summary_response_time(hash)
58
+ end
59
+
60
+ def summary_redirect(hash)
61
+ return if hash[:timing][:redirect_end] <= 0
62
+ hash[:summary][:redirect] =
63
+ hash[:timing][:redirect_end] - hash[:timing][:redirect_start]
64
+ end
65
+
66
+ def summary_app_cache(hash)
67
+ return if hash[:timing][:fetch_start] <= 0
68
+ hash[:summary][:app_cache] =
69
+ hash[:timing][:domain_lookup_start] - hash[:timing][:fetch_start]
70
+ end
71
+
72
+ def summary_dns(hash)
73
+ return if hash[:timing][:domain_lookup_start] <= 0
74
+ hash[:summary][:dns] =
75
+ hash[:timing][:domain_lookup_end] - hash[:timing][:domain_lookup_start]
76
+ end
77
+
78
+ def summary_tcp_connection(hash)
79
+ return if hash[:timing][:connect_start] <= 0
80
+ hash[:summary][:tcp_connection] =
81
+ hash[:timing][:connect_end] - hash[:timing][:connect_start]
82
+ end
83
+
84
+ def summary_tcp_connection_secure(hash)
85
+ return if hash[:timing][:secure_connection_start].nil? &&
86
+ hash[:timing][:secure_connection_start] <= 0
87
+
88
+ hash[:summary][:tcp_connection_secure] =
89
+ hash[:timing][:connect_end] - hash[:timing][:secure_connection_start]
90
+ end
91
+
92
+ def summary_request(hash)
93
+ return if hash[:timing][:request_start] <= 0
94
+ hash[:summary][:request] =
95
+ hash[:timing][:response_start] - hash[:timing][:request_start]
96
+ end
97
+
98
+ def summary_response(hash)
99
+ return if hash[:timing][:response_start] <= 0
100
+ hash[:summary][:response] =
101
+ hash[:timing][:response_end] - hash[:timing][:response_start]
102
+ end
103
+
104
+ def summary_dom_processing(hash)
105
+ return if hash[:timing][:dom_loading] <= 0
106
+ hash[:summary][:dom_processing] =
107
+ hash[:timing][:dom_content_loaded_event_start] -
108
+ hash[:timing][:dom_loading]
109
+ end
110
+
111
+ def summary_time_to_first_byte(hash)
112
+ return if hash[:timing][:domain_lookup_start] <= 0
113
+ hash[:summary][:time_to_first_byte] =
114
+ hash[:timing][:response_start] - hash[:timing][:domain_lookup_start]
115
+ end
116
+
117
+ def summary_time_to_last_byte(hash)
118
+ return if hash[:timing][:domain_lookup_start] <= 0
119
+ hash[:summary][:time_to_last_byte] =
120
+ hash[:timing][:response_end] - hash[:timing][:domain_lookup_start]
121
+ end
122
+
123
+ def summary_response_time(hash)
124
+ hash[:summary][:response_time] =
125
+ latest_timestamp(hash) - earliest_timestamp(hash)
126
+ end
127
+
128
+ def underscored(camel_cased_word)
129
+ word = camel_cased_word.to_s.dup
130
+ word.gsub!(/::/, '/')
131
+ word.gsub!(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
132
+ word.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
133
+ word.tr!("-", "_")
134
+ word.downcase!
135
+ word
136
+ end
137
+
138
+ def earliest_timestamp(hash)
139
+ return hash[:timing][:navigation_start] if hash[:timing][:navigation_start] > 0
140
+ return hash[:timing][:redirect_start] if hash[:timing][:redirect_start] > 0
141
+ return hash[:timing][:redirect_end] if hash[:timing][:redirect_end] > 0
142
+ return hash[:timing][:fetch_start] if hash[:timing][:fetch_start] > 0
143
+ end
144
+
145
+ def latest_timestamp(hash)
146
+ return hash[:timing][:load_event_end] if hash[:timing][:load_event_end] > 0
147
+ return hash[:timing][:load_event_start] if hash[:timing][:load_event_start] > 0
148
+ return hash[:timing][:dom_complete] if hash[:timing][:dom_complete] > 0
149
+ return hash[:timing][:dom_content_loaded_event_end] if hash[:timing][:dom_content_loaded_event_end] > 0
150
+ return hash[:timing][:dom_content_loaded_event_start] if hash[:timing][:dom_content_loaded_event_start] > 0
151
+ return hash[:timing][:dom_interactive] if hash[:timing][:dom_interactive] > 0
152
+ return hash[:timing][:response_end] if hash[:timing][:response_end] > 0
153
+ end
154
+ end
155
+
156
+ class Browser
157
+ def performance
158
+ data =
159
+ case driver.browser
160
+ when :internet_explorer
161
+ Object::JSON.parse(driver.execute_script(performance_test_for_ie))
162
+ else
163
+ driver.execute_script(performance_test)
164
+ end
165
+ performance_error if data.nil?
166
+ PerformanceData.new(data).mapping
167
+ end
168
+
169
+ def with_performance
170
+ yield PerformanceData.new(performance_data).mapping if performance_supported?
171
+ end
172
+
173
+ def performance_data
174
+ driver.execute_script(performance_test)
175
+ end
176
+
177
+ alias performance_supported? performance_data
178
+
179
+ def performance_error
180
+ raise "Unable to collect performance metrics from the current "\
181
+ "browser. Make sure the browser you are using supports collecting "\
182
+ "performance metrics."
183
+ end
184
+
185
+ def performance_test
186
+ "return window.performance || "\
187
+ "window.webkitPerformance || window.mozPerformance || "\
188
+ "window.msPerformance;"
189
+ end
190
+
191
+ def performance_test_for_ie
192
+ "return JSON.stringify(window.performance.toJSON());"
193
+ end
194
+ end
195
+ end
@@ -0,0 +1,3 @@
1
+ module TestPerformance
2
+ VERSION = "1.0.0".freeze
3
+ end
@@ -0,0 +1,37 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'test_performance/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "test_performance"
8
+ spec.version = TestPerformance::VERSION
9
+ spec.authors = ["Jeff Nyman"]
10
+ spec.email = ["jeffnyman@gmail.com"]
11
+
12
+ spec.summary = %q{Generate performance metrics from watir-based automation.}
13
+ spec.description = %q{Generate performance metrics from watir-based automation.}
14
+ spec.homepage = "https://github.com/jeffnyman/test_performance"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.13"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec", "~> 3.0"
27
+ spec.add_development_dependency "rubocop"
28
+ spec.add_development_dependency "pry"
29
+
30
+ spec.add_runtime_dependency "watir", "~> 6.0"
31
+
32
+ spec.post_install_message = %{
33
+ (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
34
+ TestPerformance #{TestPerformance::VERSION} has been installed.
35
+ (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
36
+ }
37
+ end
metadata ADDED
@@ -0,0 +1,145 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: test_performance
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Jeff Nyman
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-01-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.13'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.13'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: watir
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '6.0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '6.0'
97
+ description: Generate performance metrics from watir-based automation.
98
+ email:
99
+ - jeffnyman@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".hound.yml"
106
+ - ".rspec"
107
+ - ".rubocop.yml"
108
+ - ".travis.yml"
109
+ - CODE_OF_CONDUCT.md
110
+ - Gemfile
111
+ - LICENSE.txt
112
+ - README.md
113
+ - Rakefile
114
+ - bin/console
115
+ - bin/setup
116
+ - lib/test_performance.rb
117
+ - lib/test_performance/version.rb
118
+ - test_performance.gemspec
119
+ homepage: https://github.com/jeffnyman/test_performance
120
+ licenses:
121
+ - MIT
122
+ metadata: {}
123
+ post_install_message: "\n(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)\n
124
+ \ TestPerformance 1.0.0 has been installed.\n(::) (::) (::) (::) (::) (::) (::)
125
+ (::) (::) (::) (::) (::)\n "
126
+ rdoc_options: []
127
+ require_paths:
128
+ - lib
129
+ required_ruby_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ requirements: []
140
+ rubyforge_project:
141
+ rubygems_version: 2.5.1
142
+ signing_key:
143
+ specification_version: 4
144
+ summary: Generate performance metrics from watir-based automation.
145
+ test_files: []