Refactoring ime tests

Scenarios:
* Input method menu
* Input method indicator is shown
* Unsupported input language (pending)

Added IMEPage

Change-Id: I1f68d177bd05baca6ae8da97364b81a4d851b8b6
This commit is contained in:
Niklas Laxström
2013-10-28 12:41:06 +02:00
parent e3c93d17fa
commit 52372f5857
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
input method.
@commons.wikimedia.beta.wmflabs.org
Scenario: Input method indicator is shown
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
Then I should see the input method indicator
@commons.wikimedia.beta.wmflabs.org
Scenario: Input method menu
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 suggested languages
@commons.wikimedia.beta.wmflabs.org
Scenario: Unsupported input language
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
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
on(IMEPage).search_input_element.click
end
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
When(/^I open the input method menu$/) do
on(RandomPage) do |page|
page.search_input_element.fire_event "onfocus"
page.search_input_element.click
page.input_method_element.when_present.click
step 'I click on an input box'
pending('Bug in ULS with unsupported languages like avk') do
on(IMEPage).input_method_element.when_present.click
end
end
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
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
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
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
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(: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')
li(:main_page, id: 'n-mainpage-description')
a(:malayalam_link, title: 'Malayalam')
@@ -21,6 +17,5 @@ class RandomPage
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