Moved ULS tests from browsertests repository
Change-Id: I4f4a4c5530ad7e5dff70171b59a589dc98b1ef29
This commit is contained in:
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
|
||||
Reference in New Issue
Block a user