QA: Refactor for mediawiki_selenium 1.0

Refactored by following steps outlined in UPGRADE.md under the
mediawiki_selenium project.

Change-Id: I52717292df0541eb489b34ec083ec4a957f7546d
This commit is contained in:
Dan Duvall 2015-03-05 14:41:11 -08:00 committed by Zfilipin
parent 9afcb77e6f
commit 7a5bd933d4
19 changed files with 87 additions and 105 deletions

View file

@ -3,6 +3,5 @@
source "https://rubygems.org"
gem "mediawiki_api"
gem "mediawiki_selenium"
gem "mediawiki_selenium", "~> 1.0.1"
gem "rubocop", require: false

View file

@ -5,39 +5,39 @@ GEM
astrolabe (1.3.0)
parser (>= 2.2.0.pre.3, < 3.0)
builder (3.2.2)
childprocess (0.5.3)
childprocess (0.5.5)
ffi (~> 1.0, >= 1.0.11)
cucumber (1.3.16)
cucumber (1.3.19)
builder (>= 2.1.2)
diff-lcs (>= 1.1.3)
gherkin (~> 2.12)
multi_json (>= 1.7.5, < 2.0)
multi_test (>= 0.1.1)
data_magic (0.19)
multi_test (>= 0.1.2)
data_magic (0.20)
faker (>= 1.1.2)
yml_reader (>= 0.3)
yml_reader (>= 0.4)
diff-lcs (1.2.5)
domain_name (0.5.20)
domain_name (0.5.23)
unf (>= 0.0.5, < 1.0.0)
faker (1.4.3)
i18n (~> 0.5)
faraday (0.9.0)
faraday (0.9.1)
multipart-post (>= 1.2, < 3)
faraday-cookie_jar (0.0.6)
faraday (>= 0.7.4)
http-cookie (~> 1.0.0)
ffi (1.9.3)
ffi (1.9.6)
gherkin (2.12.2)
multi_json (~> 1.3)
headless (1.0.2)
http-cookie (1.0.2)
domain_name (~> 0.5)
i18n (0.6.11)
json (1.8.1)
mediawiki_api (0.2.1)
i18n (0.7.0)
json (1.8.2)
mediawiki_api (0.3.1)
faraday (~> 0.9, >= 0.9.0)
faraday-cookie_jar (~> 0.0, >= 0.0.6)
mediawiki_selenium (0.3.2)
mediawiki_selenium (1.0.1)
cucumber (~> 1.3, >= 1.3.10)
headless (~> 1.0, >= 1.0.1)
json (~> 1.8, >= 1.8.1)
@ -46,15 +46,16 @@ GEM
rest-client (~> 1.6, >= 1.6.7)
rspec-expectations (~> 2.14, >= 2.14.4)
syntax (~> 1.2, >= 1.2.0)
mime-types (2.3)
multi_json (1.10.1)
multi_test (0.1.1)
thor (~> 0.19, >= 0.19.1)
mime-types (2.4.3)
multi_json (1.11.0)
multi_test (0.1.2)
multipart-post (2.0.0)
netrc (0.7.7)
page-object (1.0.2)
netrc (0.10.3)
page-object (1.0.3)
page_navigation (>= 0.9)
selenium-webdriver (>= 2.42.0)
watir-webdriver (>= 0.6.9)
selenium-webdriver (>= 2.44.0)
watir-webdriver (>= 0.6.11)
page_navigation (0.9)
data_magic (>= 0.14)
parser (2.2.0.pre.4)
@ -62,7 +63,7 @@ GEM
slop (~> 3.4, >= 3.4.5)
powerpack (0.0.9)
rainbow (2.0.0)
rest-client (1.7.2)
rest-client (1.7.3)
mime-types (>= 1.16, < 3.0)
netrc (~> 0.7)
rspec-expectations (2.99.2)
@ -74,26 +75,26 @@ GEM
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.4)
ruby-progressbar (1.6.0)
rubyzip (1.1.6)
selenium-webdriver (2.42.0)
childprocess (>= 0.5.0)
rubyzip (1.1.7)
selenium-webdriver (2.45.0)
childprocess (~> 0.5)
multi_json (~> 1.0)
rubyzip (~> 1.0)
websocket (~> 1.0.4)
websocket (~> 1.0)
slop (3.6.0)
syntax (1.2.0)
thor (0.19.1)
unf (0.1.4)
unf_ext
unf_ext (0.0.6)
watir-webdriver (0.6.10)
selenium-webdriver (>= 2.18.0)
websocket (1.0.7)
yml_reader (0.3)
watir-webdriver (0.7.0)
selenium-webdriver (>= 2.45)
websocket (1.2.1)
yml_reader (0.5)
PLATFORMS
ruby
DEPENDENCIES
mediawiki_api
mediawiki_selenium
mediawiki_selenium (~> 1.0.1)
rubocop

View file

@ -1,5 +0,0 @@
export MEDIAWIKI_URL=http://localhost/wiki/
export MEDIAWIKI_API_URL=http://localhost/w/api.php
export MEDIAWIKI_USER=Selenium_user
export MEDIAWIKI_PASSWORD=Selenium_password
export BROWSER=firefox

View file

@ -0,0 +1,35 @@
# 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:
mediawiki_url: http://127.0.0.1:8080/wiki/
mediawiki_user: Selenium_user
mediawiki_password: vagrant
mw-vagrant-guest:
mediawiki_url: http://127.0.0.1/wiki/
mediawiki_user: Selenium_user
mediawiki_password: vagrant
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!

View file

@ -1,14 +1,3 @@
#
# This file is subject to the license terms in the LICENSE file found in the
# qa-browsertests top-level directory and at
# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/LICENSE. No part of
# qa-browsertests, including this file, may be copied, modified, propagated, or
# distributed except according to the terms contained in the LICENSE file.
#
# Copyright 2012-2014 by the Mediawiki developers. See the CREDITS file in the
# qa-browsertests top-level directory and at
# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/CREDITS
#
@chrome @clean @firefox @internet_explorer_6 @internet_explorer_7 @internet_explorer_8 @internet_explorer_9 @internet_explorer_10 @phantomjs
Feature: File

View file

@ -1,14 +1,3 @@
#
# This file is subject to the license terms in the LICENSE file found in the
# qa-browsertests top-level directory and at
# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/LICENSE. No part of
# qa-browsertests, including this file, may be copied, modified, propagated, or
# distributed except according to the terms contained in the LICENSE file.
#
# Copyright 2012-2014 by the Mediawiki developers. See the CREDITS file in the
# qa-browsertests top-level directory and at
# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/CREDITS
#
@chrome @clean @firefox @internet_explorer_6 @internet_explorer_7 @internet_explorer_8 @internet_explorer_9 @internet_explorer_10 @phantomjs
Feature: Log in

View file

@ -1,14 +1,3 @@
#
# This file is subject to the license terms in the LICENSE file found in the
# qa-browsertests top-level directory and at
# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/LICENSE. No part of
# qa-browsertests, including this file, may be copied, modified, propagated, or
# distributed except according to the terms contained in the LICENSE file.
#
# Copyright 2012-2014 by the Mediawiki developers. See the CREDITS file in the
# qa-browsertests top-level directory and at
# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/CREDITS
#
@chrome @clean @firefox @internet_explorer_6 @internet_explorer_7 @internet_explorer_8 @internet_explorer_9 @internet_explorer_10 @login @phantomjs
Feature: Preferences

View file

@ -1,6 +1,6 @@
Given(/^I go to the "(.+)" page with content "(.+)"$/) do |page_title, page_content|
@wikitext = page_content
on(APIPage).create page_title, page_content
api.create_page page_title, page_content
step "I am on the #{page_title} page"
end
@ -10,7 +10,7 @@ Given(/^I am on the (.+) page$/) do |article|
end
Given(/^I create page "(.*?)" with content "(.*?)"$/) do |page_title, page_content|
on(APIPage).create page_title, page_content
api.create_page page_title, page_content
end
When(/^I click the Link Target link$/) do
@ -18,7 +18,7 @@ When(/^I click the Link Target link$/) do
end
Then(/^I should be on the Link Target Test Page$/) do
@browser.url.should match(/Link_Target_Test_Page/)
browser.url.should match(/Link_Target_Test_Page/)
end
Then(/^the page content should contain "(.*?)"$/) do |content|

View file

@ -14,11 +14,11 @@ Given(/^I am at Log in page$/) do
end
When(/^I log in with incorrect password$/) do
on(LoginPage).login_with(ENV["MEDIAWIKI_USER"], "incorrect password", false)
on(LoginPage).login_with(user, "incorrect password", false)
end
When(/^I log in with incorrect username$/) do
on(LoginPage).login_with("incorrect username", ENV["MEDIAWIKI_PASSWORD"], false)
on(LoginPage).login_with("incorrect username", password, false)
end
When(/^I log in without entering credentials$/) do
@ -26,7 +26,7 @@ When(/^I log in without entering credentials$/) do
end
When(/^I log in without entering password$/) do
on(LoginPage).login_with(ENV["MEDIAWIKI_USER"], "", false)
on(LoginPage).login_with(user, "", false)
end
Then(/^error box should be visible$/) do
@ -49,7 +49,7 @@ Then(/^Log in element should be there$/) do
end
Then(/^main page should open$/) do
@browser.url.should == on(MainPage).class.url
browser.url.should == on(MainPage).class.url
end
Then(/^Password element should be there$/) do

View file

@ -1,2 +1,4 @@
require "mediawiki_api"
require "mediawiki_selenium"
require 'mediawiki_selenium'
require 'mediawiki_selenium/support'
require 'mediawiki_selenium/step_definitions'

View file

@ -1,10 +0,0 @@
module URL
def self.url(name)
if ENV["MEDIAWIKI_URL"]
mediawiki_url = ENV["MEDIAWIKI_URL"]
else
mediawiki_url = "http://127.0.0.1:80/w/index.php"
end
"#{mediawiki_url}#{name}"
end
end

View file

@ -12,8 +12,7 @@
class CreateAccountPage
include PageObject
include URL
page_url URL.url("<%=params[:page_title]%>")
page_url "<%=params[:page_title]%>"
button(:create_account, id: "wpCreateaccount")
end

View file

@ -12,8 +12,7 @@
class FileDoesNotExistPage
include PageObject
include URL
page_url URL.url("File:<%=params[:page_name]%>")
page_url "File:<%=params[:page_name]%>"
div(:file_does_not_exist_message, id: "mw-imagepage-nofile")
end

View file

@ -1,8 +1,7 @@
class MainPage
include PageObject
include URL
page_url URL.url("")
page_url ""
a(:edit_link, href: /action=edit/)
li(:help_link, id: "n-help")

View file

@ -12,8 +12,7 @@
class PreferencesAppearancePage
include PageObject
include URL
page_url URL.url("Special:Preferences#mw-prefsection-rendering")
page_url "Special:Preferences#mw-prefsection-rendering"
checkbox(:auto_number_check, id: "mw-input-wpnumberheadings")
radio_button(:cologne_blue, id: "mw-input-wpskin-cologneblue")

View file

@ -12,8 +12,7 @@
class PreferencesEditingPage
include PageObject
include URL
page_url URL.url("Special:Preferences#mw-prefsection-rendering")
page_url "Special:Preferences#mw-prefsection-rendering"
select_list(:edit_area_font_style_select, id: "mw-input-wpeditfont")
checkbox(:edit_section_double_click_check, id: "mw-input-wpeditondblclick")

View file

@ -12,8 +12,7 @@
class PreferencesPage
include PageObject
include URL
page_url URL.url("Special:Preferences")
page_url "Special:Preferences"
a(:appearance_link, id: "preftab-rendering")
a(:editing_link, id: "preftab-editing")

View file

@ -12,8 +12,7 @@
class PreferencesUserProfilePage
include PageObject
include URL
page_url URL.url("Special:Preferences#mw-prefsection-personal")
page_url "Special:Preferences#mw-prefsection-personal"
table(:basic_info_table, id: "mw-htmlform-info")
link(:change_password_link, text: "Change password")

View file

@ -1,7 +1,7 @@
class ZtargetPage < MainPage
include URL
page_url URL.url("<%=params[:article_name]%>")
include PageObject
page_url "<%=params[:article_name]%>"
a(:link_target_page_link, text: "link to the test target page")
end