6 use Test::More 'tests' => 24;
7 use SGN::Test::WWW::WebDriver;
9 my $d = SGN::Test::WWW::WebDriver->new();
11 $d->while_logged_in_as('submitter', sub {
13 $d->get_ok('/tools'); # something else than the index page, which has a dialog that messes up the test
16 # Create a new trail list for comparison test
17 my $lists = $d->find_element_ok('navbar_lists', 'id', 'find navbar list button');
20 my $add_list_input = $d->find_element_ok('add_list_input', 'id', 'find add list input');
21 $add_list_input->send_keys('new_trial_list');
23 my $add_list_button = $d->find_element_ok('add_list_button', 'id', 'find add list button');
24 $add_list_button->click();
27 '//div[@id="private_list_data_table_filter"]//input[@type="search"]',
29 "find search in table and find 'new_trial_list'")->send_keys('new_trial_list');
32 $d->find_element_ok("view_list_new_trial_list", "id", "view new list test")->click();
35 $d->find_element_ok("updateListDescField", "id", "add trial test list description")->send_keys("new_trial_list_description");
38 $d->find_element_ok("updateListDescButton", "id", "find update List Desc Button")->click();
40 $d->driver()->accept_alert();
44 $d->find_element_ok("dialog_add_list_item", "id", "add trial test list")->send_keys("Kasese solgs trial\ntrial2 NaCRRI");
48 $d->find_element_ok("dialog_add_list_item_button", "id", "find dialog_add_list_item_button test")->click();
52 $d->find_element_ok("type_select", "id", "find select of type list")->click();
55 '//select[@id="type_select"]/option[@name="trials"]',
57 "select 'trials' as type list")->click();
60 $d->find_element_ok("list_item_dialog_validate", "id", "find and click validate 'trails' type list")->click();
63 $d->driver()->accept_alert();
66 $d->find_element_ok("close_list_item_dialog", "id", "find close list item dialog")->click();
70 $d->find_element_ok("close_list_dialog_button", "id", "find close dialog button")->click();
74 # Change page to trial comparison
75 $d->get_ok('/tools/trial/comparison/list');
79 $d->find_element("trials_list_select", "id", "find trials select")->click();
83 '//select[@id="trials_list_select"]/option[contains(text(), "new_trial_list")]',
85 "select 'new_trial_list' as list")->click();
88 $d->find_element_ok("unit_select", "id", "find select plot observation level")->click();
92 '//select[@id="unit_select"]/option[@value="plot"]',
94 "select plot observation level")->click();
97 $d->find_element_ok("trait_select", "id", "find trait select");
100 '//select[@id="trait_select"]/option[contains(text(), "dry matter content percentage|CO_334:0000092")]',
102 "select 'new_trial_list' as list")->click();
105 # Check trial names on axis of created plot
106 my $plot_view = $d->find_element_ok(
107 '//div[@id="tc-grid"]',
109 'find a content of plot')->get_attribute('innerHTML');
112 ok($plot_view =~ /trial2 NaCRRI/, "Verify if test_accession1 on pedigree panel");
113 ok($plot_view =~ /Kasese solgs trial/, "Verify if 'Kasese solgs trial' on pedigree panel");