diff --git a/tests/browser/features/font_selection.feature b/tests/browser/features/font_selection.feature index c70b2ed2..55adf0ba 100644 --- a/tests/browser/features/font_selection.feature +++ b/tests/browser/features/font_selection.feature @@ -21,7 +21,7 @@ Feature: Font selection 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 125dbc7a..bf699d86 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 @@ end 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 2fe3d5a6..92a061a7 100644 --- a/tests/browser/features/step_definitions/panel_steps.rb +++ b/tests/browser/features/step_definitions/panel_steps.rb @@ -41,30 +41,15 @@ end 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 @@ When(/^I apply the changes$/) do 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 786c0b80..87de00f9 100644 --- a/tests/browser/features/support/pages/panel_page.rb +++ b/tests/browser/features/support/pages/panel_page.rb @@ -31,6 +31,8 @@ class PanelPage 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')