Commit bb14bb9b authored by Hussain Kashef's avatar Hussain Kashef

added end to end test

parent 15d36095
Pipeline #68247 passed with stage
in 38 minutes and 8 seconds
......@@ -81,6 +81,13 @@ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
end
end
def wait_for_ajax_block
Timeout.timeout(Capybara.default_max_wait_time) do
loop until page.evaluate_script('jQuery.active').zero?
yield
end
end
def fill_field_char_by_char_and_wait_for_ajax(locator, text)
field = page.find_field(locator)
text.split('').each do |char|
......
......@@ -45,6 +45,7 @@ class AssignmentsTest < ApplicationSystemTestCase
assert_text 'Aktiv'
assert_text @client
end
test 'assign multiple clients' do
login_as @user
......@@ -91,6 +92,33 @@ class AssignmentsTest < ApplicationSystemTestCase
assert_text another_client
end
test 'Reserve and unreserve client' do
login_as @user
visit volunteers_path
click_link 'Klient/in suchen', match: :first
click_link 'Klient/in suchen'
wait_for_ajax_block do
click_button 'Reservieren'
end
visit root_path
visit volunteers_path
click_link 'Klient/in suchen', match: :first
click_link 'Klient/in suchen'
within '.reserve-client-action-cell' do
assert_text @user.full_name
assert page.has_button?('Reservation aufheben')
click_button 'Reservation aufheben'
end
visit root_path
visit volunteers_path
click_link 'Klient/in suchen', match: :first
click_link 'Klient/in suchen'
within '.reserve-client-action-cell' do
assert page.has_button?('Reservieren')
end
end
test 'volunteer cannot see new/edit assignment buttons' do
create :assignment, volunteer: @volunteer
login_as @volunteer.user
......
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