use Carp;
use Test::Harness;
-
## Backendtests:
# &runtests(
# );
+++ /dev/null
-### Create Database
-
-diag("Create test database '$lxtest->{db}'");
-
-$sel->open_ok($lxtest->{lxadmin});
-$sel->title_is("Lx-Office ERP Administration -");
-
-$sel->open_ok($lxtest->{lxadmin});
-$sel->title_is("Lx-Office ERP Administration -");
-$sel->click_ok("//input[(\@name=\"action\") and (\@value=\"Datenbankadministration\")]");
-$sel->wait_for_page_to_load_ok($lxtest->{timeout});
-$sel->title_is("Lx-Office ERP / Datenbankadministration -");
-$sel->type_ok("dbuser", $lxtest->{dbuser});
-
-$sel->type_ok("dbpasswd", $lxtest->{dbpasswd});
-$sel->type_ok("dbuser", $lxtest->{dbuser});
-$sel->type_ok("dbhost", $lxtest->{dbhost});
-$sel->type_ok("dbport", $lxtest->{dbport});
-$sel->type_ok("dbdefault", $lxtest->{dbdefault});
-
-$sel->click_ok("//input[(\@name=\"action\") and (\@value=\"Datenbank anlegen\")]");
-$sel->wait_for_page_to_load_ok($lxtest->{timeout});
-$sel->title_is("Lx-Office ERP Datenbankadministration / Datenbank anlegen -");
-$sel->type_ok("db", $lxtest->{db});
-$sel->select_ok("encoding", "label=ISO 8859-1");
-$sel->click_ok("//input[(\@name=\"chart\") and (\@value=\"Germany-DATEV-SKR03EU\")]");
-$sel->click_ok("//input[(\@name=\"action\") and (\@value=\"Weiter\")]");
-$sel->wait_for_page_to_load_ok($lxtest->{timeoutlong});
-$sel->title_is("Lx-Office ERP Datenbankadministration / Datenbank anlegen -");
-$sel->click_ok("//input[(\@name=\"action\") and (\@value=\"Weiter\")]");
-$sel->wait_for_page_to_load_ok($lxtest->{timeout});
-$sel->title_is("Lx-Office ERP Administration -");
+++ /dev/null
-
-### Create new user
-diag("Create test user '$lxtest->{testuserlogin}'");
-$sel->open_ok($lxtest->{lxadmin});
-$sel->title_is("Lx-Office ERP Administration -");
-$sel->click_ok("action");
-$sel->wait_for_page_to_load_ok($lxtest->{timeout});
-$sel->title_is("Lx-Office ERP Administration / Benutzer erfassen -");
-$sel->type_ok("login", $lxtest->{testuserlogin});
-$sel->type_ok("password", $lxtest->{testuserpasswd});
-$sel->type_ok("name", "Selenium");
-$sel->type_ok("email", "selenium\@lx-office.org");
-$sel->type_ok("signature", "Selenium Testuser");
-$sel->type_ok("tel", "0000");
-$sel->type_ok("fax", "1111");
-$sel->type_ok("company", "Sel-enium");
-$sel->type_ok("signature", "Selenium Testuser\nTestfirma");
-$sel->type_ok("address", "Testfirma");
-$sel->type_ok("steuernummer", "111-222-333-444");
-$sel->type_ok("co_ustid", "1234567");
-$sel->type_ok("duns", "0987654321");
-$sel->click_ok("dbdriver");
-$sel->type_ok("newtemplates", "seleniumtestuser");
-$sel->click_ok("menustyle");
-$sel->type_ok("Pg_dbhost", $lxtest->{dbhost});
-$sel->type_ok("Pg_dbname", $lxtest->{db});
-$sel->type_ok("Pg_dbport", $lxtest->{dbport});
-$sel->type_ok("Pg_dbuser", $lxtest->{dbuser});
-$sel->type_ok("Pg_dbpasswd", $lxtest->{dbpasswd});
-$sel->click_ok("action");
-$sel->wait_for_page_to_load_ok($lxtest->{timeout});
-$sel->title_is("Lx-Office ERP Administration -");
+++ /dev/null
-### Delete user
-diag("Delete test user '$lxtest->{testuserlogin}'");
-$sel->open_ok($lxtest->{lxadmin});
-$sel->title_is("Lx-Office ERP Administration -");
-$sel->click_ok("link=$lxtest->{testuserlogin}");
-$sel->wait_for_page_to_load_ok($lxtest->{timeout});
-$sel->title_is("Lx-Office ERP Administration / Benutzerdaten bearbeiten -");
-$sel->click_ok("//input[(\@name=\"action\") and (\@value=\"Löschen\")]");
-$sel->wait_for_page_to_load_ok($lxtest->{timeout});
+++ /dev/null
-#### Delete database
-diag("Delete test database '$lxtest->{db}'");
-
-$sel->open_ok($lxtest->{lxadmin});
-$sel->title_is("Lx-Office ERP Administration -");
-$sel->click_ok("//input[(\@name=\"action\") and (\@value=\"Datenbankadministration\")]");
-$sel->wait_for_page_to_load_ok($lxtest->{timeout});
-$sel->title_is("Lx-Office ERP / Datenbankadministration -");
-
-$sel->type_ok("dbhost", $lxtest->{dbhost});
-$sel->type_ok("dbport", $lxtest->{dbport});
-$sel->type_ok("dbuser", $lxtest->{dbuser});
-$sel->type_ok("dbpasswd", $lxtest->{dbpasswd});
-
-$sel->click_ok("//input[(\@name=\"action\") and (\@value=\"Datenbank löschen\")]");
-$sel->wait_for_page_to_load_ok($lxtest->{timeoutlong});
-$sel->title_is("Lx-Office ERP Datenbankadministration / Datenbank löschen -");
-$sel->click_ok("//input[\@value=\"$lxtest->{db}\"]");
-$sel->click_ok("//input[(\@name=\"action\") and (\@value=\"Weiter\")]");
-$sel->wait_for_page_to_load_ok($lxtest->{timeout});
-$sel->body_text_is("Lx-Office ERP Datenbankadministration / Datenbank löschen $lxtest->{db} wurde erfolgreich gelöscht");
-$sel->click_ok("//input[(\@name=\"action\") and (\@value=\"Weiter\")]");
-$sel->wait_for_page_to_load_ok($lxtest->{timeout});
-$sel->title_is("Lx-Office ERP Administration -");
#
#######################################################################
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};
$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");
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