Adding Selenium tests for Members

This commit is contained in:
Henri-Damien LAURENT 2009-08-28 23:47:43 +02:00
parent b93586c4a2
commit 6aff71af4b
6 changed files with 236 additions and 0 deletions

16
selenium/KohaTests Normal file
View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
<title>Test Suite</title>
</head>
<body>
<table id="suiteTable" cellpadding="1" cellspacing="1" border="1" class="selenium"><tbody>
<tr><td><b>Test Suite</b></td></tr>
<tr><td><a href="Members/AddMember">Enregistrement Lecteur</a></td></tr>
<tr><td><a href="Members/SearchMember">Recherche Lecteur</a></td></tr>
<tr><td><a href="Members/DeletMember">DeletMember</a></td></tr>
</tbody></table>
</body>
</html>

View File

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>Enregistrement Lecteur</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Enregistrement Lecteur</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/cgi-bin/koha/members/memberentry.pl?op=add&amp;amp;categorycode=PERS</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>surname</td>
<td>Cocteau</td>
</tr>
<tr>
<td>type</td>
<td>firstname</td>
<td>Jean</td>
</tr>
<tr>
<td>type</td>
<td>dateofbirth</td>
<td>12/02/1967</td>
</tr>
<tr>
<td>click</td>
<td>sex-male</td>
<td></td>
</tr>
<tr>
<td>select</td>
<td>btitle</td>
<td>label=Mr</td>
</tr>
<tr>
<td>type</td>
<td>address</td>
<td>123, rue de la gaieté</td>
</tr>
<tr>
<td>type</td>
<td>city</td>
<td>Marseille</td>
</tr>
<tr>
<td>type</td>
<td>cardnumber</td>
<td>123141</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>save</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Mr Jean Cocteau (123141)</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>DeletMember</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">DeletMember</td></tr>
</thead><tbody>
<tr>
<td>click</td>
<td>//li[4]/span/span/button</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>link=Delete</td>
<td></td>
</tr>
<tr>
<td>assertConfirmation</td>
<td>Are you sure you want to delete this patron? This cannot be undone.</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>Recherche Lecteur</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Recherche Lecteur</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/cgi-bin/koha/members/members-home.pl</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>searchmember</td>
<td>Cocteau</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//input[@value='Search']</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>searchheader</td>
<td>Results 1 to 1 of 1 found for 'Cocteau'</td>
</tr>
<tr>
<td>type</td>
<td>searchmember</td>
<td>123141</td>
</tr>
<tr>
<td>select</td>
<td>searchorderby</td>
<td>label=Cardnumber</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//input[@value='Search']</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>searchheader</td>
<td>Results 1 to 1 of 1 found for '123141'</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>link=Cocteau, Jean</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td></td>
<td>Jean Cocteau (123141)</td>
</tr>
</tbody></table>
</body>
</html>

View File

@ -0,0 +1,24 @@
use strict;
use warnings;
use Time::HiRes qw(sleep);
use Test::WWW::Selenium;
use Test::More "no_plan";
use Test::Exception;
my $sel = Test::WWW::Selenium->new( host => "localhost",
port => 4444,
browser => "*chrome",
browser_url => "http://change-this-to-the-site-you-are-testing/" );
$sel->open_ok("/cgi-bin/koha/members/memberentry.pl?op=add&amp;categorycode=PERS");
$sel->type_ok("surname", "Cocteau");
$sel->type_ok("firstname", "Jean");
$sel->type_ok("dateofbirth", "12/02/1967");
$sel->click_ok("sex-male");
$sel->select_ok("btitle", "label=Mr");
$sel->type_ok("address", "123, rue de la gaieté");
$sel->type_ok("city", "Marseille");
$sel->type_ok("cardnumber", "123141");
$sel->click_ok("save");
$sel->wait_for_page_to_load_ok("30000");
$sel->is_text_present_ok("Mr Jean Cocteau (123141)");

View File

@ -0,0 +1,25 @@
use strict;
use warnings;
use Time::HiRes qw(sleep);
use Test::WWW::Selenium;
use Test::More "no_plan";
use Test::Exception;
my $sel = Test::WWW::Selenium->new( host => "localhost",
port => 4444,
browser => "*chrome",
browser_url => "http://change-this-to-the-site-you-are-testing/" );
$sel->open_ok("/cgi-bin/koha/members/members-home.pl");
$sel->type_ok("searchmember", "Cocteau");
$sel->click_ok("//input[\@value='Search']");
$sel->wait_for_page_to_load_ok("30000");
$sel->text_is("searchheader", "Results 1 to 1 of 1 found for 'Cocteau'");
$sel->type_ok("searchmember", "123141");
$sel->select_ok("searchorderby", "label=Cardnumber");
$sel->click_ok("//input[\@value='Search']");
$sel->wait_for_page_to_load_ok("30000");
$sel->text_is("searchheader", "Results 1 to 1 of 1 found for '123141'");
$sel->click_ok("link=Cocteau, Jean");
$sel->wait_for_page_to_load_ok("30000");
$sel->is_text_present_ok("");