Commit 4d3011f3 authored by Fatih Acet's avatar Fatih Acet

Merge branch 'fix-broken-buil-9724713' into 'master'

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

See merge request !8926
parents ef0f1336 21ea4863
...@@ -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