8 use SGN::Test::WWW::WebDriver;
9 use SGN::Test::Fixture;
11 my $t = SGN::Test::WWW::WebDriver->new();
12 my $f = SGN::Test::Fixture->new();
13 my $schema = $f->bcs_schema;
15 $t->while_logged_in_as("submitter", sub {
17 $t->get_ok("/breeders/trials");
20 my $refresh_tree = $t->find_element_ok("refresh_jstree_html", "id", "refresh tree")->click();
23 my $open_tree = $t->find_element_ok("jstree-icon", "class", "open up tree")->click();
26 my $add_folder = $t->find_element_ok("new_folder_dialog_link", "id", "create new folder")->click();
28 my $new_folder_name = $t->find_element_ok("new_folder_name", "id","pass F1 as new folder name")->send_keys("F1");
30 my $add_folder_submit = $t->find_element_ok("new_folder_submit", "id", "create new folder submit")->click();
31 $t->driver->accept_alert();
34 my $refresh_tree = $t->find_element_ok("refresh_jstree_html", "id", "refresh tree")->click();
37 my $open_tree = $t->find_element_ok("jstree-icon", "class", "open up tree")->click();
40 my $page_source = $t->driver->get_page_source();
42 ok($page_source =~ /glyphicon-folder-open/, "check if folder appears");
45 my $add_folder = $t->find_element_ok("new_folder_dialog_link", "id", "create new folder")->click();
48 my $new_folder_name = $t->find_element_ok("new_folder_name", "id","pass F2 as new folder name")->send_keys("F2");
50 my $new_folder_name = $t->find_element_ok("new_folder_parent_folder_id", "id","pass F1 as new folder's parent name")->send_keys("F1");
52 my $add_folder_submit = $t->find_element_ok("new_folder_submit", "id", "create new folder submit")->click();
53 $t->driver->accept_alert();
56 my $refresh_tree = $t->find_element_ok("refresh_jstree_html", "id", "refresh tree")->click();
59 my $open_tree = $t->find_element_ok("jstree-icon", "class", "open up tree")->click();
63 my $add_trial = $t->find_element_ok("open_folder_dialog_link", "id", "place trial in F2")->click();
66 my $folder_name = $t->find_element_ok("html_select_folder_for_trial", "id","pass F2 as folder name")->send_keys("F1F2");
68 my $trial_name = $t->find_element_ok("html_select_trial_for_folder", "id","pass test_trial as trial name")->send_keys("test_trial");
70 my $trial_submit = $t->find_element_ok("set_trial_folder", "id", "add trial to folder submit")->click();
71 $t->driver->accept_alert();
74 my $refresh_tree = $t->find_element_ok("refresh_jstree_html", "id", "refresh tree")->click();
77 #my $open_tree = $t->find_element_ok("jstree-icon", "class", "open up tree")->click();
80 $t->get_ok("/folder/145");
83 my $delete_folder = $t->find_element_ok("delete_folder_button", "id", "delete folder fails because child folder.")->click();
84 $t->driver->accept_alert();
86 $t->driver->accept_alert();
89 my $move_folder = $t->find_element_ok("Folders", "partial_link_text", "go to folder tab")->click();
93 my $move_folder = $t->find_element_ok("move_folder_dialog_link", "id", "move folder")->click();
95 my $folder_name = $t->find_element_ok("move_folder_id", "id","pass F2 as folder name")->send_keys("F1F2");
97 my $move_folder = $t->find_element_ok("move_folder_submit", "id", "move folder")->click();
98 $t->driver->accept_alert();
100 $t->get_ok("/folder/145");
103 my $delete_folder = $t->find_element_ok("delete_folder_button", "id", "delete folder")->click();
104 $t->driver->accept_alert();
106 $t->driver->accept_alert();
108 my $check_folder_deleted = $schema->resultset("Project::Project")->find({ project_id => 145});
109 ok(!$check_folder_deleted, "folder deleted.");