Commit 21ea4863 authored by Filipa Lacerda's avatar Filipa Lacerda

Fixes broken build: Use jquery to get the element position in the page

parent 74607020
...@@ -18,11 +18,10 @@ feature 'toggler_behavior', js: true, feature: true do ...@@ -18,11 +18,10 @@ feature 'toggler_behavior', js: true, feature: true do
it 'should be scrolled down to fragment' do it 'should be scrolled down to fragment' do
page_height = page.current_window.size[1] page_height = page.current_window.size[1]
page_scroll_y = page.evaluate_script("window.scrollY") page_scroll_y = page.evaluate_script("window.scrollY")
fragment_position_top = page.evaluate_script("document.querySelector('#{fragment_id}').getBoundingClientRect().top") fragment_position_top = page.evaluate_script("$('#{fragment_id}').offset().top")
expect(find('.js-toggle-content').visible?).to eq true expect(find('.js-toggle-content').visible?).to eq true
expect(find(fragment_id).visible?).to eq true expect(find(fragment_id).visible?).to eq true
expect(fragment_position_top).to be > page_scroll_y expect(fragment_position_top).to be >= page_scroll_y
expect(fragment_position_top).to be < (page_scroll_y + page_height) expect(fragment_position_top).to be < (page_scroll_y + page_height)
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment