Nikerabbit has uploaded a new change for review.

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


Change subject: More refactoring ULS font selection tests
......................................................................

More refactoring ULS font selection tests

Change-Id: I6595e279657948265c45407be2c01a4587fdbc94
---
M tests/browser/features/font_selection.feature
M tests/browser/features/step_definitions/font_selection_steps.rb
M tests/browser/features/step_definitions/panel_steps.rb
M tests/browser/features/support/pages/panel_page.rb
4 files changed, 20 insertions(+), 30 deletions(-)


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

diff --git a/tests/browser/features/font_selection.feature 
b/tests/browser/features/font_selection.feature
index c70b2ed..55adf0b 100644
--- a/tests/browser/features/font_selection.feature
+++ b/tests/browser/features/font_selection.feature
@@ -21,7 +21,7 @@
       And a font selector for content language appears
 
   Scenario: Discarding live preview of content font
-      And I select "OpenDyslexic" font for the content language for the live 
preview
+    When I select "OpenDyslexic" font for the content language for the live 
preview
       And I close the panel to discard the changes
     Then the active content font must be the same as font prior to the preview
       # System is the default value for English and German
diff --git a/tests/browser/features/step_definitions/font_selection_steps.rb 
b/tests/browser/features/step_definitions/font_selection_steps.rb
index 125dbc7..40761d5 100644
--- a/tests/browser/features/step_definitions/font_selection_steps.rb
+++ b/tests/browser/features/step_definitions/font_selection_steps.rb
@@ -9,3 +9,13 @@
 When(/^I open fonts panel of language settings$/) do
        on(PanelPage).panel_fonts_element.click
 end
+
+Then(/^the active content font must be the same as font prior to the 
preview$/) do
+       on(PanelPage).get_content_font.should === @original_content_font
+end
+
+Then(/^the selected content font must be "(.*?)"$/) do |font|
+       step 'I open display settings'
+       step 'I open fonts panel of language settings'
+       on(PanelPage).selected_content_font.should == font
+end
diff --git a/tests/browser/features/step_definitions/panel_steps.rb 
b/tests/browser/features/step_definitions/panel_steps.rb
index 2fe3d5a..c1e5d7d 100644
--- a/tests/browser/features/step_definitions/panel_steps.rb
+++ b/tests/browser/features/step_definitions/panel_steps.rb
@@ -41,30 +41,15 @@
 
 
 When(/^I close the panel to discard the changes$/) do
-       on(PanelPage) do |page|
-               page.panel_button_close_element.click
-               # Also close the ULS language selection if open
-               if uls_position() == 'personal'
-                       page.uls_button_close_element.when_visible.click
-               end
-       end
+       on(PanelPage).panel_button_close_element.click
 end
 
-Then(/^the active (.*?) font must be the same as font prior to the preview$/) 
do |type|
-       case type
-       when "content"
-               on(PanelPage).get_content_font.should === @original_content_font
-       when "interface"
-               on(PanelPage).get_interface_font.should === 
@original_interface_font
-       else
-               pending
-       end
+Then(/^the active interface font must be the same as font prior to the 
preview$/) do
+       on(PanelPage).get_interface_font.should === @original_interface_font
 end
 
-Then(/^the selected (.*?) font must be "(.*?)"$/) do |type, font|
-       if type == 'interface'
-               type = 'ui'
-       end
+Then(/^the selected interface font must be "(.*?)"$/) do |font|
+       type = 'ui'
        step 'I open "Fonts" panel of language settings'
        Selenium::WebDriver::Support::Select.new(
                @browser.driver.find_element(:id, "#{type}-font-selector")
@@ -78,15 +63,8 @@
        sleep 4
 end
 
-Then(/^the (.*) font must be changed to the "(.*?)" font$/) do |type, font|
-       case type
-       when "content"
-               on(PanelPage).get_content_font.should match("^#{font}")
-       when "interface"
-               on(PanelPage).get_interface_font.should match("^#{font}")
-       else
-               pending
-       end
+Then(/^the interface font must be changed to the "(.*?)" font$/) do |font|
+       on(PanelPage).get_interface_font.should match("^#{font}")
 end
 
 Then(/^I can disable input methods$/) do
diff --git a/tests/browser/features/support/pages/panel_page.rb 
b/tests/browser/features/support/pages/panel_page.rb
index 786c0b8..87de00f 100644
--- a/tests/browser/features/support/pages/panel_page.rb
+++ b/tests/browser/features/support/pages/panel_page.rb
@@ -31,6 +31,8 @@
        span(:trigger_cog, class: 'uls-settings-trigger')
        a(:trigger_personal, class: 'uls-trigger')
 
+       select(:selected_content_font, id: 'content-font-selector')
+
        select(:select_font_for_interface, id: 'ui-font-selector')
        select(:select_font_for_content, id: 'content-font-selector')
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6595e279657948265c45407be2c01a4587fdbc94
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <[email protected]>

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

Reply via email to