3 solgs.t - integration tests for solgs
15 use SGN::Test::WWW::Mechanize;
18 BEGIN { use_ok( 'SGN::Test::WWW::Mechanize' ) or
19 BAIL_OUT('Could not load SGN::Test::WWW::Mechanize');
22 BEGIN { use_ok( 'Test::More' ) or
23 BAIL_OUT('Could not load Test::More');
26 BEGIN { use_ok( 'SGN::Controller::solGS::solGS' ) or
27 BAIL_OUT( 'Could not load SGN::Controller::solGS::solGS');
29 BEGIN { use_ok( 'SGN::Model::solGS::solGS' ) or
30 BAIL_OUT( 'Could not load SGN::Model::solGS::solGS');
32 BEGIN { use_ok( 'SGN::Controller::solGS::solgsStock' ) or
33 BAIL_OUT( 'Could not load SGN::Controller::solGS::solgsStock');
37 my $mech = SGN::Test::WWW::Mechanize->new;
39 $mech->get_ok('/solgs/search', 'search page');
40 $mech->content_contains('Search for a trait', 'search trait section');
41 $mech->content_contains('Browse by traits', 'traits index');
43 my @traits_indices = $mech->find_all_links( url_regex => qr/solgs\/traits/ );
44 $mech->links_ok( \@traits_indices, 'trait indices links work' );
45 $mech->get_ok($traits_indices[0], 'a page for a list of traits starting with a certain letter');
46 $mech->content_contains('Traits beginning with', 'traits list section');
48 my @traits_list= $mech->find_all_links( url_regex => qr/solgs\/search\/result\/traits/i );
49 $mech->links_ok( \@traits_list, 'links to traits starting with a certain letter work.' );
50 $mech->get_ok($traits_list[0], 'a link to a traits search page works');
51 $mech->content_contains('Traits with genomic selection data', 'Traits with genomic selection data');
53 my @traits_pop= $mech->find_all_links( url_regex => qr/solgs\/search\/result\/populations/i );
54 $mech->links_ok( \@traits_pop, 'links to search page for populations evaluated for a trait work.' );
55 $mech->get_ok($traits_pop[0], 'a link to populations evaluated for a trait search page works');
56 $mech->get_ok($traits_pop[0], $traits_pop[0]->url);
57 $mech->content_contains('select a training population to calculate GEBV', 'list of training populations for a trait section');
58 # diag('Please wait..this may take a few minutes..');
59 # my @training_pops = $mech->find_all_links(url_regex=> qr/trait\/70682\/population/);
62 # foreach my $tr_pop (@training_pops) {
63 # my $url = $tr_pop->url;
64 # $mech->links_ok( $url, $url ) or
65 # diag("if similar urls are passing the test, page $url might be
66 # failing because of the type of its dataset.");
69 $mech->get_ok('/solgs/trait/70682/population/128', 'a training population page');
70 $mech->content_contains($_)
73 'Trait phenotype data',
74 'Predicted genomc estimated breeding values',
77 '10 folds cross-validation report',
80 diag('GEBV data download');
81 my $gebv_download_link = $mech->find_link( text_regex => qr/download all gebvs/i );
82 ok( $gebv_download_link, 'got a GEBV data download link' );
83 my $url = defined $gebv_download_link ? $gebv_download_link->url : '';
84 $url ? $mech->links_ok( $url, 'GEBV data download link works' )
85 : ok(0, 'no GEBV download url found');
87 my $size = length( $mech->content );
88 cmp_ok( $size, '>=', 1000,"got at least 1KB (file size: $size, $url) of data from the GEBV data download url" );
91 diag('Marker Effects data download');
92 $mech->get_ok('/solgs/trait/70682/population/128', 'a training population page');
93 my $marker_download_link = $mech->find_link( text_regex => qr/download all marker effects/i );
94 ok( $marker_download_link, 'got a marker effects data download link' );
95 $url = defined $marker_download_link ? $marker_download_link->url : '';
96 $url ? $mech->links_ok( $url, 'Marker effects data download link works' )
97 : ok(0, 'no marker effects download url found');
99 $size = length( $mech->content );
100 cmp_ok( length( $mech->content ), '>=', 1000,"got at least 1KB (file size: $size, $url) of data from the marker effects data download url" );
103 diag('Model accuracy data download');
104 $mech->get_ok('/solgs/trait/70682/population/128', 'a training population page');
105 my $accuracy_download_link = $mech->find_link( text_regex => qr/download model accuracy/i );
106 ok( $accuracy_download_link, 'got a model accuracy data download link' );
107 $url = defined $accuracy_download_link ? $accuracy_download_link->url : '';
108 $url ? $mech->links_ok( $url, 'Model accuracy data download link works' )
109 : ok(0, 'no model accuracy download url found');
111 $size = length( $mech->content);
112 cmp_ok( $size, '>=', 100,"got at least 0.1KB (file size: $size, $url) of data from the model accuracy data download url" );
115 $mech->get_ok('/solgs/population/128', 'Got a population page');
116 $mech->content_contains($_)
118 'Population summary',
123 diag("Please wait... this may a few minutes..");
124 my @traits= $mech->find_all_links( url_regex => qr/solgs\/trait/ );
125 my $no_traits = scalar(@traits);
126 cmp_ok($no_traits, '>=', 1, "this population has $no_traits traits for GS analysis");
128 diag("Please wait... this may take a few minutes..");
129 $url = $traits[0]->url;
130 $mech->get_ok($traits[0], "run GS for a trait ($url) of a training population");
131 $mech->content_contains($_)
133 'Population summary',
134 'Trait phenotype data',
135 'Predicted genomc estimated breeding values',
138 '10 folds cross-validation report',
139 'prediction population',
142 diag("Please wait... combining populations...this may a few minutes..");
143 $mech->get_ok('/solgs/combine/populations/trait/confirm/70762', 'confirmation page for populations to be combined');
144 $mech->get_ok('/solgs/model/combined/populations/2789927696/trait/70762', 'GEBV output for combined training populations');
145 $mech->content_contains($_)
147 'Population summary',
148 'Trait phenotype data',
149 'Predicted genomc estimated breeding values',
152 '10 folds cross-validation report',