Refactoring Input method menu is not offscreen
Change-Id: Iff83160eb6c99d6109098e431341240a21274665
This commit is contained in:
committed by
Amir E. Aharoni
parent
135d1bc2b7
commit
967683c98e
@@ -52,31 +52,15 @@ input method.
|
|||||||
Then I should see the input method indicator
|
Then I should see the input method indicator
|
||||||
And in it there must be an element with Malayalam text
|
And in it there must be an element with Malayalam text
|
||||||
|
|
||||||
@login @reset-preferences-after
|
@commons.wikimedia.beta.wmflabs.org
|
||||||
Scenario: Input method menu is not offscreen
|
Scenario Outline: Input method menu is completely visible
|
||||||
|
Given I visit a random page with <skin> skin and <language> as the interface language
|
||||||
Input method indicator is not offscreen for English and RTL languages.
|
When I open the input method menu
|
||||||
|
|
||||||
Given I am logged in
|
|
||||||
Given I set "English" as the interface language
|
|
||||||
When I visit page in Vector skin
|
|
||||||
And I open the input method menu
|
|
||||||
Then I should see the input method menu is not offscreen
|
Then I should see the input method menu is not offscreen
|
||||||
|
|
||||||
Given I am logged in
|
Examples:
|
||||||
Given I set "Hebrew" as the interface language
|
| skin | language |
|
||||||
When I visit page in Monobook skin
|
| Vector | English |
|
||||||
And I open the input method menu
|
| Vector | Hebrew |
|
||||||
Then I should see the input method menu is not offscreen
|
| Monobook | English |
|
||||||
|
#| Monobook | Hebrew |
|
||||||
Given I am logged in
|
|
||||||
Given I set "English" as the interface language
|
|
||||||
When I visit page in Monobook skin
|
|
||||||
And I open the input method menu
|
|
||||||
Then I should see the input method menu is not offscreen
|
|
||||||
|
|
||||||
Given I am logged in
|
|
||||||
Given I set "Hebrew" as the interface language
|
|
||||||
When I visit page in Vector skin
|
|
||||||
And I open the input method menu
|
|
||||||
Then I should see the input method menu is not offscreen
|
|
||||||
|
|||||||
@@ -63,20 +63,10 @@ Then(/^in it there must be an element with Malayalam text$/) do
|
|||||||
on(IMEPage).input_method_enabled_element.text.should == 'ഇൻസ്ക്രിപ്റ്റ് 2'
|
on(IMEPage).input_method_enabled_element.text.should == 'ഇൻസ്ക്രിപ്റ്റ് 2'
|
||||||
end
|
end
|
||||||
|
|
||||||
When(/^I visit page in Vector skin$/) do
|
Given(/^I visit a random page with (.+) skin and (.+) as the interface language$/) do |skin, language|
|
||||||
visit(PanelPage, :using_params => {:extra => "useskin=vector"})
|
visit(IMEPage, :using_params => {:extra => "useskin=#{skin.downcase}&uselang=#{on(IMEPage).language_to_code(language)}"})
|
||||||
end
|
|
||||||
|
|
||||||
When(/^I visit page in Monobook skin$/) do
|
|
||||||
visit(PanelPage, :using_params => {:extra => "useskin=monobook"})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
Then(/^I should see the input method menu is not offscreen$/) do
|
Then(/^I should see the input method menu is not offscreen$/) do
|
||||||
@browser.execute_script( "
|
on(IMEPage).ime_input_method_menu_onscreen?.should == true
|
||||||
var $selectorMenu = $( '.imeselector-menu' ),
|
|
||||||
menuLeft = $selectorMenu.offset().left,
|
|
||||||
menuRight = menuLeft + $selectorMenu.width();
|
|
||||||
|
|
||||||
return ( menuLeft >= 0 && menuRight <= $( window ).width() );
|
|
||||||
" ).should == true
|
|
||||||
end
|
end
|
||||||
|
|||||||
20
tests/browser/features/support/modules/language_module.rb
Normal file
20
tests/browser/features/support/modules/language_module.rb
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
module LanguageModule
|
||||||
|
include PageObject
|
||||||
|
|
||||||
|
def language_to_code(language)
|
||||||
|
case language
|
||||||
|
when 'German'
|
||||||
|
'de'
|
||||||
|
when 'English'
|
||||||
|
'en'
|
||||||
|
when 'Finnish'
|
||||||
|
'fi'
|
||||||
|
when 'Hebrew'
|
||||||
|
'he'
|
||||||
|
when 'Hindi'
|
||||||
|
'hi'
|
||||||
|
else
|
||||||
|
pending
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,5 +1,9 @@
|
|||||||
class IMEPage
|
class IMEPage
|
||||||
include PageObject
|
include PageObject
|
||||||
|
include LanguageModule
|
||||||
|
|
||||||
|
include URL
|
||||||
|
page_url URL.url('?<%=params[:extra]%>')
|
||||||
|
|
||||||
div(:input_method, class: 'imeselector imeselector-toggle')
|
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')
|
||||||
@@ -10,4 +14,13 @@ class IMEPage
|
|||||||
li(:malayalam_inscript2, data_ime_inputmethod: 'ml-inscript2')
|
li(:malayalam_inscript2, data_ime_inputmethod: 'ml-inscript2')
|
||||||
a(:more_languages, class: 'ime-selector-more-languages')
|
a(:more_languages, class: 'ime-selector-more-languages')
|
||||||
text_field(:search_input, id: 'searchInput')
|
text_field(:search_input, id: 'searchInput')
|
||||||
|
|
||||||
|
def ime_input_method_menu_onscreen?
|
||||||
|
@browser.execute_script( "
|
||||||
|
var $selectorMenu = $( '.imeselector-menu' ),
|
||||||
|
menuLeft = $selectorMenu.offset().left,
|
||||||
|
menuRight = menuLeft + $selectorMenu.width();
|
||||||
|
|
||||||
|
return ( menuLeft >= 0 && menuRight <= $( window ).width() );" )
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
class PanelPage
|
class PanelPage
|
||||||
include PageObject
|
include PageObject
|
||||||
|
include LanguageModule
|
||||||
|
|
||||||
include URL
|
include URL
|
||||||
page_url URL.url('?<%=params[:extra]%>')
|
page_url URL.url('?<%=params[:extra]%>')
|
||||||
@@ -52,23 +53,6 @@ class PanelPage
|
|||||||
font('body')
|
font('body')
|
||||||
end
|
end
|
||||||
|
|
||||||
def language_to_code(language)
|
|
||||||
case language
|
|
||||||
when 'German'
|
|
||||||
'de'
|
|
||||||
when 'English'
|
|
||||||
'en'
|
|
||||||
when 'Finnish'
|
|
||||||
'fi'
|
|
||||||
when 'Hebrew'
|
|
||||||
'he'
|
|
||||||
when 'Hindi'
|
|
||||||
'hi'
|
|
||||||
else
|
|
||||||
pending
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
def font(selector)
|
def font(selector)
|
||||||
@browser.execute_script( "return $( '#{selector}' ).css( 'font-family' );" )
|
@browser.execute_script( "return $( '#{selector}' ).css( 'font-family' );" )
|
||||||
|
|||||||
Reference in New Issue
Block a user