Archived
1
0

* add create simple article testcase, make tests language-independent

This commit is contained in:
Sebastian Nohn
2006-10-29 09:17:13 +00:00
parent 7b35dca2c9
commit de90b6243d
2 changed files with 68 additions and 36 deletions
+67 -36
View File
@@ -9,6 +9,8 @@ require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
require_once 'TestConfiguration.php'; require_once 'TestConfiguration.php';
require_once '../../lang/serendipity_lang_'.S9Y_LANG.'.inc.php';
class SerendipityTestSuite extends PHPUnit_Extensions_SeleniumTestCase class SerendipityTestSuite extends PHPUnit_Extensions_SeleniumTestCase
{ {
public function setUp() public function setUp()
@@ -35,8 +37,8 @@ class SerendipityTestSuite extends PHPUnit_Extensions_SeleniumTestCase
public function testExpertInstallation() public function testExpertInstallation()
{ {
$this->open(S9Y_INSTALLDIR); $this->open(S9Y_INSTALLDIR);
$this->assertTextNotPresent('Not writable'); $this->assertTextNotPresent(NOT_WRITABLE);
$this->clickAndWait('link=Expert installation'); $this->clickAndWait('link='.EXPERT_INSTALLATION);
$this->select('dbType', 'SQLite'); $this->select('dbType', 'SQLite');
$this->type('user', 'Test User'); $this->type('user', 'Test User');
$this->type('pass', 'Test Password'); $this->type('pass', 'Test Password');
@@ -44,8 +46,8 @@ class SerendipityTestSuite extends PHPUnit_Extensions_SeleniumTestCase
$this->select('rewrite', 'Use Apache mod_rewrite'); $this->select('rewrite', 'Use Apache mod_rewrite');
$this->type('blogTitle', 's9y Testsuite Testblog'); $this->type('blogTitle', 's9y Testsuite Testblog');
$this->type('blogDescription', 'The lalaforce is coming to get you!'); $this->type('blogDescription', 'The lalaforce is coming to get you!');
$this->clickAndWait("//input[@value='Complete installation']"); $this->clickAndWait("//input[@value='".COMPLETE_INSTALLATION."']");
$this->assertTextPresent('Serendipity has been successfully installed'); $this->assertTextPresent(SERENDIPITY_INSTALLED);
} }
public function testLoginLogout() public function testLoginLogout()
@@ -53,77 +55,77 @@ class SerendipityTestSuite extends PHPUnit_Extensions_SeleniumTestCase
$this->open(S9Y_INSTALLDIR); $this->open(S9Y_INSTALLDIR);
$this->assertTitleEquals('s9y Testsuite Testblog'); $this->assertTitleEquals('s9y Testsuite Testblog');
$this->assertTextPresent('Blog Administration'); $this->assertTextPresent(SUPERUSER);
$this->clickAndWait('link=Open login screen'); $this->clickAndWait('link='.SUPERUSER_OPEN_LOGIN);
$this->assertTextPresent('Please enter your credentials below'); $this->assertTextPresent(PLEASE_ENTER_CREDENTIALS);
$this->type('serendipity[user]', 'Test User'); $this->type('serendipity[user]', 'Test User');
$this->type('serendipity[pass]', 'Test Password2'); $this->type('serendipity[pass]', 'Test Password2');
$this->clickAndWait('submit'); $this->clickAndWait('submit');
$this->assertTextPresent('Please enter your credentials below'); $this->assertTextPresent(PLEASE_ENTER_CREDENTIALS);
$this->assertTextPresent('You appear to have entered an invalid username or password'); $this->assertTextPresent(WRONG_USERNAME_OR_PASSWORD);
$this->type('serendipity[user]', 'Test User'); $this->type('serendipity[user]', 'Test User');
$this->type('serendipity[pass]', 'Test Password'); $this->type('serendipity[pass]', 'Test Password');
$this->clickAndWait('submit'); $this->clickAndWait('submit');
$this->assertTitleEquals('Serendipity Administration Suite'); $this->assertTitleEquals(SERENDIPITY_ADMIN_SUITE);
$this->assertTextPresent('Welcome back, John Doe'); $this->assertTextPresent(WELCOME_BACK.' John Doe');
$this->clickAndWait('link=Back to Weblog'); $this->clickAndWait('link='.BACK_TO_BLOG);
$this->assertTitleEquals('s9y Testsuite Testblog'); $this->assertTitleEquals('s9y Testsuite Testblog');
$this->assertTextPresent('Blog Administration'); $this->assertTextPresent(SUPERUSER);
$this->clickAndWait('link=Open administration'); $this->clickAndWait('link='.SUPERUSER_OPEN_ADMIN);
$this->assertTitleEquals('Serendipity Administration Suite'); $this->assertTitleEquals(SERENDIPITY_ADMIN_SUITE);
$this->assertTextPresent('Welcome back, John Doe'); $this->assertTextPresent(WELCOME_BACK.' John Doe');
$this->clickAndWait('link=Logout'); $this->clickAndWait('link='.LOGOUT);
$this->assertTextPresent('Please enter your credentials below'); $this->assertTextPresent(PLEASE_ENTER_CREDENTIALS);
$this->clickAndWait('link=Back to Weblog'); $this->clickAndWait('link='.BACK_TO_BLOG);
$this->assertTitleEquals('s9y Testsuite Testblog'); $this->assertTitleEquals('s9y Testsuite Testblog');
$this->assertTextPresent('Blog Administration'); $this->assertTextPresent(SUPERUSER);
$this->clickAndWait('link=Open login screen'); $this->clickAndWait('link='.SUPERUSER_OPEN_LOGIN);
$this->assertTextPresent('Please enter your credentials below'); $this->assertTextPresent(PLEASE_ENTER_CREDENTIALS);
} }
public function testCreateContentCategory() { public function testCreateContentCategory() {
$this->open(S9Y_INSTALLDIR); $this->open(S9Y_INSTALLDIR);
$this->assertTitleEquals('s9y Testsuite Testblog'); $this->assertTitleEquals('s9y Testsuite Testblog');
$this->assertTextPresent('Blog Administration'); $this->assertTextPresent(SUPERUSER);
$this->clickAndWait('link=Open login screen'); $this->clickAndWait('link='.SUPERUSER_OPEN_LOGIN);
$this->assertTextPresent('Please enter your credentials below'); $this->assertTextPresent(PLEASE_ENTER_CREDENTIALS);
$this->type('serendipity[user]', 'Test User'); $this->type('serendipity[user]', 'Test User');
$this->type('serendipity[pass]', 'Test Password'); $this->type('serendipity[pass]', 'Test Password');
$this->clickAndWait('submit'); $this->clickAndWait('submit');
$this->assertTitleEquals('Serendipity Administration Suite'); $this->assertTitleEquals(SERENDIPITY_ADMIN_SUITE);
$this->assertTextPresent('Welcome back, John Doe'); $this->assertTextPresent(WELCOME_BACK.' John Doe');
$this->clickAndWait('link=Categories'); $this->clickAndWait('link='.CATEGORIES);
$this->clickAndWait('link=Create New Category'); $this->clickAndWait('link='.CREATE_NEW_CAT);
$this->assertTextPresent('Create New Category'); $this->assertTextPresent(CREATE_NEW_CAT);
$this->type('serendipity[cat][name]', 'Test Category 001'); $this->type('serendipity[cat][name]', 'Test Category 001');
$this->type('serendipity[cat][description]', 'This is the description for Test Category 001'); $this->type('serendipity[cat][description]', 'This is the description for Test Category 001');
$this->clickAndWait('SAVE'); $this->clickAndWait('SAVE');
$this->assertTextPresent('Test Category 001'); $this->assertTextPresent('Test Category 001');
$this->clickAndWait('link=Create New Category'); $this->clickAndWait('link='.CREATE_NEW_CAT);
$this->assertTextPresent('Create New Category'); $this->assertTextPresent(CREATE_NEW_CAT);
$this->type('serendipity[cat][name]', 'Test Category 002'); $this->type('serendipity[cat][name]', 'Test Category 002');
$this->type('serendipity[cat][description]', 'This is the description for Test Category 002'); $this->type('serendipity[cat][description]', 'This is the description for Test Category 002');
$this->clickAndWait('SAVE'); $this->clickAndWait('SAVE');
$this->assertTextPresent('Test Category 002'); $this->assertTextPresent('Test Category 002');
$this->clickAndWait('link=Create New Category'); $this->clickAndWait('link='.CREATE_NEW_CAT);
$this->assertTextPresent('Create New Category'); $this->assertTextPresent(CREATE_NEW_CAT);
$this->select('parent_cat', 'Test Category 001'); $this->select('parent_cat', 'Test Category 001');
$this->type('serendipity[cat][name]', 'Test Category 001-1'); $this->type('serendipity[cat][name]', 'Test Category 001-1');
$this->type('serendipity[cat][description]', 'This is the description for Test Category 001-1'); $this->type('serendipity[cat][description]', 'This is the description for Test Category 001-1');
@@ -133,9 +135,9 @@ class SerendipityTestSuite extends PHPUnit_Extensions_SeleniumTestCase
# The Sub-Sub-Category-Test is blocked by http://pear.php.net/bugs/bug.php?id=9189 # The Sub-Sub-Category-Test is blocked by http://pear.php.net/bugs/bug.php?id=9189
# #
# $this->clickAndWait('link=Create New Category'); # $this->clickAndWait('link='.CREATE_NEW_CAT);
# #
# $this->assertTextPresent('Create New Category'); # $this->assertTextPresent(CREATE_NEW_CAT);
# $this->select('parent_cat', ' Test Category 001-1'); # $this->select('parent_cat', ' Test Category 001-1');
# $this->type('serendipity[cat][name]', 'Test Category 001-1-1'); # $this->type('serendipity[cat][name]', 'Test Category 001-1-1');
# $this->type('serendipity[cat][description]', 'This is the description for Test Category 001-1-1'); # $this->type('serendipity[cat][description]', 'This is the description for Test Category 001-1-1');
@@ -143,5 +145,34 @@ class SerendipityTestSuite extends PHPUnit_Extensions_SeleniumTestCase
# #
# $this->assertTextPresent('Test Category 001-1-1'); # $this->assertTextPresent('Test Category 001-1-1');
} }
public function testCreateSimpleArticle() {
$this->open(S9Y_INSTALLDIR);
$this->assertTitleEquals('s9y Testsuite Testblog');
$this->assertTextPresent(SUPERUSER);
$this->clickAndWait('link='.SUPERUSER_OPEN_LOGIN);
$this->assertTextPresent(PLEASE_ENTER_CREDENTIALS);
$this->type('serendipity[user]', 'Test User');
$this->type('serendipity[pass]', 'Test Password');
$this->clickAndWait('submit');
$this->assertTitleEquals(SERENDIPITY_ADMIN_SUITE);
$this->assertTextPresent(WELCOME_BACK.' John Doe');
$this->clickAndWait('link='.NEW_ENTRY);
$this->assertTextPresent(ENTRY_BODY);
$this->type('entryTitle', 'Test Entry 001');
$this->type('serendipity[body]', 'Test Body');
$this->clickAndWait("//input[@value='- ".SAVE." -']");
$this->assertTextPresent(IFRAME_SAVE);
$this->clickAndWait('link='.VIEW);
$this->assertTitleEquals('Test Entry 001 - s9y Testsuite Testblog');
$this->assertTextPresent('Test Body');
$this->clickAndWait('link='.EDIT_ENTRY);
}
} }
?> ?>
+1
View File
@@ -7,4 +7,5 @@ define('SELENIUM_HOST', '172.16.177.130');
define('SELENIUM_PORT', 4444); define('SELENIUM_PORT', 4444);
define('SELENIUM_BROWSER', '*firefox'); define('SELENIUM_BROWSER', '*firefox');
define('S9Y_INSTALLDIR', 'http://example.com/serendipity/'); define('S9Y_INSTALLDIR', 'http://example.com/serendipity/');
define('S9Y_LANG', 'en');
?> ?>