Merge branch 'master' into topic/create_plant_entries
[sgn.git] / t / selenium2 / breeders / location.t
blob8222961c53ec36898dad61fa6d873dd5c9a4e792
2 use lib 't/lib';
4 use Test::More 'tests'=>8;
6 use SGN::Test::WWW::WebDriver;
8 my $t = SGN::Test::WWW::WebDriver->new();
10 $t->while_logged_in_as("submitter", sub { 
11     $t->get_ok('/breeders/locations');
12     
13     my $add_location_link = $t->find_element_ok(
14         "add_location_link", 
15         "id", 
16         "find element add location link as submitter"
17         );
18     
19     $add_location_link->click();
21     sleep(2);
22     
23     my $location_desc_input = $t->find_element_ok(
24         "location_description", 
25         "id",
26         "find location input test");
27     $location_desc_input->send_keys("yet another test location");
28     my $longitude = $t->find_element_ok(
29         "longitude", 
30         "id",
31         "find longitude input test");
32     $longitude->send_keys("100");
33     my $latitude = $t->find_element_ok(
34         "latitude",
35         "id",
36         "find latitude input test");
37     $latitude->send_keys("blabla");
38     my $submit_button = $t->find_element_ok(
39         "new_location_submit",
40         "id",
41         "find add_new_location_button test");
42     $submit_button->click();
44     ok($t->driver->get_alert_text() =~ m/must be numbers/i, "enter numbers in latitude test");
45     $t->driver->accept_alert();
47     $latitude->clear();
48     $latitude->send_keys("200");
49     $submit_button->click();
50     
51     ok($t->driver->get_alert_text() =~ m/new location was saved/i, 'new location was saved test');
52     
53     $t->driver->accept_alert();
54     
55                        }
56     );