Edit area monospace font test

bug: 53734
Change-Id: Ia4abf6a47a18605c5a28f6f57aa8841584285f37
This commit is contained in:
Amir E. Aharoni
2013-10-11 00:11:23 +03:00
parent 35ac3b972a
commit eff4f8960d
7 changed files with 94 additions and 6 deletions

View File

@@ -9,11 +9,14 @@ end
When(/^I open "(.*?)" panel of language settings$/) do |panel|
on(PanelPage) do |page|
# These can be of two different type of elements, which PageObjects do not like.
if uls_position() == 'interlanguage'
page.trigger_cog_element.when_visible.click
elsif uls_position() == 'personal'
page.trigger_personal_element.when_visible.click
# Open the ULS panel if it's not open already
if !page.language_settings_dialog_element.visible?
# These can be of two different type of elements, which PageObjects do not like.
if uls_position() == 'interlanguage'
page.trigger_cog_element.when_visible.click
elsif uls_position() == 'personal'
page.trigger_personal_element.when_visible.click
end
end
case panel

View File

@@ -0,0 +1,15 @@
When(/^I set the editing fonts to "(.*?)"$/) do |editing_font|
visit(PreferencesPage) do |page|
page.preftab_editing_element.click
page.pref_editfont_element.select_value editing_font
page.save_element.click
end
end
When(/^I edit a page$/) do
visit(NoInterlanguagePage).edit_link_element.click
end
Then(/^I should see the edit area text being displayed using "(.*?)" font$/) do |font|
on(EditPage).editarea_element.style("font-family").should match(/^#{font}/)
end

View File

@@ -12,10 +12,11 @@ module InterlanguagePageModule
a(:english_link, text: 'English')
a(:hindi_link, text: 'हिन्दी')
div(:input_settings, id: 'input-settings-block')
div(:language_list, class: 'row uls-language-list lcd')
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)
a(:talk, text: 'Discussion')
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')
a(:edit_link, css: '#ca-edit a')
end

View File

@@ -0,0 +1,5 @@
class EditPage
include PageObject
textarea(:editarea, id: 'wpTextbox1')
end

View File

@@ -7,6 +7,7 @@ class PanelPage
div(:uls, class: 'uls-menu')
span(:uls_button_close, id: 'uls-close')
div(:language_settings_dialog, id: 'language-settings-dialog')
div(:panel_display, id: 'display-settings-block')
div(:panel_input, id: 'input-settings-block')
button(:panel_fonts, id: 'uls-display-settings-fonts-tab')

View File

@@ -6,4 +6,7 @@ class PreferencesPage
select(:set_interface_language, id: 'mw-input-wplanguage')
button(:save, id: 'prefcontrol')
a(:preftab_editing, id: 'preftab-editing')
select(:pref_editfont, id: 'mw-input-wpeditfont')
end

View File

@@ -0,0 +1,60 @@
@login @commons.wikimedia.beta.wmflabs.org
Feature: Font preferences respected in different languages
If a user has an edit font preferences respect that preference.
If a user has no edit font preference, but the UI language has a monospace defined,
the edit area has monospace font, given there is no ULS webfont preference for the user.
If a user has no edit font preference, but the UI language has no monospace defined,
the edit area has the font according to the ULS webfont preferences.
Background:
# This is needed to reset the fonts for the relevant languages.
# There's no better way to reset ULS preferences.
Given I am logged in
When I open "Language" panel of language settings
And I click the button with the ellipsis
And I use the panel to change my interface language to "German"
And I open "Fonts" panel of language settings
# This is the System font
And I select "Systemschriftart" font for the content language for the live preview
And I select "Systemschriftart" font for the interface language for the live preview
And I open "Language" panel of language settings
And I click the button with the ellipsis
And I use the panel to change my interface language to "English"
And I apply the changes
And I set the editing fonts to "default"
Scenario: Edit area fonts should not change on UI language change if the user preferences for edit area font are set
When I set the editing fonts to "monospace"
And I edit a page
Then I should see the edit area text being displayed using "monospace" font
And I set the editing fonts to "default"
Scenario: Edit area should use the fonts selected by the user from ULS for a language
When I open "Fonts" panel of language settings
And I select "OpenDyslexic" font for the content language for the live preview
And I apply the changes
And I edit a page
Then I should see the edit area text being displayed using "OpenDyslexic" font
Scenario: Edit area should use the ULS selected fonts when content language has a ULS font selection
When I open "Language" panel of language settings
And I click the button with the ellipsis
And I use the panel to change my interface language to "German"
And I open "Fonts" panel of language settings
And I select "OpenDyslexic" font for the content language for the live preview
And I apply the changes
And I edit a page
Then I should see the edit area text being displayed using "OpenDyslexic" font
Scenario: Edit area should use the system default fonts when content language does not have any ULS font selection
When I open "Language" panel of language settings
And I click the button with the ellipsis
And I use the panel to change my interface language to "German"
And I apply the changes
And I edit a page
Then I should see the edit area text being displayed using "monospace" font
Scenario: Edit area should use browser's default Monospace font for languages that have a default monospace font (Latin, Cyrillic, Hebrew etc.)
When I edit a page
Then I should see the edit area text being displayed using "monospace" font