Moved ULS tests from browsertests repository
Change-Id: I4f4a4c5530ad7e5dff70171b59a589dc98b1ef29
This commit is contained in:
11
tests/browser/Gemfile
Executable file
11
tests/browser/Gemfile
Executable file
@@ -0,0 +1,11 @@
|
||||
#ruby=ruby-2.0.0-p247
|
||||
#ruby-gemset=UniversalLanguageSelector
|
||||
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem 'cucumber'
|
||||
gem 'json'
|
||||
gem 'net-http-persistent'
|
||||
gem 'page-object'
|
||||
gem 'rspec-expectations'
|
||||
gem 'syntax'
|
||||
56
tests/browser/Gemfile.lock
Normal file
56
tests/browser/Gemfile.lock
Normal file
@@ -0,0 +1,56 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
builder (3.2.2)
|
||||
childprocess (0.3.9)
|
||||
ffi (~> 1.0, >= 1.0.11)
|
||||
cucumber (1.3.6)
|
||||
builder (>= 2.1.2)
|
||||
diff-lcs (>= 1.1.3)
|
||||
gherkin (~> 2.12.0)
|
||||
multi_json (~> 1.7.5)
|
||||
multi_test (>= 0.0.2)
|
||||
data_magic (0.15.2)
|
||||
faker (>= 1.1.2)
|
||||
yml_reader (>= 0.2)
|
||||
diff-lcs (1.2.4)
|
||||
faker (1.2.0)
|
||||
i18n (~> 0.5)
|
||||
ffi (1.9.0)
|
||||
gherkin (2.12.1)
|
||||
multi_json (~> 1.3)
|
||||
i18n (0.6.5)
|
||||
json (1.8.0)
|
||||
multi_json (1.7.9)
|
||||
multi_test (0.0.2)
|
||||
net-http-persistent (2.9)
|
||||
page-object (0.9.2)
|
||||
page_navigation (>= 0.8)
|
||||
selenium-webdriver (>= 2.35.0)
|
||||
watir-webdriver (>= 0.6.4)
|
||||
page_navigation (0.9)
|
||||
data_magic (>= 0.14)
|
||||
rspec-expectations (2.14.2)
|
||||
diff-lcs (>= 1.1.3, < 2.0)
|
||||
rubyzip (0.9.9)
|
||||
selenium-webdriver (2.35.0)
|
||||
childprocess (>= 0.2.5)
|
||||
multi_json (~> 1.0)
|
||||
rubyzip
|
||||
websocket (~> 1.0.4)
|
||||
syntax (1.0.0)
|
||||
watir-webdriver (0.6.4)
|
||||
selenium-webdriver (>= 2.18.0)
|
||||
websocket (1.0.7)
|
||||
yml_reader (0.2)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
cucumber
|
||||
json
|
||||
net-http-persistent
|
||||
page-object
|
||||
rspec-expectations
|
||||
syntax
|
||||
1
tests/browser/README.md
Normal file
1
tests/browser/README.md
Normal file
@@ -0,0 +1 @@
|
||||
Please see https://github.com/wikimedia/qa-browsertests for instructions on how to run tests.
|
||||
36
tests/browser/config/config.yml
Normal file
36
tests/browser/config/config.yml
Normal file
@@ -0,0 +1,36 @@
|
||||
mediawiki_username: Selenium_user
|
||||
|
||||
chrome:
|
||||
name: chrome
|
||||
platform: Linux
|
||||
version:
|
||||
|
||||
firefox:
|
||||
name: firefox
|
||||
platform: Linux
|
||||
version: 23
|
||||
|
||||
internet_explorer_6:
|
||||
name: internet_explorer
|
||||
platform: Windows XP
|
||||
version: 6
|
||||
|
||||
internet_explorer_7:
|
||||
name: internet_explorer
|
||||
platform: Windows XP
|
||||
version: 7
|
||||
|
||||
internet_explorer_8:
|
||||
name: internet_explorer
|
||||
platform: Windows XP
|
||||
version: 8
|
||||
|
||||
internet_explorer_9:
|
||||
name: internet_explorer
|
||||
platform: Windows 7
|
||||
version: 9
|
||||
|
||||
internet_explorer_10:
|
||||
name: internet_explorer
|
||||
platform: Windows 8
|
||||
version: 10
|
||||
2
tests/browser/config/cucumber.yml
Normal file
2
tests/browser/config/cucumber.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
ci: --format Cucumber::Formatter::Sauce --out reports/junit
|
||||
default: --format progress
|
||||
7
tests/browser/features/step_definitions/common_steps.rb
Normal file
7
tests/browser/features/step_definitions/common_steps.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
Given(/^I am at random page$/) do
|
||||
visit RandomPage
|
||||
end
|
||||
|
||||
Given(/^I am logged in$/) do
|
||||
visit(LoginPage).login_with(@mediawiki_username, @mediawiki_password)
|
||||
end
|
||||
@@ -0,0 +1,12 @@
|
||||
Given(/^that my browser's accept language is (.+)$/) do |language|
|
||||
@browser = browser(environment, test_name(@scenario), @saucelabs_username, @saucelabs_key, language)
|
||||
$session_id = @browser.driver.instance_variable_get(:@bridge).session_id
|
||||
end
|
||||
|
||||
When(/^I visit a random page$/) do
|
||||
visit(RandomPage)
|
||||
end
|
||||
|
||||
Then(/^link to the main page has text (.+)$/) do |text|
|
||||
on(RandomPage).main_page_element.text.should == text
|
||||
end
|
||||
@@ -0,0 +1,160 @@
|
||||
Given(/^I am on a page with interlanguage links$/) do
|
||||
visit InterlanguagePage
|
||||
end
|
||||
|
||||
Given(/^I am on a page without interlanguage links$/) do
|
||||
visit NoInterlanguagePage # .add_links_element.when_visible.should be_visible
|
||||
# cannot do this because of https://bugzilla.wikimedia.org/show_bug.cgi?id=49139
|
||||
end
|
||||
|
||||
Given(/^I am on a talk page with interlanguage links$/) do
|
||||
visit(InterlanguagePage).talk_element.click
|
||||
end
|
||||
|
||||
Given(/^I am on a talk page without interlanguage links$/) do
|
||||
visit(NoInterlanguagePage).talk_element.click
|
||||
end
|
||||
|
||||
Given(/^I navigate to the anonymous Language Settings panel$/) do
|
||||
step 'I am on a page with interlanguage links'
|
||||
step 'I click the cog icon by Languages in the sidebar'
|
||||
step 'I see the anonymous Language Settings panel'
|
||||
end
|
||||
|
||||
Given(/^I navigate to the Language Settings panel$/) do
|
||||
step 'I am on a page with interlanguage links'
|
||||
step 'I click the cog icon by Languages in the sidebar'
|
||||
step 'I see the Language Settings panel'
|
||||
end
|
||||
|
||||
When(/^I click Apply Settings$/) do
|
||||
on(InterlanguagePage).apply_settings_element.click
|
||||
end
|
||||
|
||||
When(/^I click Cancel$/) do
|
||||
on(InterlanguagePage).cancel_element.click
|
||||
end
|
||||
|
||||
Then(/^I click Enable input$/) do
|
||||
on(InterlanguagePage).enable_input_element.when_visible.click
|
||||
end
|
||||
|
||||
When(/^I click Fonts$/) do
|
||||
on(InterlanguagePage).fonts_settings
|
||||
end
|
||||
|
||||
When(/^I click Input$/) do
|
||||
on(InterlanguagePage).input_settings_element.click
|
||||
end
|
||||
|
||||
When(/^I click on the link to select Malayalam$/) do
|
||||
on(RandomPage).malayalam_link
|
||||
end
|
||||
|
||||
When(/^I click the button with the ellipsis$/) do
|
||||
on(InterlanguagePage).ellipsis_button_element.click
|
||||
end
|
||||
|
||||
When(/^I click the cog icon by Languages in the sidebar$/) do
|
||||
on(NoInterlanguagePage).cog_element.when_present.click
|
||||
end
|
||||
|
||||
When(/^I click X$/) do
|
||||
on(InterlanguagePage).x_element.click
|
||||
end
|
||||
|
||||
When(/^I navigate to the talk page$/) do
|
||||
on(InterlanguagePage).talk_element.click
|
||||
end
|
||||
|
||||
When(/^in the language filter I type (.+)$/) do |language_abbreviation|
|
||||
on(RandomPage).language_filter=language_abbreviation
|
||||
end
|
||||
|
||||
Then(/^a font selectbox appears$/) do
|
||||
on(InterlanguagePage).content_font_selectbox_element.should be_visible
|
||||
end
|
||||
|
||||
Then(/^I can disable input methods$/) do
|
||||
on(InterlanguagePage).disable_input_methods_element.when_visible.should be_visible
|
||||
end
|
||||
|
||||
Then(/^I can enable input methods$/) do
|
||||
on(InterlanguagePage).enable_input_element.when_visible.should be_visible
|
||||
end
|
||||
|
||||
Then(/^I can navigate back to Input Settings$/) do
|
||||
on(InterlanguagePage) do |page|
|
||||
page.back_to_input
|
||||
page.x_element.should be_visible
|
||||
end
|
||||
end
|
||||
|
||||
Then(/^I can navigate back to Language Settings$/) do
|
||||
on(InterlanguagePage) do |page|
|
||||
page.back_to_display
|
||||
page.x_element.should be_visible
|
||||
end
|
||||
end
|
||||
|
||||
When(/^I choose a different language for writing$/) do
|
||||
on(InterlanguagePage).non_default_language_element.when_visible.click
|
||||
end
|
||||
|
||||
Then(/^I do not see the Language Settings panel$/) do
|
||||
on(InterlanguagePage) do |page|
|
||||
page.language_button_element.should_not be_visible
|
||||
page.fonts_button_element.should_not be_visible
|
||||
page.default_language_button_element.should_not be_visible
|
||||
page.other_language_button_element.should_not be_visible
|
||||
end
|
||||
end
|
||||
|
||||
Then(/^I see Common Languages$/) do
|
||||
on(InterlanguagePage).language_list.should match Regexp.escape('Common languages')
|
||||
end
|
||||
|
||||
Then(/^I see Language Search$/) do
|
||||
on(InterlanguagePage).language_search_element.should be_visible
|
||||
end
|
||||
|
||||
Then(/^I see the anonymous Language Settings panel$/) do
|
||||
on(NoInterlanguagePage) do |page|
|
||||
page.language_button_element.when_present.should be_visible
|
||||
page.fonts_button_element.should be_visible
|
||||
end
|
||||
end
|
||||
|
||||
Then(/^I see the Language Settings panel$/) do
|
||||
on(NoInterlanguagePage) do |page|
|
||||
page.language_button_element.when_present.should be_visible
|
||||
page.fonts_button_element.should be_visible
|
||||
page.default_language_button_element.should be_visible
|
||||
page.other_language_button_element.should be_visible
|
||||
end
|
||||
end
|
||||
|
||||
Then(/^I see Worldwide$/) do
|
||||
on(InterlanguagePage) do |page|
|
||||
page.language_list.should match Regexp.escape('Worldwide')
|
||||
page.english_link_element.should be_visible
|
||||
end
|
||||
end
|
||||
|
||||
Then(/^the cog icon brings up anonymous Language Settings again$/) do
|
||||
step 'I click the cog icon by Languages in the sidebar'
|
||||
step 'I see the anonymous Language Settings panel'
|
||||
end
|
||||
|
||||
Then(/^the cog icon brings up Language Settings again$/) do
|
||||
step 'I click the cog icon by Languages in the sidebar'
|
||||
step 'I see the Language Settings panel'
|
||||
end
|
||||
|
||||
Then(/^a font selectbox appears for content$/) do
|
||||
on(InterlanguagePage).content_font_selectbox_element.should be_visible
|
||||
end
|
||||
|
||||
Then(/^I should see the How to use link near the Malayalam transliteration item$/) do
|
||||
on(InterlanguagePage).how_to_use_ml_transliteration_element.should be_visible
|
||||
end
|
||||
69
tests/browser/features/step_definitions/uls_ime_steps.rb
Normal file
69
tests/browser/features/step_definitions/uls_ime_steps.rb
Normal file
@@ -0,0 +1,69 @@
|
||||
# encoding: utf-8
|
||||
|
||||
Given(/^I am on a wiki in Kotava language$/) do
|
||||
visit(RandomPage)
|
||||
# Fake a Kotava Wiki
|
||||
@browser.execute_script( "mw.config.set( 'wgContentLanguage', 'avk' )" )
|
||||
end
|
||||
|
||||
When(/^I click on an input box$/) do
|
||||
on(RandomPage) do |page|
|
||||
page.search_input_element.click
|
||||
# For some reason click alone doesn't seem to trigger the ime indicator
|
||||
# when running tests
|
||||
page.search_input_element.send_keys ' '
|
||||
end
|
||||
end
|
||||
|
||||
When(/^I click on the input method indicator$/) do
|
||||
on(RandomPage).input_method_element.click
|
||||
end
|
||||
|
||||
When(/^I open the input method menu$/) do
|
||||
on(RandomPage) do |page|
|
||||
page.search_input_element.click
|
||||
page.search_input_element.send_keys ' '
|
||||
page.input_method_element.click
|
||||
end
|
||||
end
|
||||
|
||||
Then(/^I should see the input method indicator$/) do
|
||||
on(RandomPage).input_method_element.should be_visible
|
||||
end
|
||||
|
||||
Then(/^I should see input methods for (.+)/) do |language|
|
||||
on(RandomPage).input_method_ime_list_title.should == language
|
||||
end
|
||||
|
||||
Then(/^I should see a list of available input methods$/) do
|
||||
on(RandomPage).input_method_selector_menu_element.should be_visible
|
||||
end
|
||||
|
||||
Then(/^I should see a list of suggested languages$/) do
|
||||
on(RandomPage).input_method_language_list_element.should be_visible
|
||||
end
|
||||
|
||||
When(/^I choose (.+?) as the input language$/) do |language|
|
||||
on(RandomPage) do |page|
|
||||
page.more_languages
|
||||
page.language_filter = language
|
||||
page.language_filter_element.send_keys :return
|
||||
end
|
||||
end
|
||||
|
||||
When(/^I click on the Malayalam InScript 2 menu item$/) do
|
||||
on(RandomPage).uls_malayalam_inscript2_item_element.click
|
||||
end
|
||||
|
||||
When(/^I press Control\-M$/) do
|
||||
on(RandomPage).search_input_element.send_keys [:control, 'm']
|
||||
end
|
||||
|
||||
When(/^I go to another random page$/) do
|
||||
visit(RandomPage)
|
||||
end
|
||||
|
||||
Then(/^in it there must be an element with Malayalam text$/) do
|
||||
# 'input_method_enabled' alone only returns []
|
||||
on(RandomPage).input_method_enabled_element.text.should == 'ഇൻസ്ക്രിപ്റ്റ് 2'
|
||||
end
|
||||
11
tests/browser/features/step_definitions/uls_steps.rb
Normal file
11
tests/browser/features/step_definitions/uls_steps.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
When(/^I click language selector trigger element$/) do
|
||||
on(RandomPage).uls_trigger
|
||||
end
|
||||
|
||||
Then(/^I should see the Language selector$/) do
|
||||
on(RandomPage).language_settings_dialog_element.should be_visible
|
||||
end
|
||||
|
||||
Then(/^I should see a cog icon near the 'Languages' header$/) do
|
||||
on(RandomPage).cog_element.should exist
|
||||
end
|
||||
138
tests/browser/features/support/env.rb
Normal file
138
tests/browser/features/support/env.rb
Normal file
@@ -0,0 +1,138 @@
|
||||
# before all
|
||||
require 'bundler/setup'
|
||||
require 'page-object'
|
||||
require 'page-object/page_factory'
|
||||
require 'watir-webdriver'
|
||||
require 'yaml'
|
||||
|
||||
World(PageObject::PageFactory)
|
||||
|
||||
def browser(environment, test_name, saucelabs_username, saucelabs_key, language)
|
||||
if environment == :cloudbees
|
||||
sauce_browser(test_name, saucelabs_username, saucelabs_key, language)
|
||||
else
|
||||
local_browser(language)
|
||||
end
|
||||
end
|
||||
def environment
|
||||
if ENV['ENVIRONMENT'] == 'cloudbees'
|
||||
:cloudbees
|
||||
else
|
||||
:local
|
||||
end
|
||||
end
|
||||
def local_browser(language)
|
||||
if ENV['BROWSER_LABEL']
|
||||
browser_label = ENV['BROWSER_LABEL'].to_sym
|
||||
else
|
||||
browser_label = :firefox
|
||||
end
|
||||
|
||||
if language == 'default'
|
||||
Watir::Browser.new browser_label
|
||||
else
|
||||
if browser_label == :firefox
|
||||
profile = Selenium::WebDriver::Firefox::Profile.new
|
||||
elsif browser_label == :chrome
|
||||
profile = Selenium::WebDriver::Chrome::Profile.new
|
||||
else
|
||||
raise "Changing default language is currently supported only for Firefox and Chrome!"
|
||||
end
|
||||
profile['intl.accept_languages'] = language
|
||||
Watir::Browser.new browser_label, :profile => profile
|
||||
end
|
||||
end
|
||||
def sauce_api(json, saucelabs_username, saucelabs_key)
|
||||
%x{curl -H 'Content-Type:text/json' -s -X PUT -d '#{json}' http://#{saucelabs_username}:#{saucelabs_key}@saucelabs.com/rest/v1/#{saucelabs_username}/jobs/#{$session_id}}
|
||||
end
|
||||
def sauce_browser(test_name, saucelabs_username, saucelabs_key, language)
|
||||
config = YAML.load_file('config/config.yml')
|
||||
browser_label = config[ENV['BROWSER_LABEL']]
|
||||
|
||||
if language == 'default'
|
||||
caps = Selenium::WebDriver::Remote::Capabilities.send(browser_label['name'])
|
||||
elsif browser_label['name'] == 'firefox'
|
||||
profile = Selenium::WebDriver::Firefox::Profile.new
|
||||
profile['intl.accept_languages'] = language
|
||||
caps = Selenium::WebDriver::Remote::Capabilities.firefox(:firefox_profile => profile)
|
||||
elsif browser_label['name'] == 'chrome'
|
||||
profile = Selenium::WebDriver::Chrome::Profile.new
|
||||
profile['intl.accept_languages'] = language
|
||||
caps = Selenium::WebDriver::Remote::Capabilities.chrome('chrome.profile' => profile.as_json['zip'])
|
||||
end
|
||||
|
||||
caps.platform = browser_label['platform']
|
||||
caps.version = browser_label['version']
|
||||
caps[:name] = "#{test_name} #{ENV['JOB_NAME']}##{ENV['BUILD_NUMBER']}"
|
||||
|
||||
require 'selenium/webdriver/remote/http/persistent' # http_client
|
||||
browser = Watir::Browser.new(
|
||||
:remote,
|
||||
http_client: Selenium::WebDriver::Remote::Http::Persistent.new,
|
||||
url: "http://#{saucelabs_username}:#{saucelabs_key}@ondemand.saucelabs.com:80/wd/hub",
|
||||
desired_capabilities: caps)
|
||||
|
||||
browser.wd.file_detector = lambda do |args|
|
||||
# args => ['/path/to/file']
|
||||
str = args.first.to_s
|
||||
str if File.exist?(str)
|
||||
end
|
||||
|
||||
browser
|
||||
end
|
||||
def secret_yml_location
|
||||
secret_yml_locations = ['/private/wmf/', 'config/']
|
||||
secret_yml_locations.each do |secret_yml_location|
|
||||
return secret_yml_location if File.exists?("#{secret_yml_location}secret.yml")
|
||||
end
|
||||
nil
|
||||
end
|
||||
def test_name(scenario)
|
||||
if scenario.respond_to? :feature
|
||||
"#{scenario.feature.name}: #{scenario.name}"
|
||||
elsif scenario.respond_to? :scenario_outline
|
||||
"#{scenario.scenario_outline.feature.name}: #{scenario.scenario_outline.name}: #{scenario.name}"
|
||||
end
|
||||
end
|
||||
|
||||
config = YAML.load_file('config/config.yml')
|
||||
mediawiki_username = config['mediawiki_username']
|
||||
|
||||
unless secret_yml_location == nil
|
||||
secret = YAML.load_file("#{secret_yml_location}secret.yml")
|
||||
mediawiki_password = secret['mediawiki_password']
|
||||
end
|
||||
|
||||
if ENV['ENVIRONMENT'] == 'cloudbees'
|
||||
saucelabs_username = secret['saucelabs_username']
|
||||
saucelabs_key = secret['saucelabs_key']
|
||||
end
|
||||
|
||||
Before('@language') do |scenario|
|
||||
@language = true
|
||||
@saucelabs_username = saucelabs_username
|
||||
@saucelabs_key = saucelabs_key
|
||||
@scenario = scenario
|
||||
end
|
||||
Before('@login') do
|
||||
puts "secret.yml file at /private/wmf/ or config/ is required for tests tagged @login" if secret_yml_location == nil
|
||||
end
|
||||
|
||||
Before do |scenario|
|
||||
@config = config
|
||||
@does_not_exist_page_name = Random.new.rand.to_s
|
||||
@mediawiki_username = mediawiki_username
|
||||
@mediawiki_password = mediawiki_password
|
||||
unless @language
|
||||
@browser = browser(environment, test_name(scenario), saucelabs_username, saucelabs_key, 'default')
|
||||
$session_id = @browser.driver.instance_variable_get(:@bridge).session_id
|
||||
end
|
||||
end
|
||||
|
||||
After do |scenario|
|
||||
if environment == :cloudbees
|
||||
sauce_api(%Q{{"passed": #{scenario.passed?}}}, saucelabs_username, saucelabs_key)
|
||||
sauce_api(%Q{{"public": true}}, saucelabs_username, saucelabs_key)
|
||||
end
|
||||
@browser.close unless ENV['KEEP_BROWSER_OPEN'] == 'true'
|
||||
end
|
||||
@@ -0,0 +1,30 @@
|
||||
require "page-object"
|
||||
|
||||
module InterlanguagePageModule
|
||||
include PageObject
|
||||
|
||||
a(:add_links, id: 'wbc-linkToItem-link')
|
||||
span(:apply_settings, class: 'uls-settings-trigger')
|
||||
a(:back_to_display, text: 'Back to display settings')
|
||||
a(:back_to_input, text: 'Back to input settings')
|
||||
button(:cancel, class: 'button uls-display-settings-cancel')
|
||||
span(:cog, class: 'uls-settings-trigger')
|
||||
select_list(:content_font_selectbox, id: 'content-font-selector')
|
||||
button(:default_language_button, class: 'button uls-language-button down')
|
||||
button(:disable_input_methods, class: 'active green button uls-input-toggle-button')
|
||||
button(:ellipsis_button, class: 'uls-more-languages button')
|
||||
button(:enable_input, class: 'active green button uls-input-toggle-button')
|
||||
a(:english_link, text: 'English')
|
||||
button(:fonts_button, id: 'uls-display-settings-fonts-tab')
|
||||
button(:fonts_settings, id: 'uls-display-settings-fonts-tab')
|
||||
div(:input_settings, id: 'input-settings-block')
|
||||
button(:language_button, id: 'uls-display-settings-language-tab')
|
||||
div(:language_list, class: 'row uls-language-list lcd')
|
||||
text_field(:language_search, id: 'languagefilter')
|
||||
button(:non_default_language, class: 'button uls-language-button', index: 1)
|
||||
button(:other_language_button, class: 'button uls-language-button')
|
||||
a(:talk, text: 'Discussion')
|
||||
select_list(:ui_font_selectbox, id: 'ui-font-selector')
|
||||
span(:x, id: 'languagesettings-close')
|
||||
a(:how_to_use_ml_transliteration, href: 'https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Extension:UniversalLanguageSelector/Input_methods/ml-transliteration')
|
||||
end
|
||||
10
tests/browser/features/support/modules/url_module.rb
Normal file
10
tests/browser/features/support/modules/url_module.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
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
|
||||
11
tests/browser/features/support/pages/interlanguage_page.rb
Normal file
11
tests/browser/features/support/pages/interlanguage_page.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
class InterlanguagePage
|
||||
include PageObject
|
||||
|
||||
include URL
|
||||
def self.url
|
||||
URL.url('Boleyn_family')
|
||||
end
|
||||
page_url url
|
||||
|
||||
include InterlanguagePageModule
|
||||
end
|
||||
23
tests/browser/features/support/pages/login_page.rb
Normal file
23
tests/browser/features/support/pages/login_page.rb
Normal file
@@ -0,0 +1,23 @@
|
||||
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
|
||||
@@ -0,0 +1,11 @@
|
||||
class NoInterlanguagePage
|
||||
include PageObject
|
||||
|
||||
include URL
|
||||
def self.url
|
||||
URL.url('Think_Like_a_Cat')
|
||||
end
|
||||
page_url url
|
||||
|
||||
include InterlanguagePageModule
|
||||
end
|
||||
27
tests/browser/features/support/pages/random_page.rb
Normal file
27
tests/browser/features/support/pages/random_page.rb
Normal file
@@ -0,0 +1,27 @@
|
||||
class RandomPage
|
||||
include PageObject
|
||||
|
||||
include URL
|
||||
page_url URL.url('Special:Random')
|
||||
|
||||
span(:cog, title: 'Language settings')
|
||||
a(:create_a_book, text: 'Create a book')
|
||||
a(:download_as_pdf, text: 'Download as PDF')
|
||||
a(:download_the_file, text: 'Download the file')
|
||||
div(:input_method, class: 'imeselector imeselector-toggle')
|
||||
a(:input_method_enabled, class: 'ime-name imeselector-toggle')
|
||||
h3(:input_method_ime_list_title, class: 'ime-list-title')
|
||||
ul(:input_method_language_list, class: 'ime-language-list')
|
||||
div(:input_method_selector_menu, class: 'imeselector-menu')
|
||||
text_field(:language_filter, id: 'languagefilter')
|
||||
div(:language_settings_dialog, id: 'language-settings-dialog')
|
||||
li(:main_page, id: 'n-mainpage-description')
|
||||
a(:malayalam_link, title: 'Malayalam')
|
||||
a(:more_languages, class: 'ime-selector-more-languages')
|
||||
a(:print_export, text: 'Print/export')
|
||||
a(:printable_version, text: 'Printable version')
|
||||
li(:uls_malayalam_inscript2_item, data_ime_inputmethod: 'ml-inscript2')
|
||||
button(:search_button, id: 'searchButton')
|
||||
text_field(:search_input, id: 'searchInput')
|
||||
a(:uls_trigger, class: 'uls-trigger')
|
||||
end
|
||||
10
tests/browser/features/support/sauce.rb
Normal file
10
tests/browser/features/support/sauce.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
require 'cucumber/formatter/junit'
|
||||
|
||||
module Cucumber::Formatter
|
||||
class Sauce < Junit
|
||||
def format_exception(exception)
|
||||
sauce_job_page = "Sauce Labs job URL: http://saucelabs.com/jobs/#{$session_id}\n"
|
||||
([sauce_job_page] + ["#{exception.message} (#{exception.class})"] + exception.backtrace).join("\n")
|
||||
end
|
||||
end
|
||||
end
|
||||
12
tests/browser/features/uls.feature
Normal file
12
tests/browser/features/uls.feature
Normal file
@@ -0,0 +1,12 @@
|
||||
@sandbox.translatewiki.net
|
||||
Feature: Universal Language Selector User language selector
|
||||
|
||||
@test2.wikipedia.org
|
||||
Scenario: Open Language selector
|
||||
Given I visit a random page
|
||||
When I click language selector trigger element
|
||||
Then I should see the Language selector
|
||||
|
||||
Scenario: The cog icon is visible in the sidebar on an article
|
||||
Given I am at random page
|
||||
Then I should see a cog icon near the 'Languages' header
|
||||
14
tests/browser/features/uls_accept_language.feature
Normal file
14
tests/browser/features/uls_accept_language.feature
Normal file
@@ -0,0 +1,14 @@
|
||||
@ie6-bug @ie7-bug @ie8-bug @ie9-bug @language @sandbox.translatewiki.net
|
||||
Feature: Universal Language Selector Accept-Language
|
||||
|
||||
Scenario Outline: Accept-Language
|
||||
Given that my browser's accept language is <language>
|
||||
When I visit a random page
|
||||
Then link to the main page has text <text>
|
||||
|
||||
Examples:
|
||||
| language | text |
|
||||
| de | Hauptseite |
|
||||
| sr | Главна страна |
|
||||
| sr-ec | Главна страна |
|
||||
| sr-el | Glavna strana |
|
||||
74
tests/browser/features/uls_cog_sidebar_anon_user.feature
Normal file
74
tests/browser/features/uls_cog_sidebar_anon_user.feature
Normal file
@@ -0,0 +1,74 @@
|
||||
@en.wikipedia.beta.wmflabs.org @ie6-bug @ie7-bug
|
||||
Feature: ULS cog behaviour on the side-bar for logged in users
|
||||
|
||||
Scenario: Page without interlanguage links has cog icon and language selector
|
||||
Given I am on a page without interlanguage links
|
||||
When I click the cog icon by Languages in the sidebar
|
||||
Then I see the anonymous Language Settings panel
|
||||
|
||||
Scenario: Page with interlanguage links has cog icon and language selector
|
||||
Given I am on a page with interlanguage links
|
||||
When I click the cog icon by Languages in the sidebar
|
||||
Then I see the anonymous Language Settings panel
|
||||
|
||||
Scenario: Page without interlanguage links has cog icon and language selector on Talk page
|
||||
Given I am on a talk page without interlanguage links
|
||||
When I click the cog icon by Languages in the sidebar
|
||||
Then I see the anonymous Language Settings panel
|
||||
|
||||
Scenario: Page with interlanguage links has cog icon and language selector on Talk page
|
||||
Given I am on a talk page with interlanguage links
|
||||
When I click the cog icon by Languages in the sidebar
|
||||
Then I see the anonymous Language Settings panel
|
||||
|
||||
Scenario: Language Settings closes and opens with X button
|
||||
Given I navigate to the anonymous Language Settings panel
|
||||
When I click X
|
||||
Then I do not see the Language Settings panel
|
||||
And the cog icon brings up anonymous Language Settings again
|
||||
|
||||
Scenario: Language Settings closes and opens with Apply Settings buttons
|
||||
Given I navigate to the anonymous Language Settings panel
|
||||
When I click Apply Settings
|
||||
Then I do not see the Language Settings panel
|
||||
And the cog icon brings up anonymous Language Settings again
|
||||
|
||||
Scenario: Language Settings closes and opens with Cancel buttons
|
||||
Given I navigate to the anonymous Language Settings panel
|
||||
When I click Cancel
|
||||
Then I do not see the Language Settings panel
|
||||
And the cog icon brings up anonymous Language Settings again
|
||||
|
||||
Scenario: Input settings display
|
||||
Given I navigate to the anonymous Language Settings panel
|
||||
When I click Input
|
||||
Then I can enable input methods
|
||||
And I can disable input methods
|
||||
|
||||
Scenario: How to use link appears in the Input settings panel
|
||||
Given I navigate to the anonymous Language Settings panel
|
||||
When I click Input
|
||||
And I click Enable input
|
||||
And I click the button with the ellipsis
|
||||
And in the language filter I type ml
|
||||
And I click on the link to select Malayalam
|
||||
Then I should see the How to use link near the Malayalam transliteration item
|
||||
|
||||
Scenario: Fonts default settings and display
|
||||
Given I navigate to the anonymous Language Settings panel
|
||||
When I click Fonts
|
||||
Then a font selectbox appears
|
||||
|
||||
Scenario: Fonts not default settings and display
|
||||
Given I navigate to the anonymous Language Settings panel
|
||||
When I click Fonts
|
||||
Then a font selectbox appears for content
|
||||
|
||||
Scenario: More languages
|
||||
Given I navigate to the anonymous Language Settings panel
|
||||
And I click Input
|
||||
And I click Enable input
|
||||
When I click the button with the ellipsis
|
||||
Then I see Worldwide
|
||||
And I see Language Search
|
||||
And I can navigate back to Input Settings
|
||||
68
tests/browser/features/uls_cog_sidebar_logged_user.feature
Normal file
68
tests/browser/features/uls_cog_sidebar_logged_user.feature
Normal file
@@ -0,0 +1,68 @@
|
||||
@en.wikipedia.beta.wmflabs.org @login @ie6-bug @ie7-bug
|
||||
Feature: ULS cog behaviour on the side-bar for logged in users
|
||||
|
||||
Background:
|
||||
Given I am logged in
|
||||
|
||||
Scenario: Page without interlanguage links has cog icon and language selector
|
||||
Given I am on a page without interlanguage links
|
||||
When I click the cog icon by Languages in the sidebar
|
||||
Then I see the Language Settings panel
|
||||
|
||||
Scenario: Page with interlanguage links has cog icon and language selector
|
||||
Given I am on a page with interlanguage links
|
||||
When I click the cog icon by Languages in the sidebar
|
||||
Then I see the Language Settings panel
|
||||
|
||||
Scenario: Page without interlanguage links has cog icon and language selector on Talk page
|
||||
Given I am on a talk page without interlanguage links
|
||||
When I click the cog icon by Languages in the sidebar
|
||||
Then I see the Language Settings panel
|
||||
|
||||
Scenario: Page with interlanguage links has cog icon and language selector on Talk page
|
||||
Given I am on a talk page with interlanguage links
|
||||
When I click the cog icon by Languages in the sidebar
|
||||
Then I see the Language Settings panel
|
||||
|
||||
Scenario: Language Settings closes and opens with X button
|
||||
Given I navigate to the Language Settings panel
|
||||
When I click X
|
||||
Then I do not see the Language Settings panel
|
||||
And the cog icon brings up Language Settings again
|
||||
|
||||
Scenario: Language Settings closes and opens with Apply Settings buttons
|
||||
Given I navigate to the Language Settings panel
|
||||
When I click Apply Settings
|
||||
Then I do not see the Language Settings panel
|
||||
And the cog icon brings up Language Settings again
|
||||
|
||||
Scenario: Language Settings closes and opens with Cancel buttons
|
||||
Given I navigate to the Language Settings panel
|
||||
When I click Cancel
|
||||
Then I do not see the Language Settings panel
|
||||
And the cog icon brings up Language Settings again
|
||||
|
||||
Scenario: Input settings display
|
||||
Given I navigate to the Language Settings panel
|
||||
When I click Input
|
||||
Then I can enable input methods
|
||||
And I can disable input methods
|
||||
|
||||
Scenario: Fonts default settings and display
|
||||
Given I navigate to the Language Settings panel
|
||||
When I click Fonts
|
||||
Then a font selectbox appears
|
||||
|
||||
Scenario: Fonts not default settings and display
|
||||
Given I navigate to the Language Settings panel
|
||||
When I choose a different language for writing
|
||||
And I click Fonts
|
||||
Then a font selectbox appears for content
|
||||
|
||||
Scenario: More languages
|
||||
Given I navigate to the Language Settings panel
|
||||
When I click the button with the ellipsis
|
||||
Then I see Common Languages
|
||||
And I see Worldwide
|
||||
And I see Language Search
|
||||
And I can navigate back to Language Settings
|
||||
51
tests/browser/features/uls_ime.feature
Normal file
51
tests/browser/features/uls_ime.feature
Normal file
@@ -0,0 +1,51 @@
|
||||
@commons.wikimedia.beta.wmflabs.org
|
||||
Feature: Universal Language Selector input method engine
|
||||
|
||||
User is able to select among different input methods via a menu which is
|
||||
activated by the input method indicator. User can type with selected input
|
||||
method in different input fields and temporarily activate and deactivate the
|
||||
input method.
|
||||
|
||||
Scenario: Input method indicator is shown
|
||||
|
||||
The input method indicator is shown when input field gets a focus.
|
||||
|
||||
Given I am at random page
|
||||
When I click on an input box
|
||||
Then I should see the input method indicator
|
||||
|
||||
Scenario: Input method menu
|
||||
|
||||
Input method menu is shown when user clicks the input method indicator.
|
||||
|
||||
Given I am at random page
|
||||
When I click on an input box
|
||||
And I click on the input method indicator
|
||||
Then I should see input methods for English
|
||||
And I should see a list of available input methods
|
||||
And I should see a list of suggested languages
|
||||
|
||||
Scenario: Unsupported input language
|
||||
|
||||
User visits a wiki with content language that does not have have an input
|
||||
method.
|
||||
|
||||
Given I am on a wiki in Kotava language
|
||||
When I open the input method menu
|
||||
Then I should see input methods for Kotava
|
||||
|
||||
Scenario: Sticky input methods
|
||||
|
||||
Chosen input method selection persists across page loads.
|
||||
|
||||
Given I am at random page
|
||||
When I open the input method menu
|
||||
And I choose ml as the input language
|
||||
And I open the input method menu
|
||||
And I click on the Malayalam InScript 2 menu item
|
||||
And I press Control-M
|
||||
And I go to another random page
|
||||
And I click on an input box
|
||||
And I press Control-M
|
||||
Then I should see the input method indicator
|
||||
And in it there must be an element with Malayalam text
|
||||
Reference in New Issue
Block a user