mediawiki-extensions-Multim.../tests/browser/features/step_definitions/basic_mmv_navigation_steps.rb
Aaron Arcos 63021d0b0e Fix e2e tests to support data:URIs
We are using data:URIs to measure performace. This
change broke e2e tests that were trying to match plain urls.

Change-Id: I8220801472cde595dd6651ef2796468eba484071
2014-02-19 12:00:47 -08:00

93 lines
2.8 KiB
Ruby

Given(/^I am at a wiki article with at least two embedded pictures$/) do
visit(LightboxDemoPage)
on(LightboxDemoPage).image1_in_article_element.should be_visible
end
When(/^I click on the first image in the article$/) do
on(LightboxDemoPage) do |page|
page.image1_in_article
end
end
When(/^I click the next arrow$/) do
on(LightboxDemoPage) do |page|
page.next_image()
end
end
When(/^I click the previous arrow$/) do
on(LightboxDemoPage) do |page|
page.previous_image()
end
end
When(/^I close MMV$/) do
on(LightboxDemoPage) do |page|
page.exit_mmv()
end
end
Then(/^I should be navigated back to the original wiki article$/) do
on(LightboxDemoPage) do |page|
page.image1_in_article_element.should be_visible
page.mmv_wrapper_element.should_not be_visible
end
end
Then(/^the image and metadata of the next image should appear$/) do
on(LightboxDemoPage) do |page|
# MMV was launched, article is not visible yet
page.image1_in_article_element.should_not be_visible
# Check basic MMV elements are present
page.mmv_wrapper_element.should be_visible
page.mmv_image_div_element.should be_visible
# Check image content
page.mmv_image_div_element.image_element.attribute('src').should match /Offsite|^data:image;base64,.+gB4Rmls/
# Check metadata is present
page.mmv_metadata_title_element.should exist
page.mmv_metadata_title_element.should exist
page.mmv_metadata_desc_element.should exist
end
end
Then(/^the image metadata and the image itself should be there$/) do
on(LightboxDemoPage) do |page|
# MMV was launched, article is not visible now
page.image1_in_article_element.should_not be_visible
# Check basic MMV elements are present
page.mmv_wrapper_element.should be_visible
page.mmv_image_div_element.should be_visible
# Check image content
page.mmv_image_div_element.image_element.attribute('src').should match /Kerala|^data:image;base64,.+gBeRmlsZSB/
# Check metadata is present
page.mmv_metadata_title_element.should exist
page.mmv_metadata_title_element.should exist
page.mmv_metadata_desc_element.should exist
end
end
Then(/^the image and metadata of the previous image should appear$/) do
on(LightboxDemoPage) do |page|
# MMV was launched, article is not visible yet
on(LightboxDemoPage).image1_in_article_element.should_not be_visible
# Check basic MMV elements are present
page.mmv_wrapper_element.should be_visible
page.mmv_image_div_element.should be_visible
# Check image content
page.mmv_image_div_element.image_element.attribute('src').should match /Kerala|^data:image;base64,.+gBeRmlsZSB/
# Check metadata is present
page.mmv_metadata_title_element.should exist
page.mmv_metadata_title_element.should exist
page.mmv_metadata_desc_element.should exist
end
end