3 stock_search.t - tests for /stock/search/
7 Tests for stock search page
11 Naama Menda <nm249@cornell.edu>
20 BEGIN { $ENV{SGN_SKIP_CGI} = 1 } #< can skip compiling cgis, not using them here
21 use SGN::Test::Data qw/create_test/;
22 use SGN::Test::WWW::Mechanize;
25 my $mech = SGN::Test::WWW::Mechanize->new;
27 $mech->get_ok("/stock/search/");
29 $mech->content_contains("Stock name");
30 $mech->content_contains("Stock type");
31 $mech->content_contains("Organism");
32 $mech->html_lint_ok('empty stock search valid html');
34 $mech->with_test_level( local => sub {
35 my $stock = create_test('Stock::Stock', {
36 description => "LALALALA3475",
38 my $person = $mech->create_test_user(
39 first_name => 'testfirstname',
40 last_name => 'testlastname',
41 user_name => 'testusername',
42 password => 'testpassword',
43 user_type => 'submitter',
45 my $sp_person_id = $person->{id};
47 $stock->create_stockprops( {'sp_person_id' => $sp_person_id} , {cv_name => 'local'} );
49 $mech->submit_form_ok({
50 form_name => 'stock_search_form',
52 stock_name => $stock->name,
53 person => $person->{first_name} . ', ' . $person->{last_name},
55 }, 'submitted stock search form');
57 $mech->html_lint_ok('valid html after stock search');
59 $mech->content_contains( $stock->name );
60 $mech->content_contains("results");
62 #go to the stock detail page
63 $mech->follow_link_ok( { url => '/stock/'.$stock->stock_id.'/view' }, 'go to the stock detail page' );
65 $mech->html_lint_ok( 'stock detail page html ok' );