# Copyright (c) 2008-2010 bivio Software, Inc. All Rights Reserved. # $Id: crm-ticket-deletion.btest,v 1.1 2011/12/14 10:31:18 andrews Exp $ test_setup('PetShop'); home_page(); login_as('crm_tech1'); my($tests) = [ { link_suffix => ['', '', '', ''], deleted => ['A', 'B', 'C'], }, { link_suffix => ['_3', '_2', '_1', ''], deleted => ['D', 'C', 'B'], }, { link_suffix => ['_3', '', '_1', ''], deleted => ['D', 'A', 'C'], }, ]; foreach my $test (@$tests) { my($subject) = 'Subject ' . random_string(); my($text) = 'text '. random_string(); visit_uri('/crm_forum/tickets'); follow_link('new_ticket'); submit_form('Send', { 'To:' => 'nemo@acme.com', 'Subject:' => $subject, 'Text:' => $text . ' A', }); foreach my $suffix qw(B C D) { follow_link_in_table('Ticket', 'Subject', $subject); follow_link('Answer'); submit_form('Send', { 'Action:' => 'Open', 'Text:' => $text . ' ' . $suffix, }); } visit_uri('/crm_forum/tickets'); follow_link($subject); my(@deleted) = @{$test->{deleted}}; foreach my $suffix (@{$test->{link_suffix}}) { follow_link('delete_message' . $suffix . '$'); submit_form('Delete'); visit_uri('/crm_forum/tickets'); if (my $d = shift(@deleted)) { follow_link($subject); verify_no_text($text . ' ' . $d); } else { verify_no_text($subject); } } }