mediawiki_selenium 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -4
- data/UPGRADE.md +18 -1
- data/lib/mediawiki_selenium/browser_factory/base.rb +14 -2
- data/lib/mediawiki_selenium/support/pages.rb +0 -1
- data/lib/mediawiki_selenium/version.rb +1 -1
- data/spec/browser_factory/base_spec.rb +24 -0
- metadata +2 -3
- data/lib/mediawiki_selenium/support/pages/api_page.rb +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 726360dc3c099dde3ad6827c181be19adbfa5e54
|
4
|
+
data.tar.gz: f6e3f6a52f72b471183508046d9b59f48af103bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb1180596eb74635fa300f438453f691d69dcdc31cb880e01e1eaf863416c68f20f9291aaf294ddfd876f8a96eae6399361fcc35ddbbcdbbd9ea39c3d1d49ae2
|
7
|
+
data.tar.gz: 44e1fb0e9c836131336baf5015fa8875c48cd2b293b6db05aa832db1a5b9233370070d73b550bb9914992f50063d3fccd06f198fb8e239f52b0c2ae67a279f4c
|
data/README.md
CHANGED
@@ -37,7 +37,7 @@ Create a `Gemfile` in the root of your MediaWiki-related project that
|
|
37
37
|
specifies the version of `mediawiki_selenium` you wish to use (typically the
|
38
38
|
latest version).
|
39
39
|
|
40
|
-
gem 'mediawiki_selenium', '~> 1.
|
40
|
+
gem 'mediawiki_selenium', '~> 1.3.0'
|
41
41
|
|
42
42
|
Install the gem and its dependencies by running `bundle install`. (If
|
43
43
|
[Bundler](http://bundler.io/) is not yet installed, install it with
|
@@ -69,7 +69,7 @@ for local development, or against at least the [Beta Cluster](http://www.mediawi
|
|
69
69
|
for continuous integration.
|
70
70
|
|
71
71
|
For details on how environment configuration is loaded and used by step
|
72
|
-
definitions, see the documentation for
|
72
|
+
definitions, see the documentation for {MediawikiSelenium::Environment}.
|
73
73
|
|
74
74
|
## Writing Tests
|
75
75
|
|
@@ -79,8 +79,8 @@ you'll find some helpful [high-level documentation](http://www.mediawiki.org/wik
|
|
79
79
|
to get you started.
|
80
80
|
|
81
81
|
To see exactly which methods are available from within step definitions, see
|
82
|
-
the documentation for
|
83
|
-
|
82
|
+
the documentation for {MediawikiSelenium::Environment},
|
83
|
+
{MediawikiSelenium::ApiHelper}, and {MediawikiSelenium::PageFactory}.
|
84
84
|
|
85
85
|
## Running Tests
|
86
86
|
|
@@ -199,6 +199,11 @@ See https://www.mediawiki.org/wiki/Gerrit
|
|
199
199
|
|
200
200
|
## Release notes
|
201
201
|
|
202
|
+
### 1.3.0 2015-06-10
|
203
|
+
* Added {Mediawiki::Environment#override} for overriding environment
|
204
|
+
configuration at runtime
|
205
|
+
* Removed deprecated `APIPage` page object and updated upgrade docs
|
206
|
+
|
202
207
|
### 1.2.1 2015-06-02
|
203
208
|
* Fixed issue with inconsistent JSON output in Raita logger when using
|
204
209
|
scenario outlines
|
data/UPGRADE.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
First, update the `Gemfile` in your project's root directory to specify the
|
6
6
|
new version.
|
7
7
|
|
8
|
-
gem 'mediawiki_selenium', '~> 1.
|
8
|
+
gem 'mediawiki_selenium', '~> 1.3.0'
|
9
9
|
|
10
10
|
## Upgrade gems and dependencies
|
11
11
|
|
@@ -113,3 +113,20 @@ Would be changed to:
|
|
113
113
|
When(/^I am viewing Topic page$/) do
|
114
114
|
on(FlowPage).wait_until { browser.url =~ /Topic/ }
|
115
115
|
end
|
116
|
+
|
117
|
+
## Refactor use of deprecated `APIPage`
|
118
|
+
|
119
|
+
API requests should be made directly using {MediawikiSelenium::ApiHelper#api}
|
120
|
+
which returns an instance of [MediawikiApi::Client](https://doc.wikimedia.org/rubygems/mediawiki-ruby-api/).
|
121
|
+
|
122
|
+
For example:
|
123
|
+
|
124
|
+
Given(/^the "(.*)" article contains "(.*)"$/) do |title, text|
|
125
|
+
on(APIPage).create(title, text)
|
126
|
+
end
|
127
|
+
|
128
|
+
Would be changed to:
|
129
|
+
|
130
|
+
Given(/^the "(.*)" article contains "(.*)"$/) do |title, text|
|
131
|
+
api.create_page(title, text)
|
132
|
+
end
|
@@ -71,6 +71,7 @@ module MediawikiSelenium
|
|
71
71
|
@browser_name = browser_name
|
72
72
|
@bindings = {}
|
73
73
|
@browser_cache = {}
|
74
|
+
@overrides = {}
|
74
75
|
end
|
75
76
|
|
76
77
|
# Returns a unique set of all the binding keys.
|
@@ -146,6 +147,8 @@ module MediawikiSelenium
|
|
146
147
|
# @return [Hash]
|
147
148
|
#
|
148
149
|
def browser_options(config)
|
150
|
+
config = config.merge(@overrides)
|
151
|
+
|
149
152
|
options = default_browser_options.tap do |default_options|
|
150
153
|
bindings.each do |(names, bindings_for_option)|
|
151
154
|
bindings_for_option.each do |binding|
|
@@ -183,10 +186,19 @@ module MediawikiSelenium
|
|
183
186
|
new_browser(browser_options(config))
|
184
187
|
end
|
185
188
|
|
189
|
+
# Always use the given configuration when setting up a new browser,
|
190
|
+
# regardless of what has been previously configured.
|
191
|
+
#
|
192
|
+
# @param config [Hash] Configuration overrides.
|
193
|
+
#
|
194
|
+
def override(config)
|
195
|
+
@overrides.merge!(config)
|
196
|
+
end
|
197
|
+
|
186
198
|
# Executes additional teardown tasks.
|
187
199
|
#
|
188
|
-
# @param
|
189
|
-
# @param
|
200
|
+
# @param _env [Environment] Environment.
|
201
|
+
# @param _status [Symbol] Status of the executed scenario.
|
190
202
|
#
|
191
203
|
def teardown(_env, _status)
|
192
204
|
# abstract
|
@@ -211,5 +211,29 @@ module MediawikiSelenium::BrowserFactory
|
|
211
211
|
end
|
212
212
|
end
|
213
213
|
end
|
214
|
+
|
215
|
+
describe '#override' do
|
216
|
+
subject { factory.override(overrides) }
|
217
|
+
|
218
|
+
before do
|
219
|
+
allow(Selenium::WebDriver::Remote::Capabilities).to receive(browser_name)
|
220
|
+
end
|
221
|
+
|
222
|
+
it 'always uses the given configuration when setting up a new browser' do
|
223
|
+
# Set up a binding that will accept :foo configuration
|
224
|
+
@foo = nil
|
225
|
+
factory.configure(:foo) { |foo| @foo = foo }
|
226
|
+
|
227
|
+
# Override with config { foo: 'y' }
|
228
|
+
factory.override(foo: 'y')
|
229
|
+
|
230
|
+
# Invoke the binding with `browser_options` and config { foo: 'x' }
|
231
|
+
factory.browser_options(foo: 'x')
|
232
|
+
|
233
|
+
# The configuration hook should have been invoked with the overriden
|
234
|
+
# value
|
235
|
+
expect(@foo).to eq('y')
|
236
|
+
end
|
237
|
+
end
|
214
238
|
end
|
215
239
|
end
|
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.3.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: 2015-06-
|
16
|
+
date: 2015-06-11 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: cucumber
|
@@ -357,7 +357,6 @@ files:
|
|
357
357
|
- lib/mediawiki_selenium/support/modules/api_helper.rb
|
358
358
|
- lib/mediawiki_selenium/support/modules/strict_pending.rb
|
359
359
|
- lib/mediawiki_selenium/support/pages.rb
|
360
|
-
- lib/mediawiki_selenium/support/pages/api_page.rb
|
361
360
|
- lib/mediawiki_selenium/support/pages/login_page.rb
|
362
361
|
- lib/mediawiki_selenium/support/pages/random_page.rb
|
363
362
|
- lib/mediawiki_selenium/support/pages/reset_preferences_page.rb
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'page-object'
|
2
|
-
require 'mediawiki_api'
|
3
|
-
|
4
|
-
class APIPage
|
5
|
-
include PageObject
|
6
|
-
|
7
|
-
def client
|
8
|
-
return @client if defined?(@client)
|
9
|
-
|
10
|
-
unless ENV['MEDIAWIKI_API_URL']
|
11
|
-
raise 'Environment variable MEDIAWIKI_API_URL must be set in order to use the API'
|
12
|
-
end
|
13
|
-
|
14
|
-
@client = MediawikiApi::Client.new(ENV['MEDIAWIKI_API_URL'])
|
15
|
-
@client.log_in ENV['MEDIAWIKI_USER'], ENV['MEDIAWIKI_PASSWORD']
|
16
|
-
|
17
|
-
@client
|
18
|
-
end
|
19
|
-
|
20
|
-
def create(title, content)
|
21
|
-
client.create_page title, content
|
22
|
-
end
|
23
|
-
|
24
|
-
def protect(title, reason)
|
25
|
-
client.protect_page title, reason
|
26
|
-
end
|
27
|
-
end
|