Amire80 has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/89624


Change subject: WIP: Edit area monospace font test
......................................................................

WIP: Edit area monospace font test

Not complete, don't merge

bug: 53734
Change-Id: Ia4abf6a47a18605c5a28f6f57aa8841584285f37
---
M tests/browser/features/step_definitions/panel_steps.rb
M tests/browser/features/support/modules/interlanguage_module.rb
M tests/browser/features/support/pages/panel_page.rb
M tests/browser/features/support/pages/preferences_page.rb
A tests/browser/features/textarea_font.feature
5 files changed, 83 insertions(+), 6 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector 
refs/changes/24/89624/1

diff --git a/tests/browser/features/step_definitions/panel_steps.rb 
b/tests/browser/features/step_definitions/panel_steps.rb
index 4515321..b40e7ab 100644
--- a/tests/browser/features/step_definitions/panel_steps.rb
+++ b/tests/browser/features/step_definitions/panel_steps.rb
@@ -9,11 +9,13 @@
 
 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
+               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
diff --git a/tests/browser/features/support/modules/interlanguage_module.rb 
b/tests/browser/features/support/modules/interlanguage_module.rb
index 2088ec6..f4609e6 100644
--- a/tests/browser/features/support/modules/interlanguage_module.rb
+++ b/tests/browser/features/support/modules/interlanguage_module.rb
@@ -12,10 +12,11 @@
   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
diff --git a/tests/browser/features/support/pages/panel_page.rb 
b/tests/browser/features/support/pages/panel_page.rb
index 8f7905e..ac8ead4 100644
--- a/tests/browser/features/support/pages/panel_page.rb
+++ b/tests/browser/features/support/pages/panel_page.rb
@@ -7,6 +7,7 @@
        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')
diff --git a/tests/browser/features/support/pages/preferences_page.rb 
b/tests/browser/features/support/pages/preferences_page.rb
index e81c74d..78245d9 100644
--- a/tests/browser/features/support/pages/preferences_page.rb
+++ b/tests/browser/features/support/pages/preferences_page.rb
@@ -6,4 +6,7 @@
 
        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
diff --git a/tests/browser/features/textarea_font.feature 
b/tests/browser/features/textarea_font.feature
new file mode 100644
index 0000000..a92e0b0
--- /dev/null
+++ b/tests/browser/features/textarea_font.feature
@@ -0,0 +1,70 @@
+@login @reset-preferences-after @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:
+    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
+      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
+
+  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 random page
+    Then I should see the edit area text being displayed using "monospace" font
+
+  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 edit a random page
+    Then I should see the edit area text being displayed using "OpenDyslexic" 
font
+
+  Scenario: Edit area should use the appropriate 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 random page
+    Then I should see the edit area text being displayed using "OpenDyslexic" 
font
+
+  Scenario: Edit area should use the appropriate 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 random page
+    Then I should see the edit area text being displayed using 
"<systasfdasdfasdfem>" font
+
+  Scenario: Edit area should use the appropriate ULS fonts when content 
language has a ULS font and UI language does not
+    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 random page
+    Then I should see the edit area using the selected ULS font for the 
content language applied on the <lang> attribute of the <textarea>
+
+  Scenario: Edit area should use browser's default Monospace font for 
languages that have a monospace font defined (applicable only for languages 
using the Latin script)
+    When I edit a random page
+    Then I should see the edit area text being displayed using "<monospace>" 
font
+
+  Scenario: Edit area should use the font inherited from the font-family of 
the html body element for the page for languages that do not have a monospace 
font (applicable only for languages using non-latin script (possible exception 
of Russian; Needs: A language as a specific value)
+    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 "Hindi"
+      And I apply the changes
+      And I edit a random page
+    Then I should see the edit area text being displayed using 
"<non-monospace>" font

-- 
To view, visit https://gerrit.wikimedia.org/r/89624
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia4abf6a47a18605c5a28f6f57aa8841584285f37
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector
Gerrit-Branch: master
Gerrit-Owner: Amire80 <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to