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
Scenario: Clicking the image closes the download menu
Given I open the download menu
When I click the image
When I click the download icon
And I click the image
Then the download menu should disappear
Scenario: Image size defaults to original
When I open the download menu
Then the download image size label should match the original
When I click the download icon
Then the original beginning download image size label should be "4000 × 3000 px jpg"
And the download links should be the original image
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
Scenario: Attribution area can be opened
Given I open the download menu
When I click on the attribution area
When I click the download icon
And I click on the attribution area
Then the attribution area should be open
Scenario: Attribution area can be closed
Given I open the download menu
And the attribution area is open
When I click on the attribution area close icon
When I click the download icon
And I click on the attribution area
And I click on the attribution area close icon
Then the attribution area should be collapsed
Scenario: The small download option has the correct information
Given I open the download dropdown
When I click the small download size
Then the download size options should disappear
And the download image size label should match the small size
And the download links should be the small thumbnail
When I open the download dropdown
And I click the small download size
And the download size options disappears
Then the download image size label should be "193 × 145 px jpg"
And the download links should be the 193 thumbnail
Scenario: The medium download option has the correct information
Given I open the download dropdown
When I click the medium download size
Then the download size options should disappear
And the download image size label should match the medium size
And the download links should be the medium thumbnail
When I open the download dropdown
And I click the medium download size
And the download size options disappears
Then the download image size label should be "640 × 480 px jpg"
And the download links should be the 640 thumbnail
Scenario: The large download option has the correct information
Given I open the download dropdown
When I click the large download size
Then the download size options should disappear
And the download image size label should match the large size
And the download links should be the large thumbnail
When I open the download dropdown
And I click the large download size
And the download size options disappears
Then the download image size label should be "1200 × 900 px jpg"
And the download links should be the 1200 thumbnail

View file

@ -1,32 +1,21 @@
# encoding: utf-8
Given /^I open the download menu$/ do
When /^I open the download dropdown$/ do
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 "the download size options should appear"
end
When /^I click the download icon$/ do
on(E2ETestPage).mmv_download_icon_element.click
on(E2ETestPage).mmv_download_icon_element.when_present.click
end
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
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
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
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
on(E2ETestPage).mmv_download_menu_element.when_present.should be_visible
expect(on(E2ETestPage).mmv_download_menu_element.when_present).to be_visible
end
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
Then /^the download image size label should match the original$/ do
on(E2ETestPage).mmv_download_size_label_element.when_present.text.should eq "4000 × 3000 px jpg"
Then /^the original beginning download image size label should be "(.*)"$/ do |size_in_pixels|
expect(on(E2ETestPage).mmv_download_size_label_element.when_present.text).to eq size_in_pixels
end
Then /^the download image size label should match the small size$/ do
on(E2ETestPage).mmv_download_size_label_element.when_present.text.should eq "193 × 145 px jpg"
end
Then /^the download image size label should match the medium size$/ do
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"
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
end
Then /^the download size options should appear$/ do
on(E2ETestPage).mmv_download_size_menu_element.when_present.should be_visible
end
Then /^the download size options should disappear$/ do
on(E2ETestPage).mmv_download_size_menu_element.when_not_present
expect(on(E2ETestPage).mmv_download_size_menu_element.when_present).to be_visible
end
Then /^the download links should be the original image$/ do
on(E2ETestPage) do |page|
page.mmv_download_link_element.attribute('href').should match /^?download$/
page.mmv_download_preview_link_element.attribute('href').should_not match /^?download$/
page.mmv_download_link_element.attribute('href').should_not match /\/thumb\//
page.mmv_download_preview_link_element.attribute('href').should_not match /\/thumb\//
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_link_element.attribute('href')).not_to match /\/thumb\//
expect(page.mmv_download_preview_link_element.attribute('href')).not_to match /\/thumb\//
end
end
Then /^the download links should be the (\d+) thumbnail$/ do |thumb_size|
on(E2ETestPage) do |page|
Watir::Wait.until { page.mmv_download_link_element.attribute('href').match thumb_size }
page.mmv_download_link_element.attribute('href').should match /^?download$/
page.mmv_download_preview_link_element.attribute('href').should_not match /^?download$/
page.mmv_download_preview_link_element.attribute('href').should match thumb_size
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
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
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
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

View file

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