6 use SGN::Test qw/validate_urls/;
9 use SGN::Test::WWW::Mechanize;
10 use CXGN::GEM::Schema;
16 my $base_url = $ENV{SGN_TEST_SERVER};
17 my $mech = SGN::Test::WWW::Mechanize->new;
19 ## This test are local test, so it will use the with_test_level function
21 $mech->with_test_level( local => sub {
23 ## First take variables for the test from the database ##
25 my @schema_list = ('gem', 'biosource', 'metadata', 'public');
26 my $schema_list = join(',', @schema_list);
28 my $dbh = $mech->context()->dbc()->dbh();
30 my $schema = $mech->context->dbic_schema('CXGN::GEM::Schema');
32 ## WWW. GEM SEARCH TEST ###
34 $urls{"gem search page for templates"} = "/search/direct_search.pl?search=template";
35 $urls{"gem search page for experiments"} = "/search/direct_search.pl?search=experiment";
36 $urls{"gem search page for platforms"} = "/search/direct_search.pl?search=platform";
38 ## WWW. RESULT AND DETAIL PAGES ###
41 ## Take a template, an experiment name and a platform name
43 my ($template_row) = $schema->resultset('GeTemplate')
46 order_by => {-asc => 'template_id'},
51 ## Now it will test the expected gem result web-page if there is at least one row
52 ## in the database. If not, it will test the error page
54 if (defined $template_row) {
56 my $template_id = $template_row->get_column('template_id');
57 my $template_name = $template_row->get_column('template_name');
59 $urls{'gem results page for templates'} = "/search/gem_template_search.pl?w616_template_parameters=$template_name";
60 $urls{'gem template page'} = "/gem/template.pl?id=$template_id";
61 $urls{'gem template page (name)'} = "/gem/template.pl?name=$template_name";
66 my ($experiment_row) = $schema->resultset('GeExperiment')
69 order_by => {-asc => 'experiment_id'},
74 ## Now it will test the expected gem result web-page if there is at least one row
75 ## in the database. If not, it will test the error page
77 if (defined $experiment_row) {
79 my $experiment_id = $experiment_row->get_column('experiment_id');
80 my $experiment_name = $experiment_row->get_column('experiment_name');
82 my @exp_frags = split(/ /, $experiment_name);
83 my $partial_name = $exp_frags[0];
85 $urls{'gem results page for experiments'} = "/search/gem_experiment_search.pl?w932_experiment_parameters=$partial_name";
86 $urls{'gem experiment page'} = "/gem/experiment.pl?id=$experiment_id";
87 $urls{'gem experiment page (name)'} = "/gem/experiment.pl?name=$experiment_name";
92 my ($platform_row) = $schema->resultset('GePlatform')
95 order_by => {-asc => 'platform_id'},
100 if (defined $platform_row) {
102 my $platform_id = $platform_row->get_column('platform_id');
103 my $platform_name = $platform_row->get_column('platform_name');
105 my @plat_frags = split(/ /, $platform_name);
106 my $plat_partial_name = $plat_frags[0];
108 $urls{'gem results page for platform'} = "/search/gem_experiment_search.pl?w932_template_parameters=$plat_partial_name";
109 $urls{'gem platform page'} = "/gem/platform.pl?id=$platform_id";
110 $urls{'gem platform page (name)'} = "/gem/platform.pl?name=$platform_name";
113 ## EXPERIMENTAL DESIGN ##
115 my ($experimental_design_row) = $schema->resultset('GeExperimentalDesign')
118 order_by => {-asc => 'experimental_design_id'},
123 if (defined $experimental_design_row) {
125 my $expdesign_id = $experimental_design_row->get_column('experimental_design_id');
126 my $expdesign_name = $experimental_design_row->get_column('experimental_design_name');
128 $urls{'gem detail page for experimental design'} = "/gem/experimental_design.pl?id=$expdesign_id";
129 $urls{'gem detail page for experimental design (name)'} = "/gem/experimental_design.pl?name=$expdesign_name";
134 my ($target_row) = $schema->resultset('GeTarget')
137 order_by => {-asc => 'target_id'},
142 if (defined $target_row) {
144 my $target_id = $target_row->get_column('target_id');
145 my $target_name = $target_row->get_column('target_name');
147 $urls{'gem detail page for target'} = "/gem/target.pl?id=$target_id";
148 $urls{'gem detail page for target (name)'} = "/gem/target.pl?name=$target_name";
150 validate_urls(\%urls, $ENV{ITERATIONS} || 1 );