2014-10-15 18:06:41 +00:00
|
|
|
# encoding: utf-8
|
|
|
|
|
2014-12-08 16:20:42 +00:00
|
|
|
When /^I open the download dropdown$/ do
|
2014-10-15 18:06:41 +00:00
|
|
|
step "I click the download icon"
|
|
|
|
step "I click the download down arrow icon"
|
|
|
|
end
|
|
|
|
|
|
|
|
When /^I click the download icon$/ do
|
2014-12-08 16:20:42 +00:00
|
|
|
on(E2ETestPage).mmv_download_icon_element.when_present.click
|
2014-10-15 18:06:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
When /^I click the download down arrow icon$/ do
|
2014-12-08 16:20:42 +00:00
|
|
|
sleep 1
|
2015-04-06 12:19:53 +00:00
|
|
|
on(E2ETestPage).mmv_download_down_arrow_icon_element.when_present(10).click
|
2014-10-15 18:06:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
When /^I click on the attribution area$/ do
|
2015-04-06 12:19:53 +00:00
|
|
|
on(E2ETestPage).mmv_download_attribution_area_element.when_present(10).click
|
2014-10-15 18:06:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
When /^I click on the attribution area close icon$/ do
|
|
|
|
on(E2ETestPage).mmv_download_attribution_area_close_icon_element.click
|
|
|
|
end
|
|
|
|
|
|
|
|
When /^I click the (.*) download size$/ do |size_option|
|
|
|
|
on(E2ETestPage) do |page|
|
|
|
|
case size_option
|
|
|
|
when "small"
|
|
|
|
@index = 1
|
|
|
|
when "medium"
|
|
|
|
@index = 2
|
|
|
|
when "large"
|
|
|
|
@index = 3
|
|
|
|
else
|
|
|
|
@index = 0
|
|
|
|
end
|
|
|
|
|
2015-02-13 11:18:27 +00:00
|
|
|
page.mmv_download_size_options_elements[@index].click
|
2014-10-15 18:06:41 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-02-13 11:18:27 +00:00
|
|
|
When /^the download size options appear$/ do
|
|
|
|
on(E2ETestPage).mmv_download_size_menu_element.when_present
|
|
|
|
end
|
|
|
|
|
2014-12-08 16:20:42 +00:00
|
|
|
When /^the download size options disappears$/ do
|
|
|
|
on(E2ETestPage).mmv_download_size_menu_element.when_not_present
|
2014-10-15 18:06:41 +00:00
|
|
|
end
|
|
|
|
|
2015-02-11 19:28:13 +00:00
|
|
|
When /^the download menu appears$/ do
|
2015-04-06 12:19:53 +00:00
|
|
|
on(E2ETestPage).mmv_download_menu_element.when_present(10)
|
2015-02-11 19:28:13 +00:00
|
|
|
end
|
|
|
|
|
2014-12-08 16:20:42 +00:00
|
|
|
Then /^the download menu should appear$/ do
|
2015-04-06 12:19:53 +00:00
|
|
|
expect(on(E2ETestPage).mmv_download_menu_element.when_present(10)).to be_visible
|
2014-10-15 18:06:41 +00:00
|
|
|
end
|
|
|
|
|
2014-12-08 16:20:42 +00:00
|
|
|
Then /^the download menu should disappear$/ do
|
|
|
|
expect(on(E2ETestPage).mmv_download_menu_element).not_to be_visible
|
2014-10-15 18:06:41 +00:00
|
|
|
end
|
|
|
|
|
2014-12-08 16:20:42 +00:00
|
|
|
Then /^the original beginning download image size label should be "(.*)"$/ do |size_in_pixels|
|
2015-04-06 12:19:53 +00:00
|
|
|
expect(on(E2ETestPage).mmv_download_size_label_element.when_present(10).text).to eq size_in_pixels
|
2014-10-15 18:06:41 +00:00
|
|
|
end
|
|
|
|
|
2014-12-08 16:20:42 +00:00
|
|
|
Then /^the download image size label should be "(.*)"$/ do |size_in_pixels|
|
|
|
|
on(E2ETestPage) do |page|
|
|
|
|
page.mmv_download_size_options_elements[0].when_not_present
|
|
|
|
expect(page.mmv_download_size_label_element.when_present.text).to eq size_in_pixels
|
|
|
|
end
|
2014-10-15 18:06:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
Then /^the download size options should appear$/ do
|
2014-12-08 16:20:42 +00:00
|
|
|
expect(on(E2ETestPage).mmv_download_size_menu_element.when_present).to be_visible
|
2014-10-15 18:06:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
Then /^the download links should be the original image$/ do
|
|
|
|
on(E2ETestPage) do |page|
|
2014-12-08 16:20:42 +00:00
|
|
|
expect(page.mmv_download_link_element.attribute('href')).to match /^?download$/
|
|
|
|
expect(page.mmv_download_preview_link_element.attribute('href')).not_to match /^?download$/
|
2015-12-09 16:06:51 +00:00
|
|
|
expect(page.mmv_download_link_element.attribute('href')).not_to match %r{/thumb/}
|
|
|
|
expect(page.mmv_download_preview_link_element.attribute('href')).not_to match %r{/thumb/}
|
2014-10-15 18:06:41 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
Then /^the download links should be the (\d+) thumbnail$/ do |thumb_size|
|
|
|
|
on(E2ETestPage) do |page|
|
2014-12-08 16:20:42 +00:00
|
|
|
page.wait_until { page.mmv_download_link_element.attribute('href').match thumb_size }
|
|
|
|
expect(page.mmv_download_link_element.attribute('href')).to match /^?download$/
|
|
|
|
expect(page.mmv_download_preview_link_element.attribute('href')).not_to match /^?download$/
|
|
|
|
expect(page.mmv_download_preview_link_element.attribute('href')).to match thumb_size
|
2014-10-15 18:06:41 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
Then /^the attribution area should be collapsed$/ do
|
2015-04-06 12:19:53 +00:00
|
|
|
expect(on(E2ETestPage).mmv_download_attribution_area_element.when_present(10).attribute('class')).to match 'mw-mmv-download-attribution-collapsed'
|
2014-10-15 18:06:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
Then /^the attribution area should be open$/ do
|
2014-12-08 16:20:42 +00:00
|
|
|
expect(on(E2ETestPage).mmv_download_attribution_area_element.when_present.attribute('class')).not_to match 'mw-mmv-download-attribution-collapsed'
|
2015-12-09 16:06:51 +00:00
|
|
|
end
|