mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-27 04:06:51 +00:00
Merge "[BrowserTest] Browser can now zoom out whenever required"
This commit is contained in:
commit
623b59e4a5
|
@ -123,7 +123,7 @@ Then(/^I should see pull-down menu containing Page Settings$/) do
|
||||||
end
|
end
|
||||||
|
|
||||||
Then(/^I take screenshot of Visual Editor insert menu$/) do
|
Then(/^I take screenshot of Visual Editor insert menu$/) do
|
||||||
capture_screenshot("#{@scenario.name}-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.tools_menu_element, @current_page.page_option_menu_element])
|
capture_screenshot("#{@scenario.name}-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.tools_menu_element, @current_page.page_option_menu_element], nil, 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
Then(/^I should see Insert pull-down menu$/) do
|
Then(/^I should see Insert pull-down menu$/) do
|
||||||
|
@ -152,18 +152,18 @@ end
|
||||||
|
|
||||||
Then(/^I should see Special character Insertion window$/) do
|
Then(/^I should see Special character Insertion window$/) do
|
||||||
on(VisualEditorPage).iframe_element.when_present.should be_visible
|
on(VisualEditorPage).iframe_element.when_present.should be_visible
|
||||||
capture_screenshot("#{@scenario.name}-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.iframe_element])
|
capture_screenshot("#{@scenario.name}-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.iframe_element], nil, -2)
|
||||||
end
|
end
|
||||||
|
|
||||||
Then(/^I should see save changes dialog box$/) do
|
Then(/^I should see save changes dialog box$/) do
|
||||||
on(VisualEditorPage).iframe_element.when_present.should be_visible
|
on(VisualEditorPage).iframe_element.when_present.should be_visible
|
||||||
capture_screenshot("#{@scenario.name}-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.iframe_element])
|
capture_screenshot("#{@scenario.name}-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.iframe_element], nil, -2)
|
||||||
end
|
end
|
||||||
|
|
||||||
Then(/^I should see Page settings dialog box$/) do
|
Then(/^I should see Page settings dialog box$/) do
|
||||||
on(VisualEditorPage).iframe_element.when_present.should be_visible
|
on(VisualEditorPage).iframe_element.when_present.should be_visible
|
||||||
|
|
||||||
capture_screenshot("#{@scenario.name}-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.iframe_element])
|
capture_screenshot("#{@scenario.name}-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.iframe_element], nil, 0)
|
||||||
|
|
||||||
capture_screenshot("VisualEditor_Page_Settings_Redirects-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.page_settings_heading_element, @current_page.prevent_redirect_element], @current_page.iframe_element, 0)
|
capture_screenshot("VisualEditor_Page_Settings_Redirects-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.page_settings_heading_element, @current_page.prevent_redirect_element], @current_page.iframe_element, 0)
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,15 @@ def capture_screenshot(file_name, page_elements, offset_element=nil, browser_zoo
|
||||||
screenshot_directory = ENV["LANGUAGE_SCREENSHOT_PATH"] || "screenshots"
|
screenshot_directory = ENV["LANGUAGE_SCREENSHOT_PATH"] || "screenshots"
|
||||||
FileUtils.mkdir_p screenshot_directory
|
FileUtils.mkdir_p screenshot_directory
|
||||||
screenshot_path = "#{screenshot_directory}/#{file_name}"
|
screenshot_path = "#{screenshot_directory}/#{file_name}"
|
||||||
browser_zoom.times do
|
|
||||||
|
browser_zoom.abs.times do
|
||||||
|
if browser_zoom > 0
|
||||||
@browser.send_keys [:control, :add]
|
@browser.send_keys [:control, :add]
|
||||||
|
else
|
||||||
|
@browser.send_keys [:control, :subtract]
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@browser.screenshot.save screenshot_path
|
@browser.screenshot.save screenshot_path
|
||||||
crop_image screenshot_path, page_elements, offset_element
|
crop_image screenshot_path, page_elements, offset_element
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue