[browser test] Moved Ruby code that multiple repositories use to mediawiki_selenium Ruby gem

Bug: 56088
Change-Id: I9fdfcf0f9df8f1bd9df3c358d2e1a7925fa5928d
This commit is contained in:
Zeljko Filipin 2014-02-11 15:17:31 +01:00
parent 8dd6239013
commit 0b1fcc2231
4 changed files with 10 additions and 46 deletions

View file

@ -22,19 +22,19 @@ GEM
headless (1.0.1) headless (1.0.1)
i18n (0.6.9) i18n (0.6.9)
json (1.8.1) json (1.8.1)
mediawiki_selenium (0.2.0) mediawiki_selenium (0.2.2)
cucumber (~> 1.3.10) cucumber (~> 1.3, >= 1.3.10)
headless (~> 1.0.1) headless (~> 1.0, >= 1.0.1)
json (~> 1.8.1) json (~> 1.8, >= 1.8.1)
net-http-persistent (~> 2.9.1) net-http-persistent (~> 2.9, >= 2.9.1)
page-object (~> 0.9.5) page-object (~> 0.9, >= 0.9.5)
rest-client (~> 1.6.7) rest-client (~> 1.6, >= 1.6.7)
rspec-expectations (~> 2.14.4) rspec-expectations (~> 2.14, >= 2.14.4)
syntax (~> 1.2.0) syntax (~> 1.2, >= 1.2.0)
mime-types (2.1) mime-types (2.1)
multi_json (1.8.4) multi_json (1.8.4)
multi_test (0.0.3) multi_test (0.0.3)
net-http-persistent (2.9.3) net-http-persistent (2.9.4)
page-object (0.9.6) page-object (0.9.6)
page_navigation (>= 0.9) page_navigation (>= 0.9)
selenium-webdriver (>= 2.39.0) selenium-webdriver (>= 2.39.0)

View file

@ -1,3 +0,0 @@
Given(/^I am logged in$/) do
visit(LoginPage).login_with(ENV["MEDIAWIKI_USER"], ENV["MEDIAWIKI_PASSWORD"])
end

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://en.wikipedia.beta.wmflabs.org/wiki/"
end
"#{mediawiki_url}#{name}"
end
end

View file

@ -1,23 +0,0 @@
class LoginPage
include PageObject
include URL
page_url URL.url("Special:UserLogin")
div(:feedback, class: "errorbox")
button(:login, id: "wpLoginAttempt")
text_field(:password, id: "wpPassword1")
a(:password_strength, text: "password strength")
a(:phishing, text: "phishing")
text_field(:username, id: "wpName1")
a(:username_displayed, title: /Your user page/)
def logged_in_as_element
@browser.div(id: "mw-content-text").p.b
end
def login_with(username, password)
self.username = username
self.password = password
login
end
end