]> git.mjollnir.org Git - s9y.git/commitdiff
* add create simple article testcase, make tests language-independent
authornohn <nohn>
Sun, 29 Oct 2006 09:17:13 +0000 (09:17 +0000)
committernohn <nohn>
Sun, 29 Oct 2006 09:17:13 +0000 (09:17 +0000)
tests/gui/SerendipityTestSuite.php
tests/gui/TestConfiguration.php.dist

index bf51a66f878a900ecd5e93e9cb91a7ab5a060f43..fbfc3e3673b84d527d456a7a8da6c826d883564f 100644 (file)
@@ -9,6 +9,8 @@ require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
 
 require_once 'TestConfiguration.php';
 
+require_once '../../lang/serendipity_lang_'.S9Y_LANG.'.inc.php';
+
 class SerendipityTestSuite extends PHPUnit_Extensions_SeleniumTestCase
 {
     public function setUp()
@@ -35,8 +37,8 @@ class SerendipityTestSuite extends PHPUnit_Extensions_SeleniumTestCase
     public function testExpertInstallation()
     {
         $this->open(S9Y_INSTALLDIR);
-        $this->assertTextNotPresent('Not writable');
-        $this->clickAndWait('link=Expert installation');
+        $this->assertTextNotPresent(NOT_WRITABLE);
+        $this->clickAndWait('link='.EXPERT_INSTALLATION);
         $this->select('dbType', 'SQLite');
         $this->type('user', 'Test User');
         $this->type('pass', 'Test Password');
@@ -44,8 +46,8 @@ class SerendipityTestSuite extends PHPUnit_Extensions_SeleniumTestCase
         $this->select('rewrite', 'Use Apache mod_rewrite');
         $this->type('blogTitle', 's9y Testsuite Testblog');
         $this->type('blogDescription', 'The lalaforce is coming to get you!');
-        $this->clickAndWait("//input[@value='Complete installation']");
-        $this->assertTextPresent('Serendipity has been successfully installed');
+        $this->clickAndWait("//input[@value='".COMPLETE_INSTALLATION."']");
+        $this->assertTextPresent(SERENDIPITY_INSTALLED);
     }
 
     public function testLoginLogout()
@@ -53,77 +55,77 @@ class SerendipityTestSuite extends PHPUnit_Extensions_SeleniumTestCase
         $this->open(S9Y_INSTALLDIR);
 
         $this->assertTitleEquals('s9y Testsuite Testblog');
-        $this->assertTextPresent('Blog Administration');
-        $this->clickAndWait('link=Open login screen');
+        $this->assertTextPresent(SUPERUSER);
+        $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[pass]', 'Test Password2');
         $this->clickAndWait('submit');
 
-        $this->assertTextPresent('Please enter your credentials below');
-        $this->assertTextPresent('You appear to have entered an invalid username or password');
+        $this->assertTextPresent(PLEASE_ENTER_CREDENTIALS);
+        $this->assertTextPresent(WRONG_USERNAME_OR_PASSWORD);
         $this->type('serendipity[user]', 'Test User');
         $this->type('serendipity[pass]', 'Test Password');      
         $this->clickAndWait('submit');
 
-        $this->assertTitleEquals('Serendipity Administration Suite');
-        $this->assertTextPresent('Welcome back, John Doe');
-        $this->clickAndWait('link=Back to Weblog');
+        $this->assertTitleEquals(SERENDIPITY_ADMIN_SUITE);
+        $this->assertTextPresent(WELCOME_BACK.' John Doe');
+        $this->clickAndWait('link='.BACK_TO_BLOG);
 
         $this->assertTitleEquals('s9y Testsuite Testblog');
-        $this->assertTextPresent('Blog Administration');
-        $this->clickAndWait('link=Open administration');
+        $this->assertTextPresent(SUPERUSER);
+        $this->clickAndWait('link='.SUPERUSER_OPEN_ADMIN);
 
-        $this->assertTitleEquals('Serendipity Administration Suite');
-        $this->assertTextPresent('Welcome back, John Doe');
-        $this->clickAndWait('link=Logout');
+        $this->assertTitleEquals(SERENDIPITY_ADMIN_SUITE);
+        $this->assertTextPresent(WELCOME_BACK.' John Doe');
+        $this->clickAndWait('link='.LOGOUT);
 
-        $this->assertTextPresent('Please enter your credentials below');
-        $this->clickAndWait('link=Back to Weblog');
+        $this->assertTextPresent(PLEASE_ENTER_CREDENTIALS);
+        $this->clickAndWait('link='.BACK_TO_BLOG);
 
         $this->assertTitleEquals('s9y Testsuite Testblog');
-        $this->assertTextPresent('Blog Administration');
-        $this->clickAndWait('link=Open login screen');
+        $this->assertTextPresent(SUPERUSER);
+        $this->clickAndWait('link='.SUPERUSER_OPEN_LOGIN);
 
-        $this->assertTextPresent('Please enter your credentials below');
+        $this->assertTextPresent(PLEASE_ENTER_CREDENTIALS);
     }
 
     public function testCreateContentCategory() {
         $this->open(S9Y_INSTALLDIR);
 
         $this->assertTitleEquals('s9y Testsuite Testblog');
-        $this->assertTextPresent('Blog Administration');
-        $this->clickAndWait('link=Open login screen');
+        $this->assertTextPresent(SUPERUSER);
+        $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[pass]', 'Test Password');
         $this->clickAndWait('submit');
 
-        $this->assertTitleEquals('Serendipity Administration Suite');
-        $this->assertTextPresent('Welcome back, John Doe');
-        $this->clickAndWait('link=Categories');
+        $this->assertTitleEquals(SERENDIPITY_ADMIN_SUITE);
+        $this->assertTextPresent(WELCOME_BACK.' John Doe');
+        $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][description]', 'This is the description for Test Category 001');
         $this->clickAndWait('SAVE');
 
         $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][description]', 'This is the description for Test Category 002');
         $this->clickAndWait('SAVE');
 
         $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->type('serendipity[cat][name]', '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
 #
-#       $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', '&nbsp;Test Category 001-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');
@@ -143,5 +145,34 @@ class SerendipityTestSuite extends PHPUnit_Extensions_SeleniumTestCase
 #
 #       $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);
+    }
 }
 ?>
index f8dfaae1fefd41fb14f2bb15e97f2980d10821bb..d735732936c30adfff393829fb30749e24fe2068 100644 (file)
@@ -7,4 +7,5 @@ define('SELENIUM_HOST',    '172.16.177.130');
 define('SELENIUM_PORT',    4444);
 define('SELENIUM_BROWSER', '*firefox');
 define('S9Y_INSTALLDIR',   'http://example.com/serendipity/');
+define('S9Y_LANG',         'en');
 ?>