mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-17 12:53:24 +00:00
Merge "Fix E2E scroll assertion logic"
This commit is contained in:
commit
bd9b268107
|
@ -5,10 +5,10 @@ end
|
||||||
|
|
||||||
When(/^I click on the first image in the article$/) do
|
When(/^I click on the first image in the article$/) do
|
||||||
on(LightboxDemoPage) do |page|
|
on(LightboxDemoPage) do |page|
|
||||||
# Scroll the article on purpose
|
# We store the offset of the image as the scroll position, because cucumber/selenium
|
||||||
page.execute_script "window.scroll(10, 100)"
|
# automatically scrolls to it when we ask it to click on it
|
||||||
@articleScrollTop = page.execute_script("return $(window).scrollTop();")
|
@articleScrollTop = page.execute_script("return Math.round($('a[href=\"/wiki/File:Sunrise_over_fishing_boats_in_Kerala.jpg\"]').first().find('img').offset().top);")
|
||||||
@articleScrollLeft = page.execute_script("return $(window).scrollLeft();")
|
# Scrolls to the image and clicks on it
|
||||||
page.image1_in_article
|
page.image1_in_article
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -68,7 +68,6 @@ 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(LightboxDemoPage) do |page|
|
on(LightboxDemoPage) do |page|
|
||||||
page.execute_script("return $(window).scrollTop();").should eq @articleScrollTop
|
page.execute_script("return $(window).scrollTop();").should eq @articleScrollTop
|
||||||
page.execute_script("return $(window).scrollLeft();").should eq @articleScrollLeft
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue