Merge branch 'master' into topic/create_plant_entries
[sgn.git] / t / selenium2 / breeders / create_genotyping_trial.t
blobd6cb6cd08c816da16099d7be6ec0d46a5bfce87e
2 use strict;
4 use lib 't/lib';
6 use Test::More;
8 use Data::Dumper;
9 use SGN::Test::WWW::WebDriver;
10 use SGN::Test::Fixture;
12 my $f = SGN::Test::Fixture->new();
13 my $t = SGN::Test::WWW::WebDriver->new();
15 $t->while_logged_in_as(
16     "submitter", 
19     sub { 
20         $t->get_ok('/breeders/genotyping');
21         my $link = $t->find_element_ok("create_igd_genotyping_trial_link", "id", "find creategenotype trial link");
22         $link->click();
23         sleep(5);
25         my $input_year = $t->find_element_ok("year_select", "id", "find year select");
27         $input_year->send_keys("2015");
29         my $file_upload = $t->find_element_ok("igd_genotyping_trial_upload_file", "id", "find trial file upload button");
30         my $filename = $f->config->{basepath}."/t/data/genotype_trial_upload/CASSAVA_GS_74Template";
31         my $remote_filename = $t->driver()->upload_file($filename);
32         $file_upload->send_keys($filename);
33         
34         my $accession_input = $t->find_element_ok("igd_accession_select_box_list_select", "id", "find accession list"); 
35         $accession_input->send_keys("test_list");
37         my $ok = $t->find_element_ok("add_igd_geno_trial_submit", "id", "find ok button on submit genotype trial dialog");
38         $ok->click();
40         sleep(5);
42         $t->driver->accept_alert();
44         sleep(3);
45         
46         # verify Trial Design
47         #
48         $t->find_element_ok("trial_accessions_onswitch", "id", "view trial accessions")->click();
49         sleep(3);
50         $t->find_element_ok("BLANK", "partial_link_text", "verify accessions");
51         $t->find_element_ok("test_accession5", "partial_link_text", "verify accessions");
52         $t->find_element_ok("test_accession1", "partial_link_text", "verify accessions");
53         $t->find_element_ok("test_accession2", "partial_link_text", "verify accessions");
54         $t->find_element_ok("test_accession3", "partial_link_text", "verify accessions");
55         $t->find_element_ok("test_accession4", "partial_link_text", "verify accessions");
56         $t->find_element_ok("trial_controls_onswitch", "id", "view trial controls")->click();
57         sleep(3);
58         $t->find_element_ok("trial_plots_onswitch", "id", "view trial plots")->click();
59         sleep(3);
60         $t->find_element_ok("//div[contains(., 'CASSAVA_GS_74_A01')]", "xpath", "verify plots")->get_text();
61         $t->find_element_ok("//div[contains(., 'CASSAVA_GS_74_A02')]", "xpath", "verify plots")->get_text();
62         $t->find_element_ok("//div[contains(., 'CASSAVA_GS_74_A03')]", "xpath", "verify plots")->get_text();
63         $t->find_element_ok("//div[contains(., 'CASSAVA_GS_74_A04')]", "xpath", "verify plots")->get_text();
64         $t->find_element_ok("//div[contains(., 'CASSAVA_GS_74_A05')]", "xpath", "veify plots")->get_text();
65         $t->find_element_ok("//div[contains(., 'CASSAVA_GS_74_F05_BLANK')]", "xpath", "verify plots")->get_text();
66         
67         $t->find_element_ok("trial_plate_layout_onswitch", "id", "view plate layout")->click();
68         sleep(3);
69         $t->find_element_ok("//div[contains(., 'A01')]", "xpath", "verify plots")->get_text();
70         $t->find_element_ok("//div[contains(., 'A02')]", "xpath", "verify plots")->get_text();
71         $t->find_element_ok("//div[contains(., 'A03')]", "xpath", "verify plots")->get_text();
72         $t->find_element_ok("//div[contains(., 'A04')]", "xpath", "verify plots")->get_text();
73         $t->find_element_ok("//div[contains(., 'A05')]", "xpath", "verify plots")->get_text();
74         $t->find_element_ok("//div[contains(., 'F05')]", "xpath", "verify plots")->get_text();
75         
76         sleep(1);
77         $t->download_linked_file("genotyping_trial_spreadsheet_link");
78         
79         sleep(10);
80         
81     });
84 done_testing();