Merge "Refactoring ime tests"

This commit is contained in:
jenkins-bot
2013-10-29 14:04:41 +00:00
committed by Gerrit Code Review
4 changed files with 21 additions and 20 deletions

View File

@@ -5,6 +5,7 @@ activated by the input method indicator. User can type with selected input
method in different input fields and temporarily activate and deactivate the method in different input fields and temporarily activate and deactivate the
input method. input method.
@commons.wikimedia.beta.wmflabs.org
Scenario: Input method indicator is shown Scenario: Input method indicator is shown
The input method indicator is shown when input field gets a focus. The input method indicator is shown when input field gets a focus.
@@ -13,6 +14,7 @@ input method.
When I click on an input box When I click on an input box
Then I should see the input method indicator Then I should see the input method indicator
@commons.wikimedia.beta.wmflabs.org
Scenario: Input method menu Scenario: Input method menu
Input method menu is shown when user clicks the input method indicator. Input method menu is shown when user clicks the input method indicator.
@@ -24,6 +26,7 @@ input method.
And I should see a list of available input methods And I should see a list of available input methods
And I should see a list of suggested languages And I should see a list of suggested languages
@commons.wikimedia.beta.wmflabs.org
Scenario: Unsupported input language Scenario: Unsupported input language
User visits a wiki with content language that does not have have an input User visits a wiki with content language that does not have have an input

View File

@@ -7,40 +7,34 @@ Given(/^I am on a wiki in Kotava language$/) do
end end
When(/^I click on an input box$/) do When(/^I click on an input box$/) do
on(RandomPage) do |page| on(IMEPage).search_input_element.click
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 end
When(/^I click on the input method indicator$/) do When(/^I click on the input method indicator$/) do
on(RandomPage).input_method_element.when_present.click on(IMEPage).input_method_element.when_present.click
end end
When(/^I open the input method menu$/) do When(/^I open the input method menu$/) do
on(RandomPage) do |page| step 'I click on an input box'
page.search_input_element.fire_event "onfocus" pending('Bug in ULS with unsupported languages like avk') do
page.search_input_element.click on(IMEPage).input_method_element.when_present.click
page.input_method_element.when_present.click
end end
end end
Then(/^I should see the input method indicator$/) do Then(/^I should see the input method indicator$/) do
on(RandomPage).input_method_element.when_present.should be_visible on(IMEPage).input_method_element.when_present.should be_visible
end end
Then(/^I should see input methods for (.+)/) do |language| Then(/^I should see input methods for (.+)/) do |language|
on(RandomPage).input_method_ime_list_title.should == language on(IMEPage).input_method_ime_list_title.should == language
end end
Then(/^I should see a list of available input methods$/) do Then(/^I should see a list of available input methods$/) do
on(RandomPage).input_method_selector_menu_element.should be_visible on(IMEPage).input_method_selector_menu_element.should be_visible
end end
Then(/^I should see a list of suggested languages$/) do Then(/^I should see a list of suggested languages$/) do
on(RandomPage).input_method_language_list_element.should be_visible on(IMEPage).input_method_language_list_element.should be_visible
end end
When(/^I choose (.+?) as the input language$/) do |language| When(/^I choose (.+?) as the input language$/) do |language|

View File

@@ -0,0 +1,9 @@
class IMEPage
include PageObject
div(:input_method, class: 'imeselector 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(:search_input, id: 'searchInput')
end

View File

@@ -8,11 +8,7 @@ class RandomPage
a(:create_a_book, text: 'Create a book') a(:create_a_book, text: 'Create a book')
a(:download_as_pdf, text: 'Download as PDF') a(:download_as_pdf, text: 'Download as PDF')
a(:download_the_file, text: 'Download the file') a(:download_the_file, text: 'Download the file')
div(:input_method, class: 'imeselector imeselector-toggle')
a(:input_method_enabled, class: 'ime-name 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') text_field(:language_filter, id: 'languagefilter')
li(:main_page, id: 'n-mainpage-description') li(:main_page, id: 'n-mainpage-description')
a(:malayalam_link, title: 'Malayalam') a(:malayalam_link, title: 'Malayalam')
@@ -21,6 +17,5 @@ class RandomPage
a(:printable_version, text: 'Printable version') a(:printable_version, text: 'Printable version')
li(:uls_malayalam_inscript2_item, data_ime_inputmethod: 'ml-inscript2') li(:uls_malayalam_inscript2_item, data_ime_inputmethod: 'ml-inscript2')
button(:search_button, id: 'searchButton') button(:search_button, id: 'searchButton')
text_field(:search_input, id: 'searchInput')
a(:uls_trigger, class: 'uls-trigger') a(:uls_trigger, class: 'uls-trigger')
end end