mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-25 00:25:47 +00:00
Merge "QA: update navigation test for rspec"
This commit is contained in:
commit
25c294d569
|
@ -9,13 +9,13 @@ When /^I click the previous arrow$/ do
|
||||||
end
|
end
|
||||||
|
|
||||||
When /^I press the browser back button$/ do
|
When /^I press the browser back button$/ do
|
||||||
on(E2ETestPage).execute_script("window.history.back();");
|
$browser.back
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^the image and metadata of the next image should appear$/ do
|
Then /^the image and metadata of the next image should appear$/ do
|
||||||
on(E2ETestPage) do |page|
|
on(E2ETestPage) do |page|
|
||||||
# MMV was launched, article is not visible yet
|
# MMV was launched, article is not visible yet
|
||||||
page.image1_in_article_element.should_not be_visible
|
expect(page.image1_in_article_element).not_to be_visible
|
||||||
check_elements_in_viewer_for_image3 page
|
check_elements_in_viewer_for_image3 page
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -23,7 +23,7 @@ end
|
||||||
Then /^the image and metadata of the previous image should appear$/ do
|
Then /^the image and metadata of the previous image should appear$/ do
|
||||||
on(E2ETestPage) do |page|
|
on(E2ETestPage) do |page|
|
||||||
# MMV was launched, article is not visible yet
|
# MMV was launched, article is not visible yet
|
||||||
page.image1_in_article_element.should_not be_visible
|
expect(page.image1_in_article_element).not_to be_visible
|
||||||
check_elements_in_viewer_for_image1 page
|
check_elements_in_viewer_for_image1 page
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -31,13 +31,13 @@ end
|
||||||
Then /^the wiki article should be scrolled to the same position as before opening MMV$/ do
|
Then /^the wiki article should be scrolled to the same position as before opening MMV$/ do
|
||||||
on(E2ETestPage) do |page|
|
on(E2ETestPage) do |page|
|
||||||
@scrollDifference = page.execute_script("return $(window).scrollTop();") - @articleScrollTop
|
@scrollDifference = page.execute_script("return $(window).scrollTop();") - @articleScrollTop
|
||||||
@scrollDifference.abs.should be < 2
|
expect(@scrollDifference.abs).to be < 2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^I should be navigated back to the original wiki article$/ do
|
Then /^I should be navigated back to the original wiki article$/ do
|
||||||
on(E2ETestPage) do |page|
|
on(E2ETestPage) do |page|
|
||||||
page.image1_in_article_element.should be_visible
|
expect(page.image1_in_article_element).to be_visible
|
||||||
page.mmv_wrapper_element.should_not be_visible
|
expect(page.mmv_wrapper_element).not_to be_visible
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -55,97 +55,97 @@ end
|
||||||
# while looking at image1 (Kerala)
|
# while looking at image1 (Kerala)
|
||||||
def check_elements_in_viewer_for_image1(page)
|
def check_elements_in_viewer_for_image1(page)
|
||||||
# Check basic MMV elements are present
|
# Check basic MMV elements are present
|
||||||
page.mmv_overlay_element.when_present.should be_visible
|
expect(page.mmv_overlay_element.when_present).to be_visible
|
||||||
page.mmv_wrapper_element.when_present.should be_visible
|
expect(page.mmv_wrapper_element.when_present).to be_visible
|
||||||
page.mmv_image_div_element.should be_visible
|
expect(page.mmv_image_div_element).to be_visible
|
||||||
|
|
||||||
# Check image content
|
# Check image content
|
||||||
page.mmv_image_div_element.image_element.attribute('src').should match /Kerala/
|
expect(page.mmv_image_div_element.image_element.attribute('src')).to match /Kerala/
|
||||||
|
|
||||||
# Check basic metadata is present
|
# Check basic metadata is present
|
||||||
|
|
||||||
# Title
|
# Title
|
||||||
page.mmv_metadata_title_element.when_present.text.should match /^Sunrise over fishing boats$/
|
expect(page.mmv_metadata_title_element.when_present.text).to match /^Sunrise over fishing boats$/
|
||||||
# License
|
# License
|
||||||
page.mmv_metadata_license_element.when_present.attribute('href').should match /^http:\/\/creativecommons\.org\/licenses\/by-sa\/3\.0$/
|
expect(page.mmv_metadata_license_element.when_present.attribute('href')).to match /^http:\/\/creativecommons\.org\/licenses\/by-sa\/3\.0$/
|
||||||
page.mmv_metadata_license_element.when_present.text.should match /CC BY-SA 3.0/
|
expect(page.mmv_metadata_license_element.when_present.text).to match 'CC BY-SA 3.0'
|
||||||
# Credit
|
# Credit
|
||||||
page.mmv_metadata_credit_element.when_present.should be_visible
|
expect(page.mmv_metadata_credit_element.when_present).to be_visible
|
||||||
page.mmv_metadata_source_element.when_present.text.should match /Own work/
|
expect(page.mmv_metadata_source_element.when_present.text).to match 'Own work'
|
||||||
|
|
||||||
# Image metadata
|
# Image metadata
|
||||||
page.mmv_image_metadata_wrapper_element.when_present.should be_visible
|
expect(page.mmv_image_metadata_wrapper_element.when_present).to be_visible
|
||||||
# Description
|
# Description
|
||||||
page.mmv_image_metadata_desc_element.when_present.text.should match /Sunrise over fishing boats on the beach south of Kovalam/
|
expect(page.mmv_image_metadata_desc_element.when_present.text).to match 'Sunrise over fishing boats on the beach south of Kovalam'
|
||||||
# Image metadata links
|
# Image metadata links
|
||||||
page.mmv_image_metadata_links_wrapper_element.when_present.should be_visible
|
expect(page.mmv_image_metadata_links_wrapper_element.when_present).to be_visible
|
||||||
# Details link
|
# Details link
|
||||||
page.mmv_details_page_link_element.when_present.text.should match /More details/
|
expect(page.mmv_details_page_link_element.when_present.text).to match 'More details'
|
||||||
page.mmv_details_page_link_element.when_present.attribute('href').should match /boats_in_Kerala.jpg$/
|
expect(page.mmv_details_page_link_element.when_present.attribute('href')).to match /boats_in_Kerala.jpg$/
|
||||||
end
|
end
|
||||||
|
|
||||||
# Helper function that verifies the presence of various elements in viewer
|
# Helper function that verifies the presence of various elements in viewer
|
||||||
# while looking at image2 (Aquarium)
|
# while looking at image2 (Aquarium)
|
||||||
def check_elements_in_viewer_for_image2(page)
|
def check_elements_in_viewer_for_image2(page)
|
||||||
# Check basic MMV elements are present
|
# Check basic MMV elements are present
|
||||||
page.mmv_overlay_element.when_present.should be_visible
|
expect(page.mmv_overlay_element.when_present).to be_visible
|
||||||
page.mmv_wrapper_element.when_present.should be_visible
|
expect(page.mmv_wrapper_element.when_present).to be_visible
|
||||||
page.mmv_image_div_element.should be_visible
|
expect(page.mmv_image_div_element).to be_visible
|
||||||
|
|
||||||
# Check image content
|
# Check image content
|
||||||
page.mmv_image_div_element.image_element.attribute('src').should match /Offsite/
|
expect(page.mmv_image_div_element.image_element.attribute('src')).to match 'Offsite'
|
||||||
|
|
||||||
# Check basic metadata is present
|
# Check basic metadata is present
|
||||||
|
|
||||||
# Title
|
# Title
|
||||||
page.mmv_metadata_title_element.when_present.text.should match /^Tropical Fish Aquarium$/
|
expect(page.mmv_metadata_title_element.when_present.text).to match /^Tropical Fish Aquarium$/
|
||||||
# License
|
# License
|
||||||
page.mmv_metadata_license_element.when_present.attribute('href').should match /^http:\/\/creativecommons\.org\/licenses\/by-sa\/3\.0$/
|
expect(page.mmv_metadata_license_element.when_present.attribute('href')).to match /^http:\/\/creativecommons\.org\/licenses\/by-sa\/3\.0$/
|
||||||
page.mmv_metadata_license_element.when_present.text.should match /CC BY-SA 3.0/
|
expect(page.mmv_metadata_license_element.when_present.text).to match 'CC BY-SA 3.0'
|
||||||
# Credit
|
# Credit
|
||||||
page.mmv_metadata_credit_element.when_present.should be_visible
|
expect(page.mmv_metadata_credit_element.when_present).to be_visible
|
||||||
page.mmv_metadata_source_element.when_present.text.should match /Wikimedia Foundation/
|
expect(page.mmv_metadata_source_element.when_present.text).to match 'Wikimedia Foundation'
|
||||||
|
|
||||||
# Image metadata
|
# Image metadata
|
||||||
page.mmv_image_metadata_wrapper_element.when_present.should be_visible
|
expect(page.mmv_image_metadata_wrapper_element.when_present).to be_visible
|
||||||
# Description
|
# Description
|
||||||
page.mmv_image_metadata_desc_element.when_present.text.should match /Photo from Wikimedia Foundation/
|
expect(page.mmv_image_metadata_desc_element.when_present.text).to match 'Photo from Wikimedia Foundation'
|
||||||
# Image metadata links
|
# Image metadata links
|
||||||
page.mmv_image_metadata_links_wrapper_element.when_present.should be_visible
|
expect(page.mmv_image_metadata_links_wrapper_element.when_present).to be_visible
|
||||||
# Details link
|
# Details link
|
||||||
page.mmv_details_page_link_element.when_present.text.should match /More details/
|
expect(page.mmv_details_page_link_element.when_present.text).to match 'More details'
|
||||||
page.mmv_details_page_link_element.when_present.attribute('href').should match /All_Hands_Offsite.*\.jpg$/
|
expect(page.mmv_details_page_link_element.when_present.attribute('href')).to match /All_Hands_Offsite.*\.jpg$/
|
||||||
end
|
end
|
||||||
|
|
||||||
# Helper function that verifies the presence of various elements in viewer
|
# Helper function that verifies the presence of various elements in viewer
|
||||||
# while looking at image3 (Hong Kong)
|
# while looking at image3 (Hong Kong)
|
||||||
def check_elements_in_viewer_for_image3(page)
|
def check_elements_in_viewer_for_image3(page)
|
||||||
# Check basic MMV elements are present
|
# Check basic MMV elements are present
|
||||||
page.mmv_overlay_element.when_present.should be_visible
|
expect(page.mmv_overlay_element.when_present).to be_visible
|
||||||
page.mmv_wrapper_element.when_present.should be_visible
|
expect(page.mmv_wrapper_element.when_present).to be_visible
|
||||||
page.mmv_image_div_element.should be_visible
|
expect(page.mmv_image_div_element).to be_visible
|
||||||
|
|
||||||
# Check image content
|
# Check image content
|
||||||
page.mmv_image_div_element.image_element.attribute('src').should match /Hong_Kong/
|
expect(page.mmv_image_div_element.image_element.attribute('src')).to match 'Hong_Kong'
|
||||||
|
|
||||||
# Check basic metadata is present
|
# Check basic metadata is present
|
||||||
|
|
||||||
# Title
|
# Title
|
||||||
page.mmv_metadata_title_element.when_present.text.should match /^Hong Kong Harbor at night$/
|
expect(page.mmv_metadata_title_element.when_present.text).to match /^Hong Kong Harbor at night$/
|
||||||
# License
|
# License
|
||||||
page.mmv_metadata_license_element.when_present.attribute('href').should match /^http:\/\/creativecommons\.org\/licenses\/by-sa\/3\.0$/
|
expect(page.mmv_metadata_license_element.when_present.attribute('href')).to match /^http:\/\/creativecommons\.org\/licenses\/by-sa\/3\.0$/
|
||||||
page.mmv_metadata_license_element.when_present.text.should match /CC BY-SA 3.0/
|
expect(page.mmv_metadata_license_element.when_present.text).to match 'CC BY-SA 3.0'
|
||||||
# Credit
|
# Credit
|
||||||
page.mmv_metadata_credit_element.when_present.should be_visible
|
expect(page.mmv_metadata_credit_element.when_present).to be_visible
|
||||||
page.mmv_metadata_source_element.when_present.text.should match /Wikimedia Foundation/
|
expect(page.mmv_metadata_source_element.when_present.text).to match 'Wikimedia Foundation'
|
||||||
|
|
||||||
# Image metadata
|
# Image metadata
|
||||||
page.mmv_image_metadata_wrapper_element.when_present.should be_visible
|
expect(page.mmv_image_metadata_wrapper_element.when_present).to be_visible
|
||||||
# Description
|
# Description
|
||||||
page.mmv_image_metadata_desc_element.when_present.text.should match /Photos from our product team's talks at Wikimania 2013 in Hong Kong./
|
expect(page.mmv_image_metadata_desc_element.when_present.text).to match /Photos from our product team's talks at Wikimania 2013 in Hong Kong./
|
||||||
# Image metadata links
|
# Image metadata links
|
||||||
page.mmv_image_metadata_links_wrapper_element.when_present.should be_visible
|
expect(page.mmv_image_metadata_links_wrapper_element.when_present).to be_visible
|
||||||
# Details link
|
# Details link
|
||||||
page.mmv_details_page_link_element.when_present.text.should match /More details/
|
expect(page.mmv_details_page_link_element.when_present.text).to match 'More details'
|
||||||
page.mmv_details_page_link_element.when_present.attribute('href').should match /Wikimania_2013_-_Hong_Kong_-_Photo_090\.jpg$/
|
expect(page.mmv_details_page_link_element.when_present.attribute('href')).to match /Wikimania_2013_-_Hong_Kong_-_Photo_090\.jpg$/
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue