X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=t%2Fselenium%2FAllTests.t;h=c5ebf1d19e600b793e48c8d13ce05a2ff30c4527;hb=58a1b54b6a04d70fda952ca86bc3b85b866264e9;hp=c3c5265b7f70c29557c90620c6ed7d76856511d4;hpb=111276a18a6edd391c7d653f77003fe24ae00d8f;p=kivitendo-erp.git diff --git a/t/selenium/AllTests.t b/t/selenium/AllTests.t index c3c5265b7..c5ebf1d19 100644 --- a/t/selenium/AllTests.t +++ b/t/selenium/AllTests.t @@ -39,7 +39,6 @@ use Test::More qw(no_plan); use IO::Socket; - if(-f "/tmp/lxtest-temp.conf") { eval { require('/tmp/lxtest-temp.conf'); }; } @@ -62,6 +61,11 @@ # 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 " @@ -74,9 +78,9 @@ $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"); @@ -109,14 +113,41 @@ 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;