start fixing test for multi cat phenotype upload.
[sgn.git] / t / selenium2 / breeders / create_phenotyping_spreadsheet.t
bloba43bf36a53e3e50120c940fd8c48491063cac9e2
1 use strict;
3 use lib 't/lib';
5 use Test::More 'tests' => 25;
6 use SGN::Test::WWW::WebDriver;
7 use SGN::Test::Fixture;
9 my $d = SGN::Test::WWW::WebDriver->new();
10 my $f = SGN::Test::Fixture->new();
12 $d->while_logged_in_as("submitter", sub {
13         sleep(2);
15         $d->get_ok('/breeders/trial/137');
16         sleep(3);
18         $d->find_element_ok("lists_link", "name", "find lists_link")->click();
20         $d->find_element_ok("add_list_input", "id", "find add list input");
22         my $add_list_input = $d->find_element_ok("add_list_input", "id", "find add list input test");
24         my $random_val = int(rand(1000));
25         my $list_name = sprintf("selenium_test_pheno_spreadsheet_%d", $random_val);
27         $add_list_input->send_keys($list_name);
28         sleep(1);
30         $d->find_element_ok("add_list_button", "id", "find add list button test")->click();
31         sleep(1);
33         $d->find_element_ok("view_list_$list_name", "id", "view list test")->click();
34         sleep(2);
36         $d->find_element_ok("updateListDescField", "id", "find list type")->send_keys($list_name);
38         $d->find_element_ok("type_select", "id", "find list type")->click();
39         $d->find_element_ok('option[name="traits"]', "css", "select type 'traits' from a list")->click();
40         sleep(1);
42         $d->find_element_ok("dialog_add_list_item", "id", "add test list")
43                 ->send_keys("dry matter content|CO_334:0000092\nfresh root weight|CO_334:0000012\nfresh shoot weight|CO_334:0000016\nharvest index|CO_334:0000015\n");
44         sleep(1);
46         $d->find_element_ok("dialog_add_list_item_button", "id", "find dialog_add_list_item_button test")->click();
48         $d->find_element_ok("close_list_item_dialog", "id", "find close_list_item_dialog button test")->click();
49         sleep(1);
51         $d->find_element_ok("close_list_dialog_button", "id", "find close dialog button")->click();
53         $d->get_ok('/breeders/trial/137');
54         sleep(5);
56         my $trail_files_onswitch = $d->find_element_ok(
57                 "trial_upload_files_onswitch",
58                 "id",
59                 "find and open 'trial upload files onswitch' and click");
60         $trail_files_onswitch->click();
61         sleep(2);
63         $d->find_element_ok(
64                 'button[name="create_spreadsheet_link"]',
65                 'css',
66                 "find create spreadsheet link")->click();
67         sleep(2);
69         $d->find_element_ok(
70                 'trait_list_spreadsheet_list_select',
71                 'id',
72                 "find list select select box")->click();
73         sleep(1);
75         $d->find_element_ok(
76                 "//select[\@id='trait_list_spreadsheet_list_select']//option[contains(text(),\"$list_name\")]",
77                 'xpath',
78                 "Select a new $list_name from list select")->click();
80         $d->find_element_ok('include_notes_column', 'id', "find include notes column checkbox and click")->click();
82         $d->find_element_ok(
83                 'create_spreadsheet_phenotype_file_format',
84                 'id',
85                 "find and open 'phenotype file format' select input")->click();
86         sleep(1);
88         $d->find_element_ok(
89                 '//select[@id="create_spreadsheet_phenotype_file_format"]//option[@value="ExcelBasicSimple"]',
90                 'xpath',
91                 "Select 'value: ExcelBasicSimple (name: Simple)' as file format")->click();
92         sleep(1);
94         $d->find_element_ok(
95                 'create_spreadsheet_data_level',
96                 'id',
97                 "find and open list of 'data levels' select input")->click();
98         sleep(1);
100         $d->find_element_ok(
101                 '//select[@id="create_spreadsheet_data_level"]//option[@value="plots"]',
102                 'xpath',
103                 "Select plants as value for select data levels input")->click();
104         sleep(1);
106         $d->find_element_ok('create_phenotyping_ok_button', 'id', "find create excel file button and click")->click();
108         sleep(3);
109         $d->logout_ok();
112 $d->driver->close();
113 $f->clean_up_db();
114 done_testing();