Revision d14f75f9
Von Udo Spallek vor etwa 18 Jahren hinzugefügt
t/lx-office.t | ||
---|---|---|
36 | 36 |
use Carp; |
37 | 37 |
use Test::Harness; |
38 | 38 |
|
39 |
|
|
40 | 39 |
## Backendtests: |
41 | 40 |
# &runtests( |
42 | 41 |
# ); |
t/selenium/001CreateTestDatabase.t | ||
---|---|---|
1 |
### Create Database |
|
2 |
|
|
3 |
diag("Create test database '$lxtest->{db}'"); |
|
4 |
|
|
5 |
$sel->open_ok($lxtest->{lxadmin}); |
|
6 |
$sel->title_is("Lx-Office ERP Administration -"); |
|
7 |
|
|
8 |
$sel->open_ok($lxtest->{lxadmin}); |
|
9 |
$sel->title_is("Lx-Office ERP Administration -"); |
|
10 |
$sel->click_ok("//input[(\@name=\"action\") and (\@value=\"Datenbankadministration\")]"); |
|
11 |
$sel->wait_for_page_to_load_ok($lxtest->{timeout}); |
|
12 |
$sel->title_is("Lx-Office ERP / Datenbankadministration -"); |
|
13 |
$sel->type_ok("dbuser", $lxtest->{dbuser}); |
|
14 |
|
|
15 |
$sel->type_ok("dbpasswd", $lxtest->{dbpasswd}); |
|
16 |
$sel->type_ok("dbuser", $lxtest->{dbuser}); |
|
17 |
$sel->type_ok("dbhost", $lxtest->{dbhost}); |
|
18 |
$sel->type_ok("dbport", $lxtest->{dbport}); |
|
19 |
$sel->type_ok("dbdefault", $lxtest->{dbdefault}); |
|
20 |
|
|
21 |
$sel->click_ok("//input[(\@name=\"action\") and (\@value=\"Datenbank anlegen\")]"); |
|
22 |
$sel->wait_for_page_to_load_ok($lxtest->{timeout}); |
|
23 |
$sel->title_is("Lx-Office ERP Datenbankadministration / Datenbank anlegen -"); |
|
24 |
$sel->type_ok("db", $lxtest->{db}); |
|
25 |
$sel->select_ok("encoding", "label=ISO 8859-1"); |
|
26 |
$sel->click_ok("//input[(\@name=\"chart\") and (\@value=\"Germany-DATEV-SKR03EU\")]"); |
|
27 |
$sel->click_ok("//input[(\@name=\"action\") and (\@value=\"Weiter\")]"); |
|
28 |
$sel->wait_for_page_to_load_ok($lxtest->{timeoutlong}); |
|
29 |
$sel->title_is("Lx-Office ERP Datenbankadministration / Datenbank anlegen -"); |
|
30 |
$sel->click_ok("//input[(\@name=\"action\") and (\@value=\"Weiter\")]"); |
|
31 |
$sel->wait_for_page_to_load_ok($lxtest->{timeout}); |
|
32 |
$sel->title_is("Lx-Office ERP Administration -"); |
t/selenium/002CreateTestUser.t | ||
---|---|---|
1 |
|
|
2 |
### Create new user |
|
3 |
diag("Create test user '$lxtest->{testuserlogin}'"); |
|
4 |
$sel->open_ok($lxtest->{lxadmin}); |
|
5 |
$sel->title_is("Lx-Office ERP Administration -"); |
|
6 |
$sel->click_ok("action"); |
|
7 |
$sel->wait_for_page_to_load_ok($lxtest->{timeout}); |
|
8 |
$sel->title_is("Lx-Office ERP Administration / Benutzer erfassen -"); |
|
9 |
$sel->type_ok("login", $lxtest->{testuserlogin}); |
|
10 |
$sel->type_ok("password", $lxtest->{testuserpasswd}); |
|
11 |
$sel->type_ok("name", "Selenium"); |
|
12 |
$sel->type_ok("email", "selenium\@lx-office.org"); |
|
13 |
$sel->type_ok("signature", "Selenium Testuser"); |
|
14 |
$sel->type_ok("tel", "0000"); |
|
15 |
$sel->type_ok("fax", "1111"); |
|
16 |
$sel->type_ok("company", "Sel-enium"); |
|
17 |
$sel->type_ok("signature", "Selenium Testuser\nTestfirma"); |
|
18 |
$sel->type_ok("address", "Testfirma"); |
|
19 |
$sel->type_ok("steuernummer", "111-222-333-444"); |
|
20 |
$sel->type_ok("co_ustid", "1234567"); |
|
21 |
$sel->type_ok("duns", "0987654321"); |
|
22 |
$sel->click_ok("dbdriver"); |
|
23 |
$sel->type_ok("newtemplates", "seleniumtestuser"); |
|
24 |
$sel->click_ok("menustyle"); |
|
25 |
$sel->type_ok("Pg_dbhost", $lxtest->{dbhost}); |
|
26 |
$sel->type_ok("Pg_dbname", $lxtest->{db}); |
|
27 |
$sel->type_ok("Pg_dbport", $lxtest->{dbport}); |
|
28 |
$sel->type_ok("Pg_dbuser", $lxtest->{dbuser}); |
|
29 |
$sel->type_ok("Pg_dbpasswd", $lxtest->{dbpasswd}); |
|
30 |
$sel->click_ok("action"); |
|
31 |
$sel->wait_for_page_to_load_ok($lxtest->{timeout}); |
|
32 |
$sel->title_is("Lx-Office ERP Administration -"); |
t/selenium/998DeleteTestUser.t | ||
---|---|---|
1 |
### Delete user |
|
2 |
diag("Delete test user '$lxtest->{testuserlogin}'"); |
|
3 |
$sel->open_ok($lxtest->{lxadmin}); |
|
4 |
$sel->title_is("Lx-Office ERP Administration -"); |
|
5 |
$sel->click_ok("link=$lxtest->{testuserlogin}"); |
|
6 |
$sel->wait_for_page_to_load_ok($lxtest->{timeout}); |
|
7 |
$sel->title_is("Lx-Office ERP Administration / Benutzerdaten bearbeiten -"); |
|
8 |
$sel->click_ok("//input[(\@name=\"action\") and (\@value=\"L?schen\")]"); |
|
9 |
$sel->wait_for_page_to_load_ok($lxtest->{timeout}); |
t/selenium/999DeleteTestDatabase.t | ||
---|---|---|
1 |
#### Delete database |
|
2 |
diag("Delete test database '$lxtest->{db}'"); |
|
3 |
|
|
4 |
$sel->open_ok($lxtest->{lxadmin}); |
|
5 |
$sel->title_is("Lx-Office ERP Administration -"); |
|
6 |
$sel->click_ok("//input[(\@name=\"action\") and (\@value=\"Datenbankadministration\")]"); |
|
7 |
$sel->wait_for_page_to_load_ok($lxtest->{timeout}); |
|
8 |
$sel->title_is("Lx-Office ERP / Datenbankadministration -"); |
|
9 |
|
|
10 |
$sel->type_ok("dbhost", $lxtest->{dbhost}); |
|
11 |
$sel->type_ok("dbport", $lxtest->{dbport}); |
|
12 |
$sel->type_ok("dbuser", $lxtest->{dbuser}); |
|
13 |
$sel->type_ok("dbpasswd", $lxtest->{dbpasswd}); |
|
14 |
|
|
15 |
$sel->click_ok("//input[(\@name=\"action\") and (\@value=\"Datenbank l?schen\")]"); |
|
16 |
$sel->wait_for_page_to_load_ok($lxtest->{timeoutlong}); |
|
17 |
$sel->title_is("Lx-Office ERP Datenbankadministration / Datenbank l?schen -"); |
|
18 |
$sel->click_ok("//input[\@value=\"$lxtest->{db}\"]"); |
|
19 |
$sel->click_ok("//input[(\@name=\"action\") and (\@value=\"Weiter\")]"); |
|
20 |
$sel->wait_for_page_to_load_ok($lxtest->{timeout}); |
|
21 |
$sel->body_text_is("Lx-Office ERP Datenbankadministration / Datenbank l?schen $lxtest->{db} wurde erfolgreich gel?scht"); |
|
22 |
$sel->click_ok("//input[(\@name=\"action\") and (\@value=\"Weiter\")]"); |
|
23 |
$sel->wait_for_page_to_load_ok($lxtest->{timeout}); |
|
24 |
$sel->title_is("Lx-Office ERP Administration -"); |
t/selenium/AllTests.t | ||
---|---|---|
30 | 30 |
# |
31 | 31 |
####################################################################### |
32 | 32 |
no strict; |
33 |
push @INC, ['/tselenium']; |
|
33 |
push @INC, ['/t/selenium'];
|
|
34 | 34 |
use vars qw( $lxdebug $lxtest $sel ); |
35 | 35 |
use strict; |
36 |
|
|
37 |
use Test::WWW::Selenium; |
|
38 | 36 |
use Carp; |
39 |
use Test::More tests => 86; # Need to be cutomized |
|
40 | 37 |
|
41 |
diag('Pretests and initialisation'); |
|
38 |
use Test::WWW::Selenium; |
|
39 |
use Test::More; |
|
40 |
use IO::Socket; |
|
42 | 41 |
|
43 |
eval { require('t/lxtest.conf'); };
|
|
42 |
eval { require('t/lxtest.conf'); }; |
|
44 | 43 |
if ($@) { |
45 | 44 |
diag("No test configuration found in t/lxtest.conf.\n |
46 | 45 |
Maybe you forget to copy t/lxtest.conf.default to t/lxtest.conf. Exit test...\n"); |
47 | 46 |
exit 0; |
48 | 47 |
}; |
49 | 48 |
|
49 |
sub server_is_running { |
|
50 |
return IO::Socket::INET->new(PeerAddr => $ENV{SRC_HOST} || $lxtest->{seleniumhost}, |
|
51 |
PeerPort => $ENV{SRC_PORT} || $lxtest->{seleniumport}, |
|
52 |
); |
|
53 |
} |
|
54 |
if (server_is_running) { |
|
55 |
plan tests => 204; # Need to be cutomized |
|
56 |
} |
|
57 |
else { |
|
58 |
plan skip_all => "No selenium server found! " |
|
59 |
."Maybe you forgot to start it or " |
|
60 |
."the preferences in t/lxtest.conf doesen't fit to your system"; |
|
61 |
exit 0; |
|
62 |
} |
|
63 |
|
|
64 |
diag('Pretests and initialisation'); |
|
65 |
|
|
66 |
|
|
67 |
|
|
50 | 68 |
$lxtest->{test_id} = time; # create individual ids by unixtime |
51 | 69 |
$lxtest->{testuserlogin} = $lxtest->{testlogin} . $lxtest->{test_id}; |
52 | 70 |
$lxtest->{testuserpasswd} = $lxtest->{test_id}; |
... | ... | |
62 | 80 |
$lxtest->{lxadmin} = $lxtest->{lxbaseurl} . "admin.pl?path=$lxtest->{path}&rpw=$lxtest->{rpw}&nextsub=list_users&action=Weiter"; |
63 | 81 |
|
64 | 82 |
|
83 |
|
|
84 |
|
|
85 |
|
|
65 | 86 |
eval { $sel = Test::WWW::Selenium->new( |
66 | 87 |
host => $lxtest->{seleniumhost}, |
67 | 88 |
port => $lxtest->{seleniumport}, |
68 | 89 |
browser => $lxtest->{seleniumbrowser}, |
69 |
browser_url => $lxtest->{lxadmin}); |
|
90 |
browser_url => $lxtest->{lxadmin}, |
|
91 |
auto_stop => '0', |
|
92 |
); |
|
70 | 93 |
}; |
71 | 94 |
if ($@) { |
72 | 95 |
diag("No Selenium Server running, or wrong preferences\n\n"); |
... | ... | |
77 | 100 |
|
78 | 101 |
diag('Starting Selenium tests...'); |
79 | 102 |
|
80 |
require('t/selenium/001CreateTestDatabase.t'); |
|
81 |
require('t/selenium/002CreateTestUser.t'); |
|
82 |
|
|
83 |
require('t/selenium/998DeleteTestUser.t'); |
|
84 |
require('t/selenium/999DeleteTestDatabase.t'); |
|
103 |
opendir(SCRIPTS, 't/selenium/testscripts'); |
|
104 |
my @testscripts = sort readdir(SCRIPTS); |
|
105 |
|
|
106 |
foreach my $script (@testscripts){ |
|
107 |
my $file = "t/selenium/testscripts/" . $script; |
|
108 |
require_ok($file) if ( $script =~ /^\d\d\d.*\.t$/ ); |
|
109 |
} |
|
110 |
exit 1; |
|
85 | 111 |
|
86 | 112 |
$sel=''; # Destroy selenium object |
87 | 113 |
|
Auch abrufbar als: Unified diff
Verbesserungen am testframework...