3 t/integration/feature.t - integration tests for generic feature URLs
7 Tests for generic feature URLs
11 These tests assume that a polypeptide does not have a specialized feature mason
12 component and gets rendered as a generic feature with mason/feature/default.mas
13 from SGN::Controller::Feature.
25 use SGN::Test::WWW::Mechanize skip_cgi => 1;
26 use SGN::Test::Data qw/ create_test /;
28 my $mech = SGN::Test::WWW::Mechanize->new;
30 my $poly_cvterm = create_test('Cv::Cvterm', { name => 'polypeptide' });
31 my $poly_feature = create_test('Sequence::Feature', { type => $poly_cvterm });
32 my $schema = $poly_feature->result_source->schema;
33 $poly_feature->add_to_featureprops({ value => 'Testing note one', type => $schema->get_cvterm_or_die('null:Note'), rank => 1 });
34 $poly_feature->add_to_featureprops({ value => 'Testing note two', type => $schema->get_cvterm_or_die('null:Note'), rank => 2 });
36 my $poly_featureloc = create_test('Sequence::Featureloc', { feature => $poly_feature });
38 for my $url ( "/feature/".$poly_feature->name.'/details', "/feature/".$poly_feature->feature_id.'/details' ) {
40 $mech->get_ok( $url );
42 $mech->html_lint_ok('valid HTML');
44 my ($name, $residues) = ($poly_feature->name, $poly_feature->residues);
46 like( $mech->findvalue( '/html/body//span[@class="sequence"]'), qr/>$name\s*/, "Found >$name\\n");
47 like( $mech->findvalue( '/html/body//div[@class="info_table_fieldval"]'), qr/polypeptide/i, "Found the polypeptide cvterm");
50 sprintf '/html/body//div[@class="info_table_fieldval"]/a[@href="/chado/cvterm?cvterm_id=%s"]',
51 $poly_cvterm->cvterm_id
52 ),'the proper cvterm id link exists');
54 $mech->content_contains('Polypeptide details');
55 $mech->content_contains($poly_feature->name);
57 $mech->content_contains('Testing note one');
58 $mech->content_contains('Testing note two');