cv for average = 0
[sgn.git] / t / selenium2 / breeders / breeder_search.t
blob2b023c500acb397811cc3aa67cf075ec8f82d6b5
1 use lib 't/lib';
3 use Test::More;
4 use SGN::Test::WWW::WebDriver;
5 use SGN::Test::Fixture;
6 use CXGN::BreederSearch;
8 my $f = SGN::Test::Fixture->new();
10 my $bs = CXGN::BreederSearch->new( { dbh=> $f->dbh() });
12 my $refresh = 'SELECT refresh_materialized_views()';
13 my $h = $f->dbh->prepare($refresh);
14 $h->execute();
16 my $t = SGN::Test::WWW::WebDriver->new();
17 #$t->driver->set_implicit_wait_timeout(5);
19 $t->get_ok('/breeders/search');
21 $t->find_element_ok("c1_to_list_menu", "id", "check if login prompt appears for c1")->send_keys('breeding programs');
23 sleep(1);
25 $t->while_logged_in_as("submitter", sub {
26     $t->get_ok('/breeders/search');
28     $t->find_element_ok("select1", "id", "retrieve traits")->send_keys('traits');
30     sleep(1);
32     $t->find_element_ok("c1_data", "id", "select specific trait")->send_keys('dry matter content|CO:0000092');
34     sleep(1);
36     $t->find_element_ok("c1_select_all", "id", "select all traits")->click();
38     sleep(1);
40     $t->find_element_ok("select2", "id", "retrieve trials")->send_keys('trials');
42     sleep(3);
44     $t->find_element_ok("c2_data", "id", "select specific trial")->send_keys('Kasese solgs trial');
46     sleep(1);
48     $t->find_element_ok("c2_select_all", "id", "select all trials")->click();
50     sleep(1);
52     $t->find_element_ok("select3", "id", "retrieve years")->send_keys('years');
54     sleep(3);
56     $t->find_element_ok("c3_data", "id", "select specific year")->send_keys('2014');
58     sleep(1);
60     $t->find_element_ok("c3_select_all", "id", "select all years")->click();
62     sleep(1);
64     $t->find_element_ok("select4", "id", "retrieve accessions")->send_keys('accessions');
66     sleep(3);
68     $t->find_element_ok("c4_data", "id", "select specific accession")->send_keys('UG120001');
70     sleep(1);
72     $t->find_element_ok("c4_select_all", "id", "select all accessions")->click();
74     sleep(1);
76     $t->find_element_ok("c1_data_new_list_name", "id", "new list")->send_keys('trait_list');
78     $t->find_element_ok("c1_data_add_to_new_list", "id", "create trait list")->click();
80     sleep(3);
82     $t->driver->accept_alert();
84     $t->find_element_ok("c2_data_new_list_name", "id", "new list")->send_keys('trial_list');
86     $t->find_element_ok("c2_data_add_to_new_list", "id", "create trial list")->click();
88     sleep(1);
90     $t->driver->accept_alert();
92     $t->find_element_ok("c3_data_new_list_name", "id", "new list")->send_keys('year_list');
94     $t->find_element_ok("c3_data_add_to_new_list", "id", "create year list")->click();
96     sleep(1);
98     $t->driver->accept_alert();
100     $t->find_element_ok("c4_data_new_list_name", "id", "new list")->send_keys('acc_list');
102     $t->find_element_ok("c4_data_add_to_new_list", "id", "create accession list")->click();
104     sleep(1);
106     $t->driver->accept_alert();
108     $t->find_element_ok("paste_list_select", "id", "paste test acc list")->send_keys('test_list');
110     sleep(2);
112     $t->find_element_ok("c1_data", "id", "select pasted test accession")->send_keys('test_accession1');
114     $t->find_element_ok("c1_select_all", "id", "select all pasted accessions")->click();
116     ## add test for '0 results' error here?
118     $t->find_element_ok("c1_data_list_select", "id", "select acc_list")->send_keys('acc_list');
120     $t->find_element_ok("c1_data_button", "id", "add c1_data to acc_list")->click();
122     sleep(1);
124     $t->driver->accept_alert();
126     $t->find_element_ok("refresh_lists", "id", " refresh lists")->click();
128     sleep(1);
130     $t->find_element_ok("paste_list_select", "id", "paste test acc list")->send_keys('acc_list');
132     sleep(5);
134     $t->find_element_ok("c1_data", "id", "select pasted test accession")->send_keys('test_accession1');
136     $t->find_element_ok("c1_data", "id", "select pasted list accession")->send_keys('UG120001');
138     sleep(1);
140     $t->find_element_ok("select1", "id", "retrieve breeding programs")->send_keys('breeding_programs');
142     sleep(2);
144     $t->find_element_ok("c1_data", "id", "select specific breeding_program")->send_keys('test');
146     $t->find_element_ok("c2_querytype_or", "id", "toggle c2_querytype to intersect")->click();
148     sleep(1);
150     $t->find_element_ok("c1_select_all", "id", "select all breeding programs")->click();
152     $t->find_element_ok("select2", "id", "retrieve genotyping protocols")->send_keys('genotyping_protocols');
154     sleep(1);
156     $t->find_element_ok("c2_data", "id", "select specific genotyping protocol")->send_keys('GBS ApeKI genotyping v4');
158     $t->find_element_ok("c3_querytype_or", "id", "toggle c3_querytype to intersect")->click();
160     $t->find_element_ok("c2_select_all", "id", "select all breeding programs")->click();
162     $t->find_element_ok("select3", "id", "retrieve locations")->send_keys('locations');
164     sleep(1);
166     $t->find_element_ok("c3_data", "id", "select specific location")->send_keys('test_location');
168     $t->find_element_ok("c4_querytype_or", "id", "toggle c4_querytype to intersect")->click();
170     $t->find_element_ok("c3_select_all", "id", "select all locations")->click();
172     $t->find_element_ok("select4", "id", "retrieve plots")->send_keys('plots');
174     sleep(2);
176     $t->find_element_ok("c4_data", "id", "select specific plot")->send_keys('KASESE_TP2013_1000');
178     $t->find_element_ok("c2_querytype_and", "id", "toggle c2_querytype to union")->click();
180     $t->find_element_ok("c3_querytype_and", "id", "toggle c3_querytype to union")->click();
182     $t->find_element_ok("c4_querytype_and", "id", "toggle c4_querytype to union")->click();
184     }
188 done_testing();