mediawiki_selenium 0.2.10 → 0.2.11
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 +33 -13
- data/lib/mediawiki_selenium/support/pages/login_page.rb +2 -2
- data/lib/mediawiki_selenium/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5d44bafcfdc87b54e5c29b9a29b1ef93366fad8
|
4
|
+
data.tar.gz: 56954dbdba4ab4ac095678d8c639014cea7e8249
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4298b95a70fd4c07873b4ab8ab98bcf2677822e2595949cc20064d027c9212422480a0378a83fd4b2a2f12ea98c8129c39618593a59d15e925381230e6b0f0e2
|
7
|
+
data.tar.gz: 71f460f3cd1572b4d1750d17f86d4ede7b07f2775a90086c3ff1b60e4d7aefd7a940d176d724277afa11523eb095fb351fb81f8df6b890a93bdf991838d4f60b
|
data/README.md
CHANGED
@@ -1,21 +1,30 @@
|
|
1
1
|
# Mediawiki::Selenium
|
2
2
|
|
3
|
-
Several MediaWiki extensions share code that makes it easy to run Selenium
|
4
|
-
makes it easy to update the shared code.
|
3
|
+
Several MediaWiki extensions share code that makes it easy to run Selenium
|
4
|
+
tests. This gem makes it easy to update the shared code.
|
5
5
|
|
6
6
|
## Installation
|
7
7
|
|
8
|
-
To run the Selenium tests you will have to install Ruby. Look at the `Gemfile`
|
9
|
-
|
8
|
+
To run the Selenium tests you will have to install Ruby. Look at the `Gemfile`
|
9
|
+
file for the exact required version. You also have to install the latest
|
10
|
+
versions of RubyGems and Firefox (the default browser in which the tests run).
|
11
|
+
The easiest way to install Ruby on Linux/Unix/Mac is [RVM](https://rvm.io/) and
|
12
|
+
on Windows [RubyInstaller](http://rubyinstaller.org/).
|
13
|
+
|
14
|
+
ALERT: On Windows you must use Ruby 1.9.3 for now because cucumber/gherkin
|
15
|
+
library currently doesn't work with Ruby 2.x.x.
|
10
16
|
|
11
17
|
cd /tests/browser
|
12
18
|
gem update --system
|
13
19
|
gem install bundler
|
14
20
|
bundle install
|
15
21
|
|
16
|
-
If you're not using RVM to manage your Ruby versions, you will need to run the
|
22
|
+
If you're not using RVM to manage your Ruby versions, you will need to run the
|
23
|
+
commands as root (using `sudo`).
|
17
24
|
|
18
|
-
Environment variables MEDIAWIKI_USER and MEDIAWIKI_PASSWORD are required for
|
25
|
+
Environment variables MEDIAWIKI_USER and MEDIAWIKI_PASSWORD are required for
|
26
|
+
tests tagged `@login`. For local testing, create a test user on your local wiki
|
27
|
+
and export the user and password as the values for those variables.
|
19
28
|
For example:
|
20
29
|
|
21
30
|
export MEDIAWIKI_USER=<username here> # Linux/Unix/Mac
|
@@ -28,38 +37,49 @@ For example:
|
|
28
37
|
|
29
38
|
Run the tests with `bundle exec cucumber`, this should start Firefox.
|
30
39
|
|
31
|
-
By default the tests run at en.wikipedia.beta.wmflabs.org. If you want to run
|
40
|
+
By default the tests run at en.wikipedia.beta.wmflabs.org. If you want to run
|
41
|
+
the tests elsewhere, set the `MEDIAWIKI_URL` environment variable. For example:
|
32
42
|
|
33
43
|
export MEDIAWIKI_URL=http://commons.wikimedia.beta.wmflabs.org/wiki/ # Linux/Unix/Mac
|
34
44
|
set MEDIAWIKI_URL=http://commons.wikimedia.beta.wmflabs.org/wiki/ # Windows
|
35
45
|
|
36
46
|
To run a single test file enter `bundle exec cucumber features/FEATURE_NAME.feature`.
|
37
47
|
|
38
|
-
To run a single test scenario, put a colon and the line number (NN) on which
|
48
|
+
To run a single test scenario, put a colon and the line number (NN) on which
|
49
|
+
the scenario begins after the file name: `bundle exec cucumber features/FEATURE_NAME.feature:NN`.
|
39
50
|
|
40
|
-
You can use a different browser with the `BROWSER` env variable, the fastest is
|
51
|
+
You can use a different browser with the `BROWSER` env variable, the fastest is
|
52
|
+
probably PhantomJS, a headless browser:
|
41
53
|
|
42
54
|
export BROWSER=phantomjs # Linux/Unix/Mac
|
43
55
|
set BROWSER=phantomjs # Windows
|
44
56
|
|
45
|
-
By default, the browser will close itself at the end of every scenario. If you
|
57
|
+
By default, the browser will close itself at the end of every scenario. If you
|
58
|
+
want the browser to stay open, set the environment variable `KEEP_BROWSER_OPEN`
|
59
|
+
to `true`:
|
46
60
|
|
47
61
|
export KEEP_BROWSER_OPEN=true # Linux/Unix/Mac
|
48
62
|
set KEEP_BROWSER_OPEN=true # Windows
|
49
63
|
|
50
64
|
## Screenshots
|
51
65
|
|
52
|
-
You can get screenshots on failures (since 0.2.1) by setting the environment
|
66
|
+
You can get screenshots on failures (since 0.2.1) by setting the environment
|
67
|
+
variable SCREENSHOT_FAILURES to "true", screenshots will be written under the
|
68
|
+
`screenshots` directory relatively to working directory. The
|
69
|
+
SCREENSHOT_FAILURES_PATH environment variable (since 0.2.2) let you override
|
70
|
+
the destination path for screenshots. Example:
|
53
71
|
|
54
72
|
SCREENSHOT_FAILURES=true SCREENSHOT_FAILURES_PATH="/tmp/screenshots" bundle exec cucumber
|
55
73
|
|
56
74
|
## Update your Gemfile
|
57
75
|
|
58
|
-
In your repository, the Gemfile specify dependencies and Gemfile.lock defines
|
76
|
+
In your repository, the Gemfile specify dependencies and Gemfile.lock defines
|
77
|
+
the whole dependency tree. To update it simply run:
|
59
78
|
|
60
79
|
bundle update
|
61
80
|
|
62
|
-
It will fetch all dependencies and updates the Gemfile.lock file, you can then
|
81
|
+
It will fetch all dependencies and updates the Gemfile.lock file, you can then
|
82
|
+
commit back both files.
|
63
83
|
|
64
84
|
## Links
|
65
85
|
|
@@ -27,11 +27,11 @@ class LoginPage
|
|
27
27
|
def logged_in_as_element
|
28
28
|
@browser.div(id: "mw-content-text").p.b
|
29
29
|
end
|
30
|
-
def login_with(username, password)
|
30
|
+
def login_with(username, password, wait_for_logout_element = true)
|
31
31
|
self.username_element.when_present.send_keys(username)
|
32
32
|
self.password_element.when_present.send_keys(password)
|
33
33
|
login_element.fire_event("onfocus")
|
34
34
|
login_element.when_present.click
|
35
|
-
logout_element.when_present
|
35
|
+
logout_element.when_present if wait_for_logout_element
|
36
36
|
end
|
37
37
|
end
|