mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-16 20:35:09 +00:00
Upgrade browser tests to the latest version of mediawiki_selenium Ruby gem
Bug: T99659 Change-Id: I57c9c73284ed856ee1d9a8f490cd511d07953f77
This commit is contained in:
parent
20a23ff4a4
commit
2c3ac55a67
2
Gemfile
2
Gemfile
|
@ -1,4 +1,4 @@
|
||||||
source "https://rubygems.org"
|
source "https://rubygems.org"
|
||||||
|
|
||||||
gem "mediawiki_selenium", "~> 0.4.0"
|
gem "mediawiki_selenium", "~> 1.6.2"
|
||||||
gem "rubocop", "~> 0.29.1", require: false
|
gem "rubocop", "~> 0.29.1", require: false
|
||||||
|
|
34
Gemfile.lock
34
Gemfile.lock
|
@ -5,7 +5,7 @@ GEM
|
||||||
astrolabe (1.3.1)
|
astrolabe (1.3.1)
|
||||||
parser (~> 2.2)
|
parser (~> 2.2)
|
||||||
builder (3.2.2)
|
builder (3.2.2)
|
||||||
childprocess (0.5.6)
|
childprocess (0.5.8)
|
||||||
ffi (~> 1.0, >= 1.0.11)
|
ffi (~> 1.0, >= 1.0.11)
|
||||||
cucumber (1.3.20)
|
cucumber (1.3.20)
|
||||||
builder (>= 2.1.2)
|
builder (>= 2.1.2)
|
||||||
|
@ -17,11 +17,11 @@ GEM
|
||||||
faker (>= 1.1.2)
|
faker (>= 1.1.2)
|
||||||
yml_reader (>= 0.4)
|
yml_reader (>= 0.4)
|
||||||
diff-lcs (1.2.5)
|
diff-lcs (1.2.5)
|
||||||
domain_name (0.5.24)
|
domain_name (0.5.25)
|
||||||
unf (>= 0.0.5, < 1.0.0)
|
unf (>= 0.0.5, < 1.0.0)
|
||||||
faker (1.5.0)
|
faker (1.6.1)
|
||||||
i18n (~> 0.5)
|
i18n (~> 0.5)
|
||||||
faraday (0.9.1)
|
faraday (0.9.2)
|
||||||
multipart-post (>= 1.2, < 3)
|
multipart-post (>= 1.2, < 3)
|
||||||
faraday-cookie_jar (0.0.6)
|
faraday-cookie_jar (0.0.6)
|
||||||
faraday (>= 0.7.4)
|
faraday (>= 0.7.4)
|
||||||
|
@ -29,7 +29,7 @@ GEM
|
||||||
ffi (1.9.10)
|
ffi (1.9.10)
|
||||||
gherkin (2.12.2)
|
gherkin (2.12.2)
|
||||||
multi_json (~> 1.3)
|
multi_json (~> 1.3)
|
||||||
headless (1.0.2)
|
headless (2.2.0)
|
||||||
http-cookie (1.0.2)
|
http-cookie (1.0.2)
|
||||||
domain_name (~> 0.5)
|
domain_name (~> 0.5)
|
||||||
i18n (0.7.0)
|
i18n (0.7.0)
|
||||||
|
@ -37,27 +37,29 @@ GEM
|
||||||
mediawiki_api (0.5.0)
|
mediawiki_api (0.5.0)
|
||||||
faraday (~> 0.9, >= 0.9.0)
|
faraday (~> 0.9, >= 0.9.0)
|
||||||
faraday-cookie_jar (~> 0.0, >= 0.0.6)
|
faraday-cookie_jar (~> 0.0, >= 0.0.6)
|
||||||
mediawiki_selenium (0.4.3)
|
mediawiki_selenium (1.6.2)
|
||||||
cucumber (~> 1.3, >= 1.3.10)
|
cucumber (~> 1.3, >= 1.3.20)
|
||||||
headless (~> 1.0, >= 1.0.1)
|
headless (~> 2.0, >= 2.1.0)
|
||||||
json (~> 1.8, >= 1.8.1)
|
json (~> 1.8, >= 1.8.1)
|
||||||
mediawiki_api (~> 0.2, >= 0.2.1)
|
mediawiki_api (~> 0.5, >= 0.5.0)
|
||||||
page-object (~> 1.0)
|
page-object (~> 1.0)
|
||||||
rest-client (~> 1.6, >= 1.6.7)
|
rest-client (~> 1.6, >= 1.6.7)
|
||||||
|
rspec-core (~> 2.14, >= 2.14.4)
|
||||||
rspec-expectations (~> 2.14, >= 2.14.4)
|
rspec-expectations (~> 2.14, >= 2.14.4)
|
||||||
syntax (~> 1.2, >= 1.2.0)
|
syntax (~> 1.2, >= 1.2.0)
|
||||||
mime-types (2.6.2)
|
thor (~> 0.19, >= 0.19.1)
|
||||||
|
mime-types (2.99)
|
||||||
multi_json (1.11.2)
|
multi_json (1.11.2)
|
||||||
multi_test (0.1.2)
|
multi_test (0.1.2)
|
||||||
multipart-post (2.0.0)
|
multipart-post (2.0.0)
|
||||||
netrc (0.10.3)
|
netrc (0.11.0)
|
||||||
page-object (1.1.0)
|
page-object (1.1.0)
|
||||||
page_navigation (>= 0.9)
|
page_navigation (>= 0.9)
|
||||||
selenium-webdriver (>= 2.44.0)
|
selenium-webdriver (>= 2.44.0)
|
||||||
watir-webdriver (>= 0.6.11)
|
watir-webdriver (>= 0.6.11)
|
||||||
page_navigation (0.9)
|
page_navigation (0.9)
|
||||||
data_magic (>= 0.14)
|
data_magic (>= 0.14)
|
||||||
parser (2.2.2.6)
|
parser (2.2.3.0)
|
||||||
ast (>= 1.1, < 3.0)
|
ast (>= 1.1, < 3.0)
|
||||||
powerpack (0.1.1)
|
powerpack (0.1.1)
|
||||||
rainbow (2.0.0)
|
rainbow (2.0.0)
|
||||||
|
@ -65,6 +67,7 @@ GEM
|
||||||
http-cookie (>= 1.0.2, < 2.0)
|
http-cookie (>= 1.0.2, < 2.0)
|
||||||
mime-types (>= 1.16, < 3.0)
|
mime-types (>= 1.16, < 3.0)
|
||||||
netrc (~> 0.7)
|
netrc (~> 0.7)
|
||||||
|
rspec-core (2.99.2)
|
||||||
rspec-expectations (2.99.2)
|
rspec-expectations (2.99.2)
|
||||||
diff-lcs (>= 1.1.3, < 2.0)
|
diff-lcs (>= 1.1.3, < 2.0)
|
||||||
rubocop (0.29.1)
|
rubocop (0.29.1)
|
||||||
|
@ -75,16 +78,17 @@ GEM
|
||||||
ruby-progressbar (~> 1.4)
|
ruby-progressbar (~> 1.4)
|
||||||
ruby-progressbar (1.7.5)
|
ruby-progressbar (1.7.5)
|
||||||
rubyzip (1.1.7)
|
rubyzip (1.1.7)
|
||||||
selenium-webdriver (2.47.1)
|
selenium-webdriver (2.48.1)
|
||||||
childprocess (~> 0.5)
|
childprocess (~> 0.5)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
rubyzip (~> 1.0)
|
rubyzip (~> 1.0)
|
||||||
websocket (~> 1.0)
|
websocket (~> 1.0)
|
||||||
syntax (1.2.0)
|
syntax (1.2.0)
|
||||||
|
thor (0.19.1)
|
||||||
unf (0.1.4)
|
unf (0.1.4)
|
||||||
unf_ext
|
unf_ext
|
||||||
unf_ext (0.0.7.1)
|
unf_ext (0.0.7.1)
|
||||||
watir-webdriver (0.8.0)
|
watir-webdriver (0.9.1)
|
||||||
selenium-webdriver (>= 2.46.2)
|
selenium-webdriver (>= 2.46.2)
|
||||||
websocket (1.2.2)
|
websocket (1.2.2)
|
||||||
yml_reader (0.5)
|
yml_reader (0.5)
|
||||||
|
@ -93,5 +97,5 @@ PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
mediawiki_selenium (~> 0.4.0)
|
mediawiki_selenium (~> 1.6.2)
|
||||||
rubocop (~> 0.29.1)
|
rubocop (~> 0.29.1)
|
||||||
|
|
39
tests/browser/environments.yml
Normal file
39
tests/browser/environments.yml
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
# Customize this configuration as necessary to provide defaults for various
|
||||||
|
# test environments.
|
||||||
|
#
|
||||||
|
# The set of defaults to use is determined by the MEDIAWIKI_ENVIRONMENT
|
||||||
|
# environment variable.
|
||||||
|
#
|
||||||
|
# export MEDIAWIKI_ENVIRONMENT=mw-vagrant-host
|
||||||
|
# bundle exec cucumber
|
||||||
|
#
|
||||||
|
# Additional variables set by the environment will override the corresponding
|
||||||
|
# defaults defined here.
|
||||||
|
#
|
||||||
|
# export MEDIAWIKI_ENVIRONMENT=mw-vagrant-host
|
||||||
|
# export MEDIAWIKI_USER=Selenium_user2
|
||||||
|
# bundle exec cucumber
|
||||||
|
#
|
||||||
|
mw-vagrant-host: &default
|
||||||
|
user_factory: true
|
||||||
|
mediawiki_url: http://127.0.0.1:8080/wiki/
|
||||||
|
|
||||||
|
mw-vagrant-guest:
|
||||||
|
user_factory: true
|
||||||
|
mediawiki_url: http://127.0.0.1/wiki/
|
||||||
|
|
||||||
|
beta:
|
||||||
|
mediawiki_url: http://en.wikipedia.beta.wmflabs.org/wiki/
|
||||||
|
mediawiki_user: Selenium_user
|
||||||
|
# mediawiki_password: SET THIS IN THE ENVIRONMENT!
|
||||||
|
|
||||||
|
test2:
|
||||||
|
mediawiki_url: http://test2.wikipedia.org/wiki/
|
||||||
|
mediawiki_user: Selenium_user
|
||||||
|
# mediawiki_password: SET THIS IN THE ENVIRONMENT!
|
||||||
|
|
||||||
|
integration:
|
||||||
|
user_factory: true
|
||||||
|
# mediawiki_url: THIS WILL BE SET BY JENKINS
|
||||||
|
|
||||||
|
default: *default
|
|
@ -4,27 +4,27 @@ end
|
||||||
|
|
||||||
Given /^I visit the Commons page$/ do
|
Given /^I visit the Commons page$/ do
|
||||||
@commons_open_time = Time.now.getutc
|
@commons_open_time = Time.now.getutc
|
||||||
@browser.goto "https://commons.wikimedia.org/wiki/File:Sunrise_over_fishing_boats_in_Kerala.jpg"
|
browser.goto "https://commons.wikimedia.org/wiki/File:Sunrise_over_fishing_boats_in_Kerala.jpg"
|
||||||
end
|
end
|
||||||
|
|
||||||
Given /^I visit an unrelated Commons page to warm up the browser cache$/ do
|
Given /^I visit an unrelated Commons page to warm up the browser cache$/ do
|
||||||
@browser.goto "https://commons.wikimedia.org/wiki/File:Wikimedia_Foundation_2013_All_Hands_Offsite_-_Day_2_-_Photo_16.jpg"
|
browser.goto "https://commons.wikimedia.org/wiki/File:Wikimedia_Foundation_2013_All_Hands_Offsite_-_Day_2_-_Photo_16.jpg"
|
||||||
end
|
end
|
||||||
|
|
||||||
Given /^I have a small browser window$/ do
|
Given /^I have a small browser window$/ do
|
||||||
@browser.window.resize_to 900, 700
|
browser.window.resize_to 900, 700
|
||||||
end
|
end
|
||||||
|
|
||||||
Given /^I have an average browser window$/ do
|
Given /^I have an average browser window$/ do
|
||||||
@browser.window.resize_to 1366, 768
|
browser.window.resize_to 1366, 768
|
||||||
end
|
end
|
||||||
|
|
||||||
Given /^I have a large browser window$/ do
|
Given /^I have a large browser window$/ do
|
||||||
@browser.window.resize_to 1920, 1080
|
browser.window.resize_to 1920, 1080
|
||||||
end
|
end
|
||||||
|
|
||||||
Given /^I am using a custom user agent$/ do
|
Given /^I am using a custom user agent$/ do
|
||||||
@browser = browser(test_name(@scenario), user_agent: ENV["BROWSER_USERAGENT"])
|
browser(test_name(@scenario), user_agent: env[:browser_useragent])
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^the File: page image is loaded$/ do
|
Then /^the File: page image is loaded$/ do
|
||||||
|
|
|
@ -44,7 +44,7 @@ When /^I click the image$/ do
|
||||||
# Clicking the top-left corner of the image is necessary for the test to work on IE
|
# Clicking the top-left corner of the image is necessary for the test to work on IE
|
||||||
# A plain click on the image element ends up hitting the dialog, which means it won't close
|
# A plain click on the image element ends up hitting the dialog, which means it won't close
|
||||||
begin
|
begin
|
||||||
@browser.driver.action.move_to(@browser.driver.find_element(:class, 'mw-mmv-image'), 10, 10).click.perform
|
browser.driver.action.move_to(browser.driver.find_element(:class, 'mw-mmv-image'), 10, 10).click.perform
|
||||||
rescue
|
rescue
|
||||||
# Plain click for web drivers that don't support mouse moves (Safari, currently)
|
# Plain click for web drivers that don't support mouse moves (Safari, currently)
|
||||||
on(E2ETestPage).mmv_image_div_element.when_present.click
|
on(E2ETestPage).mmv_image_div_element.when_present.click
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
require "rubygems"
|
require 'mediawiki_selenium/cucumber'
|
||||||
require "bundler/setup"
|
require 'mediawiki_selenium/pages'
|
||||||
|
require 'mediawiki_selenium/step_definitions'
|
||||||
Bundler.require
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ require "json"
|
||||||
class CommonsPage
|
class CommonsPage
|
||||||
include PageObject
|
include PageObject
|
||||||
|
|
||||||
page_url URL.url("File:Sunrise_over_fishing_boats_in_Kerala.jpg")
|
page_url "File:Sunrise_over_fishing_boats_in_Kerala.jpg"
|
||||||
|
|
||||||
img(:commons_image, src: /Kerala\.jpg$/)
|
img(:commons_image, src: /Kerala\.jpg$/)
|
||||||
div(:mmv_image_loaded_cucumber, class: "mw-mmv-image-loaded-cucumber")
|
div(:mmv_image_loaded_cucumber, class: "mw-mmv-image-loaded-cucumber")
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class E2ETestPage < CommonsPage
|
class E2ETestPage < CommonsPage
|
||||||
include PageObject
|
include PageObject
|
||||||
|
|
||||||
page_url URL.url("MediaViewerE2ETest")
|
page_url "MediaViewerE2ETest"
|
||||||
|
|
||||||
# Tag page elements that we will need.
|
# Tag page elements that we will need.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue