Merge "QA: WIP update tests for RSpec3 syntax etc."

This commit is contained in:
jenkins-bot 2014-12-17 18:24:20 +00:00 committed by Gerrit Code Review
commit 9c38b75f30
3 changed files with 55 additions and 83 deletions

View file

@ -9,47 +9,47 @@ Feature: Download menu
Then the download menu should appear Then the download menu should appear
Scenario: Clicking the image closes the download menu Scenario: Clicking the image closes the download menu
Given I open the download menu When I click the download icon
When I click the image And I click the image
Then the download menu should disappear Then the download menu should disappear
Scenario: Image size defaults to original Scenario: Image size defaults to original
When I open the download menu When I click the download icon
Then the download image size label should match the original Then the original beginning download image size label should be "4000 × 3000 px jpg"
And the download links should be the original image And the download links should be the original image
Scenario: Attribution area is collapsed by default Scenario: Attribution area is collapsed by default
When I open the download menu When I click the download icon
Then the attribution area should be collapsed Then the attribution area should be collapsed
Scenario: Attribution area can be opened Scenario: Attribution area can be opened
Given I open the download menu When I click the download icon
When I click on the attribution area And I click on the attribution area
Then the attribution area should be open Then the attribution area should be open
Scenario: Attribution area can be closed Scenario: Attribution area can be closed
Given I open the download menu When I click the download icon
And the attribution area is open And I click on the attribution area
When I click on the attribution area close icon And I click on the attribution area close icon
Then the attribution area should be collapsed Then the attribution area should be collapsed
Scenario: The small download option has the correct information Scenario: The small download option has the correct information
Given I open the download dropdown When I open the download dropdown
When I click the small download size And I click the small download size
Then the download size options should disappear And the download size options disappears
And the download image size label should match the small size Then the download image size label should be "193 × 145 px jpg"
And the download links should be the small thumbnail And the download links should be the 193 thumbnail
Scenario: The medium download option has the correct information Scenario: The medium download option has the correct information
Given I open the download dropdown When I open the download dropdown
When I click the medium download size And I click the medium download size
Then the download size options should disappear And the download size options disappears
And the download image size label should match the medium size Then the download image size label should be "640 × 480 px jpg"
And the download links should be the medium thumbnail And the download links should be the 640 thumbnail
Scenario: The large download option has the correct information Scenario: The large download option has the correct information
Given I open the download dropdown When I open the download dropdown
When I click the large download size And I click the large download size
Then the download size options should disappear And the download size options disappears
And the download image size label should match the large size Then the download image size label should be "1200 × 900 px jpg"
And the download links should be the large thumbnail And the download links should be the 1200 thumbnail

View file

@ -1,32 +1,21 @@
# encoding: utf-8 # encoding: utf-8
Given /^I open the download menu$/ do When /^I open the download dropdown$/ do
step "I click the download icon" step "I click the download icon"
step "the download menu should appear"
end
Given /^the attribution area is open$/ do
step "I click on the attribution area"
end
Given /^I open the download dropdown$/ do
step "I open the download menu"
step "the download image size label should match the original"
step "the download links should be the original image"
step "I click the download down arrow icon" step "I click the download down arrow icon"
step "the download size options should appear"
end end
When /^I click the download icon$/ do When /^I click the download icon$/ do
on(E2ETestPage).mmv_download_icon_element.click on(E2ETestPage).mmv_download_icon_element.when_present.click
end end
When /^I click the download down arrow icon$/ do When /^I click the download down arrow icon$/ do
on(E2ETestPage).mmv_download_down_arrow_icon_element.click sleep 1
on(E2ETestPage).mmv_download_down_arrow_icon_element.when_present.click
end end
When /^I click on the attribution area$/ do When /^I click on the attribution area$/ do
on(E2ETestPage).mmv_download_attribution_area_element.click on(E2ETestPage).mmv_download_attribution_area_element.when_present.click
end end
When /^I click on the attribution area close icon$/ do When /^I click on the attribution area close icon$/ do
@ -50,72 +39,55 @@ When /^I click the (.*) download size$/ do |size_option|
end end
end end
When /^the download size options disappears$/ do
on(E2ETestPage).mmv_download_size_menu_element.when_not_present
end
Then /^the download menu should appear$/ do Then /^the download menu should appear$/ do
on(E2ETestPage).mmv_download_menu_element.when_present.should be_visible expect(on(E2ETestPage).mmv_download_menu_element.when_present).to be_visible
end end
Then /^the download menu should disappear$/ do Then /^the download menu should disappear$/ do
on(E2ETestPage).mmv_download_menu_element.should_not be_visible expect(on(E2ETestPage).mmv_download_menu_element).not_to be_visible
end end
Then /^the download image size label should match the original$/ do Then /^the original beginning download image size label should be "(.*)"$/ do |size_in_pixels|
on(E2ETestPage).mmv_download_size_label_element.when_present.text.should eq "4000 × 3000 px jpg" expect(on(E2ETestPage).mmv_download_size_label_element.when_present.text).to eq size_in_pixels
end end
Then /^the download image size label should match the small size$/ do Then /^the download image size label should be "(.*)"$/ do |size_in_pixels|
on(E2ETestPage).mmv_download_size_label_element.when_present.text.should eq "193 × 145 px jpg" on(E2ETestPage) do |page|
end 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
Then /^the download image size label should match the medium size$/ do end
on(E2ETestPage).mmv_download_size_label_element.when_present.text.should eq "640 × 480 px jpg"
end
Then /^the download image size label should match the large size$/ do
on(E2ETestPage).mmv_download_size_label_element.when_present.text.should eq "1200 × 900 px jpg"
end end
Then /^the download size options should appear$/ do Then /^the download size options should appear$/ do
on(E2ETestPage).mmv_download_size_menu_element.when_present.should be_visible expect(on(E2ETestPage).mmv_download_size_menu_element.when_present).to be_visible
end
Then /^the download size options should disappear$/ do
on(E2ETestPage).mmv_download_size_menu_element.when_not_present
end end
Then /^the download links should be the original image$/ do Then /^the download links should be the original image$/ do
on(E2ETestPage) do |page| on(E2ETestPage) do |page|
page.mmv_download_link_element.attribute('href').should match /^?download$/ expect(page.mmv_download_link_element.attribute('href')).to match /^?download$/
page.mmv_download_preview_link_element.attribute('href').should_not match /^?download$/ expect(page.mmv_download_preview_link_element.attribute('href')).not_to match /^?download$/
page.mmv_download_link_element.attribute('href').should_not match /\/thumb\// expect(page.mmv_download_link_element.attribute('href')).not_to match /\/thumb\//
page.mmv_download_preview_link_element.attribute('href').should_not match /\/thumb\// expect(page.mmv_download_preview_link_element.attribute('href')).not_to match /\/thumb\//
end end
end end
Then /^the download links should be the (\d+) thumbnail$/ do |thumb_size| Then /^the download links should be the (\d+) thumbnail$/ do |thumb_size|
on(E2ETestPage) do |page| on(E2ETestPage) do |page|
Watir::Wait.until { page.mmv_download_link_element.attribute('href').match thumb_size } page.wait_until { page.mmv_download_link_element.attribute('href').match thumb_size }
page.mmv_download_link_element.attribute('href').should match /^?download$/ expect(page.mmv_download_link_element.attribute('href')).to match /^?download$/
page.mmv_download_preview_link_element.attribute('href').should_not match /^?download$/ expect(page.mmv_download_preview_link_element.attribute('href')).not_to match /^?download$/
page.mmv_download_preview_link_element.attribute('href').should match thumb_size expect(page.mmv_download_preview_link_element.attribute('href')).to match thumb_size
end end
end end
Then /^the download links should be the small thumbnail$/ do
step "the download links should be the 193 thumbnail"
end
Then /^the download links should be the medium thumbnail$/ do
step "the download links should be the 640 thumbnail"
end
Then /^the download links should be the large thumbnail$/ do
step "the download links should be the 1200 thumbnail"
end
Then /^the attribution area should be collapsed$/ do Then /^the attribution area should be collapsed$/ do
on(E2ETestPage).mmv_download_attribution_area_element.attribute('class').should match /mw-mmv-download-attribution-collapsed/ expect(on(E2ETestPage).mmv_download_attribution_area_element.when_present.attribute('class')).to match 'mw-mmv-download-attribution-collapsed'
end end
Then /^the attribution area should be open$/ do Then /^the attribution area should be open$/ do
on(E2ETestPage).mmv_download_attribution_area_element.attribute('class').should_not match /mw-mmv-download-attribution-collapsed/ expect(on(E2ETestPage).mmv_download_attribution_area_element.when_present.attribute('class')).not_to match 'mw-mmv-download-attribution-collapsed'
end end

View file

@ -40,7 +40,7 @@ When /^I close MMV$/ do
end end
When /^I click the image$/ do When /^I click the image$/ do
on(E2ETestPage).mmv_image_div_element.click on(E2ETestPage).mmv_image_div_element.when_present.click
end end
Then /^the image metadata and the image itself should be there$/ do Then /^the image metadata and the image itself should be there$/ do