X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=t%2Fselenium%2FAllTests.t;h=3c6acf66a722a678f948692fbf486f1fad643492;hb=ebef09a8bde1d401fc7b0d60cfe09393e9a84c0f;hp=254472a6cad6d57db45affcf15a739829e322a1a;hpb=4c2d836d17061a19020dd8fc0ae3d42b3e1b010a;p=kivitendo-erp.git diff --git a/t/selenium/AllTests.t b/t/selenium/AllTests.t index 254472a6c..3c6acf66a 100644 --- a/t/selenium/AllTests.t +++ b/t/selenium/AllTests.t @@ -30,23 +30,41 @@ # ####################################################################### no strict; - push @INC, ['/tselenium']; + push @INC, ['/t/selenium']; use vars qw( $lxdebug $lxtest $sel ); use strict; - - use Test::WWW::Selenium; use Carp; - use Test::More tests => 86; # Need to be cutomized - diag('Pretests and initialisation'); + use Test::WWW::Selenium; + use Test::More; + use IO::Socket; - eval { require('t/lxtest.conf'); }; + eval { require('t/lxtest.conf'); }; if ($@) { diag("No test configuration found in t/lxtest.conf.\n Maybe you forget to copy t/lxtest.conf.default to t/lxtest.conf. Exit test...\n"); exit 0; }; + sub server_is_running { + return IO::Socket::INET->new(PeerAddr => $ENV{SRC_HOST} || $lxtest->{seleniumhost}, + PeerPort => $ENV{SRC_PORT} || $lxtest->{seleniumport}, + ); + } + if (server_is_running) { + plan tests => 204; # Need to be cutomized + } + else { + plan skip_all => "No selenium server found! " + ."Maybe you forgot to start it or " + ."the preferences in t/lxtest.conf doesen't fit to your system"; + exit 0; + } + + diag('Pretests and initialisation'); + + + $lxtest->{test_id} = time; # create individual ids by unixtime $lxtest->{testuserlogin} = $lxtest->{testlogin} . $lxtest->{test_id}; $lxtest->{testuserpasswd} = $lxtest->{test_id}; @@ -62,11 +80,16 @@ $lxtest->{lxadmin} = $lxtest->{lxbaseurl} . "admin.pl?path=$lxtest->{path}&rpw=$lxtest->{rpw}&nextsub=list_users&action=Weiter"; + + + eval { $sel = Test::WWW::Selenium->new( host => $lxtest->{seleniumhost}, port => $lxtest->{seleniumport}, browser => $lxtest->{seleniumbrowser}, - browser_url => $lxtest->{lxadmin}); + browser_url => $lxtest->{lxadmin}, + auto_stop => '0', + ); }; if ($@) { diag("No Selenium Server running, or wrong preferences\n\n"); @@ -77,11 +100,14 @@ diag('Starting Selenium tests...'); - require('t/selenium/001CreateTestDatabase.t'); - require('t/selenium/002CreateTestUser.t'); - - require('t/selenium/998DeleteTestUser.t'); - require('t/selenium/999DeleteTestDatabase.t'); + opendir(SCRIPTS, 't/selenium/testscripts'); + my @testscripts = sort readdir(SCRIPTS); + + foreach my $script (@testscripts){ + my $file = "t/selenium/testscripts/" . $script; + require_ok($file) if ( $script =~ /^\d\d\d.*\.t$/ ); + } + exit 1; $sel=''; # Destroy selenium object