3 use Test::More 'tests' => 31;
5 use SGN::Test::WWW::WebDriver;
6 use SGN::Test::Fixture;
7 use Selenium::Remote::WDKeys 'KEYS';
9 my $f = SGN::Test::Fixture->new();
11 my $t = SGN::Test::WWW::WebDriver->new();
13 $t->while_logged_in_as("submitter", sub {
16 $t->get_ok('/breeders/accessions');
19 $t->find_element_ok("lists_link", "name", "find lists_link")->click();
21 my $random_val = int(rand(1000));
22 my $list_name = sprintf("pedigree_accessions_%d", $random_val);
23 $t->find_element_ok("add_list_input", "id", "find add list input test")->send_keys($list_name);
25 $t->find_element_ok("add_list_button", "id", "find add list button test")->click();
27 $t->find_element_ok("view_list_$list_name", "id", "view list test")->click();
31 "updateListDescField",
33 "add type of list")->send_keys("pedigree_accessions_for_selenium_tests");
35 $t->find_element_ok("type_select", "id", "add type of list")->click();
38 $t->find_element_ok('option[name="accessions"]', "css", "select type 'accessions' from a list")->click();
41 $t->find_element_ok("dialog_add_list_item", "id", "add test list")->send_keys("TMS14F1001P0001\nTMS14F1006P0001\nTMS14F1008P0004\nTMS14F1011P0002\nTMS14F1013P0005\nTMS13F1303P0001\nTMS13F1020P0002\nTMS13F1307P0011\nTMS13F1307P0020\nTMS13F1288P0009\nTMS13F1108P0007\n");
44 $t->find_element_ok("dialog_add_list_item_button", "id", "find dialog_add_list_item_button test")->click();
46 $t->find_element_ok("close_list_item_dialog", "id", "find close_list_item_dialog button test")->click();
48 $t->find_element_ok("close_list_dialog_button", "id", "find close dialog button and click")->click();
50 $t->get_ok('/breeders/accessions');
53 my $add_accessions_link = $t->find_element_ok(
54 "add_accessions_link",
56 "find element add accessions link as submitter");
57 $add_accessions_link->click();
60 $t->find_element_ok("list_div_list_select", "id", "select new list test")->click();
61 $t->find_element_ok("//select[\@id='list_div_list_select']//option[contains(text(),\"$list_name\")]", 'xpath', "select $list_name option")->click();
64 $t->find_element_ok("new_accessions_submit", "id", "submit new accessions")->click();
67 $t->find_element_ok("review_found_matches_hide", "id", "review found matches test")->click();
70 my $species_name_input = $t->find_element_ok("species_name_input", "id", "input species name");
71 $species_name_input->send_keys(KEYS->{'control'}, 'a');
72 $species_name_input->send_keys(KEYS->{'backspace'});
73 $species_name_input->send_keys("Manihot esculenta");
76 my $review_matches = $t->find_element_ok("review_absent_accessions_submit", "id", "review matches submit");
77 $review_matches->click();
81 $t->find_element_ok("close_add_accessions_saved_message_modal", "id", "close add accessions saved message modal");
83 # PEDIGREE UPLOAD FROM FILE FOR LIST
84 $t->get_ok('/breeders/accessions');
87 $t->find_element_ok("upload_pedigrees_link", "id", "click on upload_pedigrees_link ")->click();
90 my $upload_input = $t->find_element_ok("pedigrees_uploaded_file", "id", "find file input");
92 my $filename = $f->config->{basepath}."/t/data/pedigree_upload/pedigree_upload_selenium.txt";
94 $t->driver()->upload_file($filename);
96 $upload_input->send_keys($filename);
99 my $upload_pedigrees = $t->find_element_ok("upload_pedigrees_dialog_submit", "id", "submit upload pedigrees file ");
100 $upload_pedigrees->click();
104 $t->find_element_ok("upload_pedigrees_store", "id", "find and upload pedigrees store")->click();
106 $t->find_element_ok("pedigrees_upload_success_dismiss", "id", "dismiss success modal ")->click();
109 # PEDIGREE LIST DOWNLOAD
110 $t->get_ok('/breeders/download');
113 $t->find_element_ok("pedigree_accession_list_list_select", "id", "select pedigrees accession download list")->click();
117 "//select[\@id='pedigree_accession_list_list_select']/option[contains(text(),\"$list_name\")]",
119 "Confirm $list_name pedigrees accession list to download")->click();
122 $t->find_element_ok("pedigree", "id", "click pedigree download button")->click();