mediawiki_selenium 1.0.1 → 1.0.2
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/.yardopts +3 -0
- data/README.md +29 -10
- data/lib/mediawiki_selenium/environment.rb +12 -3
- data/lib/mediawiki_selenium/page_factory.rb +1 -2
- data/lib/mediawiki_selenium/version.rb +1 -1
- data/spec/environment_spec.rb +8 -0
- data/spec/page_factory_spec.rb +19 -0
- data/templates/tests/browser/environments.yml +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67af225480dde4d5ac5bacbe01d631d2334859ec
|
4
|
+
data.tar.gz: 28454c89b3d8f8550953e18fe9b7762a0333d669
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbcef005071dba80b554fc05c2a61a9fb20a1fb00cafd576fb9cacfb6debe2aae41caf3d571983a1b367c7f693d640998507d3d786051e34e0854f2e032498db
|
7
|
+
data.tar.gz: a98d7297808c1d75ec7ee16c46d7763e14609e9ce6d43f1298ba641452dd536e5612322b925a2dc7fc6388313334a71302fc86a89da7197534175f957d8fb27d
|
data/.yardopts
CHANGED
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.0.
|
40
|
+
gem 'mediawiki_selenium', '~> 1.0.2'
|
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
|
@@ -97,16 +97,30 @@ To run a single scenario, give the line number as well.
|
|
97
97
|
|
98
98
|
bundle exec cucumber feature/some.feature:11
|
99
99
|
|
100
|
-
The set of default configuration to use (see "Getting started")
|
101
|
-
by the `MEDIAWIKI_ENVIRONMENT` environment variable,
|
102
|
-
somewhere in your shell profile.
|
103
|
-
|
104
|
-
development and executing tests on the host OS, the environment name would be
|
105
|
-
`mw-vagrant-host`.
|
100
|
+
The set of default configuration to use (see "Getting started") can be
|
101
|
+
specified by the `MEDIAWIKI_ENVIRONMENT` environment variable, defined
|
102
|
+
somewhere in your shell profile. If no value is set, an entry called `default`
|
103
|
+
is loaded.
|
106
104
|
|
107
|
-
|
108
|
-
|
109
|
-
|
105
|
+
For example, if your `environments.yml` file looked something like this.
|
106
|
+
|
107
|
+
mw-vagrant-host: &default
|
108
|
+
mediawiki_url: http://127.0.0.1:8080/wiki/
|
109
|
+
# ...
|
110
|
+
|
111
|
+
mw-vagrant-guest:
|
112
|
+
mediawiki_url: http://127.0.0.1/wiki/
|
113
|
+
# ...
|
114
|
+
|
115
|
+
beta:
|
116
|
+
mediawiki_url: http://en.wikipedia.beta.wmflabs.org/wiki/
|
117
|
+
# ...
|
118
|
+
|
119
|
+
default: *default
|
120
|
+
|
121
|
+
Defining `MEDIAWIKI_ENVIRONMENT=beta` in your shell would tell MW-Selenium to
|
122
|
+
use the configuration for `beta` above. Leaving it unset would use the entry
|
123
|
+
called `default` which in this case points to `mw-vagrant-host`.
|
110
124
|
|
111
125
|
Firefox is the default browser, but you can specify a different one by setting
|
112
126
|
`BROWSER`.
|
@@ -185,6 +199,11 @@ See https://www.mediawiki.org/wiki/Gerrit
|
|
185
199
|
|
186
200
|
## Release notes
|
187
201
|
|
202
|
+
### 1.0.2 2015-03-26
|
203
|
+
* Fixed double yield bug in `PageFactory#on`
|
204
|
+
* Implemented loading of a `default` configuration from `environments.yml`
|
205
|
+
* Improved readme with configuration examples
|
206
|
+
|
188
207
|
### 1.0.1 2015-03-05
|
189
208
|
* Fixed regex pattern in shared "I am logged in" step
|
190
209
|
|
@@ -19,8 +19,17 @@ module MediawikiSelenium
|
|
19
19
|
# mediawiki_user: Selenium_user
|
20
20
|
#
|
21
21
|
# Which default set to use is determined by the value of the
|
22
|
-
# `MEDIAWIKI_ENVIRONMENT` environment variable
|
23
|
-
# {load_default}.)
|
22
|
+
# `MEDIAWIKI_ENVIRONMENT` environment variable, or an entry called "default"
|
23
|
+
# if none is set. (See {load} and {load_default}.) The easiest way to
|
24
|
+
# designate such a default set is to use a YAML anchor like so.
|
25
|
+
#
|
26
|
+
# beta: &default
|
27
|
+
# mediawiki_url: http://en.wikipedia.beta.wmflabs.org/wiki/
|
28
|
+
# mediawiki_user: Selenium_user
|
29
|
+
# test2:
|
30
|
+
# mediawiki_url: http://test2.wikipedia.org/wiki/
|
31
|
+
# mediawiki_user: Selenium_user
|
32
|
+
# default: *default
|
24
33
|
#
|
25
34
|
# Any additional configuration specified via environment variables overrides
|
26
35
|
# what is specified in the YAML file. For example, the following would use
|
@@ -85,7 +94,7 @@ module MediawikiSelenium
|
|
85
94
|
# @see load
|
86
95
|
#
|
87
96
|
def load_default
|
88
|
-
load(ENV['MEDIAWIKI_ENVIRONMENT'], ENV)
|
97
|
+
load(ENV['MEDIAWIKI_ENVIRONMENT'] || 'default', ENV)
|
89
98
|
end
|
90
99
|
end
|
91
100
|
|
@@ -16,7 +16,7 @@ module MediawikiSelenium
|
|
16
16
|
def on_page(page_class, params = { using_params: {} }, visit = false)
|
17
17
|
@browser = browser if visit
|
18
18
|
|
19
|
-
super(page_class, params, false)
|
19
|
+
super(page_class, params, false) do |page|
|
20
20
|
if page.respond_to?(:goto)
|
21
21
|
wiki_url = method(:wiki_url)
|
22
22
|
|
@@ -33,6 +33,5 @@ module MediawikiSelenium
|
|
33
33
|
|
34
34
|
# @see #on_page
|
35
35
|
alias on on_page
|
36
|
-
|
37
36
|
end
|
38
37
|
end
|
data/spec/environment_spec.rb
CHANGED
@@ -69,6 +69,14 @@ module MediawikiSelenium
|
|
69
69
|
expect(Environment).to receive(:load).with('foo', ENV)
|
70
70
|
subject
|
71
71
|
end
|
72
|
+
|
73
|
+
context 'where MEDIAWIKI_ENVIRONMENT is not defined' do
|
74
|
+
it 'looks for a "default" environment' do
|
75
|
+
expect(ENV).to receive(:[]).with('MEDIAWIKI_ENVIRONMENT').and_return(nil)
|
76
|
+
expect(Environment).to receive(:load).with('default', ENV)
|
77
|
+
subject
|
78
|
+
end
|
79
|
+
end
|
72
80
|
end
|
73
81
|
|
74
82
|
describe '#==' do
|
data/spec/page_factory_spec.rb
CHANGED
@@ -12,8 +12,27 @@ module MediawikiSelenium
|
|
12
12
|
describe '#on_page' do
|
13
13
|
subject { env.on_page(page_class, { using_params: {} }, visit) }
|
14
14
|
|
15
|
+
let(:page_class) { Class.new { include ::PageObject } }
|
16
|
+
let(:visit) { false }
|
17
|
+
|
15
18
|
let(:browser) { double('Watir::Browser') }
|
16
19
|
|
20
|
+
it 'returns a new page object' do
|
21
|
+
page = double('PageObject')
|
22
|
+
expect(page_class).to receive(:new).and_return(page)
|
23
|
+
expect(subject).to be(page)
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'when given a block' do
|
27
|
+
it 'yields it only once with a new page object' do
|
28
|
+
page = double('PageObject')
|
29
|
+
allow(page_class).to receive(:new).and_return(page)
|
30
|
+
|
31
|
+
expect { |block| env.on_page(page_class, &block) }.to yield_control.once
|
32
|
+
expect { |block| env.on_page(page_class, &block) }.to yield_with_args(page)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
17
36
|
context 'when told to visit a page' do
|
18
37
|
let(:visit) { true }
|
19
38
|
let(:config) { { mediawiki_url: 'http://an.example/wiki/' } }
|
@@ -14,7 +14,7 @@
|
|
14
14
|
# export MEDIAWIKI_USER=Selenium_user2
|
15
15
|
# bundle exec cucumber
|
16
16
|
#
|
17
|
-
mw-vagrant-host:
|
17
|
+
mw-vagrant-host: &default
|
18
18
|
mediawiki_url: http://127.0.0.1:8080/wiki/
|
19
19
|
mediawiki_user: Selenium_user
|
20
20
|
mediawiki_password: vagrant
|
@@ -33,3 +33,5 @@ test2:
|
|
33
33
|
mediawiki_url: http://test2.wikipedia.org/wiki/
|
34
34
|
mediawiki_user: Selenium_user
|
35
35
|
# mediawiki_password: SET THIS IN THE ENVIRONMENT!
|
36
|
+
|
37
|
+
default: *default
|
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.0.
|
4
|
+
version: 1.0.2
|
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-03-
|
16
|
+
date: 2015-03-26 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: cucumber
|