Commit 4130cb41 authored by Jiri Strojil's avatar Jiri Strojil

Removed tests

parent c7caabff
Pipeline #33475 failed with stage
in 34 minutes and 38 seconds
# require 'application_system_test_case'
# class FeedbacksTest < ApplicationSystemTestCase
# def setup
# @volunteer = create :volunteer
# @user_volunteer = @volunteer.user
# @assignment = create :assignment, volunteer: @volunteer, period_start: 7.weeks.ago
# @superadmin = create :user
# @other_volunteer = create :volunteer
# @group_offer = create :group_offer, necessary_volunteers: 2, title: 'some_group_offer'
# create :group_assignment, volunteer: @volunteer, group_offer: @group_offer
# create :group_assignment, volunteer: @other_volunteer, group_offer: @group_offer
# end
# def setup_feedbacks
# @assignment_volunteer_feedback = create :feedback, volunteer: @volunteer,
# author: @user_volunteer, feedbackable: @assignment,
# comments: 'author_volunteer_assignment_feedback'
# create :feedback, feedbackable: @assignment,
# volunteer: @volunteer, author: @superadmin, comments: 'author_superadmin_assignment_feedback'
# create :feedback, feedbackable: @group_offer, author: @user_volunteer,
# volunteer: @volunteer, comments: 'author_volunteer_group_offer_feedback'
# create :feedback, feedbackable: @group_offer, author: @superadmin, volunteer: @volunteer,
# comments: 'author_superadmin_group_offer_feedback'
# create :feedback, volunteer: @other_volunteer, feedbackable: @group_offer,
# author: @superadmin, comments: 'author_other_volunteer_group_offer_feedback'
# end
# test 'volunteer can see assignment feedbacks index' do
# setup_feedbacks
# login_as @user_volunteer
# visit root_url
# within '.navbar-top' do
# click_link I18n.t("role.#{@user_volunteer.role}"), href: '#'
# end
# click_link 'Profil bearbeiten'
# within '.assignments-table' do
# click_link 'Halbjahres-Rapport Liste', href: polymorphic_path([@volunteer, @assignment, Feedback])
# end
# refute page.has_text? 'author_superadmin_assignment_feedback'
# assert page.has_text? 'author_volunteer_assignment_feedback'
# end
# test 'volunteer can see group offer feedbacks index' do
# setup_feedbacks
# login_as @user_volunteer
# visit root_url
# within '.navbar-top' do
# click_link I18n.t("role.#{@user_volunteer.role}"), href: '#'
# end
# click_link 'Profil bearbeiten'
# within '.group-assignments-table' do
# click_link 'Halbjahres-Rapport Liste', href: polymorphic_path([@volunteer, @group_offer, Feedback])
# end
# refute page.has_text? 'author_superadmin_group_offer_feedback'
# assert page.has_text? 'author_volunteer_group_offer_feedback'
# end
# test 'assignment_feedback_index_contains_only_the_feedbacks_of_one_assignment' do
# setup_feedbacks
# login_as @user_volunteer
# visit volunteer_path(@user_volunteer.volunteer)
# within '.assignments-table' do
# click_link 'Halbjahres-Rapport Liste', href: polymorphic_path([@volunteer, @assignment, Feedback])
# end
# refute page.has_text? 'author_superadmin_assignment_feedback'
# assert page.has_text? 'author_volunteer_assignment_feedback'
# end
# test 'group offer feedbacks index contains only the feedbacks related to that group offer' do
# setup_feedbacks
# other_group_offer = create :group_offer, title: 'some_other_group_offer', necessary_volunteers: 2
# create :group_assignment, volunteer: @volunteer, group_offer: other_group_offer
# create :group_assignment, volunteer: @other_volunteer, group_offer: other_group_offer
# create :feedback, volunteer: @volunteer, feedbackable: other_group_offer,
# author: @user_volunteer, comments: 'same_volunteer_other_groupoffer_feedback'
# login_as @user_volunteer
# visit polymorphic_path([@volunteer, @group_offer, Feedback])
# assert page.has_text? 'author_volunteer_group_offer_feedback'
# refute page.has_text? 'author_superadmin_group_offer_feedback'
# refute page.has_text? 'author_other_volunteer_group_offer_feedback'
# refute page.has_text? 'same_volunteer_other_groupoffer_feedback'
# login_as @superadmin
# visit polymorphic_path([@volunteer, @group_offer, Feedback])
# assert page.has_text? 'author_volunteer_group_offer_feedback'
# assert page.has_text? 'author_superadmin_group_offer_feedback'
# assert page.has_text? 'author_other_volunteer_group_offer_feedback'
# refute page.has_text? 'same_volunteer_other_groupoffer_feedback'
# end
# test 'assignment feedbacks index contains only the feedbacks related to that assignment' do
# setup_feedbacks
# other_assignment = create :assignment, volunteer: @volunteer
# create :feedback, feedbackable: other_assignment, volunteer: @volunteer,
# author: @user_volunteer, comments: 'same_volunteer_other_assignment_feedback'
# login_as @user_volunteer
# visit polymorphic_path([@volunteer, @assignment, Feedback])
# assert page.has_text? 'author_volunteer_assignment_feedback'
# refute page.has_text? 'author_superadmin_assignment_feedback'
# refute page.has_text? 'same_volunteer_other_assignment_feedback'
# login_as @superadmin
# visit polymorphic_path([@volunteer, @assignment, Feedback])
# assert page.has_text? 'author_volunteer_assignment_feedback'
# assert page.has_text? 'author_superadmin_assignment_feedback'
# refute page.has_text? 'same_volunteer_other_assignment_feedback'
# end
# test 'volunteer can create only their feedbacks on assignment' do
# other_assignment = create :assignment, volunteer: create(:volunteer)
# login_as @user_volunteer
# visit new_polymorphic_path([@volunteer, other_assignment, Feedback])
# assert page.has_text? 'Sie sind nicht berechtigt diese Aktion durchzuführen.'
# end
# test 'volunteer can create only their feedbacks on group_offer' do
# other_group_offer = create :group_offer, necessary_volunteers: 2, title: 'other_group_offer'
# create :group_assignment, volunteer: create(:volunteer), group_offer: other_group_offer
# create :group_assignment, volunteer: create(:volunteer), group_offer: other_group_offer
# login_as @user_volunteer
# visit new_polymorphic_path([@volunteer, other_group_offer, Feedback])
# assert page.has_text? 'Sie sind nicht berechtigt diese Aktion durchzuführen.'
# end
# test 'create_new_assignment_feedback_as_volunteer' do
# login_as @user_volunteer
# play_create_new_assignment_feedback
# end
# test 'create new assignment feedback as superadmin' do
# login_as @superadmin
# play_create_new_assignment_feedback
# end
# test 'create new group_offer feedback as volunteer' do
# login_as @user_volunteer
# play_create_new_group_offer_feedback
# end
# test 'create new group_offer feedback as superadmin' do
# login_as @superadmin
# play_create_new_group_offer_feedback
# end
# FEEDBACK_FORM_FILL = [
# { text: 'important_goals_answer_given' , field: 'Was waren die wichtigsten Inhalte (oder Ziele) Ihres Einsatzes in den letzten Monaten?'},
# { text: 'achievment_answer_given' , field: 'Was konnte in den letzten Monaten erreicht werden?' },
# { text: 'continue_answer_given' , field: 'Soll der Einsatz weiterlaufen und wenn ja, mit welchen Inhalten (Zielen)?' },
# { text: 'new_comments_given', field: 'Bemerkungen' }
# ].freeze
# def play_create_new_assignment_feedback
# visit volunteer_path(@volunteer)
# within '.assignments-table' do
# click_link 'Halbjahres-Rapport erfassen'
# end
# FEEDBACK_FORM_FILL.each do |fill_values|
# fill_in fill_values[:field], with: fill_values[:text]
# end
# click_button 'Halbjahres-Rapport erfassen'
# assert page.has_text? 'Halbjahres-Rapport wurde erfolgreich erstellt.'
# within '.assignments-table' do
# click_link 'Halbjahres-Rapport Liste', href: polymorphic_path([@volunteer, @assignment, Feedback])
# end
# click_link 'Anzeigen'
# FEEDBACK_FORM_FILL.each do |fill_values|
# assert page.has_text? fill_values[:text]
# end
# end
# def play_create_new_group_offer_feedback
# visit volunteer_path(@volunteer)
# within '.group-assignments-table' do
# click_link 'Halbjahres-Rapport erfassen'
# end
# FEEDBACK_FORM_FILL.each do |fill_values|
# fill_in fill_values[:field], with: fill_values[:text]
# end
# click_button 'Halbjahres-Rapport erfassen'
# assert page.has_text? 'Halbjahres-Rapport wurde erfolgreich erstellt.'
# within '.group-assignments-table' do
# click_link 'Halbjahres-Rapport Liste', href: polymorphic_path([@volunteer, @group_offer, Feedback])
# end
# click_link 'Anzeigen'
# FEEDBACK_FORM_FILL.each do |fill_values|
# assert page.has_text? fill_values[:text]
# end
# end
# end
require 'application_system_test_case'
class VolunteerSubmitsAfterRemindTest < ApplicationSystemTestCase
setup do
@assignment = create :assignment
@volunteer = @assignment.volunteer
create :hour, hourable: @assignment, created_at: 2.days.ago
@assignment_feedback = create :feedback, feedbackable: @assignment, author: @volunteer.user,
volunteer: @volunteer
@group_offer = create :group_offer
@group_assignment = create :group_assignment, volunteer: @volunteer, group_offer: @group_offer
create :hour, hourable: @group_offer, volunteer: @volunteer, created_at: 2.days.ago
@group_offer_feedback = create :feedback, feedbackable: @group_offer, author: @volunteer.user,
volunteer: @volunteer, comments: 'feedback_volunteer1'
login_as @volunteer.user
end
test 'last_submitted_hours_and_feedbacks_form_is_autosaved' do
@volunteer.update(waive: false, iban: nil, bank: nil)
visit last_submitted_hours_and_feedbacks_assignment_path(@assignment)
fill_field_char_by_char_and_wait_for_ajax('IBAN', 'CH12345')
@volunteer.reload
assert_equal 'CH12345', @volunteer.iban
fill_field_char_by_char_and_wait_for_ajax('Bank', 'Name of the bank')
@volunteer.reload
assert_equal 'Name of the bank', @volunteer.bank
visit last_submitted_hours_and_feedbacks_assignment_path(@assignment)
assert page.has_field? 'IBAN', with: 'CH12345'
assert page.has_field? 'Name der Bank', with: 'Name of the bank'
check 'Ich verzichte auf die Auszahlung von Spesen.'
wait_for_ajax
@volunteer.reload
assert @volunteer.waive
visit last_submitted_hours_and_feedbacks_assignment_path(@assignment)
assert page.has_field? 'Ich verzichte auf die Auszahlung von Spesen.', checked: true
refute page.has_field? 'IBAN'
refute page.has_field? 'Name der Bank'
end
test 'volunteer_can_confirm_hours_and_feedbacks_for_their_assignment' do
visit last_submitted_hours_and_feedbacks_assignment_path(@assignment)
assert_text @assignment.client
assert_text @assignment_feedback.comments
check 'Ich verzichte auf die Auszahlung von Spesen.'
click_on 'Bestätigen'
assert_equal current_path, hours_and_feedbacks_submitted_assignments_path
assert_text 'Die Stunden und Halbjahres-Rapporte wurden erfolgreich bestätigt.'
@volunteer.reload
assert @volunteer.waive
end
test 'volunteer_can_confirm_hours_and_feedbacks_for_their_group_assignment' do
group_assignment = @group_offer.group_assignments.where(volunteer: @volunteer).last
visit last_submitted_hours_and_feedbacks_group_assignment_path(group_assignment)
assert_text group_assignment.to_label
assert_text @group_offer_feedback.comments
click_on 'Bestätigen'
assert_equal current_path, hours_and_feedbacks_submitted_assignments_path
assert_text 'Die Stunden und Halbjahres-Rapporte wurden erfolgreich bestätigt.'
end
test 'volunteer can see only own hours and feedbacks of group assignment' do
@group_assignment1 = @group_offer.group_assignments.where(volunteer: @volunteer).last
@hour_volunteer1 = create :hour, volunteer: @volunteer, hourable: @group_offer,
comments: 'hour_volunteer1'
@volunteer2 = create :volunteer
@group_assignment2 = @group_offer.group_assignments.where(volunteer: @volunteer2).last
@hour_volunteer2 = create :hour, volunteer: @volunteer2, hourable: @group_offer,
comments: 'hour_volunteer2'
@group_offer_feedback2 = create :feedback, feedbackable: @group_offer, author: @volunteer2.user,
volunteer: @volunteer2, comments: 'feedback_volunteer2'
visit last_submitted_hours_and_feedbacks_group_assignment_path(@group_assignment1)
assert_text 'hour_volunteer1'
assert_text 'feedback_volunteer1'
refute_text 'hour_volunteer2'
refute_text 'feedback_volunteer2'
end
test 'volunteer_can_edit_feedback_on_last_submitted_hours_and_feedbacks_path' do
login_as @assignment_feedback.volunteer.user
visit last_submitted_hours_and_feedbacks_assignment_path(@assignment_feedback.feedbackable)
click_link 'Bearbeiten', match_polymorph_path(
[@assignment_feedback.volunteer, @assignment_feedback.feedbackable, @assignment_feedback]
)
# assert the redirect back to the previous page works
fill_in 'Was konnte in den letzten Monaten erreicht werden?', with: 'some_different_goal_text'
click_button 'Halbjahres-Rapport aktualisieren'
assert page.has_text? 'Halbjahres-Rapport wurde erfolgreich geändert.'
assert page.has_text? 'Zuletzt übermittelte Stunden und Halbjahres-Rapporte'
end
test 'superadmin_clicks_submit_on_lshaf_form_ads_submitted_at_and_submitted_by' do
# Assignment
login_as @assignment_feedback.feedbackable.creator
visit last_submitted_hours_and_feedbacks_assignment_path(@assignment_feedback.feedbackable)
click_button 'Bestätigen'
@assignment_feedback.feedbackable.reload
assert_equal @assignment_feedback.feedbackable.creator, @assignment_feedback.feedbackable.submitted_by
# GroupAssignment
login_as @group_assignment.creator
visit last_submitted_hours_and_feedbacks_group_assignment_path(@group_assignment)
click_button 'Bestätigen'
@group_assignment.reload
assert_equal @group_assignment.creator, @group_assignment.submitted_by
end
test 'volunteer_does_not_see_bestaetigen_if_superadmin_allready_did' do
# Assignment
feedback_submitter = @assignment_feedback.feedbackable.creator
@assignment_feedback.feedbackable.update(submit_feedback: feedback_submitter)
login_as @assignment_feedback.volunteer.user
visit last_submitted_hours_and_feedbacks_assignment_path(@assignment_feedback.feedbackable)
assert page.has_text? 'Bestätigt am ' \
"#{I18n.l(@assignment_feedback.feedbackable.submitted_at.to_date)} durch " \
"#{feedback_submitter.full_name} - #{feedback_submitter.email}"
refute page.has_button? 'Bestätigen'
# GroupAssignment
feedback_submitter = @group_assignment.creator
@group_assignment.update(submit_feedback: feedback_submitter)
login_as @group_assignment.volunteer.user
visit last_submitted_hours_and_feedbacks_group_assignment_path(@group_assignment)
assert page.has_text? 'Bestätigt am ' \
"#{I18n.l(@group_assignment.submitted_at.to_date)} durch " \
"#{feedback_submitter.full_name} - #{feedback_submitter.email}"
refute page.has_button? 'Bestätigen'
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