mediawiki_selenium 1.7.4 → 1.8.0
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +7 -0
- data/RELEASES.md +18 -0
- data/lib/mediawiki_selenium.rb +0 -1
- data/lib/mediawiki_selenium/browser_factory/base.rb +1 -1
- data/lib/mediawiki_selenium/cucumber/env.rb +1 -1
- data/lib/mediawiki_selenium/cucumber/hooks.rb +0 -10
- data/lib/mediawiki_selenium/environment.rb +1 -1
- data/lib/mediawiki_selenium/pages/login_page.rb +4 -4
- data/lib/mediawiki_selenium/version.rb +1 -1
- data/mediawiki_selenium.gemspec +4 -8
- data/spec/environment_spec.rb +2 -2
- metadata +21 -25
- data/lib/mediawiki_selenium/raita.rb +0 -46
- data/lib/mediawiki_selenium/raita/formatter.rb +0 -21
- data/lib/mediawiki_selenium/raita/logger.rb +0 -122
- data/lib/mediawiki_selenium/raita/null_io.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6db797531ecca1447bef8c4861e5a892ae293bb
|
4
|
+
data.tar.gz: fb6897ac2916f4b4a0b33d3846521847b4933a2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52c4cee07ec34da9a5cd4260dfcc65a36f8359b1cf94641042cde5a98e3e1556f637688101efe08e527e83b9bfb88b8c82ba60179c55f294f6e63aec97ce6faf
|
7
|
+
data.tar.gz: 981a816a15de98c3f22db7f254280fa5171a77aab0b3e5e29d28032e220d9e7425f30be1aa361cabdf60ce06acdec4a2ec1f909cdea533dd929b9b9f0c47e065
|
data/.rubocop.yml
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
AllCops:
|
2
|
+
DisplayCopNames: true
|
2
3
|
StyleGuideCopsOnly: true
|
3
4
|
Exclude:
|
4
5
|
- 'vendor/**/*'
|
@@ -22,6 +23,12 @@ Style/DotPosition:
|
|
22
23
|
Style/FileName:
|
23
24
|
Exclude: ['bin/*']
|
24
25
|
|
26
|
+
Style/GuardClause:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
Style/MultilineIfModifier:
|
30
|
+
Enabled: false
|
31
|
+
|
25
32
|
Style/SignalException:
|
26
33
|
Enabled: false
|
27
34
|
|
data/RELEASES.md
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
## Release notes
|
2
2
|
|
3
|
+
### 1.8.0 2017-02-27
|
4
|
+
* Remove raita entirely
|
5
|
+
* Major updates in dependencies:
|
6
|
+
* page-object updated to version 2
|
7
|
+
* Watir updated to version 6
|
8
|
+
* Selenium updated to version 3
|
9
|
+
* Major changes caused by upgrade to Selenium 3:
|
10
|
+
* default browser is Chrome, instead of Firefox
|
11
|
+
* geckodriver needs to be installed when driving Firefox
|
12
|
+
* For more information about upstream changes:
|
13
|
+
* Selenium:
|
14
|
+
* Blog: https://seleniumhq.wordpress.com/
|
15
|
+
* Release notes: https://github.com/SeleniumHQ/selenium/blob/master/rb/CHANGES
|
16
|
+
* Watir:
|
17
|
+
* Blog: http://watir.github.io/blog/
|
18
|
+
* Release notes: https://github.com/watir/watir/blob/master/CHANGES.md
|
19
|
+
* page-object release notes: https://github.com/cheezy/page-object/blob/master/ChangeLog
|
20
|
+
|
3
21
|
### 1.7.4 2016-12-28
|
4
22
|
|
5
23
|
* Update JSON gem to version 2
|
data/lib/mediawiki_selenium.rb
CHANGED
@@ -9,7 +9,6 @@ module MediawikiSelenium
|
|
9
9
|
autoload :Initializer, 'mediawiki_selenium/initializer'
|
10
10
|
autoload :LoginHelper, 'mediawiki_selenium/helpers/login_helper'
|
11
11
|
autoload :PageFactory, 'mediawiki_selenium/page_factory'
|
12
|
-
autoload :Raita, 'mediawiki_selenium/raita'
|
13
12
|
autoload :RakeTask, 'mediawiki_selenium/rake_task'
|
14
13
|
autoload :RemoteBrowserFactory, 'mediawiki_selenium/remote_browser_factory'
|
15
14
|
autoload :ScreenshotHelper, 'mediawiki_selenium/helpers/screenshot_helper'
|
@@ -8,16 +8,6 @@ AfterConfiguration do |config|
|
|
8
8
|
# Install a formatter that can be used to show feature-related warnings
|
9
9
|
pretty_format, io = config.formats.find { |(format, _io)| format == 'pretty' }
|
10
10
|
config.formats << ['MediawikiSelenium::WarningsFormatter', io] if pretty_format
|
11
|
-
|
12
|
-
# Set up Raita logging if RAITA_DB_URL is set. Include any useful
|
13
|
-
# environment variables that Jenkins would have set.
|
14
|
-
env = MediawikiSelenium::Environment.load_default
|
15
|
-
raita_url = env.lookup(:raita_url, default: nil)
|
16
|
-
|
17
|
-
if raita_url
|
18
|
-
raita_build = MediawikiSelenium::Raita.build_from(env)
|
19
|
-
config.formats << ['MediawikiSelenium::Raita::Logger', { url: raita_url, build: raita_build }]
|
20
|
-
end
|
21
11
|
end
|
22
12
|
|
23
13
|
# Determine scenario name and setup the environment
|
@@ -19,9 +19,9 @@ class LoginPage
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def login_with(username, password, wait_for_logout_element = true)
|
22
|
-
username_element.
|
23
|
-
password_element.
|
24
|
-
login_element.
|
25
|
-
logout_element
|
22
|
+
username_element.send_keys(username)
|
23
|
+
password_element.send_keys(password)
|
24
|
+
login_element.click
|
25
|
+
logout_element if wait_for_logout_element
|
26
26
|
end
|
27
27
|
end
|
data/mediawiki_selenium.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.homepage = 'https://gerrit.wikimedia.org/r/#/admin/projects/mediawiki/selenium'
|
22
22
|
spec.license = 'GPL-2'
|
23
23
|
|
24
|
-
spec.bindir
|
24
|
+
spec.bindir = 'bin'
|
25
25
|
spec.executables << 'mediawiki-selenium-init'
|
26
26
|
|
27
27
|
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
@@ -31,15 +31,11 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_runtime_dependency 'headless', '~> 2.0', '>= 2.1.0'
|
32
32
|
spec.add_runtime_dependency 'json', '~> 2.0', '>= 2.0.2'
|
33
33
|
spec.add_runtime_dependency 'mediawiki_api', '~> 0.7', '>= 0.7.0'
|
34
|
-
spec.add_runtime_dependency 'page-object', '~>
|
35
|
-
|
36
|
-
# selenium-webdriver 3.0.0 always want the 'geckodriver' to be available even
|
37
|
-
# with Firefox 46 can be driven without it. T149319
|
38
|
-
spec.add_runtime_dependency 'selenium-webdriver', '< 3'
|
39
|
-
|
34
|
+
spec.add_runtime_dependency 'page-object', '~> 2.0'
|
40
35
|
spec.add_runtime_dependency 'rest-client', '~> 1.6', '>= 1.6.7'
|
41
36
|
spec.add_runtime_dependency 'rspec-core', '~> 2.14', '>= 2.14.4'
|
42
37
|
spec.add_runtime_dependency 'rspec-expectations', '~> 2.14', '>= 2.14.4'
|
38
|
+
spec.add_runtime_dependency 'selenium-webdriver', '~> 3.1.0'
|
43
39
|
spec.add_runtime_dependency 'syntax', '~> 1.2', '>= 1.2.0'
|
44
40
|
spec.add_runtime_dependency 'thor', '~> 0.19', '>= 0.19.1'
|
45
41
|
|
@@ -47,6 +43,6 @@ Gem::Specification.new do |spec|
|
|
47
43
|
spec.add_development_dependency 'bundler', '~> 1.6', '>= 1.6.3'
|
48
44
|
spec.add_development_dependency 'yard', '~> 0.8', '>= 0.8.7.4'
|
49
45
|
spec.add_development_dependency 'redcarpet', '~> 3.2', '>= 3.2.0'
|
50
|
-
spec.add_development_dependency 'rubocop', '~> 0.
|
46
|
+
spec.add_development_dependency 'rubocop', '~> 0.46.0'
|
51
47
|
spec.add_development_dependency 'rspec-mocks', '~> 2.14', '>= 2.14.4'
|
52
48
|
end
|
data/spec/environment_spec.rb
CHANGED
@@ -266,8 +266,8 @@ module MediawikiSelenium
|
|
266
266
|
context 'missing browser configuration' do
|
267
267
|
let(:browser) { nil }
|
268
268
|
|
269
|
-
it 'defaults to :
|
270
|
-
expect(subject).to be(:
|
269
|
+
it 'defaults to :chrome' do
|
270
|
+
expect(subject).to be(:chrome)
|
271
271
|
end
|
272
272
|
end
|
273
273
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mediawiki_selenium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris McMahon
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date:
|
16
|
+
date: 2017-02-27 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: cucumber
|
@@ -101,28 +101,14 @@ dependencies:
|
|
101
101
|
requirements:
|
102
102
|
- - "~>"
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version: '
|
104
|
+
version: '2.0'
|
105
105
|
type: :runtime
|
106
106
|
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
109
|
- - "~>"
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version: '
|
112
|
-
- !ruby/object:Gem::Dependency
|
113
|
-
name: selenium-webdriver
|
114
|
-
requirement: !ruby/object:Gem::Requirement
|
115
|
-
requirements:
|
116
|
-
- - "<"
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
version: '3'
|
119
|
-
type: :runtime
|
120
|
-
prerelease: false
|
121
|
-
version_requirements: !ruby/object:Gem::Requirement
|
122
|
-
requirements:
|
123
|
-
- - "<"
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '3'
|
111
|
+
version: '2.0'
|
126
112
|
- !ruby/object:Gem::Dependency
|
127
113
|
name: rest-client
|
128
114
|
requirement: !ruby/object:Gem::Requirement
|
@@ -183,6 +169,20 @@ dependencies:
|
|
183
169
|
- - ">="
|
184
170
|
- !ruby/object:Gem::Version
|
185
171
|
version: 2.14.4
|
172
|
+
- !ruby/object:Gem::Dependency
|
173
|
+
name: selenium-webdriver
|
174
|
+
requirement: !ruby/object:Gem::Requirement
|
175
|
+
requirements:
|
176
|
+
- - "~>"
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: 3.1.0
|
179
|
+
type: :runtime
|
180
|
+
prerelease: false
|
181
|
+
version_requirements: !ruby/object:Gem::Requirement
|
182
|
+
requirements:
|
183
|
+
- - "~>"
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: 3.1.0
|
186
186
|
- !ruby/object:Gem::Dependency
|
187
187
|
name: syntax
|
188
188
|
requirement: !ruby/object:Gem::Requirement
|
@@ -303,14 +303,14 @@ dependencies:
|
|
303
303
|
requirements:
|
304
304
|
- - "~>"
|
305
305
|
- !ruby/object:Gem::Version
|
306
|
-
version: 0.
|
306
|
+
version: 0.46.0
|
307
307
|
type: :development
|
308
308
|
prerelease: false
|
309
309
|
version_requirements: !ruby/object:Gem::Requirement
|
310
310
|
requirements:
|
311
311
|
- - "~>"
|
312
312
|
- !ruby/object:Gem::Version
|
313
|
-
version: 0.
|
313
|
+
version: 0.46.0
|
314
314
|
- !ruby/object:Gem::Dependency
|
315
315
|
name: rspec-mocks
|
316
316
|
requirement: !ruby/object:Gem::Requirement
|
@@ -406,10 +406,6 @@ files:
|
|
406
406
|
- lib/mediawiki_selenium/pages/login_page.rb
|
407
407
|
- lib/mediawiki_selenium/pages/random_page.rb
|
408
408
|
- lib/mediawiki_selenium/pages/reset_preferences_page.rb
|
409
|
-
- lib/mediawiki_selenium/raita.rb
|
410
|
-
- lib/mediawiki_selenium/raita/formatter.rb
|
411
|
-
- lib/mediawiki_selenium/raita/logger.rb
|
412
|
-
- lib/mediawiki_selenium/raita/null_io.rb
|
413
409
|
- lib/mediawiki_selenium/rake_task.rb
|
414
410
|
- lib/mediawiki_selenium/remote_browser_factory.rb
|
415
411
|
- lib/mediawiki_selenium/rspec.rb
|
@@ -461,7 +457,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
461
457
|
version: '0'
|
462
458
|
requirements: []
|
463
459
|
rubyforge_project:
|
464
|
-
rubygems_version: 2.6.
|
460
|
+
rubygems_version: 2.6.10
|
465
461
|
signing_key:
|
466
462
|
specification_version: 4
|
467
463
|
summary: An easy way to run MediaWiki Selenium tests.
|
@@ -1,46 +0,0 @@
|
|
1
|
-
module MediawikiSelenium
|
2
|
-
# Supports logging to a Raita Elasticsearch index. Raita is a dashboard for
|
3
|
-
# visualizing and taking action on the results of Cucumber tests.
|
4
|
-
#
|
5
|
-
module Raita
|
6
|
-
# Mapping of environment configuration/variables to Raita build fields.
|
7
|
-
#
|
8
|
-
ENV_TO_BUILD_MAPPING = {
|
9
|
-
build_number: :number,
|
10
|
-
build_url: :url,
|
11
|
-
job_name: [:project, :name],
|
12
|
-
git_commit: [:project, :commit],
|
13
|
-
git_branch: [:project, :branch],
|
14
|
-
git_url: [:project, :repo],
|
15
|
-
mediawiki_environment: [:environment, :name],
|
16
|
-
mediawiki_url: [:environment, :url],
|
17
|
-
browser: [:browser, :name],
|
18
|
-
version: [:browser, :version],
|
19
|
-
platform: [:browser, :platform]
|
20
|
-
}
|
21
|
-
|
22
|
-
autoload :Formatter, 'mediawiki_selenium/raita/formatter'
|
23
|
-
autoload :Logger, 'mediawiki_selenium/raita/logger'
|
24
|
-
autoload :NullIO, 'mediawiki_selenium/raita/null_io'
|
25
|
-
|
26
|
-
# Returns a hash of relevant build information from the given {Environment}.
|
27
|
-
#
|
28
|
-
# @param env {Environment}
|
29
|
-
#
|
30
|
-
# @return {Hash} Raita build object.
|
31
|
-
#
|
32
|
-
def self.build_from(env)
|
33
|
-
ENV_TO_BUILD_MAPPING.each.with_object({}) do |(from, to), build|
|
34
|
-
value = env.lookup(from, default: nil)
|
35
|
-
|
36
|
-
case to
|
37
|
-
when Array
|
38
|
-
build[to.first] ||= {}
|
39
|
-
build[to.first][to.last] = value
|
40
|
-
else
|
41
|
-
build[to] = value
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'gherkin/formatter/json_formatter'
|
2
|
-
|
3
|
-
module MediawikiSelenium
|
4
|
-
module Raita
|
5
|
-
class Formatter < Gherkin::Formatter::JSONFormatter
|
6
|
-
attr_reader :feature_hashes
|
7
|
-
|
8
|
-
def initialize
|
9
|
-
super(NullIO.new)
|
10
|
-
end
|
11
|
-
|
12
|
-
# Allows for simple embeddings without base64 encoding.
|
13
|
-
#
|
14
|
-
def embedding(mime_type, data)
|
15
|
-
return unless mime_type.start_with?('text/')
|
16
|
-
|
17
|
-
embeddings << { 'mime_type' => mime_type, 'data' => data }
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,122 +0,0 @@
|
|
1
|
-
require 'cucumber/formatter/gherkin_formatter_adapter'
|
2
|
-
require 'net/http'
|
3
|
-
|
4
|
-
module MediawikiSelenium
|
5
|
-
module Raita
|
6
|
-
class Logger < Cucumber::Formatter::GherkinFormatterAdapter
|
7
|
-
def initialize(_runtime, raita_options, options)
|
8
|
-
# Force expanded output of outlines. Note this will effect other
|
9
|
-
# formatters as well, but it's the only way to get a consistent JSON
|
10
|
-
# representation of feature elements with result status and duration.
|
11
|
-
#
|
12
|
-
# @see https://github.com/cucumber/gherkin/issues/165
|
13
|
-
options[:expand] = true
|
14
|
-
|
15
|
-
super(Formatter.new, false, options)
|
16
|
-
|
17
|
-
@db_url = URI.parse(raita_options[:url])
|
18
|
-
@build = raita_options[:build].merge(result: { status: 'passed', duration: 0 })
|
19
|
-
end
|
20
|
-
|
21
|
-
# Log everything at once to Raita's Elasticsearch DB.
|
22
|
-
#
|
23
|
-
def after_features(*)
|
24
|
-
@build_id = create('build', @build)['_id']
|
25
|
-
|
26
|
-
@gf.feature_hashes.each do |feature|
|
27
|
-
amend_feature(feature)
|
28
|
-
elements = feature.delete('elements')
|
29
|
-
|
30
|
-
feature_id = create('feature', feature, @build_id)['_id']
|
31
|
-
bulk('feature-element', elements, feature_id)
|
32
|
-
|
33
|
-
@build[:result][:status] = change_status(
|
34
|
-
@build[:result][:status],
|
35
|
-
feature['result']['status']
|
36
|
-
)
|
37
|
-
@build[:result][:duration] += feature['result']['duration']
|
38
|
-
end
|
39
|
-
|
40
|
-
update('build', @build_id, @build)
|
41
|
-
end
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
|
-
# Add status and duration at the feature and background/scenario level.
|
46
|
-
#
|
47
|
-
# @param feature {Hash}
|
48
|
-
#
|
49
|
-
def amend_feature(feature)
|
50
|
-
feature['result'] = { 'duration' => 0, 'status' => 'passed' }
|
51
|
-
|
52
|
-
feature['elements'].each do |element|
|
53
|
-
element['result'] = { 'duration' => 0, 'status' => 'passed' }
|
54
|
-
|
55
|
-
element['steps'].each do |step|
|
56
|
-
feature['result']['duration'] += step['result']['duration']
|
57
|
-
element['result']['duration'] += step['result']['duration']
|
58
|
-
|
59
|
-
element['result']['status'] = change_status(
|
60
|
-
element['result']['status'],
|
61
|
-
step['result']['status']
|
62
|
-
)
|
63
|
-
end
|
64
|
-
|
65
|
-
feature['result']['status'] = change_status(
|
66
|
-
feature['result']['status'],
|
67
|
-
element['result']['status']
|
68
|
-
)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
# Calculates a new status given the current parent status and the next
|
73
|
-
# child status. A status can go from 'passed' to anything, 'skipped' to
|
74
|
-
# 'failed'.
|
75
|
-
#
|
76
|
-
def change_status(cur, new)
|
77
|
-
case cur.to_s
|
78
|
-
when 'passed'
|
79
|
-
new
|
80
|
-
when 'skipped'
|
81
|
-
new == 'failed' ? new : cur
|
82
|
-
else
|
83
|
-
cur
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
def bulk(type, objects, parent = nil)
|
88
|
-
data = objects.reduce('') do |d, obj|
|
89
|
-
d << JSON.dump({ create: { _type: type, _parent: parent, _routing: @build_id } }) + "\n"
|
90
|
-
d << JSON.dump(obj) + "\n\n"
|
91
|
-
end
|
92
|
-
|
93
|
-
request(Net::HTTP::Post, ['_bulk'], data)
|
94
|
-
end
|
95
|
-
|
96
|
-
def create(type, object, parent = nil)
|
97
|
-
request(Net::HTTP::Post, [type], object, parent: parent, routing: @build_id)
|
98
|
-
end
|
99
|
-
|
100
|
-
def request(klass, paths, data, query = {})
|
101
|
-
query = query.reject { |_, v| v.nil? }
|
102
|
-
|
103
|
-
uri = @db_url.clone
|
104
|
-
uri.path = Pathname.new(uri.path).join(*paths.map(&:to_s)).to_s
|
105
|
-
uri.query = query.map { |pair| pair.join('=') unless pair.last.nil? }.compact.join('&')
|
106
|
-
|
107
|
-
data = JSON.dump(data) unless data.is_a?(String)
|
108
|
-
response = db.request(klass.new(uri), data)
|
109
|
-
|
110
|
-
JSON.parse(response.body)
|
111
|
-
end
|
112
|
-
|
113
|
-
def update(type, id, object)
|
114
|
-
request(Net::HTTP::Put, [type, id], object)
|
115
|
-
end
|
116
|
-
|
117
|
-
def db
|
118
|
-
Net::HTTP.new(@db_url.host, @db_url.port)
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|