More refactoring ULS font selection tests

Change-Id: I6595e279657948265c45407be2c01a4587fdbc94
This commit is contained in:
Niklas Laxström
2013-10-23 13:00:04 +03:00
committed by Zeljko Filipin
parent a5c7b43282
commit 48a5772e9e
4 changed files with 20 additions and 30 deletions

View File

@@ -21,7 +21,7 @@ Feature: Font selection
And a font selector for content language appears And a font selector for content language appears
Scenario: Discarding live preview of content font 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 And I close the panel to discard the changes
Then the active content font must be the same as font prior to the preview Then the active content font must be the same as font prior to the preview
# System is the default value for English and German # System is the default value for English and German

View File

@@ -9,3 +9,13 @@ end
When(/^I open fonts panel of language settings$/) do When(/^I open fonts panel of language settings$/) do
on(PanelPage).panel_fonts_element.click on(PanelPage).panel_fonts_element.click
end 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

View File

@@ -41,30 +41,15 @@ end
When(/^I close the panel to discard the changes$/) do When(/^I close the panel to discard the changes$/) do
on(PanelPage) do |page| on(PanelPage).panel_button_close_element.click
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
end end
Then(/^the active (.*?) font must be the same as font prior to the preview$/) do |type| Then(/^the active interface font must be the same as font prior to the preview$/) do
case type on(PanelPage).get_interface_font.should == @original_interface_font
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
end end
Then(/^the selected (.*?) font must be "(.*?)"$/) do |type, font| Then(/^the selected interface font must be "(.*?)"$/) do |font|
if type == 'interface' type = 'ui'
type = 'ui'
end
step 'I open "Fonts" panel of language settings' step 'I open "Fonts" panel of language settings'
Selenium::WebDriver::Support::Select.new( Selenium::WebDriver::Support::Select.new(
@browser.driver.find_element(:id, "#{type}-font-selector") @browser.driver.find_element(:id, "#{type}-font-selector")
@@ -78,15 +63,8 @@ When(/^I apply the changes$/) do
sleep 4 sleep 4
end end
Then(/^the (.*) font must be changed to the "(.*?)" font$/) do |type, font| Then(/^the interface font must be changed to the "(.*?)" font$/) do |font|
case type on(PanelPage).get_interface_font.should match("^#{font}")
when "content"
on(PanelPage).get_content_font.should match("^#{font}")
when "interface"
on(PanelPage).get_interface_font.should match("^#{font}")
else
pending
end
end end
Then(/^I can disable input methods$/) do Then(/^I can disable input methods$/) do

View File

@@ -31,6 +31,8 @@ class PanelPage
span(:trigger_cog, class: 'uls-settings-trigger') span(:trigger_cog, class: 'uls-settings-trigger')
a(:trigger_personal, class: 'uls-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_interface, id: 'ui-font-selector')
select(:select_font_for_content, id: 'content-font-selector') select(:select_font_for_content, id: 'content-font-selector')