watir-performance 0.5.4 → 0.6.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
  SHA256:
3
- metadata.gz: 5a58a01bfa8f5983de579bd6a5147d90b74d190333fbb93227cbe3ffb7cfb4b7
4
- data.tar.gz: 4c9f94b61a0a5ad458c81cc72a14ca5bc559723d763c30d101e03cb2515bef70
3
+ metadata.gz: c2700a82cb1c92e5e159afd486c2135952335e7053dde17750546301c7421569
4
+ data.tar.gz: 605a5699aa7c5e28459578b26c858711ebb5970e47eb02b4a0b1710b7ec32853
5
5
  SHA512:
6
- metadata.gz: 79b4722c0432483ddc3d6e6550cef8d79fc4d6ce897f4f3bff14d198fa5da2e4d4a4c6892ff579fe480ab2b30b7d8c79d0a432680514feeadfd35d48aac8b84f
7
- data.tar.gz: 0d5176462173598b7895fee8c3acdd908d38ad02abacc9752d506ce78e91affa3d61ff5f760382abbdf48e6ded9e3cd6cabfa43deb7a1ba9436cd10110b47b6d
6
+ metadata.gz: de7d205aa90f8b3d4e4362d4a99b242c7fdabc5ba0dbe70bf0c300791216a1c937d4fd1b8b699eb2f09222f9506426d32b5b005bf90034bd1c3fc22c17555072
7
+ data.tar.gz: 2ba85db7b30e22b66c46de210570345a54739fb5529389653c5ba46aae98505873dbca63b23e84ee0da08c0106e44739f737a9ed2c78e1a344988151df656044
data/.document CHANGED
@@ -1,5 +1,3 @@
1
1
  lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
2
+ -
5
3
  LICENSE.txt
data/.gitlab-ci.yml ADDED
@@ -0,0 +1,16 @@
1
+ dependency_scanning:
2
+ image: docker:stable
3
+ variables:
4
+ DOCKER_DRIVER: overlay2
5
+ allow_failure: true
6
+ services:
7
+ - docker:stable-dind
8
+ script:
9
+ - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
10
+ - docker run
11
+ --env DEP_SCAN_DISABLE_REMOTE_CHECKS="${DEP_SCAN_DISABLE_REMOTE_CHECKS:-false}"
12
+ --volume "$PWD:/code"
13
+ --volume /var/run/docker.sock:/var/run/docker.sock
14
+ "registry.gitlab.com/gitlab-org/security-products/dependency-scanning:$SP_VERSION" /code
15
+ artifacts:
16
+ paths: [gl-dependency-scanning-report.json]
data/.travis.yml CHANGED
@@ -3,86 +3,89 @@ language: ruby
3
3
 
4
4
  matrix:
5
5
  include:
6
-
6
+ # Testing all Available Ruby version from 2.3.7 - 2.6.0-preview1
7
7
  - os: linux
8
- rvm: 2.6.0-preview1
8
+ rvm:
9
+ - 2.6.0-preview1
10
+ env:
11
+ - MOZ_HEADLESS=1
9
12
  addons:
10
13
  chrome: stable
11
- firefox: "59.0.2"
14
+ firefox: latest
12
15
  before_install:
13
16
  - bash ./spec/support/setup-chromedriver.sh
14
17
  - bash ./spec/support/setup-geckodriver.sh
15
18
  - gem install bundler -v 1.16.1
16
- script: xvfb-run bundle exec rake
17
19
 
18
20
  - os: linux
19
21
  rvm: 2.5.1
22
+ env:
23
+ - MOZ_HEADLESS=1
20
24
  addons:
21
25
  chrome: stable
22
- firefox: "59.0.2"
26
+ firefox: latest
23
27
  before_install:
24
28
  - bash ./spec/support/setup-chromedriver.sh
25
29
  - bash ./spec/support/setup-geckodriver.sh
26
30
  - gem install bundler -v 1.16.1
27
- script: xvfb-run bundle exec rake
28
31
 
29
32
  - os: linux
30
33
  rvm: 2.4.4
34
+ env:
35
+ - MOZ_HEADLESS=1
31
36
  addons:
32
37
  chrome: stable
33
- firefox: "59.0"
38
+ firefox: latest
34
39
  before_install:
35
40
  - bash ./spec/support/setup-chromedriver.sh
36
41
  - bash ./spec/support/setup-geckodriver.sh
37
42
  - gem install bundler -v 1.16.1
38
- script: xvfb-run bundle exec rake
39
43
 
40
44
  - os: linux
41
45
  rvm: 2.3.7
46
+ env:
47
+ - MOZ_HEADLESS=1
42
48
  addons:
43
49
  chrome: stable
44
- firefox: "59.0"
50
+ firefox: latest
45
51
  before_install:
46
52
  - bash ./spec/support/setup-chromedriver.sh
47
53
  - bash ./spec/support/setup-geckodriver.sh
48
54
  - gem install bundler -v 1.16.1
49
- script: xvfb-run bundle exec rake
50
55
 
56
+ # OSX is only testing unsupported browser safari - all results should be pending
51
57
  - os: osx
52
58
  rvm: 2.5.1
53
- addons:
54
- chrome: beta
55
- firefox: "59.0.2"
56
59
  before_install:
57
- - sudo bash ./spec/support/setup-chromedriver.sh
58
- - sudo bash ./spec/support/setup-geckodriver-alt.sh
59
- - sudo safaridriver --enable
60
- - gem install bundler -v 1.16.1
61
- script: xvfb-run bundle exec rake
60
+ - sudo safaridriver --enable
61
+ - gem install bundler -v 1.16.1
62
+ script: bundle exec rake spec SPEC=spec/watir-performance-non-supported-browser_spec.rb
62
63
 
63
64
  - os: osx
64
65
  rvm: 2.4.4
65
- addons:
66
- chrome: beta
67
- firefox: "59.0"
68
66
  before_install:
69
- - sudo bash ./spec/support/setup-chromedriver.sh
70
- - sudo bash ./spec/support/setup-geckodriver-alt.sh
71
- - sudo safaridriver --enable
72
- - gem install bundler -v 1.16.1
73
- script: xvfb-run bundle exec rake
74
-
67
+ - sudo safaridriver --enable
68
+ - gem install bundler -v 1.16.1
69
+ script: bundle exec rake spec SPEC=spec/watir-performance-non-supported-browser_spec.rb
70
+
75
71
  - os: osx
76
72
  rvm: 2.3.7
77
- addons:
78
- chrome: beta
79
- firefox: "59.0"
80
73
  before_install:
81
- - sudo bash ./spec/support/setup-chromedriver.sh
82
- - sudo bash ./spec/support/setup-geckodriver-alt.sh
83
- - sudo safaridriver --enable
84
- - gem install bundler -v 1.16.1
85
- script: xvfb-run bundle exec rake
86
-
74
+ - sudo safaridriver --enable
75
+ - gem install bundler -v 1.16.1
76
+ script: bundle exec rake spec SPEC=spec/watir-performance-non-supported-browser_spec.rb
77
+
78
+ #- os: linux with saucelabs to test Edge and IE
79
+ #- os: linux
80
+ # rvm: 2.5.1
81
+ # env:
82
+ # - SAUCELABS=true
83
+ # addons:
84
+ # sauce_connect: true
85
+ # before_install:
86
+ # - gem install bundler -v 1.16.1
87
+ # - echo $SAUCELABS
88
+
89
+
87
90
  notifications:
88
91
  email: false
data/LICENSE.txt CHANGED
@@ -1,5 +1,5 @@
1
+ Copyright (c) 2018 Robert MacCracken
1
2
  Copyright (c) 2011 Tim Koopmans
2
- Copyright (c) 2017 Robert MacCracken
3
3
 
4
4
  Permission is hereby granted, free of charge, to any person obtaining
5
5
  a copy of this software and associated documentation files (the
data/README.rdoc CHANGED
@@ -1,18 +1,15 @@
1
1
  = watir-performance
2
2
 
3
3
  {<img src="https://badge.fury.io/rb/watir-performance.svg" alt="Gem Version" />}[https://badge.fury.io/rb/watir-performance]
4
- {<img src="https://beta.gemnasium.com/badges/github.com/MacCracken/watir-performance.svg" alt="Dependency Status" />}[https://beta.gemnasium.com/projects/github.com/MacCracken/watir-performance]
5
4
  {<img src="https://api.codeclimate.com/v1/badges/ce9c9de5e6146dedab27/maintainability" />}[https://codeclimate.com/github/MacCracken/watir-performance/maintainability]
6
5
  {<img src="https://travis-ci.org/MacCracken/watir-performance.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/MacCracken/watir-performance]
7
6
 
8
- Predecessor to https://github.com/90kts/watir-webdriver-performance for Watir as opposed to watir-webdriver.
7
+ Successor to 90kts:watir-webdriver-performance[https://github.com/90kts/watir-webdriver-performance] for Watir as opposed to watir-webdriver.
9
8
 
10
9
  The Watir-Performance aims to provide a set of navigation timing metrics for Watir[https://github.com/watir/watir] actions using a {W3C page performance standard}[http://w3c-test.org/webperf/specs/NavigationTiming/]. This is a perfect solution to capture response time metrics, and it’s very straightforward to do. Works for Chrome, Firefox, Edge and IE9 and up. Currently no Safari support.
11
10
 
12
- This gem collects and summarises metrics speficied in the W3C Navigation
13
- web performance specifications at
14
- https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html when using
15
- watir and a compatible browser.
11
+ This gem collects and summarises metrics speficied in the W3C:Navigation[https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html]
12
+ web performance specifications when using watir and a compatible browser.
16
13
 
17
14
  == Example output of browser.performance
18
15
  All summary times are in milliseconds, and are an abstraction of the w3c
@@ -82,7 +79,7 @@ web performance specification.
82
79
 
83
80
  == Copyright
84
81
 
85
- Copyright (c) 2011 Tim Koopmans, 2017 Robert MacCracken.
82
+ Copyright (c) 2018 Robert MacCracken, 2011 Tim Koopmans
86
83
 
87
84
  See LICENSE.txt for further details.
88
85
 
data/Rakefile CHANGED
@@ -15,7 +15,7 @@ Jeweler::Tasks.new do |gem|
15
15
  gem.homepage = "http://github.com/MacCracken/watir-performance"
16
16
  gem.license = "MIT"
17
17
  gem.summary = %Q{A simple helper gem for watir performance metrics}
18
- gem.description = %Q{This gem collects and summarises metrics speficied in the W3C Navigation web performance specifications at http://w3c-test.org/webperf/specs/NavigationTiming/ when using watir-webdriver and a compatible browser}
18
+ gem.description = %Q{This gem collects and summarises metrics speficied in the W3C Navigation web performance specifications at http://w3c-test.org/webperf/specs/NavigationTiming/ when using watir and a compatible browser}
19
19
  gem.email = ['robert.maccracken@gmail.com', "tim.koops@gmail.com"]
20
20
  gem.authors = ['Robert MacCracken', "Tim Koopmans"]
21
21
  gem.required_rubygems_version = '~> 2.7'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.4
1
+ 0.6.0
data/examples/basic.rb CHANGED
@@ -1,5 +1,5 @@
1
- require 'watir-performance'
2
1
  require 'watir'
2
+ require 'watir-performance'
3
3
  b = Watir::Browser.new :chrome
4
4
  b.goto "altentee.com"
5
5
  p b.performance
data/lib/idl_extractor.rb CHANGED
@@ -14,7 +14,7 @@ idl.each do |spec|
14
14
  end
15
15
 
16
16
  results = {}
17
- results[:class] = "Performance"
17
+ results[:class] = 'Performance'
18
18
  results[:interfaces] = {}
19
19
  nodes.each do |node|
20
20
  interface_name = node.children.first.header.name.gsub("Performance","")
@@ -51,7 +51,7 @@ module Watir
51
51
  hash[:summary][:time_to_last_byte] = hash[:timing][:response_end] -
52
52
  hash[:timing][:domain_lookup_start] if hash[:timing][:domain_lookup_start] > 0
53
53
  hash[:summary][:response_time] = latest_timestamp(hash) - earliest_timestamp(hash)
54
- hash # Return
54
+ hash
55
55
  end
56
56
 
57
57
  private
@@ -59,28 +59,29 @@ module Watir
59
59
  def underscored(camel_cased_word)
60
60
  word = camel_cased_word.to_s.dup
61
61
  word.gsub!(/::/, '/')
62
- word.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
63
- word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
64
- word.tr!("-", "_")
62
+ word.gsub!(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
63
+ word.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
64
+ word.tr!('-', '_')
65
65
  word.downcase!
66
66
  word
67
67
  end
68
68
 
69
+ def timer_checks(timers, hash)
70
+ timers.each do |timer|
71
+ return hash[:timing][timer] if hash[:timing][timer] > 0
72
+ end
73
+ end
74
+
69
75
  def earliest_timestamp(hash)
70
- return hash[:timing][:navigation_start] if hash[:timing][:navigation_start] > 0
71
- return hash[:timing][:redirect_start] if hash[:timing][:redirect_start] > 0
72
- return hash[:timing][:redirect_end] if hash[:timing][:redirect_end] > 0
73
- return hash[:timing][:fetch_start] if hash[:timing][:fetch_start] > 0
76
+ timers = %i[navigation_start redirect_start redirect_end fetch_start]
77
+ timer_checks(timers, hash)
74
78
  end
75
79
 
76
80
  def latest_timestamp(hash)
77
- return hash[:timing][:load_event_end] if hash[:timing][:load_event_end] > 0
78
- return hash[:timing][:load_event_start] if hash[:timing][:load_event_start] > 0
79
- return hash[:timing][:dom_complete] if hash[:timing][:dom_complete] > 0
80
- return hash[:timing][:dom_content_loaded_event_end] if hash[:timing][:dom_content_loaded_event_end] > 0
81
- return hash[:timing][:dom_content_loaded_event_start] if hash[:timing][:dom_content_loaded_event_start] > 0
82
- return hash[:timing][:dom_interactive] if hash[:timing][:dom_interactive] > 0
83
- return hash[:timing][:response_end] if hash[:timing][:response_end] > 0
81
+ timers = %i[load_event_end load_event_start dom_complete
82
+ dom_content_loaded_event_end dom_content_loaded_event_start
83
+ dom_interactive response_end]
84
+ timer_checks(timers, hash)
84
85
  end
85
86
  end
86
87
 
@@ -3,5 +3,4 @@ GK_VERSION=0.20.1
3
3
  echo "Using GeckoDriver version: "$GK_VERSION
4
4
  wget --no-verbose -O /tmp/geckodriver.tar.gz https://github.com/mozilla/geckodriver/releases/download/v$GK_VERSION/geckodriver-v$GK_VERSION-linux64.tar.gz
5
5
  tar -C /opt -zxf /tmp/geckodriver.tar.gz && rm /tmp/geckodriver.tar.gz
6
- sudo chmod 755 /opt/geckodriver
7
- export PATH=$PATH:/opt/geckodriver
6
+ sudo chmod 755 /opt/geckodriver
@@ -1,5 +1,5 @@
1
1
  uname=`uname -s`.chomp
2
- if uname == "Darwin"
2
+ if uname == 'Darwin'
3
3
  describe 'WatirPerformance-NonSupportedBrowser' do
4
4
  let!(:b) { @b }
5
5
 
@@ -8,22 +8,27 @@ if uname == "Darwin"
8
8
  end
9
9
 
10
10
  after(:all) do
11
- @b.quit
11
+ @b.close
12
12
  end
13
13
 
14
- pending 'should raise an error when a non supported browser is encountered' do
15
- b.goto "google.com"
16
- expect(-> { b.performance }).to raise_error RuntimeError, 'Could not collect performance metrics from your current browser. Please ensure the browser you are using supports collecting performance metrics.'
14
+ pending 'should raise an error when a non supported' \
15
+ 'browser is encountered' do
16
+
17
+ b.goto 'google.com'
18
+ error = 'Could not collect performance metrics from your current browser'\
19
+ '. Please ensure the browser you are using supports collecting ' \
20
+ 'performance metrics.'
21
+ expect(-> { b.performance }).to raise_error RuntimeError, error
17
22
  end
18
23
 
19
- pending "should return false for supported" do
20
- b.goto "google.com"
24
+ pending 'should return false for supported"'do
25
+ b.goto 'google.com'
21
26
  expect(b).not_to be_performance_supported
22
27
  end
23
28
 
24
- pending "should not support performance as block" do
25
- b.goto "google.com"
26
- b.with_performance {|performance| expect(performance).not_to be_nil }
29
+ pending 'should not support performance as block' do
30
+ b.goto 'google.com'
31
+ b.with_performance { |performance| expect(performance).not_to be_nil }
27
32
  end
28
33
  end
29
34
  end
@@ -1,15 +1,41 @@
1
- uname = `uname -s`.chomp
2
- browsers = %i[chrome firefox]
3
- if %w[MINGW CYGWIN].include? uname
4
- browsers << %i[edge internet_explorer]
5
- end
1
+ browsers = if ENV['SAUCELABS'] == 'true'
2
+ %i[edge internet_explorer]
3
+ else
4
+ %i[chrome firefox]
5
+ end
6
6
 
7
7
  browsers.each do |browser|
8
8
  describe "WatirPerformance-#{browser.upcase}" do
9
9
  let!(:b) { @b }
10
10
 
11
11
  before(:all) do
12
- @b ||= Watir::Browser.new browser
12
+ opt = case browser
13
+ when :chrome
14
+ Selenium::WebDriver::Chrome::Options.new(args: %w[no-sandbox
15
+ headless
16
+ disable-gpu])
17
+ when :firefox
18
+ Selenium::WebDriver::Firefox::Options.new(args: %w[no-sandbox
19
+ headless
20
+ disable-gpu])
21
+ when :edge
22
+ Selenium::WebDriver::Remote::Capabilities.edge
23
+ opt['platform'] = 'Windows 10'
24
+ opt['version'] = '17.17134'
25
+ opt['build'] = ENV['TRAVIS_JOB_NUMBER']
26
+ when :internet_explorer
27
+ Selenium::WebDriver::Remote::Capabilities.internet_explorer(
28
+ platform: 'Windows 10', version: '11.103',
29
+ device: 'Desktop', build: ENV['TRAVIS_JOB_NUMBER']
30
+ )
31
+ end
32
+
33
+ @b ||= if ENV['SAUCELABS'] == 'true'
34
+ test_url = "http://#{ENV['SAUCE_USERNAME']}:#{ENV['SAUCE_ACCESS_KEY']}@ondemand.saucelabs.com/wd/hub"
35
+ Watir::Browser.new(browser, url: test_url, options: opt)
36
+ else
37
+ Watir::Browser.new(browser, options: opt)
38
+ end
13
39
  end
14
40
 
15
41
  after(:all) do
@@ -24,28 +50,25 @@ browsers.each do |browser|
24
50
  it 'should get summary data from the performance metrics' do
25
51
  # Summary metrics based on Processing Model of NavigationTiming
26
52
  # http://w3c-test.org/webperf/specs/NavigationTiming/#processing-model
27
- expect(b.performance.summary).to include(:app_cache)
28
- expect(b.performance.summary).to include(:dns)
29
- expect(b.performance.summary).to include(:tcp_connection)
30
- expect(b.performance.summary).to include(:request)
31
- expect(b.performance.summary).to include(:response)
32
- expect(b.performance.summary).to include(:dom_processing)
53
+ included = %i[app_cache dns tcp_connection request response dom_processing]
54
+ included.each { |item| expect(b.performance.summary).to include(item) }
33
55
  end
34
56
 
35
57
  it 'should get the summary metrics such as Response Time, TTLB and TTFB' do
36
- expect(b.performance.summary).to include(:time_to_first_byte) # aka "server time"
37
- expect(b.performance.summary).to include(:time_to_last_byte) # aka "network + server time"
38
- expect(b.performance.summary).to include(:response_time)
58
+ # time_to_first_byte aka "server time"
59
+ # time_to_last_byte aka "network + server time"
60
+ included = %i[time_to_first_byte time_to_last_byte response_time]
61
+ included.each { |item| expect(b.performance.summary).to include(item) }
39
62
  end
40
63
 
41
- it 'should return true for chrome supported' do
64
+ it 'should return true for supported' do
42
65
  b.goto 'google.com'
43
66
  expect(b).to be_performance_supported
44
67
  end
45
68
 
46
69
  it 'should support performance as block' do
47
70
  b.goto 'google.com'
48
- b.with_performance {|performance| expect(performance).not_to be_nil }
71
+ b.with_performance { |performance| expect(performance).not_to be_nil }
49
72
  end
50
73
  end
51
74
  end
@@ -2,17 +2,17 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: watir-performance 0.5.4 ruby lib
5
+ # stub: watir-performance 0.6.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "watir-performance".freeze
9
- s.version = "0.5.4"
9
+ s.version = "0.6.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new("~> 2.7".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Robert MacCracken".freeze, "Tim Koopmans".freeze]
14
- s.date = "2018-05-07"
15
- s.description = "This gem collects and summarises metrics speficied in the W3C Navigation web performance specifications at http://w3c-test.org/webperf/specs/NavigationTiming/ when using watir-webdriver and a compatible browser".freeze
14
+ s.date = "2018-05-08"
15
+ s.description = "This gem collects and summarises metrics speficied in the W3C Navigation web performance specifications at http://w3c-test.org/webperf/specs/NavigationTiming/ when using watir and a compatible browser".freeze
16
16
  s.email = ["robert.maccracken@gmail.com".freeze, "tim.koops@gmail.com".freeze]
17
17
  s.extra_rdoc_files = [
18
18
  "LICENSE.txt",
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
20
20
  ]
21
21
  s.files = [
22
22
  ".document",
23
+ ".gitlab-ci.yml",
23
24
  ".rspec",
24
25
  ".travis.yml",
25
26
  "Gemfile",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watir-performance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert MacCracken
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-05-07 00:00:00.000000000 Z
12
+ date: 2018-05-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: watir
@@ -111,7 +111,7 @@ dependencies:
111
111
  version: '5.2'
112
112
  description: This gem collects and summarises metrics speficied in the W3C Navigation
113
113
  web performance specifications at http://w3c-test.org/webperf/specs/NavigationTiming/
114
- when using watir-webdriver and a compatible browser
114
+ when using watir and a compatible browser
115
115
  email:
116
116
  - robert.maccracken@gmail.com
117
117
  - tim.koops@gmail.com
@@ -122,6 +122,7 @@ extra_rdoc_files:
122
122
  - README.rdoc
123
123
  files:
124
124
  - ".document"
125
+ - ".gitlab-ci.yml"
125
126
  - ".rspec"
126
127
  - ".travis.yml"
127
128
  - Gemfile