fix several more system tests

parent bfd389e3
......@@ -15,7 +15,7 @@ AllCops:
DisplayCopNames: true
DisplayStyleGuide: true
ExtraDetails: true
TargetRubyVersion: 2.4
TargetRubyVersion: 2.6
Rails:
Enabled: true
......@@ -23,6 +23,8 @@ Rails/FilePath:
Enabled: false
Rails/HasAndBelongsToMany:
Enabled: false
Rails/RefuteMethods:
Enabled: false
Metrics/AbcSize:
Exclude:
......
function clientForm() {
$('.reserve-client-action-cell').on('click', ({ target }) => {
const cell = $(target).closest('td')
const { clientId } = cell.data()
const data = cell.data()
const clientId = data.clientId || data.client_id
$.ajax({
url: `/clients/${clientId}/reserve`,
type: 'PUT',
}).done(({user_name, btn_text}) => {
}).done(({ user_name, btn_text }) => {
cell.find('button, span').remove()
if (user_name) {
cell.find('button').remove()
cell.append($(`<span>${user_name}</span>`))
cell.append($(`<button class="btn btn-default">${btn_text}</button>`))
} else {
cell.find('span').remove()
cell.find('button').remove()
cell.append($(`<button class="btn btn-default">${btn_text}</button>`))
}
}).fail(error => {
console.log(error)
})
});
})
}
h4.label-list
- availability_collection.each do |availability|
- if available.read_attribute(availability)
span.label.label-success>
=> icon_span(:yes)
= t("availability.#{availability}")
- else
span.label.label-danger>
=> icon_span(:no)
= t("availability.#{availability}")
.row
.col-xs-12.availability-label-list
- availability_collection.each do |availability|
- if available.read_attribute(availability)
span.label.label-success>
=> icon_span(:yes)
= t("availability.#{availability}")
- else
span.label.label-danger>
=> icon_span(:no)
= t("availability.#{availability}")
.row
.col-xs-12
......
......@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20200513152455) do
ActiveRecord::Schema.define(version: 2020_05_13_152455) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
......
......@@ -35,7 +35,7 @@ class AdminResetUserPasswordTest < ApplicationSystemTestCase
volunteer = create :volunteer_internal, acceptance: :undecided
volunteer.contact.update!(primary_email: 'volunteer@aoz.ch')
volunteer.accepted!
login_as(@admin)
form_login_user(@admin, @comon_pw)
update_users_password(volunteer.user, @common_changed_pw, email: 'volunteer@aoz.ch')
sign_out_logged_in_user(@admin)
form_login_user(volunteer.user, @common_changed_pw, email: 'volunteer@aoz.ch')
......
......@@ -17,9 +17,9 @@ class AssignmentsTest < ApplicationSystemTestCase
page.find('.month', text: 'Jan').click
page.find_all('.day', exact_text: '1').first.click
page.find_all('input[type="submit"]').first.click
assert page.has_text? 'Begleitung wurde erfolgreich erstellt.'
assert page.has_link? @volunteer.contact.full_name
assert page.has_link? @client.contact.full_name
assert_text 'Begleitung wurde erfolgreich erstellt.'
assert_link @volunteer.contact.full_name
assert_link @client.contact.full_name
end
test 'assign unassigned client' do
......@@ -46,7 +46,6 @@ class AssignmentsTest < ApplicationSystemTestCase
assert_text @client
end
test 'assign multiple clients' do
login_as @user
visit volunteers_path
......@@ -132,7 +131,8 @@ class AssignmentsTest < ApplicationSystemTestCase
end
end
test 'social_worker can show and download assigment pdf when she is involved_authority of a client' do
test 'social_worker can show and download assigment pdf when '\
'she is involved_authority of a client' do
use_rack_driver
social_worker = create :social_worker
......@@ -153,35 +153,36 @@ class AssignmentsTest < ApplicationSystemTestCase
visit edit_assignment_path(another_assignment)
click_button 'Begleitung aktualisieren', match: :first
visit client_path(client)
assert page.has_link? 'Herunterladen'
assert_link 'Herunterladen'
visit client_path(another_assignment.client)
assert page.has_link? 'Herunterladen'
assert_link 'Herunterladen'
# check show page and pdf download via social worker
login_as social_worker
visit client_path(another_assignment.client)
assert_text another_assignment.client.contact.full_name # only to allow refute expectations to wait 0
# only to allow refute expectations to wait 0
assert_text another_assignment.client.contact.full_name
refute page.has_link? 'Anzeigen', wait: 0
refute page.has_link? 'Herunterladen', wait: 0
visit client_path(client)
assert page.has_link? 'Anzeigen'
assert page.has_link? 'Herunterladen'
assert_link 'Anzeigen'
assert_link 'Herunterladen'
click_link 'Anzeigen'
assert page.has_text? 'Vereinbarung zwischen AOZ, Freiwilligen und Begleiteten'
assert page.has_text? "#{assignment.client.contact.primary_email}"
assert page.has_text? "#{assignment.volunteer.contact.primary_email}"
assert page.has_text? "#{assignment.involved_authority.contact.primary_email}"
assert_text 'Vereinbarung zwischen AOZ, Freiwilligen und Begleiteten'
assert_text assignment.client.contact.primary_email.to_s
assert_text assignment.volunteer.contact.primary_email.to_s
assert_text assignment.involved_authority.contact.primary_email.to_s
visit client_path(client)
click_link 'Herunterladen'
pdf = load_pdf(page.body)
assert_equal 2, pdf.page_count
assert_match /#{assignment.client.contact.primary_email}/, pdf.pages.first.text
assert_match /#{assignment.volunteer.contact.primary_email}/, pdf.pages.first.text
assert_match /#{assignment.involved_authority.contact.primary_email}/, pdf.pages.first.text
assert_match(/#{assignment.client.contact.primary_email}/, pdf.pages.first.text)
assert_match(/#{assignment.volunteer.contact.primary_email}/, pdf.pages.first.text)
assert_match(/#{assignment.involved_authority.contact.primary_email}/, pdf.pages.first.text)
end
test 'assignments_print_view_is_not_paginated' do
......
......@@ -16,22 +16,29 @@ class ClientSearchesTest < ApplicationSystemTestCase
test 'basic_non_suggests_search_works' do
fill_in name: 'q[contact_full_name_cont]', with: 'zzzz'
click_button 'Suchen'
assert page.has_text? @clients.last.first.contact.full_name
assert page.has_text? @clients.last.last.contact.full_name
wait_for_ajax
find_field(name: 'q[contact_full_name_cont]').native.send_keys(:tab, :enter)
assert_text @clients.last.first.contact.full_name
assert_text @clients.last.last.contact.full_name
end
test 'enter_search_text_brings_suggestions' do
fill_autocomplete 'q[contact_full_name_cont]', with: 'aaa', items_expected: 2,
fill_autocomplete(
'q[contact_full_name_cont]',
with: 'aaa',
items_expected: 2,
check_items: [@clients.first[0].contact.full_name, @clients.first[1].contact.full_name]
)
end
test 'suggestions search triggers the search correctly' do
fill_autocomplete 'q[contact_full_name_cont]', with: 'aaa'
click_button 'Suchen'
wait_for_ajax
find_field(name: 'q[contact_full_name_cont]').native.send_keys(:tab, :enter)
visit current_url
within 'tbody' do
assert page.has_text?(@clients.first[0].contact.full_name) || page.has_text?(@clients.first[1].contact.full_name)
assert page.has_text?(@clients.first[0].contact.full_name) ||
page.has_text?(@clients.first[1].contact.full_name)
assert_equal 1, find_all('tr').size
end
end
......
......@@ -40,8 +40,8 @@ class ClientsTest < ApplicationSystemTestCase
select('Onkel', from: 'Verwandtschaftsbeziehung')
end
fill_in 'Inhalte der Begleitung', with: 'asdfasdf'
select("egal", from: "Geschlecht Freiwillige/r")
select('36 - 50', from: "Alter Freiwillige/r")
select('egal', from: 'Geschlecht Freiwillige/r')
select('36 - 50', from: 'Alter Freiwillige/r')
fill_in 'Andere Anforderungen', with: 'asdfasdf'
fill_in 'Beruf oder Ausbildung im Herkunftsland', with: 'asdfasdf'
fill_in 'Aktuelle Tätigkeiten', with: 'asdfasdf'
......@@ -147,8 +147,13 @@ class ClientsTest < ApplicationSystemTestCase
test 'client cannot be terminated if has active missions' do
client = create :client
assignment1 = create :assignment, client: client, period_start: 3.weeks.ago, period_end: 2.days.ago, period_end_set_by: @superadmin
assignment2 = create :assignment, client: client, period_start: 3.weeks.ago, period_end: nil
create :assignment, client: client,
period_start: 3.weeks.ago,
period_end: 2.days.ago,
period_end_set_by: @superadmin
assignment2 = create :assignment, client: client,
period_start: 3.weeks.ago,
period_end: nil
refute client.resigned?
login_as @superadmin
......@@ -262,13 +267,14 @@ class ClientsTest < ApplicationSystemTestCase
def create_clients_for_index_text_check
with_assignment = create :client, comments: 'with_assignment',
competent_authority: 'assigned_authority',
goals: 'assigned_goals', interests: 'assigned_interests'
competent_authority: 'assigned_authority',
goals: 'assigned_goals', interests: 'assigned_interests'
create :assignment, volunteer: create(:volunteer), client: with_assignment
with_assignment.update(created_at: 2.days.ago)
without_assignment = create :client, comments: 'without_assignment',
competent_authority: 'unassigned_authority',
goals: 'unassigned_goals', interests: 'unassigned_interests'
competent_authority: 'unassigned_authority',
goals: 'unassigned_goals',
interests: 'unassigned_interests'
without_assignment.update(created_at: 4.days.ago)
[with_assignment, without_assignment]
end
......@@ -342,7 +348,7 @@ class ClientsTest < ApplicationSystemTestCase
test 'no user can destroy client with assignment associated' do
[@superadmin, @department_manager, @social_worker].each do |user|
client = create :client, user: user
assignment = create :assignment, client: client
create :assignment, client: client
client_css = "##{dom_id client}"
login_as user
......
......@@ -3,9 +3,9 @@ require 'application_system_test_case'
class DepartmentsTest < ApplicationSystemTestCase
def setup
@superadmin = create :user, :with_clients,
:with_department, role: 'superadmin'
:with_department, role: 'superadmin'
@social_worker = create :user, :with_clients,
:with_department, role: 'social_worker'
:with_department, role: 'social_worker'
@department_manager = create :department_manager
# dirty fix for not properly working factorys or DatabaseCleaner
User.where.not(id: [@superadmin.id, @social_worker.id, @department_manager.id]).destroy_all
......@@ -14,24 +14,24 @@ class DepartmentsTest < ApplicationSystemTestCase
test 'superadmin should see departments link in navigation' do
login_as @superadmin
visit root_path
assert page.has_link? 'Standorte'
assert_link 'Standorte'
end
test 'other users should not see departments link in navigation' do
login_as @social_worker
visit root_path
assert_text 'Klient/innen'
refute page.has_link? 'Standorte', wait: 0
refute_link 'Standorte', wait: 0
end
test 'superadmin can see all departments in departments_path' do
login_as @superadmin
visit departments_path
Department.all.sample do |d|
assert page.has_text? d.contact.last_name
assert page.has_link? 'Anzeigen', href: department_path(d.id)
assert page.has_link? 'Bearbeiten', href: edit_department_path(d.id)
assert page.has_link? 'Löschen', href: department_path(d.id)
Department.all.sample do |department|
assert_text d.contact.last_name
assert_link 'Anzeigen', href: department_path(department.id)
assert_link 'Bearbeiten', href: edit_department_path(department.id)
assert_link 'Löschen', href: department_path(department.id)
end
end
......@@ -40,8 +40,8 @@ class DepartmentsTest < ApplicationSystemTestCase
login_as @superadmin
visit departments_path
first(:link, 'Standort erfassen').click
assocable_users.each do |u|
check u.to_s
assocable_users.each do |user|
check user.to_s
end
fill_in 'Name', with: 'Bogus Hog Department'
fill_in 'Strasse', with: 'bogus street 999'
......@@ -51,29 +51,29 @@ class DepartmentsTest < ApplicationSystemTestCase
fill_in 'Mailadresse', with: 'department@aoz.ch'
fill_in 'Telefonnummer', with: '0441234567'
click_button 'Standort erfassen'
assert page.has_text? 'Standort wurde erfolgreich erstellt.'
assert page.has_text? 'Bogus Hog Department'
assert page.has_text? 'Strasse'
assert page.has_text? 'Adresszusatz'
assert page.has_text? 'Ort'
assert page.has_text? 'bogus street 999'
assert page.has_text? 'bogus ext. addr.'
assert page.has_text? '9999'
assert page.has_text? 'bogus town'
assert page.has_text? 'department@aoz.ch'
assert page.has_text? '0441234567'
assert_text 'Standort wurde erfolgreich erstellt.'
assert_text 'Bogus Hog Department'
assert_text 'Strasse'
assert_text 'Adresszusatz'
assert_text 'Ort'
assert_text 'bogus street 999'
assert_text 'bogus ext. addr.'
assert_text '9999'
assert_text 'bogus town'
assert_text 'department@aoz.ch'
assert_text '0441234567'
assocable_users.each do |user|
assert page.has_link? user.full_name, href: /profiles\/#{user.profile.id}/
assert_link user.full_name, href: /profiles\/#{user.profile.id}/
end
assert page.has_link? 'Standort bearbeiten'
assert page.has_link? 'Zurück'
assert_link 'Standort bearbeiten'
assert_link 'Zurück'
end
test 'As Department Manager there is a link in the Navbar to his department' do
login_as @department_manager
visit profile_path(@department_manager.profile.id)
assert page.has_link? 'Standort',
href: department_path(@department_manager.department.first.id)
assert_link 'Standort',
href: department_path(@department_manager.department.first.id)
end
test "Department Managers can update their department's fields" do
......@@ -88,13 +88,13 @@ class DepartmentsTest < ApplicationSystemTestCase
fill_in 'Telefonnummer', with: '0441234567'
refute page.has_select? 'User', wait: 0
click_button 'Standort aktualisieren'
assert page.has_text? 'Name changed'
assert page.has_text? 'Street changed'
assert page.has_text? 'Extended address changed'
assert page.has_text? 'Zip changed'
assert page.has_text? 'City changed'
assert page.has_text? 'department@aoz.ch'
assert page.has_text? '0441234567'
assert_text 'Name changed'
assert_text 'Street changed'
assert_text 'Extended address changed'
assert_text 'Zip changed'
assert_text 'City changed'
assert_text 'department@aoz.ch'
assert_text '0441234567'
end
test 'After logging in as Department Manager he should see his department' do
......@@ -102,9 +102,9 @@ class DepartmentsTest < ApplicationSystemTestCase
fill_in 'Email', with: @department_manager.email
fill_in 'Passwort', with: 'asdfasdf'
click_button 'Anmelden'
assert page.has_text? @department_manager.department.first.contact.last_name
assert_text @department_manager.department.first.contact.last_name
if @department_manager.department.first.contact.street.present?
assert page.has_text? @department_manager.department.first.contact.street
assert_text @department_manager.department.first.contact.street
end
end
......@@ -112,11 +112,11 @@ class DepartmentsTest < ApplicationSystemTestCase
login_as @superadmin
visit new_department_path
assert_text 'Standort erfassen'
refute page.has_text? 'Secondary phone', wait: 0
refute_text 'Secondary phone', wait: 0
visit department_path(Department.first)
assert_text Department.first
refute page.has_text? 'Secondary phone', wait: 0
refute_text 'Secondary phone', wait: 0
end
test 'departments group offers with volunteers are displayed' do
......@@ -129,9 +129,9 @@ class DepartmentsTest < ApplicationSystemTestCase
login_as @department_manager
visit department_path(department)
assert page.has_link? group_offer.title
assert page.has_text? volunteer_one.full_name
assert page.has_text? volunteer_two.full_name
assert_link group_offer.title
assert_text volunteer_one.full_name
assert_text volunteer_two.full_name
end
test 'department with department manager without profile has valid link on show' do
......@@ -143,7 +143,7 @@ class DepartmentsTest < ApplicationSystemTestCase
click_button 'Standort aktualisieren'
visit department_path(department)
assert page.has_link? department_manager_no_profile.email
assert_link department_manager_no_profile.email
click_link department_manager_no_profile.email
assert_field 'Email', with: department_manager_no_profile.email
end
......
require "application_system_test_case"
require 'application_system_test_case'
class EventsTest < ApplicationSystemTestCase
def setup
......@@ -12,7 +12,7 @@ class EventsTest < ApplicationSystemTestCase
test 'new event form' do
visit new_event_path
assert page.has_text? 'Veranstaltung erfassen'
assert_text 'Veranstaltung erfassen'
select('Einführungsveranstaltung', from: 'Art')
fill_in 'Titel', with: 'Titel asdf'
select('Event Department', from: 'Standort')
......@@ -20,27 +20,27 @@ class EventsTest < ApplicationSystemTestCase
fill_in 'Beschreibung', with: 'Beschreibung asdf'
click_button 'Veranstaltung erfassen'
assert page.has_text? 'Titel asdf'
assert page.has_text? 'Beschreibung asdf'
assert page.has_text? 'Event Department'
assert_text 'Titel asdf'
assert_text 'Beschreibung asdf'
assert_text 'Event Department'
end
test 'when creating a new event, it is not possible to add volunteers' do
visit new_event_path
assert page.has_text? 'Veranstaltung erfassen'
refute page.has_text? 'Neue Teilnehmende hinzufügen', wait: 0
assert_text 'Veranstaltung erfassen'
refute_text 'Neue Teilnehmende hinzufügen', wait: 0
refute page.has_select? 'event_volunteer_volunteer_id', wait: 0
end
test 'add volunteers to an existing event' do
visit event_path(@event)
assert page.has_text? 'Neue Teilnehmende hinzufügen'
assert_text 'Neue Teilnehmende hinzufügen'
selectize_select('event_volunteer_volunteer', @volunteer1)
click_button 'Teilnehmer/in hinzufügen'
within '.event-volunteers-table' do
assert page.has_text? @volunteer1.full_name
assert_text @volunteer1.full_name
end
end
......@@ -52,25 +52,25 @@ class EventsTest < ApplicationSystemTestCase
selectize_select('event_volunteer_volunteer', @volunteer1)
click_button 'Teilnehmer/in hinzufügen'
within '.event-volunteers-table' do
assert page.has_text? @volunteer1.full_name
refute page.has_text? @volunteer2.full_name, wait: 0
assert_text @volunteer1.full_name
refute_text @volunteer2.full_name, wait: 0
end
# adding second volunteer to the event
selectize_select('event_volunteer_volunteer', @volunteer2)
click_button 'Teilnehmer/in hinzufügen'
within '.event-volunteers-table' do
assert page.has_text? @volunteer1.full_name
assert page.has_text? @volunteer2.full_name
assert_text @volunteer1.full_name
assert_text @volunteer2.full_name
# removing the first volunteer from the event
page.find_all('a', text: 'Löschen').first.click
find_all('a', text: 'Löschen').first.click
end
visit event_path(@event)
within '.event-volunteers-table' do
assert page.has_text? @volunteer2.full_name
refute page.has_text? @volunteer1.full_name, wait: 0
assert_text @volunteer2.full_name
refute_text @volunteer1.full_name, wait: 0
end
end
......@@ -82,13 +82,13 @@ class EventsTest < ApplicationSystemTestCase
click_button 'Veranstaltungen'
within '.volunteer-events-table' do
assert page.has_text? @event.title
assert page.has_text? 'Einführungsveranstaltung'
assert page.has_text? 'Event Department'
assert page.has_text? @event.end_time.strftime('%H:%M')
assert page.has_text? @event.start_time.strftime('%H:%M')
assert page.has_text? I18n.l(@event.date)
assert page.has_link? 'Anzeigen'
assert_text @event.title
assert_text 'Einführungsveranstaltung'
assert_text 'Event Department'
assert_text @event.end_time.strftime('%H:%M')
assert_text @event.start_time.strftime('%H:%M')
assert_text I18n.l(@event.date)
assert_link 'Anzeigen'
end
end
......@@ -121,13 +121,13 @@ class EventsTest < ApplicationSystemTestCase
visit events_path
assert page.has_text? 'first_page'
refute page.has_text? 'second_page', wait: 0
assert_text 'first_page'
refute_text 'second_page', wait: 0
first(:link, '2').click
assert page.has_text? 'second_page'
refute page.has_text? 'first_page', wait: 0
assert_text 'second_page'
refute_text 'first_page', wait: 0
end
test 'adding a volunteers twice to an event does not work' do
......@@ -136,13 +136,13 @@ class EventsTest < ApplicationSystemTestCase
selectize_select('event_volunteer_volunteer', @volunteer1)
click_button 'Teilnehmer/in hinzufügen'
assert page.has_text? 'Teilnehmer/in erfolgreich hinzugefügt.'
assert_text 'Teilnehmer/in erfolgreich hinzugefügt.'
within '.event-volunteers-table' do
assert page.has_text? @volunteer1
assert_text @volunteer1
end
selectize_fill('event_volunteer_volunteer', @volunteer1)
refute page.has_css?('.selectize-dropdown-content .option', text: @volunteer1)
refute_css '.selectize-dropdown-content .option', text: @volunteer1
end
end
......@@ -5,36 +5,46 @@ class GroupAssignmentTerminatesTest < ApplicationSystemTestCase
@superadmin = create :user
@volunteer = create :volunteer, salutation: 'mrs'
@group_offer = create :group_offer, creator: @superadmin
@group_assignment = create :group_assignment, volunteer: @volunteer, group_offer: @group_offer,
period_start: 20.days.ago, period_end: 10.days.ago, period_end_set_by: @superadmin
@hour = create :hour, volunteer: @volunteer, hourable: @group_offer, hours: 2
@group_assignment = create :group_assignment, volunteer: @volunteer,
group_offer: @group_offer,
period_start: 20.days.ago,
period_end: 10.days.ago,
period_end_set_by: @superadmin
@hour = create :hour, volunteer: @volunteer,
hourable: @group_offer,
hours: 2
@unrelated_group_assignment = create :group_assignment, group_offer: @group_offer
@unrelated_hour = create :hour, volunteer: @unrelated_group_assignment.volunteer,
hourable: @group_offer, hours: 5, comments: 'Unrelated Hour'
hourable: @group_offer,
hours: 5,
comments: 'Unrelated Hour'
end
test 'volunteer_can_use_group_assignment_terminate_form' do
login_as @volunteer.user
visit terminate_group_assignment_path(@group_assignment)
assert page.has_text?(/Der Einsatz (wurde|endet) am #{I18n.l(@group_assignment.period_end)}/)
assert page.has_text? "Die Freiwillige: #{@volunteer.contact.natural_name}"
assert page.has_text? "Das Gruppenangebot #{@group_offer.title} -
#{@group_offer.group_offer_category.category_name}"
assert page.has_text? @group_assignment.volunteer.hours.total_hours
assert_text(/Der Einsatz (wurde|endet) am #{I18n.l(@group_assignment.period_end)}/)
assert_text "Die Freiwillige: #{@volunteer.contact.natural_name}", normalize_ws: true
assert_text "Das Gruppenangebot #{@group_offer.title}"\
" - #{@group_offer.group_offer_category.category_name}",
normalize_ws: true
assert_text @group_assignment.volunteer.hours.total_hours
fill_in 'Was waren Ihre Hauptaktivitäten während des Einsatzes?', with: 'rand_activities_text'
fill_in 'Was waren Ihre Hauptaktivitäten während des Einsatzes?',
with: 'rand_activities_text'
fill_in 'Welche Erfolge oder Highlights haben Sie während Ihres Einsatzes erlebt?',
with: 'rand_success_text'
with: 'rand_success_text'
fill_in 'Welchen Schwierigkeiten in Bezug auf Ihren Einsatz sind Sie begegnet?',
with: 'rand_trouble_text'
fill_in 'Wie fanden Sie die von der Fachstelle Freiwilligenarbeit angebotene Unterstützung ' \
'inklusive Weiterbildungen und Anlässe?', with: 'rand_aoz_feedback_text'
with: 'rand_trouble_text'
fill_in 'Wie fanden Sie die von der Fachstelle Freiwilligenarbeit angebotene' \
' Unterstützung inklusive Weiterbildungen und Anlässe?',
with: 'rand_aoz_feedback_text'
page.accept_confirm do
click_button 'Einsatz wird hiermit abgeschlossen'
end
assert page.has_text? 'Der Gruppeneinsatz ist hiermit abgeschlossen.'
assert_text 'Der Gruppeneinsatz ist hiermit abgeschlossen.'
@group_assignment.reload
assert_equal @volunteer.user, @group_assignment.termination_submitted_by
......@@ -65,6 +75,7 @@ class GroupAssignmentTerminatesTest < ApplicationSystemTestCase
page.accept_confirm do
click_button 'Einsatz wird hiermit abgeschlossen'
end
assert_text 'Der Gruppeneinsatz ist hiermit abgeschlossen.'
mail = ActionMailer::Base.deliveries.last
assert_equal @superadmin.email, mail['to'].to_s
......
......@@ -273,7 +273,7 @@ class GroupOffersTest < ApplicationSystemTestCase
end
test 'creates/updates group assignment PDF when requested' do
# use_rack_driver
use_rack_driver
pdf_date = 1.week.ago
travel_to pdf_date
......@@ -285,7 +285,7 @@ class GroupOffersTest < ApplicationSystemTestCase
assert_text 'Gruppenangebot' # only here to avoid waiting with refute
within '.assignments-table' do
refute_link 'Herunterladen', wait: 0
refute_link 'Herunterladen', wait: 0
end
# create initial PDF
......
......@@ -14,15 +14,16 @@ class PerformanceReportsTest < ApplicationSystemTestCase
first(:link, 'Neuen Report erstellen').click
click_link two_years_ago.to_s
click_button 'Kennzahlen Report erfassen'
assert page.has_text? 'Kennzahlen Report wurde erfolgreich erstellt.'
assert page.has_text? "Kennzahlen des Kalenderjahrs #{two_years_ago}"
assert_text 'Kennzahlen Report wurde erfolgreich erstellt.'
assert_text "Kennzahlen des Kalenderjahrs #{two_years_ago}"
end
VALUE_ORDERS = {
volunteers: [
:created, :inactive, :resigned, :total,
:active_assignment, :active_group_assignment, :only_assignment_active, :only_group_active, :active_both, :active_total,
:assignment_hour_records, :assignment_hours, :group_offer_hour_records, :group_offer_hours, :total_hours,
:active_assignment, :active_group_assignment, :only_assignment_active, :only_group_active,
:active_both, :active_total, :assignment_hour_records, :assignment_hours,
:group_offer_hour_records, :group_offer_hours, :total_hours,
:assignment_feedbacks, :group_offer_feedbacks, :total_feedbacks
] + Event.kinds.keys.map(&:to_sym) + [:total_events],
clients: [:created, :inactive, :resigned, :active_assignment, :total],
......@@ -42,34 +43,56 @@ class PerformanceReportsTest < ApplicationSystemTestCase
visit performance_report_path(report_id)
volunteers, clients, assignments, group_offers = this_year_report.values_at('volunteers',
'clients', 'assignments', 'group_offers')
'clients',
'assignments',
'group_offers')
# Volunteers section
column_order = ['zurich', 'not_zurich', 'internal', 'external', 'all']
VALUE_ORDERS[:volunteers].each do |value_key|
assert page.has_text?(I18n.t("performance_reports.values_volunteers.#{value_key}") + ' ' + row_numbers(volunteers, column_order, value_key.to_s)), "volunteers: #{value_key}"
assert_text [
I18n.t("performance_reports.values_volunteers.#{value_key}"),
row_numbers(volunteers, column_order, value_key.to_s),
"volunteers: #{value_key}"
].join(' '), normalize_ws: true
# assert_text I18n.t("performance_reports.values_volunteers.#{value_key}") + ' ' + row_numbers(volunteers, column_order, value_key.to_s), "volunteers: #{value_key}"
end
# Clients section