Maintenance: Try to improve the stabilzation of the manage groups selenium test.

This commit is contained in:
Dominik Klein 2021-09-22 22:01:39 +02:00
parent f9ffa3ef51
commit 2d8780c269
2 changed files with 30 additions and 4 deletions

View file

@ -283,6 +283,17 @@ module CommonActions
move_mouse_to(element)
move_mouse_by(5, 5)
end
# Scroll into view with javscript.
#
# @param position [Symbol] :top or :bottom, position of the scroll into view
#
# scroll_into_view('button.js-submit)
#
def scroll_into_view(css_selector, position: :top)
page.execute_script("document.querySelector('#{css_selector}').scrollIntoView(#{position == :top})")
sleep 0.3
end
end
RSpec.configure do |config|

View file

@ -30,13 +30,28 @@ RSpec.describe 'Manage > Groups', type: :system do
it 'is possible to reset the assignment timeout of a group' do
find('td', text: 'Users').click
fill_in 'Assignment Timeout', with: '30'
find('button', text: 'Submit').click
within '.modal-dialog' do
fill_in 'Assignment Timeout', with: '30'
# Needed for chrome, when element is outside viewport.
scroll_into_view('button.js-submit', position: :bottom)
click_button
end
expect(Group.find_by(name: 'Users').assignment_timeout).to eq(30)
find('td', text: 'Users').click
fill_in 'Assignment Timeout', with: ''
find('button', text: 'Submit').click
within '.modal-dialog' do
fill_in 'Assignment Timeout', with: ''
# Needed for chrome, when element is outside viewport.
scroll_into_view('button.js-submit', position: :bottom)
click_button
end
expect(Group.find_by(name: 'Users').assignment_timeout).to be nil
end
end