# Copyright (c) 2008-2009 bivio Software Inc. All Rights Reserved. # $Id: crm-filters-status.btest,v 1.8 2010/11/17 22:35:37 schellj Exp $ test_setup('PetShop'); home_page(); my($name, $uri) = create_crm_forum(['crm_tech1']); do_logout(); visit_uri('/bp'); login_as('crm_tech1'); my($email) = generate_remote_email($name); my($cust1) = generate_local_email('crm_cust1'); my($tech1) = generate_local_email('crm_tech1'); send_mail($cust1, $email); my($ticket, $subject) = verify_local_mail($tech1, qr{.}, 1) =~ m{^Subject: .*#(\d+)\].*(.*)$}mi; die('no ticket') unless $ticket; my($to_lock, $to_open, $to_close) = map({ send_mail($cust1, $email); (verify_local_mail($tech1, qr{.}, 1) =~ m{^Subject: .*#(\d+)\]}mi)[0]; } 1..3); visit_uri($uri); follow_link('tickets'); foreach my $item ( ['Open (Locked)' => $to_lock], [Open => $to_open], [Close => $to_close], ) { my($action, $number) = @$item; follow_link(qr{^$number$}); submit_form(only => {action => $action}); } submit_form(refresh => { status => 'new', }); do_table_rows('Ticket', sub {test_equals(qr{new}i, shift->{Status})}); submit_form(refresh => { status => 'not_closed', }); my($status) = {}; verify_no_text('list is empty'); do_table_rows('Ticket', sub { $status->{shift->{Status}->as_string}++; return 1; }); test_ok($status->{New}, 'Not Closed status filter not including New threads'); test_ok($status->{Locked}, 'Not Closed status filter not including Locked threads'); test_ok($status->{Open}, 'Not Closed status filter not including Open threads'); test_ok(!$status->{Closed}, "Not Closed status filter is including Closed threads"); foreach my $status (qw(New Locked Open)) { while (get_html_parser()->get('Links')->unsafe_get($status)) { follow_link($status); submit_form(only => {action => 'Close'}); } }