use Test::More qw(no_plan);
use IO::Socket;
-
if(-f "/tmp/lxtest-temp.conf") {
eval { require('/tmp/lxtest-temp.conf'); };
}
# plan tests => 200; # Need to be cutomized
# }
sub init_server {
+ my $singlefileonly = 0;
+ if ($_[0] eq "singlefileonly") {
+ $singlefileonly = 1;
+ shift;
+ }
if(!server_is_running) {
print "No selenium server found! "
."Maybe you forgot to start it or "
$lxtest->{test_id} = time; # create individual ids by unixtime
- $lxtest->{testuserlogin} = $lxtest->{testlogin} . $lxtest->{test_id};
- $lxtest->{testuserpasswd} = $lxtest->{test_id};
- $lxtest->{db} = $lxtest->{db} . $lxtest->{test_id};
+ $lxtest->{testuserlogin} = $lxtest->{testlogin} . $lxtest->{test_id} if(!$lxtest->{testuserlogin});
+ $lxtest->{testuserpasswd} = $lxtest->{test_id} if(!$lxtest->{testuserpasswd});
+ $lxtest->{db} = $lxtest->{db} . $lxtest->{test_id} if(!($lxtest->{db} =~ /^seleniumtestdatabase[0-9]{10}$/));
ok(defined $lxtest->{rpw}, "Get root password");
diag('Starting Selenium tests...');
- foreach my $scriptdir (@_) {
- opendir(SCRIPTS, 't/selenium/testscripts/' . $scriptdir);
- foreach (sort readdir(SCRIPTS)) {
- require_ok("t/selenium/testscripts/". $scriptdir . "/" . $_) if ( $_ =~ /^\w\d\d\d.*\.t$/);
+ if(!$singlefileonly) {
+ foreach my $scriptdir (@_) {
+ opendir(SCRIPTS, 't/selenium/testscripts/' . $scriptdir) or die "Can't open directory!" . $!;
+ foreach (sort readdir(SCRIPTS)) {
+ if ( $_ =~ /^\w\d\d\d.*\.t$|^\d\d\d.*\.t$/ && !$sel->{ran_tests}{"t/selenium/testscripts/". $scriptdir . "/" . $_}) {
+ require_ok("t/selenium/testscripts/". $scriptdir . "/" . $_);
+ $sel->{ran_tests}{"t/selenium/testscripts/". $scriptdir . "/" . $_} = 1;
+ }
+ }
+ closedir(SCRIPTS);
}
- closedir(SCRIPTS);
+ }
+ else {
+ foreach (@_) {
+ if ( $_ =~ /^.*\/\w\d\d\d.*\.t$|^.*\/\d\d\d.*\.t$/ && !$sel->{ran_tests}{$_}) {
+ require_ok($_);
+ $sel->{ran_tests}{$_} = 1;
+ }
+ }
+ }
+ if($!) {
+ @! = ("Test fehlgeschlagen!");
}
$sel->stop();
}
+ sub start_login() {
+ require "t/selenium/testscripts/base/000Login.t" if(!$sel->{_page_opened});
+ skip("Failed page to load pages!",) if(!$sel->{_page_opened});
+
+ if($sel->get_title() ne "Lx-Office Version 2.4.3 - Selenium - " . $lxtest->{db}){
+ require "t/selenium/testscripts/base/000Login.t";
+ }
+
+ $sel->select_frame_ok("relative=up");
+ }
+
1;