1 #=====================================================================
4 # Web http://www.lx-office.org
6 #=====================================================================
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2 of the License, or
14 # (at your option) any later version.
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #======================================================================
25 # Selenium Main Caller
26 # Call all Selenium scripts from here. To use Selenium tests in
27 # Lx-Office you need to Install Selenium Remote Control. Take a look at
28 # the README Document for further informatinons on installing Selenium
29 # and testing Lx-Office and of course writing your own testcases.
31 #######################################################################
33 push @INC, ['/tselenium'];
34 use vars qw( $lxdebug $lxtest $sel );
37 use Test::WWW::Selenium;
39 use Test::More tests => 86; # Need to be cutomized
41 diag('Pretests and initialisation');
43 eval { require('t/lxtest.conf'); };
45 diag("No test configuration found in t/lxtest.conf.\n
46 Maybe you forget to copy t/lxtest.conf.default to t/lxtest.conf. Exit test...\n");
50 $lxtest->{test_id} = time; # create individual ids by unixtime
51 $lxtest->{testuserlogin} = $lxtest->{testlogin} . $lxtest->{test_id};
52 $lxtest->{testuserpasswd} = $lxtest->{test_id};
53 $lxtest->{db} = $lxtest->{db} . $lxtest->{test_id};
55 ok(defined $lxtest->{rpw}, "Get root password");
57 ok(defined $lxtest->{dbhost}, "found dbhost in config");
58 ok(defined $lxtest->{dbport}, "found dbport in config");
59 ok(defined $lxtest->{dbuser}, "found dbuser in config");
60 ok(defined $lxtest->{dbpasswd}, "found dbpasswd in config");
62 $lxtest->{lxadmin} = $lxtest->{lxbaseurl} . "admin.pl?path=$lxtest->{path}&rpw=$lxtest->{rpw}&nextsub=list_users&action=Weiter";
65 eval { $sel = Test::WWW::Selenium->new(
66 host => $lxtest->{seleniumhost},
67 port => $lxtest->{seleniumport},
68 browser => $lxtest->{seleniumbrowser},
69 browser_url => $lxtest->{lxadmin});
72 diag("No Selenium Server running, or wrong preferences\n\n");
76 ok(defined $sel, 'Creating Selenium Object');
78 diag('Starting Selenium tests...');
80 require('t/selenium/001CreateTestDatabase.t');
81 require('t/selenium/002CreateTestUser.t');
83 require('t/selenium/998DeleteTestUser.t');
84 require('t/selenium/999DeleteTestDatabase.t');
86 $sel=''; # Destroy selenium object