mediawiki_selenium 1.0.0.pre.1 → 1.0.0.pre.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/README.md +5 -0
- data/UPGRADE.md +115 -0
- data/lib/mediawiki_selenium/step_definitions/login_steps.rb +4 -2
- data/lib/mediawiki_selenium/step_definitions/resource_loader_steps.rb +4 -2
- data/lib/mediawiki_selenium/step_definitions/upload_file_steps.rb +6 -6
- data/lib/mediawiki_selenium/support.rb +1 -0
- data/lib/mediawiki_selenium/support/pages/login_page.rb +0 -1
- data/lib/mediawiki_selenium/version.rb +1 -1
- data/templates/tests/browser/features/support/env.rb +1 -3
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 93a8424d3894106aa9575f18912096df4d6bda83
|
|
4
|
+
data.tar.gz: 226dbf63109a48e9ede7a3d2346a7356e697782b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 81739dccd7bedc37d73e438b4d58bf301580e5d0d6ae3d4fbb7d7da2221c92e3be1ddfd5d68a2461cbada9d999f078d0f0c65120ebf841708a97b54c3ac1a83a
|
|
7
|
+
data.tar.gz: dbcb5db3ae8620ed8ff25279440ea3f381e0cfd4f7b378c7b5c75069ba15c71a94f0bea73670db0b45f393e4980e358ca6903895fba3fd6de9696ca862886270
|
data/README.md
CHANGED
|
@@ -44,6 +44,11 @@ Install the gem and its dependencies by running `bundle install`. (If
|
|
|
44
44
|
`gem install bundler`, or `sudo gem install bundler` if you're using a
|
|
45
45
|
system wide Ruby.)
|
|
46
46
|
|
|
47
|
+
## Upgrading
|
|
48
|
+
|
|
49
|
+
Please read the included `UPGRADE.md` for documentation on how to upgrade from
|
|
50
|
+
one major release to another.
|
|
51
|
+
|
|
47
52
|
## Getting Started
|
|
48
53
|
|
|
49
54
|
Once the gem is installed, run `mediawiki-selenium-init` in your project's
|
data/UPGRADE.md
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Upgrading from pre-1.0 releases to 1.0.0 and above
|
|
2
|
+
|
|
3
|
+
## Update your `Gemfile`
|
|
4
|
+
|
|
5
|
+
First, update the `Gemfile` in your project's root directory to specify the
|
|
6
|
+
new version.
|
|
7
|
+
|
|
8
|
+
gem 'mediawiki_selenium', '~> 1.0.0.pre.2'
|
|
9
|
+
|
|
10
|
+
## Upgrade gems and dependencies
|
|
11
|
+
|
|
12
|
+
Now run `bundle install` to update your project's gem dependencies and
|
|
13
|
+
`Gemfile.lock`.
|
|
14
|
+
|
|
15
|
+
## Run the initialization script
|
|
16
|
+
|
|
17
|
+
Version 1.0 now includes an initialization script that can help with the setup
|
|
18
|
+
of new and existing test suites. Run the script in your project's root
|
|
19
|
+
directory via Bundler.
|
|
20
|
+
|
|
21
|
+
bundle exec mediawiki-selenium-init
|
|
22
|
+
|
|
23
|
+
Two important files will be created if they don't already exist. The first is
|
|
24
|
+
an `environments.yml` configuration file that describes the environments in
|
|
25
|
+
which you intend your test suite to run. For details on how it should be
|
|
26
|
+
configured, consult the "Getting Started" section of the `README`.
|
|
27
|
+
|
|
28
|
+
The second file, `tests/browser/features/support/env.rb`, is for bootstrapping
|
|
29
|
+
the Cucumber environment. Since you're working with an existing test suite,
|
|
30
|
+
you may run into a conflict here. Just make sure that your `env.rb` contains
|
|
31
|
+
the following before anything else.
|
|
32
|
+
|
|
33
|
+
require 'mediawiki_selenium'
|
|
34
|
+
require 'mediawiki_selenium/support'
|
|
35
|
+
require 'mediawiki_selenium/step_definitions'
|
|
36
|
+
|
|
37
|
+
## Convert page object URLs
|
|
38
|
+
|
|
39
|
+
Convert all page object URLs so that they're defined relative to the root of
|
|
40
|
+
any given wiki and no longer rely on the now deprecated `URL` module. In other
|
|
41
|
+
words, change page object classes like the following.
|
|
42
|
+
|
|
43
|
+
class MainPage
|
|
44
|
+
include PageObject
|
|
45
|
+
include URL
|
|
46
|
+
|
|
47
|
+
page_url URL.url('Main_Page')
|
|
48
|
+
|
|
49
|
+
# ...
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
To something like this.
|
|
53
|
+
|
|
54
|
+
class MainPage
|
|
55
|
+
include PageObject
|
|
56
|
+
|
|
57
|
+
page_url 'Main_Page'
|
|
58
|
+
|
|
59
|
+
# ...
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
## Refactor direct use of `ENV`
|
|
63
|
+
|
|
64
|
+
Change all references to `ENV` to use the appropriate `Environment` method.
|
|
65
|
+
|
|
66
|
+
For example, change things like:
|
|
67
|
+
|
|
68
|
+
Given(/^I am logged in to the primary wiki domain$/) do
|
|
69
|
+
visit(LoginPage).login_with(ENV["MEDIAWIKI_USER"], ENV["MEDIAWIKI_PASSWORD"])
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
To something like:
|
|
73
|
+
|
|
74
|
+
Given(/^I am logged in to the primary wiki domain$/) do
|
|
75
|
+
visit(LoginPage).login_with(user, password)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
More esoteric configuration that isn't accessible via a method of
|
|
79
|
+
`Environment` can still be read via `Environment#lookup` and `Environment#[]`.
|
|
80
|
+
|
|
81
|
+
Change something like the following:
|
|
82
|
+
|
|
83
|
+
Then(/^the default language should reflect my browser language$/) do
|
|
84
|
+
on(PreferencesPage) do |page|
|
|
85
|
+
expect(page.language_preference).to eq(ENV['BROWSER_LANGUAGE'])
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
To something like:
|
|
90
|
+
|
|
91
|
+
Then(/^the default language should reflect my browser language$/) do
|
|
92
|
+
on(PreferencesPage) do |page|
|
|
93
|
+
expect(page.language_preference).to eq(env[:browser_language])
|
|
94
|
+
# or
|
|
95
|
+
expect(page.language_preference).to eq(lookup(:browser_language))
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
## Remove direct references to `@browser`
|
|
100
|
+
|
|
101
|
+
All references to `@browser` should use `Environment#browser` instead, since
|
|
102
|
+
the latter will automatically configure and launch the browser the first time
|
|
103
|
+
it's needed.
|
|
104
|
+
|
|
105
|
+
For example:
|
|
106
|
+
|
|
107
|
+
When(/^I am viewing Topic page$/) do
|
|
108
|
+
on(FlowPage).wait_until { @browser.url =~ /Topic/ }
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
Would be changed to:
|
|
112
|
+
|
|
113
|
+
When(/^I am viewing Topic page$/) do
|
|
114
|
+
on(FlowPage).wait_until { browser.url =~ /Topic/ }
|
|
115
|
+
end
|
|
@@ -9,6 +9,8 @@ mediawiki_selenium top-level directory and at
|
|
|
9
9
|
https://git.wikimedia.org/blob/mediawiki%2Fselenium/HEAD/CREDITS.
|
|
10
10
|
=end
|
|
11
11
|
|
|
12
|
-
Given(/^I am logged in$/) do
|
|
13
|
-
|
|
12
|
+
Given(/^I am logged in(?: as (\w+))$/) do |user|
|
|
13
|
+
as_user(user) do |user, password|
|
|
14
|
+
visit(LoginPage).login_with(user, password)
|
|
15
|
+
end
|
|
14
16
|
end
|
|
@@ -10,7 +10,7 @@ https://git.wikimedia.org/blob/mediawiki%2Fselenium/HEAD/CREDITS.
|
|
|
10
10
|
=end
|
|
11
11
|
|
|
12
12
|
Then(/^page has no ResourceLoader errors$/) do
|
|
13
|
-
|
|
13
|
+
result = browser.execute_script(<<-end)
|
|
14
14
|
return (function() {
|
|
15
15
|
// Returns a string listing problem modules,
|
|
16
16
|
// or empty string if all OK (or not a MediaWiki page).
|
|
@@ -41,5 +41,7 @@ return (function() {
|
|
|
41
41
|
}
|
|
42
42
|
return ret;
|
|
43
43
|
}) ();
|
|
44
|
-
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
expect(result).to eq('')
|
|
45
47
|
end
|
|
@@ -4,9 +4,9 @@ When(/^upload bogus file (.+)$/) do |file_name|
|
|
|
4
4
|
path = "#{Dir.tmpdir}/#{file_name}"
|
|
5
5
|
|
|
6
6
|
system("touch #{path}")
|
|
7
|
-
if
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
if browser.driver.browser == :chrome
|
|
8
|
+
browser.execute_script "document.getElementsByName('file')[0].removeAttribute('class');"
|
|
9
|
+
browser.execute_script "document.getElementsByName('file')[0].removeAttribute('style');"
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
on(UploadPage).select_file = path
|
|
@@ -20,9 +20,9 @@ When(/^upload file (.+)$/) do |file_name|
|
|
|
20
20
|
require "chunky_png"
|
|
21
21
|
ChunkyPNG::Image.new(Random.new.rand(255), Random.new.rand(255), Random.new.rand(255)).save path
|
|
22
22
|
|
|
23
|
-
if
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
if browser.driver.browser == :chrome
|
|
24
|
+
browser.execute_script "document.getElementsByName('file')[0].removeAttribute('class');"
|
|
25
|
+
browser.execute_script "document.getElementsByName('file')[0].removeAttribute('style');"
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
on(UploadPage).select_file = path
|
|
@@ -20,7 +20,6 @@ class LoginPage
|
|
|
20
20
|
def login_with(username, password, wait_for_logout_element = true)
|
|
21
21
|
self.username_element.when_present.send_keys(username)
|
|
22
22
|
self.password_element.when_present.send_keys(password)
|
|
23
|
-
login_element.fire_event("onfocus")
|
|
24
23
|
login_element.when_present.click
|
|
25
24
|
logout_element.when_present(10) if wait_for_logout_element
|
|
26
25
|
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.0.0.pre.
|
|
4
|
+
version: 1.0.0.pre.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-
|
|
16
|
+
date: 2015-02-18 00:00:00.000000000 Z
|
|
17
17
|
dependencies:
|
|
18
18
|
- !ruby/object:Gem::Dependency
|
|
19
19
|
name: cucumber
|
|
@@ -334,6 +334,7 @@ files:
|
|
|
334
334
|
- Gemfile
|
|
335
335
|
- LICENSE
|
|
336
336
|
- README.md
|
|
337
|
+
- UPGRADE.md
|
|
337
338
|
- bin/mediawiki-selenium-init
|
|
338
339
|
- lib/mediawiki_selenium.rb
|
|
339
340
|
- lib/mediawiki_selenium/browser_factory.rb
|