6 use SGN::Test::WWW::WebDriver;
7 use SGN::Test::Fixture;
8 use SGN::Test::solGSData;
10 my $d = SGN::Test::WWW::WebDriver->new();
11 my $f = SGN::Test::Fixture->new();
13 my $solgs_data = SGN::Test::solGSData->new({'fixture' => $f, 'accessions_list_subset' => 60, 'plots_list_subset' => 60});
14 my $cache_dir = $solgs_data->site_cluster_shared_dir();
15 print STDERR "\nsite_cluster_shared_dir-- $cache_dir\n";
17 my $accessions_list = $solgs_data->load_accessions_list();
18 # my $accessions_list = $solgs_data->get_list_details('accessions');
19 my $accessions_list_name = $accessions_list->{list_name};
20 my $accessions_list_id = 'list_' . $accessions_list->{list_id};
21 print STDERR "\naccessions list: $accessions_list_name -- $accessions_list_id\n";
22 my $plots_list = $solgs_data->load_plots_list();
23 # my $plots_list = $solgs_data->get_list_details('plots');
24 my $plots_list_name = $plots_list->{list_name};
25 my $plots_list_id = 'list_' . $plots_list->{list_id};
27 print STDERR "\nadding trials list '\n";
28 my $trials_list = $solgs_data->load_trials_list();
29 # my $trials_list = $solgs_data->get_list_details('trials');
30 my $trials_list_name = $trials_list->{list_name};
31 my $trials_list_id = 'list_' . $trials_list->{list_id};
32 print STDERR "\nadding trials dataset\n";
33 # my $trials_dt = $solgs_data->get_dataset_details('trials');
34 my $trials_dt = $solgs_data->load_trials_dataset();
35 my $trials_dt_name = $trials_dt->{dataset_name};
36 my $trials_dt_id = 'dataset_' . $trials_dt->{dataset_id};
37 print STDERR "\nadding accessions dataset\n";
38 # my $accessions_dt = $solgs_data->get_dataset_details('accessions');
39 my $accessions_dt = $solgs_data->load_accessions_dataset();
40 my $accessions_dt_name = $accessions_dt->{dataset_name};
41 my $accessions_dt_id = 'dataset_' . $accessions_dt->{dataset_id};
43 print STDERR "\nadding plots dataset\n";
44 # my $plots_dt = $solgs_data->get_dataset_details('plots');
45 my $plots_dt = $solgs_data->load_plots_dataset();
46 my $plots_dt_name = $plots_dt->{dataset_name};
47 my $plots_dt_id = 'dataset_' . $plots_dt->{dataset_id};
49 #$accessions_dt_name = '' . $accessions_dt_name . '';
50 print STDERR "\ntrials dt: $trials_dt_name -- $trials_dt_id\n";
51 print STDERR "\naccessions dt: $accessions_dt_name -- $accessions_dt_id\n";
52 print STDERR "\nplots dt: $plots_dt_name -- $plots_dt_id\n";
54 print STDERR "\ntrials list: $trials_list_name -- $trials_list_id\n";
55 print STDERR "\naccessions list: $accessions_list_name -- $accessions_list_id\n";
56 print STDERR "\nplots list: $plots_list_name -- $plots_list_id\n";
61 $d->while_logged_in_as("submitter", sub {
64 $d->get('/solgs', 'solgs home page');
66 $d->find_element_ok('population_search_entry', 'id', 'population search form')->send_keys('Kasese solgs trial');
68 $d->find_element_ok('search_training_pop', 'id', 'search for training pop')->click();
70 $d->find_element_ok('Kasese', 'partial_link_text', 'create training pop')->click();
72 $d->find_element_ok('queue_job', 'id', 'submit job tr pop')->click();
74 $d->find_element_ok('analysis_name', 'id', 'job queueing')->send_keys('Test Kasese Tr pop');
76 $d->find_element_ok('user_email', 'id', 'user email')->send_keys('email@email.com');
78 $d->find_element_ok('submit_job', 'id', 'submit')->click();
80 $d->find_element_ok('Go back', 'partial_link_text', 'go back')->click();
82 $d->find_element_ok('population_search_entry', 'id', 'population search form')->send_keys('Kasese solgs trial');
84 $d->find_element_ok('search_training_pop', 'id', 'search for training pop')->click();
86 $d->find_element_ok('Kasese', 'partial_link_text', 'create training pop')->click();
89 my $heri = $d->find_element('heritability', 'partial_link_text', 'scroll to heritability');
90 my $elem = $d->driver->execute_script( "arguments[0].scrollIntoView(true);window.scrollBy(0,-70);", $heri);
92 $d->find_element_ok('run_pheno_heritability', 'id', 'run heritability')->click();
94 $d->find_element_ok('//div[@id="heritability_canvas"]//*[contains(., "DMCP")]', 'xpath', 'heritability result')->get_text();
96 $d->find_element_ok('Download heritability', 'partial_link_text', 'download heritability')->click();
98 $d->find_element_ok('//*[contains(text(), "DMCP")]', 'xpath', 'check heritability download')->click();
100 $d->driver->go_back();
106 $d->get_ok('/breeders/trial/139', 'trial detail home page');
108 my $analysis_tools = $d->find_element('Analysis Tools', 'partial_link_text', 'toogle analysis tools');
109 my $elem = $d->driver->execute_script( "arguments[0].scrollIntoView(true);window.scrollBy(0,-50);", $analysis_tools);
111 $d->find_element_ok('Analysis Tools', 'partial_link_text', 'toogle analysis tools')->click();
113 $d->find_element_ok('run_pheno_heritability', 'id', 'run heritability')->click();
115 $d->find_element_ok('//div[@id="heritability_canvas"]//*[contains(., "DMCP")]', 'xpath', 'heritability result')->get_text();
117 $d->find_element_ok('Download heritability', 'partial_link_text', 'download heritability')->click();
119 $d->find_element_ok('//*[contains(text(), "DMCP")]', 'xpath', 'check heritability download')->click();
121 $d->driver->go_back();
124 foreach my $list_id ($trials_list_id, $accessions_list_id, $plots_list_id) {
125 $list_id =~ s/\w+_//g;
126 $solgs_data->delete_list($list_id);
129 foreach my $dataset_id ($trials_dt_id, $accessions_dt_id, $plots_dt_id) {
130 $dataset_id =~ s/\w+_//g;
131 $solgs_data->delete_dataset($dataset_id);