cv for average = 0
[sgn.git] / t / selenium2 / breeders / calendar_personal.t
blob1b763f6dc73a1048ef030abd33c21e646aaacc9d
1 use lib 't/lib';
3 use Test::More;
5 use SGN::Test::WWW::WebDriver;
7 my $t = SGN::Test::WWW::WebDriver->new();
9 $t->while_logged_in_as("submitter", sub { 
11     $t->get_ok('/calendar/personal');
13     $t->find_element_ok("fc-day", "class", "find day")->click();
15     sleep(3);
17     my $event_project_select = $t->find_element_ok("event_project_select", "id", "find event project select");
19     $event_project_select->send_keys('test');
20     
21     my $event_type_select = $t->find_element_ok("event_type_select", "id", "find event type select");
23     $event_type_select->send_keys('Planning Event');
24     
25     $t->find_element_ok("event_start", "id", "find event start")->click();
27     my $event_start_calendar = $t->find_element_ok(".day.active", "css", "find active day on calendar select");
29     $event_start_calendar->click();
31     sleep(1);
33     my $event_desc = $t->find_element_ok("event_description", "id", "find event description input");
35     $event_desc->click();
37     $event_desc->send_keys('test event description');
39     my $event_url = $t->find_element_ok("event_url", "id", "find event url input");
41     $event_url->send_keys('test.com');
43     $t->find_element_ok("add_event_submit", "id", "submit event")->click();
44     
45     sleep(1);
47     $t->driver->accept_alert();
49     sleep(1);
51     my $cal_event = $t->find_element_ok("test", "partial_link_text", "find test event");
53     $cal_event->click();
55     sleep(1);
57     $t->find_element_ok("test", "partial_link_text", "find test in event details");
59     $t->find_element_ok("Planning Event", "partial_link_text", "find event type in event details");
61     $t->find_element_ok("http://www.test.com", "partial_link_text", "find event url in event details");
63     $t->find_element_ok("event_edit_display", "id", "find event details edit")->click();
65     my $edit_event_project_select = $t->find_element_ok("edit_event_project_select", "id", "find edit event project select");
67     $edit_event_project_select->send_keys('test_trial');
68     
69     my $edit_event_type_select = $t->find_element_ok("edit_event_type_select", "id", "find edit event type select");
71     $edit_event_type_select->send_keys('harvest_date');
72     
73     $t->find_element_ok("edit_event_start", "id", "find edit event start")->click();
75     my $edit_event_desc = $t->find_element_ok("edit_event_description", "id", "find edit event description input");
77     $edit_event_desc->send_keys('test edit event description');
79     my $edit_event_url = $t->find_element_ok("edit_event_url", "id", "find edit event url input");
81     $edit_event_url->clear();
83     $edit_event_url->send_keys('http://www.testedit.com');
85     $t->find_element_ok("edit_event_submit", "id", "submit edit event")->click();
86     
87     sleep(2);
89     $t->driver->accept_alert();
91     sleep(2);
93     my $cal_editted_event = $t->find_element_ok("test_trial", "partial_link_text", "find test event");
95     $cal_editted_event->click();
97     sleep(1);
99     $t->find_element_ok("test_trial", "partial_link_text", "find program in editted event details");
101     $t->find_element_ok("Harvest_date", "partial_link_text", "find event type in editted event details");
103     $t->find_element_ok("http://www.testedit.com", "partial_link_text", "find event url in editted event details");
105     $t->find_element_ok("event_dialog_dismiss", "id", "dismiss event dialog")->click();
107     sleep(2);
109     my $cal_editted_event_location = $cal_editted_event->get_element_location();
111     $cal_editted_event->drag($cal_editted_event_location{'x'}+30, $cal_editted_event_location{'y'});
113     sleep(2);
115     $t->find_element_ok("fc-next-button", "class", "click next month arrow")->click();
117     sleep(1);
119     $t->find_element_ok("fc-nextYear-button", "class", "click next year arrow")->click();
121     sleep(1);
123     $t->find_element_ok("fc-prev-button", "class", "click prev month arrow")->click();
125     sleep(1);
127     $t->find_element_ok("fc-prevYear-button", "class", "click prev year arrow")->click();
129     sleep(1);
131     $t->find_element_ok("fc-today-button", "class", "click today button")->click();
133     sleep(1);
135     $t->find_element_ok("fc-day", "class", "find day")->click();
137     my $event_project_select = $t->find_element_ok("event_project_select", "id", "find event project select");
139     $event_project_select->send_keys('test_trial');
140     
141     my $event_type_select = $t->find_element_ok("event_type_select", "id", "find event type select");
143     $event_type_select->send_keys('harvest_date');
144     
145     $t->find_element_ok("event_start", "id", "find event start")->click();
147     my $event_start_calendar = $t->find_element_ok(".day.active", "css", "find active day on calendar select");
149     $event_start_calendar->click();
151     sleep(1);
153     my $event_desc = $t->find_element_ok("event_description", "id", "find event description input");
155     $event_desc->click();
157     $event_desc->send_keys('test repeat event type description');
159     my $event_url = $t->find_element_ok("event_url", "id", "find event url input");
161     $event_url->send_keys('test.com');
163     $t->find_element_ok("add_event_submit", "id", "submit event")->click();
164     
165     sleep(1);
167     $t->driver->accept_alert();
169     sleep(1);
171     $t->get_ok('/calendar/personal');
173     sleep(2);
175     $t->find_element_ok("test", "partial_link_text", "find test event")->click();
177     sleep(1);
179     $t->find_element_ok("delete_event_submit", "id", "delete event")->click();
181     sleep(1);
183     $t->driver->accept_alert();
185     sleep(1);
187     }
191 done_testing();