<?php
-/*
- * This test case is part of the SimpleSeleniumTestSuite.
- * Configuration for these tests are dosumented as part of SimpleSeleniumTestSuite.php
- */
-class AddContentToNewPageTestCase extends SeleniumTestCase{
-
- // Add bold text and verify output
- public function testAddBoldText(){
- $blnElementPresent = False;
- $blnTextPresent = False;
- $this->getExistingPage();
- $this->clickEditLink();
- $this->loadWikiEditor();
- $this->clearWikiEditor();
- $this->click( "//*[@id='mw-editbutton-bold']" );
- $this->clickShowPreviewBtn();
- $this->waitForPageToLoad( "600000" );
-
- try{
- $this->assertTrue($this->isElementPresent("//div[@id='wikiPreview']/p/b"));
- $blnElementPresent = True;
- } catch ( PHPUnit_Framework_AssertionFailedError $e ){
- $blnElementPresent = False;
- }
-
- try{
- $this->assertTrue($this->isTextPresent( "Bold text" ));
- $blnTextPresent = True;
-
- } catch ( PHPUnit_Framework_AssertionFailedError $e ){
- $blnTextPresent = False;
- }
-
- // Verify bold text displayed on mediawiki preview
- if (( $blnElementPresent = True ) && ( $blnTextPresent = True )){
- echo "\n Pass : Bold text displayed in the preview \n";
- }
- else{
- echo "\n Fail : Bold text displayed in the preview \n";
- }
- }
-
- // Add italic text and verify output
- public function testAddItalicText(){
- $this->getExistingPage();
- $this->clickEditLink();
- $this->loadWikiEditor();
- $this->clearWikiEditor();
- $this->click( "//*[@id='mw-editbutton-italic']" );
- $this->clickShowPreviewBtn();
- $this->waitForPageToLoad( "600000" );
-
- // Verify italic text displayed on mediawiki preview
- try{
- $this->assertTrue($this->isElementPresent("//div[@id='wikiPreview']/p/i"));
- $blnElementPresent = True;
- } catch ( PHPUnit_Framework_AssertionFailedError $e ){
- $blnElementPresent = False;
- }
-
- try{
- $this->assertTrue($this->isTextPresent( "Italic text" ));
- $blnTextPresent = True;
-
- } catch ( PHPUnit_Framework_AssertionFailedError $e ){
- $blnTextPresent = False;
- }
-
- // Verify italic text displayed on mediawiki preview
- if (( $blnElementPresent = True ) && ( $blnTextPresent = True )){
- echo "\n Pass : Italic text displayed in the preview \n";
- }
- else{
- echo "\n Fail : Italic text displayed in the preview \n";
- }
-
- }
-
- // Add internal link for a new page and verify output in the preview
- public function testAddInternalLinkNewPage(){
- $this->getExistingPage();
- $this->clickEditLink();
- $this->loadWikiEditor();
- $this->clearWikiEditor();
- $this->click( "//*[@id='mw-editbutton-link']" );
- $this->clickShowPreviewBtn();
- $this->waitForPageToLoad( "600000" );
-
- // Verify internal link displayed on mediawiki preview
- $source = $this->getText( "//*[@id='wikiPreview']/p/a" );
- $correct = strstr( $source, "Link title" );
- try{
- $this->assertEquals( $correct, true );
- echo "\n Pass : Internal link displayed in the preview \n";
-
- } catch ( PHPUnit_Framework_AssertionFailedError $e ){
- echo "\n Pass : Internal link displayed in the preview \n";
- }
-
- $this->click( "link=Link title" );
- $this->waitForPageToLoad( "600000" );
-
- // Verify internal link open as a new page - editing mode
- $source = $this->getText( "firstHeading" );
- $correct = strstr( $source, "Editing Link title" );
- try{
- $this->assertEquals( $correct, true );
- echo "\n Pass : Internal link opened as a new page in the editing mode \n";
-
- } catch ( PHPUnit_Framework_AssertionFailedError $e ){
- echo "\n Fail : Internal link opened as a new page in the editing mode \n";
- }
- }
-
- // Add external link and verify output in the preview
- public function testAddExternalLink(){
- $this->getExistingPage();
- $this->clickEditLink();
- $this->loadWikiEditor();
- $this->clearWikiEditor();
- $this->click( "//*[@id='mw-editbutton-extlink']" );
- $this->type( "wpTextbox1", "[http://www.google.com Google]" );
- $this->clickShowPreviewBtn();
- $this->waitForPageToLoad( "600000" );
-
- // Verify external links displayed on mediawiki preview
- $source = $this->getText( "//*[@id='wikiPreview']/p/a" );
- $correct = strstr( $source, "Google" );
-
- try{
- $this->assertEquals( $correct, true );
- echo "\n Pass : External link displayed in the preview \n";
- } catch ( PHPUnit_Framework_AssertionFailedError $e ){
- echo "\n Fail : External link displayed in thw preview \n";
- }
-
- $this->click( "link=Google" );
- $this->waitForPageToLoad( "600000" );
-
- // Verify external link opens
- $source = $this->getTitle();
- $correct = strstr( $source, "Google" );
- try{
- $this->assertEquals( $correct, true);
- echo "\n Pass : External link opened \n";
-
- } catch (PHPUnit_Framework_AssertionFailedError $e){
- echo "\n Fail : External link opened \n";
- }
-
- }
-
- // Add level 2 headline and verify output in the preview
- public function testAddLevel2HeadLine(){
- $blnElementPresent = False;
- $blnTextPresent = False;
- $this->getExistingPage();
- $this->clickEditLink();
- $this->loadWikiEditor();
- $this->clearWikiEditor();
- $this->click( "mw-editbutton-headline" );
- $this->clickShowPreviewBtn();
- $this->waitForPageToLoad( "600000" );
-
- try {
- $this->assertTrue($this->isElementPresent("//div[@id='wikiPreview']/h2"));
- $blnElementPresent = True;
- } catch ( PHPUnit_Framework_AssertionFailedError $e ){
- $blnElementPresent = False;
- }
-
- try{
- $source = $this->getText( "//*[@id='Headline_text']" );
- $correct = strstr( $source, "Headline text" );
- $this->assertEquals( $correct, true );
- $blnTextPresent = True;
- } catch ( PHPUnit_Framework_AssertionFailedError $e ){
- $blnTextPresent = False;
- }
-
- if(($blnElementPresent = True) && ($blnTextPresent = True)){
- echo "\n Pass : Headline text displayed in the preview \n";
- }
- else{
- echo "\n Fail : Headline text displayed in the preview \n";
- }
- }
-
- // Add text with ignore wiki format and verify output the preview
- public function testAddNoWikiFormat(){
- $this->getExistingPage();
- $this->clickEditLink();
- $this->loadWikiEditor();
- $this->clearWikiEditor();
- $this->click( "//*[@id='mw-editbutton-nowiki']" );
- $this->clickShowPreviewBtn();
- $this->waitForPageToLoad( "600000" );
-
- // Verify ignore wiki format text displayed on mediawiki preview
- $source = $this->getText( "//div[@id='wikiPreview']/p" );
- $correct = strstr( $source, "Insert non-formatted text here" );
- try{
- $this->assertEquals( $correct, true );
- echo "\n Pass : Text available without wiki formats in the preview \n ";
-
- } catch (PHPUnit_Framework_AssertionFailedError $e){
- echo "\n Fail : Text available without wiki formats in the preview\n ";
- }
- }
-
- // Add signature and verify output in the preview
- public function testAddUserSignature(){
- $this->getExistingPage();
- $this->clickEditLink();
- $this->loadWikiEditor();
- $this->clearWikiEditor();
- $this->click( "mw-editbutton-signature" );
- $this->clickShowPreviewBtn();
- $this->waitForPageToLoad( "600000" );
-
- // Verify signature displayed on mediawiki preview
- $source = $this->getText( "//*[@id='wikiPreview']/p/a" );
- $username = $this->getText( "//*[@id='pt-userpage']/a" );
- $correct = strstr( $source, $username );
-
- try{
- $this->assertEquals( $correct, true);
- echo "\n Pass : Correct name displayed in the preview \n ";
-
- } catch (PHPUnit_Framework_AssertionFailedError $e){
- echo "\n Fail : Correct name displayed in the preview \n ";
- }
- }
-
- // Add horizontal line and verify output in the preview
- public function testHorizontalLine(){
- $this->getExistingPage();
- $this->clickEditLink();
- $this->loadWikiEditor();
- $this->clearWikiEditor();
- $this->click( "mw-editbutton-hr" );
-
- $this->clickShowPreviewBtn();
- $this->waitForPageToLoad( "600000" );
+/**
+ * Selenium server manager
+ *
+ * @file
+ * @ingroup Maintenance
+ * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>
+ * http://citizendium.org/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @addtogroup Maintenance
+ *
+ */
- // Verify horizontal line displayed on mediawiki preview
- try{
- $this->assertTrue( $this->isElementPresent( "//div[@id='wikiPreview']/hr" ));
- echo "\n Pass: Horizontal line displayed in the preview \n";
- } catch (PHPUnit_Framework_AssertionFailedError $e){
- echo "\n Fail : Horizontal line displayed in the preview \n ";
- }
- }
-
- }
+class AddContentToNewPageTestCase extends SeleniumTestCase {
+
+
+ // Add bold text and verify output
+ public function testAddBoldText() {
+
+ $this->getExistingPage();
+ $this->clickEditLink();
+ $this->loadWikiEditor();
+ $this->clearWikiEditor();
+ $this->click( "//*[@id='mw-editbutton-bold']" );
+ $this->clickShowPreviewBtn();
+ $this->waitForPageToLoad( "600000" );
+
+ // Verify bold text displayed on mediawiki preview
+ $this->assertTrue($this->isElementPresent( "//div[@id='wikiPreview']/p/b" ));
+ $this->assertTrue($this->isTextPresent( "Bold text" ));
+ }
+
+ // Add italic text and verify output
+ public function testAddItalicText() {
+
+ $this->getExistingPage();
+ $this->clickEditLink();
+ $this->loadWikiEditor();
+ $this->clearWikiEditor();
+ $this->click( "//*[@id='mw-editbutton-italic']" );
+ $this->clickShowPreviewBtn();
+ $this->waitForPageToLoad( "600000" );
+
+ // Verify italic text displayed on mediawiki preview
+ $this->assertTrue($this->isElementPresent("//div[@id='wikiPreview']/p/i"));
+ $this->assertTrue($this->isTextPresent( "Italic text" ));
+ }
+
+ // Add internal link for a new page and verify output in the preview
+ public function testAddInternalLinkNewPage() {
+ $this->getExistingPage();
+ $this->clickEditLink();
+ $this->loadWikiEditor();
+ $this->clearWikiEditor();
+ $this->click( "//*[@id='mw-editbutton-link']" );
+ $this->clickShowPreviewBtn();
+ $this->waitForPageToLoad( "600000" );
+
+ // Verify internal link displayed on mediawiki preview
+ $source = $this->getText( "//*[@id='wikiPreview']/p/a" );
+ $correct = strstr( $source, "Link title" );
+ $this->assertEquals( $correct, true );
+
+ $this->click( "link=Link title" );
+ $this->waitForPageToLoad( "600000" );
+
+ // Verify internal link open as a new page - editing mode
+ $source = $this->getText( "firstHeading" );
+ $correct = strstr( $source, "Editing Link title" );
+ $this->assertEquals( $correct, true );
+ }
+
+ // Add external link and verify output in the preview
+ public function testAddExternalLink() {
+ $this->getExistingPage();
+ $this->clickEditLink();
+ $this->loadWikiEditor();
+ $this->clearWikiEditor();
+ $this->click( "//*[@id='mw-editbutton-extlink']" );
+ $this->type( "wpTextbox1", "[http://www.google.com Google]" );
+ $this->clickShowPreviewBtn();
+ $this->waitForPageToLoad( "600000" );
+
+ // Verify external links displayed on mediawiki preview
+ $source = $this->getText( "//*[@id='wikiPreview']/p/a" );
+ $correct = strstr( $source, "Google" );
+ $this->assertEquals( $correct, true );
+
+ $this->click( "link=Google" );
+ $this->waitForPageToLoad( "600000" );
+
+ // Verify external link opens
+ $source = $this->getTitle();
+ $correct = strstr( $source, "Google" );
+ $this->assertEquals( $correct, true);
+ }
+
+ // Add level 2 headline and verify output in the preview
+ public function testAddLevel2HeadLine() {
+ $blnElementPresent = False;
+ $blnTextPresent = False;
+ $this->getExistingPage();
+ $this->clickEditLink();
+ $this->loadWikiEditor();
+ $this->clearWikiEditor();
+ $this->click( "mw-editbutton-headline" );
+ $this->clickShowPreviewBtn();
+ $this->waitForPageToLoad( "600000" );
+ $this->assertTrue($this->isElementPresent( "//div[@id='wikiPreview']/h2" ));
+
+ // Verify level 2 headline displayed on mediawiki preview
+ $source = $this->getText( "//*[@id='Headline_text']" );
+ $correct = strstr( $source, "Headline text" );
+ $this->assertEquals( $correct, true );
+ }
+
+ // Add text with ignore wiki format and verify output the preview
+ public function testAddNoWikiFormat() {
+ $this->getExistingPage();
+ $this->clickEditLink();
+ $this->loadWikiEditor();
+ $this->clearWikiEditor();
+ $this->click( "//*[@id='mw-editbutton-nowiki']" );
+ $this->clickShowPreviewBtn();
+ $this->waitForPageToLoad( "600000" );
+
+ // Verify ignore wiki format text displayed on mediawiki preview
+ $source = $this->getText( "//div[@id='wikiPreview']/p" );
+ $correct = strstr( $source, "Insert non-formatted text here" );
+ $this->assertEquals( $correct, true );
+ }
+
+ // Add signature and verify output in the preview
+ public function testAddUserSignature() {
+ $this->getExistingPage();
+ $this->clickEditLink();
+ $this->loadWikiEditor();
+ $this->clearWikiEditor();
+ $this->click( "mw-editbutton-signature" );
+ $this->clickShowPreviewBtn();
+ $this->waitForPageToLoad( "600000" );
+
+ // Verify signature displayed on mediawiki preview
+ $source = $this->getText( "//*[@id='wikiPreview']/p/a" );
+ $username = $this->getText( "//*[@id='pt-userpage']/a" );
+ $correct = strstr( $source, $username );
+ $this->assertEquals( $correct, true );
+ }
+
+ // Add horizontal line and verify output in the preview
+ public function testHorizontalLine() {
+ $this->getExistingPage();
+ $this->clickEditLink();
+ $this->loadWikiEditor();
+ $this->clearWikiEditor();
+ $this->click( "mw-editbutton-hr" );
+
+ $this->clickShowPreviewBtn();
+ $this->waitForPageToLoad( "600000" );
+
+ // Verify horizontal line displayed on mediawiki preview
+ $this->assertTrue( $this->isElementPresent( "//div[@id='wikiPreview']/hr" ));
+ $this->deletePage( "new" );
+ }
+}
<?php
-/*
- * This test case is part of the SimpleSeleniumTestSuite.
- * Configuration for these tests are dosumented as part of SimpleSeleniumTestSuite.php
+
+/**
+ * Selenium server manager
+ *
+ * @file
+ * @ingroup Maintenance
+ * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>
+ * http://citizendium.org/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @addtogroup Maintenance
+ *
*/
-class AddNewPageTestCase extends SeleniumTestCase{
-
- // Verify adding a new page
- public function testAddNewPage() {
- $this->open( $this->getUrl() .
- '/index.php?title=Main_Page&action=edit' );
- $this->type("searchInput", "new");
- $this->click("searchGoButton");
- $this->waitForPageToLoad("600000");
-
- // Verify 'Search results' text available
- $source = $this->gettext( "firstHeading" );
- $correct = strstr( $source, "Search results");
- try{
- $this->assertEquals( $correct, true);
- echo "\n Pass : Text'Search results' displayed \n";
-
- } catch (PHPUnit_Framework_AssertionFailedError $e){
- echo "\n Fail : Text' Search results' displayed \n" ;
- }
-
- // Verify 'Create the page "<page name>" on this wiki' text available
- $source = $this->gettext( "//div[@id='bodyContent']/div[4]/p/b" );
- $correct = strstr ( $source, "Create the page \"New\" on this wiki!" );
- try{
- $this->assertEquals( $correct, true );
- echo "\n Pass : Text 'Create the page \"New\" on this wiki!' displayed \n";
- } catch (PHPUnit_Framework_AssertionFailedError $e){
- echo "\n Fail : Text 'Create the page \"New\" on this wiki!' displayed \n";
- }
-
- $this->click("link=New");
- $this->waitForPageToLoad("600000");
-
- // Verify 'Create' tab available
- try{
- $this->assertTrue($this->isElementPresent("link=Create"));
- echo "\n Pass : 'Create' tab displayed \n";
- } catch (PHPUnit_Framework_AssertionFailedError $e) {
- echo "\n Fail : 'Create' tab displayed \n";
- }
-
- $this->type("wpTextbox1", "add new test page");
- $this->click("wpSave");
-
- // Verify new page added
- $source = $this->gettext( "firstHeading" );
- $correct = strstr ( $source, "New" );
- try{
- $this->assertEquals( $correct, true);
- echo "\n Pass : New page added \n";
- } catch (PHPUnit_Framework_AssertionFailedError $e){
- echo "\n Fail : New page added \n";
- }
- }
+
+
+class AddNewPageTestCase extends SeleniumTestCase {
+
+ // Verify adding a new page
+ public function testAddNewPage() {
+ $newPage = "new";
+ $displayName = "New";
+ $this->open( $this->getUrl() .
+ '/index.php?title=Main_Page&action=edit' );
+ $this->type( "searchInput", $newPage );
+ $this->click( "searchGoButton" );
+ $this->waitForPageToLoad( "600000" );
+
+ // Verify 'Search results' text available
+ $source = $this->gettext( "firstHeading" );
+ $correct = strstr( $source, "Search results" );
+ $this->assertEquals( $correct, true);
+
+ // Verify 'Create the page "<page name>" on this wiki' text available
+ $source = $this->gettext( "//div[@id='bodyContent']/div[4]/p/b" );
+ $correct = strstr ( $source, "Create the page \"New\" on this wiki!" );
+ $this->assertEquals( $correct, true );
+
+ $this->click( "link=".$displayName );
+ $this->waitForPageToLoad( "600000" );
+
+ $this->assertTrue($this->isElementPresent( "link=Create" ));
+ $this->type( "wpTextbox1", "add new test page" );
+ $this->click( "wpSave" );
+
+ // Verify new page added
+ $source = $this->gettext( "firstHeading" );
+ $correct = strstr ( $source, $displayName );
+ $this->assertEquals( $correct, true );
+ }
}
--- /dev/null
+<?php
+
+/**
+ * Selenium server manager
+ *
+ * @file
+ * @ingroup Maintenance
+ * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>
+ * http://citizendium.org/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @addtogroup Maintenance
+ *
+ */
+
+Class CreateAccountTestCase extends SeleniumTestCase {
+
+ // Change these values before run the test
+ private $userName = "yourname4000";
+ private $password = "yourpass4000";
+
+ // Verify 'Log in/create account' link existance in Main page.
+ public function testMainPageLink() {
+
+ $this->click( "link=Log out" );
+ $this->waitForPageToLoad( "30000" );
+
+ $this->open( $this->getUrl().'/index.php?title=Main_Page' );
+ $this->assertTrue($this->isElementPresent( "link=Log in / create account" ));
+ }
+
+ // Verify 'Create an account' link existance in 'Log in / create account' Page.
+ public function testCreateAccountPageLink() {
+
+ $this->click( "link=Log out" );
+ $this->waitForPageToLoad( "30000" );
+
+ $this->open( $this->getUrl().'/index.php?title=Main_Page' );
+
+ // click Log in / create account link to open Log in / create account' page
+ $this->click( "link=Log in / create account" );
+ $this->waitForPageToLoad( "30000" );
+ $this->assertTrue($this->isElementPresent( "link=Create an account" ));
+ }
+
+ // Verify Create account
+ public function testCreateAccount() {
+
+ $this->click( "link=Log out" );
+ $this->waitForPageToLoad( "30000" );
+
+ $this->open( $this->getUrl().'/index.php?title=Main_Page' );
+
+ $this->click( "link=Log in / create account" );
+ $this->waitForPageToLoad( "30000" );
+
+ $this->click( "link=Create an account" );
+ $this->waitForPageToLoad( "30000" );
+
+ // Verify for blank user name
+ $this->type( "wpName2", "" );
+ $this->click( "wpCreateaccount" );
+ $this->waitForPageToLoad( "30000" );
+ $this->assertEquals( "Login error\n You have not specified a valid user name.",
+ $this->getText( "//div[@id='bodyContent']/div[4]" ));
+
+ // Verify for invalid user name
+ $this->type( "wpName2", "@" );
+ $this->click("wpCreateaccount" );
+ $this->waitForPageToLoad( "30000" );
+ $this->assertEquals( "Login error\n You have not specified a valid user name.",
+ $this->getText( "//div[@id='bodyContent']/div[4]" ));
+
+ // start of test for blank password
+ $this->type( "wpName2", $this->userName);
+ $this->type( "wpPassword2", "" );
+ $this->click( "wpCreateaccount" );
+ $this->waitForPageToLoad( "30000" );
+ $this->assertEquals( "Login error\n Passwords must be at least 1 character.",
+ $this->getText("//div[@id='bodyContent']/div[4]" ));
+
+ $this->type( "wpName2", $this->userName );
+ $this->type( "wpPassword2", $this->password );
+ $this->click( "wpCreateaccount" );
+ $this->waitForPageToLoad( "30000" );
+ $this->assertEquals( "Login error\n The passwords you entered do not match.",
+ $this->getText( "//div[@id='bodyContent']/div[4]" ));
+
+ $this->type( "wpName2", $this->userName );
+ $this->type( "wpPassword2", $this->password );
+ $this->type( "wpRetype", $this->password );
+ $this->click( "wpCreateaccount" );
+ $this->waitForPageToLoad( "30000 ");
+
+ // Verify successful account creation for valid combination of 'Username', 'Password', 'Retype password'
+ $this->assertEquals( "Welcome, ".ucfirst( $this->userName )."!",
+ $this->getText( "Welcome,_".ucfirst( $this->userName )."!" ));
+ }
+}
+?>
<?php
-/*
- * This test case is part of the SimpleSeleniumTestSuite.
- * Configuration for these tests are dosumented as part of SimpleSeleniumTestSuite.php
+
+/**
+ * Selenium server manager
+ *
+ * @file
+ * @ingroup Maintenance
+ * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>
+ * http://citizendium.org/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @addtogroup Maintenance
+ *
*/
-class DeletePageAdminTestCase extends SeleniumTestCase{
-
- // Verify adding a new page
- public function testDeletePage() {
- $this->open( $this->getUrl() .
- '/index.php?title=Main_Page&action=edit' );
- $this->click("link=Log out");
- $this->waitForPageToLoad( "30000" );
- $this->click( "link=Log in / create account" );
- $this->waitForPageToLoad( "30000" );
- $this->type( "wpName1", "nadeesha" );
- $this->type( "wpPassword1", "12345" );
- $this->click( "wpLoginAttempt" );
- $this->waitForPageToLoad( "30000" );
- $this->type( "searchInput", "new" );
- $this->click( "searchGoButton");
- $this->waitForPageToLoad( "30000" );
-
- // Verify 'Delete' link displayed
- $source = $this->gettext( "link=Delete" );
- $correct = strstr ( $source, "Delete" );
- try{
- $this->assertEquals( $correct, true);
- echo "\n Pass : 'Delete' link displayed \n";
- } catch (PHPUnit_Framework_AssertionFailedError $e){
- echo "\n Fail : 'Delete' link displayed \n";
- }
- $this->click( "link=Delete" );
- $this->waitForPageToLoad( "30000" );
- // Verify 'Delete' button available
- $this->assertTrue($this->isElementPresent( "wpConfirmB" ));
+require_once("maintenance/tests/selenium/suites/MediaWikiCommonFunction.php");
+
+class DeletePageAdminTestCase extends SeleniumTestCase {
+
+ // Verify adding a new page
+ public function testDeletePage() {
+
+
+ $newPage = "new";
+ $displayName = "New";
+
+ $this->open( $this->getUrl().'/index.php?title=Main_Page' );
+
+ $this->type( "searchInput", $newPage );
+ $this->click( "searchGoButton" );
+ $this->waitForPageToLoad( "30000" );
+ $this->click( "link=".$displayName );
+ $this->waitForPageToLoad( "60000" );
+ $this->type( "wpTextbox1", $newPage." text" );
+ $this->click( "wpSave" );
+
+ $this->open( $this->getUrl() .
+ '/index.php?title=Main_Page&action=edit' );
+ $this->click( "link=Log out" );
+ $this->waitForPageToLoad( "30000" );
+ $this->click( "link=Log in / create account" );
+ $this->waitForPageToLoad( "30000" );
+
+ $this->type( "wpName1", $this->selenium->getUser() );
+ $this->type( "wpPassword1", $this->selenium->getPass() );
+ $this->click( "wpLoginAttempt" );
+ $this->waitForPageToLoad( "30000" );
+ $this->type( "searchInput", "new" );
+ $this->click( "searchGoButton");
+ $this->waitForPageToLoad( "30000" );
+
+ // Verify 'Delete' link displayed
+ $source = $this->gettext( "link=Delete" );
+ $correct = strstr ( $source, "Delete" );
+ $this->assertEquals($correct, true );
+
+ $this->click( "link=Delete" );
+ $this->waitForPageToLoad( "30000" );
+
+ // Verify 'Delete' button available
+ $this->assertTrue($this->isElementPresent( "wpConfirmB" ));
+
+ $this->click( "wpConfirmB" );
+ $this->waitForPageToLoad( "30000" );
- try{
- $this->assertTrue($this->isElementPresent( "wpConfirmB" ));
- echo "\n Pass : 'Delete' button available \n";
- } catch ( PHPUnit_Framework_AssertionFailedError $e ){
- echo "\n Fail : 'Delete' button available \n";
- }
- $this->click( "wpConfirmB" );
- $this->waitForPageToLoad( "30000" );
-
- // Verify 'Action complete' text displayed
- $source = $this->gettext( "firstHeading" );
- $correct = strstr ( $source, "Action complete" );
- try{
- $this->assertEquals( $correct, true );
- echo "\n Pass : 'Action complete' text displayed \n";
- }catch ( PHPUnit_Framework_AssertionFailedError $e ){
- echo "\n Fail : 'Action complete' text displayed \n";
- }
+ // Verify 'Action complete' text displayed
+ $source = $this->gettext( "firstHeading" );
+ $correct = strstr ( $source, "Action complete" );
+ $this->assertEquals( $correct, true );
- // Verify '<Page Name> has been deleted. See deletion log for a record of recent deletions.' text displayed
- $source = $this->gettext( "//div[@id='bodyContent']/p[1]" );
- $correct = strstr ( $source, "\"New\" has been deleted. See deletion log for a record of recent deletions." );
- try{
- $this->assertEquals( $correct, true );
- echo "\n Pass : Page deleted successfully \n";
- } catch ( PHPUnit_Framework_AssertionFailedError $e ){
- echo "\n Fail : Page deleted successfully \n";
- }
- }
+ // Verify '<Page Name> has been deleted. See deletion log for a record of recent deletions.' text displayed
+ $source = $this->gettext( "//div[@id='bodyContent']/p[1]" );
+ $correct = strstr ( $source, "\"New\" has been deleted. See deletion log for a record of recent deletions." );
+ $this->assertEquals( $correct, true );
+ }
}
--- /dev/null
+<?php
+
+/**
+ * Selenium server manager
+ *
+ * @file
+ * @ingroup Maintenance
+ * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>
+ * http://citizendium.org/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @addtogroup Maintenance
+ *
+ */
+
+class EmailPasswordTestCase extends SeleniumTestCase {
+
+ // change user name for each and every test (with in 24 hours)
+ private $userName = "test1";
+
+ public function testEmailPasswordButton() {
+
+ $this->click( "link=Log out" );
+ $this->waitForPageToLoad( "30000" );
+
+ $this->open( $this->getUrl().'/index.php?title=Main_Page' );
+
+ // click Log in / create account link to open Log in / create account' page
+ $this->click( "link=Log in / create account" );
+ $this->waitForPageToLoad( "30000" );
+ $this->assertTrue($this->isElementPresent( "wpMailmypassword" ));
+ }
+
+ // Verify Email password functionality
+ public function testEmailPasswordMessages() {
+
+ $this->click( "link=Log out" );
+ $this->waitForPageToLoad( "30000" );
+
+ $this->open( $this->getUrl().'/index.php?title=Main_Page' );
+
+ // click Log in / create account link to open Log in / create account' page
+ $this->click( "link=Log in / create account" );
+ $this->waitForPageToLoad( "30000" );
+
+ $this->type( "wpName1", "" );
+ $this->click( "wpMailmypassword" );
+ $this->waitForPageToLoad( "30000" );
+ $this->assertEquals( "Login error\n You have not specified a valid user name.",
+ $this->getText("//div[@id='bodyContent']/div[4]"));
+
+ $this->type( "wpName1", $this->userName );
+ $this->click( "wpMailmypassword" );
+ $this->waitForPageToLoad( "30000" );
+
+ // Can not run on localhost
+ $this->assertEquals( "A new password has been sent to the e-mail address registered for ".ucfirst($this->userName).". Please log in again after you receive it.",
+ $this->getText("//div[@id='bodyContent']/div[4]" ));
+
+ $this->type( "wpName1", $this->userName );
+ $this->click( "wpMailmypassword" );
+ $this->waitForPageToLoad( "30000" );
+ $this->assertEquals( "Login error\n A password reminder has already been sent, within the last 24 hours. To prevent abuse, only one password reminder will be sent per 24 hours.",
+ $this->getText( "//div[@id='bodyContent']/div[4]" ));
+ }
+}
+?>
--- /dev/null
+<?php\r
+\r
+class MediaWikExtraTestSuite extends SeleniumTestSuite {\r
+ public function setUp() {\r
+ $this->setLoginBeforeTests( true );\r
+ parent::setUp();\r
+ }\r
+ public function addTests() {\r
+ $testFiles = array(\r
+ 'maintenance/tests/selenium/suites/MyContributionsTestCase.php',\r
+ 'maintenance/tests/selenium/suites/MyWatchListTestCase.php',\r
+ 'maintenance/tests/selenium/suites/UserPreferencesTestCase.php',\r
+ 'maintenance/tests/selenium/suites/MovePageTestCase.php',\r
+ 'maintenance/tests/selenium/suites/PageSearchTestCase.php',\r
+ 'maintenance/tests/selenium/suites/EmailPasswordTestCase.php',\r
+ 'maintenance/tests/selenium/suites/CreateAccountTestCase.php'\r
+ );\r
+ parent::addTestFiles( $testFiles );\r
+ }\r
+}\r
+++ /dev/null
-<?php
-
-
-class MediaWikiCommonFunc{
-
- // Getting existing page
- public function getExistingPage(){
- $this->open( $this->getUrl() .
- '/index.php?title=Main_Page&action=edit' );
- $this->type("searchInput", "new" );
- $this->click("searchGoButton");
- $this->waitForPageToLoad("30000");
- }
-
- // Creating new page
- public function getNewPage($pageName){
-
- $this->open( $this->getUrl() .
- '/index.php?title=Main_Page&action=edit' );
- $this->type("searchInput", $pageName );
- $this->click("searchGoButton");
- $this->waitForPageToLoad("30000");
- $this->click("link=".$pageName);
- $this->waitForPageToLoad("600000");
- }
-
- // Deleting the given page
- public function deletePage($pageName){
- $this->open( $this->getUrl() .
- '/index.php?title=Main_Page&action=edit' );
- $this->click("link=Log out");
- $this->waitForPageToLoad( "30000" );
- $this->click( "link=Log in / create account" );
- $this->waitForPageToLoad( "30000" );
- $this->type( "wpName1", "nadeesha" );
- $this->type( "wpPassword1", "12345" );
- $this->click( "wpLoginAttempt" );
- $this->waitForPageToLoad( "30000" );
- $this->type( "searchInput", $pageName );
- $this->click( "searchGoButton");
- $this->waitForPageToLoad( "30000" );
- $this->click( "link=Delete" );
- $this->waitForPageToLoad( "30000" );
- $this->click( "wpConfirmB" );
- $this->waitForPageToLoad( "30000" );
- }
-
- // Loading the mediawiki editor
- public function loadWikiEditor(){
- $this->open( $this->getUrl() .
- '/index.php?title=Main_Page&action=edit' );
- }
-
- // Clear the content of the mediawiki editor
- public function clearWikiEditor(){
- $this->type("wpTextbox1", "");
- }
-
- // Click on the 'Show preview' button of the mediawiki editor
- public function clickShowPreviewBtn(){
- $this->click("wpPreview");
- }
-
- // Click on the 'Save Page' button of the mediawiki editor
- public function clickSavePageBtn(){
- $this->click("wpSave");
- }
-
- // Click on the 'Edit' link
- public function clickEditLink(){
- $this->click("link=Edit");
- $this->waitForPageToLoad("30000");
- }
-
-
-
-}
<?php
+
+/**
+ * Selenium server manager
+ *
+ * @file
+ * @ingroup Maintenance
+ * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>
+ * http://citizendium.org/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @addtogroup Maintenance
+ *
+ */
+
class MediaWikiEditorConfig {
-
- public static function getSettings(&$includeFiles, &$globalConfigs) {
- $includes = array(
- //files that needed to be included would go here
- 'maintenance/tests/selenium/suites/MediaWikiCommonFunc.php'
- );
- $configs = array(
- 'wgDefaultSkin' => 'chick'
- );
- $includeFiles = array_merge( $includeFiles, $includes );
- $globalConfigs = array_merge( $globalConfigs, $configs);
- return true;
- }
-}
\ No newline at end of file
+
+ public static function getSettings(&$includeFiles, &$globalConfigs) {
+ $includes = array(
+ //files that needed to be included would go here
+ 'maintenance/tests/selenium/suites/MediaWikiCommonFunction.php'
+ );
+ $configs = array(
+ 'wgPageLoadTime' => "600000"
+ );
+ $includeFiles = array_merge( $includeFiles, $includes );
+ $globalConfigs = array_merge( $globalConfigs, $configs);
+ return true;
+ }
+}
+
+
+
<?php
-/*
- * Sample test suite.
- * Two ways to configure MW for these tests
- * 1) If you are running multiple test suites, add the following in LocalSettings.php
- * require_once("maintenance/tests/selenium/SimpleSeleniumConfig.php");
- * $wgSeleniumTestConfigs['SimpleSeleniumTestSuite'] = 'SimpleSeleniumConfig::getSettings';
- * OR
- * 2) Add the following to your Localsettings.php
- * $wgDefaultSkin = 'chick';
- */
-class MediaWikiEditorTestSuite extends SeleniumTestSuite
-{
- public function setUp() {
- $this->setLoginBeforeTests( True );
- parent::setUp();
- }
- public function addTests() {
- $testFiles = array(
- 'maintenance/tests/selenium/suites/AddNewPageTestCase.php',
- 'maintenance/tests/selenium/suites/AddContentToNewPageTestCase.php',
- 'maintenance/tests/selenium/suites/DeletePageAdminTestCase.php',
- 'maintenance/tests/selenium/suites/PageSearchTestCase.php'
-
- );
- parent::addTestFiles( $testFiles );
- }
-
+class MediaWikiEditorTestSuite extends SeleniumTestSuite {
+ public function setUp() {
+ $this->setLoginBeforeTests( true );
+ parent::setUp();
+ }
+ public function addTests() {
+ $testFiles = array(
+ 'maintenance/tests/selenium/suites/AddNewPageTestCase.php',
+ 'maintenance/tests/selenium/suites/AddContentToNewPageTestCase.php',
+ 'maintenance/tests/selenium/suites/PreviewPageTestCase.php',
+ 'maintenance/tests/selenium/suites/SavePageTestCase.php',
+ );
+ parent::addTestFiles( $testFiles );
+ }
}
+
--- /dev/null
+<?php
+
+/**
+ * Selenium server manager
+ *
+ * @file
+ * @ingroup Maintenance
+ * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>
+ * http://citizendium.org/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @addtogroup Maintenance
+ *
+ */
+
+class MovePageTestCase extends SeleniumTestCase {
+
+ // Verify move(rename) wiki page
+ public function testMovePage() {
+
+ $newPage = "mypage99";
+ $displayName = "Mypage99";
+
+ $this->open( $this->getUrl() .
+ '/index.php?title=Main_Page&action=edit' );
+ $this->type( "searchInput", $newPage );
+ $this->click( "searchGoButton" );
+ $this->waitForPageToLoad( "30000" );
+ $this->click( "link=".$displayName );
+ $this->waitForPageToLoad( "60000" );
+ $this->type( "wpTextbox1", $newPage." text" );
+ $this->click( "wpSave" );
+ $this->waitForPageToLoad( "60000" );
+
+ // Verify link 'Move' available
+ $this->assertTrue($this->isElementPresent( "link=Move" ));
+
+ $this->click( "link=Move" );
+ $this->waitForPageToLoad( "30000" );
+
+ // Verify correct page name displayed under 'Move Page' field
+ $this->assertEquals($displayName,
+ $this->getText("//table[@id='mw-movepage-table']/tbody/tr[1]/td[2]/strong/a"));
+ $movePageName = $this->getText( "//table[@id='mw-movepage-table']/tbody/tr[1]/td[2]/strong/a" );
+
+ // Verify 'To new title' field has current page name as the default name
+ $newTitle = $this->getValue( "wpNewTitle" );
+ $correct = strstr( $movePageName , $newTitle );
+ $this->assertEquals( $correct, true );
+
+ $this->type( "wpNewTitle", $displayName );
+ $this->click( "wpMove" );
+ $this->waitForPageToLoad( "30000" );
+
+ // Verify warning message for the same source and destination titles
+ $this->assertEquals( "Source and destination titles are the same; cannot move a page over itself.",
+ $this->getText("//div[@id='bodyContent']/p[4]/strong" ));
+
+ // Verify warning message for the blank title
+ $this->type( "wpNewTitle", "" );
+ $this->click( "wpMove" );
+ $this->waitForPageToLoad( "30000" );
+
+ // Verify warning message for the blank title
+ $this->assertEquals( "The requested page title was invalid, empty, or an incorrectly linked inter-language or inter-wiki title. It may contain one or more characters which cannot be used in titles.",
+ $this->getText( "//div[@id='bodyContent']/p[4]/strong" ));
+
+ // Verify warning messages for the invalid titles
+ $this->type( "wpNewTitle", "# < > [ ] | { }" );
+ $this->click( "wpMove" );
+ $this->waitForPageToLoad( "30000" );
+ $this->assertEquals( "The requested page title was invalid, empty, or an incorrectly linked inter-language or inter-wiki title. It may contain one or more characters which cannot be used in titles.",
+ $this->getText( "//div[@id='bodyContent']/p[4]/strong" ));
+
+ $this->type( "wpNewTitle", $displayName."move" );
+ $this->click( "wpMove" );
+ $this->waitForPageToLoad( "30000" );
+
+ // Verify move success message displayed correctly
+ $this->assertEquals( "\"".$displayName."\" has been moved to \"".$displayName."move"."\"",
+ $this->getText( "//div[@id='bodyContent']/p[1]/b" ));
+
+ $this->type( "searchInput", $newPage."move" );
+ $this->click( "searchGoButton" );
+ $this->waitForPageToLoad( "30000" );
+
+ // Verify search using new page name
+ $this->assertEquals( $displayName."move", $this->getText( "firstHeading" ));
+
+ $this->type( "searchInput", $newPage );
+ $this->click( "searchGoButton" );
+ $this->waitForPageToLoad( "30000" );
+
+ // Verify search using old page name
+ $redirectPageName = $this->getText( "//*[@id='contentSub']" );
+ $this->assertEquals( "(Redirected from ".$displayName.")" , $redirectPageName );
+
+ // newpage delete
+ $this->deletePage( $newPage."move" );
+ $this->deletePage( $newPage );
+ }
+}
+?>
--- /dev/null
+<?php
+
+/**
+ * Selenium server manager
+ *
+ * @file
+ * @ingroup Maintenance
+ * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>
+ * http://citizendium.org/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @addtogroup Maintenance
+ *
+ */
+
+class MyContributionsTestCase extends SeleniumTestCase {
+
+ // Verify user contributions
+ public function testRecentChangesAvailability() {
+
+ $newPage = "mypage999";
+ $displayName = "Mypage999";
+
+ $this->open( $this->getUrl() .
+ '/index.php?title=Main_Page&action=edit' );
+
+ $this->type( "searchInput", $newPage);
+ $this->click( "searchGoButton" );
+ $this->waitForPageToLoad( "60000" );
+ $this->click( "link=".$displayName );
+ $this->waitForPageToLoad( "600000" );
+ $this->type( "wpTextbox1", $newPage." text" );
+ $this->click( "wpSave" );
+ $this->waitForPageToLoad( "60000" );
+
+ // Verify My contributions Link available
+ $this->assertTrue($this->isElementPresent( "link=My contributions" ));
+
+ $this->click( "link=My contributions" );
+ $this->waitForPageToLoad( "30000" );
+
+ // Verify recent page adding available on My Contributions list
+ $this->assertEquals( $displayName, $this->getText( "link=".$displayName ));
+
+ $this->type( "searchInput", $newPage );
+ $this->click( "searchGoButton" );
+ $this->waitForPageToLoad( "30000" );
+
+ $this->click( "link=Edit" );
+ $this->waitForPageToLoad( "30000" );
+ $this->type( "wpTextbox1", $newPage." text changed" );
+ $this->click( "wpSave" );
+ $this->waitForPageToLoad( "30000" );
+ $this->click( "link=My contributions" );
+ $this->waitForPageToLoad( "30000" );
+
+ // Verify recent page changes available on My Contributions
+ $this->assertTrue($this->isTextPresent($displayName." ‎ (top)"));
+ $this->deletePage($newPage);
+ }
+}
+?>
--- /dev/null
+<?php
+
+/**
+ * Selenium server manager
+ *
+ * @file
+ * @ingroup Maintenance
+ * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>
+ * http://citizendium.org/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @addtogroup Maintenance
+ *
+ */
+
+
+class MyWatchListTestCase extends SeleniumTestCase {
+
+ // Verify user watchlist
+ public function testMyWatchlist() {
+
+ $newPage = "mypage";
+ $displayName = "Mypage";
+ $wikiText = "watch page";
+
+ $this->open( $this->getUrl().'/index.php?title=Main_Page' );
+
+ $this->type( "searchInput", $newPage );
+ $this->click( "searchGoButton" );
+ $this->waitForPageToLoad( "30000" );
+ $this->click( "link=".$displayName );
+ $this->waitForPageToLoad( "600000" );
+
+ $this->click( "wpWatchthis" );
+ $this->type( "wpTextbox1",$wikiText );
+ $this->click( "wpSave" );
+ $this->waitForPageToLoad( "30000" );
+
+ // Verify link 'My Watchlist' available
+ $this->assertTrue( $this->isElementPresent( "link=My watchlist" ) );
+
+ $this->click( "link=My watchlist" );
+ $this->waitForPageToLoad( "30000" );
+
+ // Verify newly added page to the watchlist is available
+ $watchList = $this->getText( "//*[@id='bodyContent']" );
+ $this->assertContains( $displayName, $watchList );
+
+ $this->type( "searchInput", $newPage );
+ $this->click( "searchGoButton" );
+ $this->waitForPageToLoad( "30000" );
+ $this->click("link=Edit");
+ $this->waitForPageToLoad( "30000" );
+ $this->click( "wpWatchthis" );
+ $this->click( "wpSave" );
+ $this->deletePage( $newPage );
+ }
+}
+?>
--- /dev/null
+<?php\r
+\r
+class PageDeleteTestSuite extends SeleniumTestSuite {\r
+ public function setUp() {\r
+ $this->setLoginBeforeTests( true );\r
+ parent::setUp();\r
+ }\r
+ public function addTests() {\r
+ $testFiles = array(\r
+ 'maintenance/tests/selenium/suites/DeletePageAdminTestCase.php'\r
+ );\r
+ parent::addTestFiles( $testFiles );\r
+ }\r
+\r
+\r
+}\r
<?php
-/*
- * This test case is part of the SimpleSeleniumTestSuite.
- * Configuration for these tests are dosumented as part of SimpleSeleniumTestSuite.php
+
+/**
+ * Selenium server manager
+ *
+ * @file
+ * @ingroup Maintenance
+ * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>
+ * http://citizendium.org/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @addtogroup Maintenance
+ *
*/
-class PageSearchTestCase extends SeleniumTestCase{
-
- // Verify the functionality of the 'Go' button
- public function testPageSearchBtnGo(){
-
- $this->open( $this->getUrl() .
- '/index.php?title=Main_Page&action=edit' );
- $this->type( "searchInput", "calcey qa" );
- $this->click( "searchGoButton" );
- $this->waitForPageToLoad( "600000" );
-
- // Verify no page matched with the entered search text
- $source = $this->gettext( "//div[@id='bodyContent']/div[4]/p/b" );
- $correct = strstr ( $source, "Create the page \"Calcey qa\" on this wiki!" );
-
- try{
- $this->assertEquals( $correct, true );
- echo "\n Pass : No page matched with the entered search text using the 'Go' button \n";
- } catch (PHPUnit_Framework_AssertionFailedError $e){
- echo "\n Pass : No page matched with the entered search text using the 'Go' button \n";
- }
-
- $this->click( "link=Calcey qa" );
- $this->waitForPageToLoad( "600000" );
-
- $this->type( "wpTextbox1", "Calcey QA team" );
- $this->click( "wpSave" );
- $this->waitForPageToLoad( "600000" );
-
- }
-
- // Verify the functionality of the 'Search' button
- public function testPageSearchBtnSearch(){
-
- $this->open( $this->getUrl() .
- '/index.php?title=Main_Page&action=edit' );
- $this->type( "searchInput", "Calcey web" );
- $this->click( "mw-searchButton" );
- $this->waitForPageToLoad( "30000" );
-
- // Verify no page is available as the search text
- $source = $this->gettext( "//div[@id='bodyContent']/div[4]/p[2]/b" );
- $correct = strstr ( $source, "Create the page \"Calcey web\" on this wiki!" );
-
- try{
- $this->assertEquals( $correct, true );
- echo "\n Pass : No page matched with the entered search text using the 'Search' button \n";
- } catch (PHPUnit_Framework_AssertionFailedError $e){
- echo "\n Pass : No page matched with the entered search text using the 'Search' button \n";
- }
-
- $this->click( "link=Calcey web" );
- $this->waitForPageToLoad( "600000" );
-
- $this->type( "wpTextbox1", "Calcey web team" );
- $this->click( "wpSave" );
- $this->waitForPageToLoad( "600000" );
-
-
- // Verify saved page is opened when the exact page name is given
- $this->type( "searchInput", "Calcey web" );
- $this->click( "mw-searchButton" );
- $this->waitForPageToLoad( "30000" );
-
- $source = $this->getText( "//*[@id='bodyContent']/div[4]/p/b" );
- $correct = strstr( $source, "There is a page named \"Calcey web\" on this wiki." );
-
- try{
- $this->assertEquals( $correct, true );
- echo "\n Pass : Exact page matched with the entered search text using 'Search' button \n";
- } catch ( PHPUnit_Framework_AssertionFailedError $e ){
- echo "\n Fail : Exact page matched with the entered search text using 'Search' button \n";
- }
-
-
- // Verify resutls available when partial page name is entered as the search text
-
- $this->type( "searchInput", "Calcey" );
- $this->click( "mw-searchButton" );
- $this->waitForPageToLoad( "30000" );
-
- // Verify text avaialble in the search result under the page titles
- if($this->isElementPresent( "Page_title_matches" )){
- try{
- $textPageTitle = $this->getText( "//*[@id='bodyContent']/div[4]/ul[1]/li[1]/div[1]/a" );
- $this->assertContains( 'Calcey', $textPageTitle );
- echo "\n Pass : Results displayed under 'Page title matches' heading for the partial title match match using the 'Search' button\n";
- } catch ( PHPUnit_Framework_AssertionFailedError $e ){
- echo "\n Fail : Results displayed under 'Page title matches' heading for the partial title match match using the 'Search' button \n";
- }
- }
- else{
- echo "\n Pass : No results avaialble for the 'Page title matches' heading for the partial title match using the 'Search' button \n";
- }
-
- // Verify text avaialble in the search result under the page text
- if($this->isElementPresent( "Page_text_matches" )){
- try{
- $textPageText = $this->getText( "//*[@id='bodyContent']/div[4]/ul[2]/li[2]/div[2]/span" );
- $this->assertContains( 'Calcey', $textPageText );
-
- echo "\n Pass : Results displayed under 'Page text matches' heading for the partial text match using the 'Search' button \n";
-
- } catch ( PHPUnit_Framework_AssertionFailedError $e ){
- echo "\n Fail : Results displayed under 'Page text matches' heading for the partial text match using the 'Search' button \n";
- }
- }
- else{
- echo "\n Pass : No results avaialble for the 'Page text matches' heading for the partial title match using the 'Search' button\n";
- }
- $this->deletePage("Calcey QA");
- $this->deletePage("Calcey web");
-
- }
-
-
-
+
+class PageSearchTestCase extends SeleniumTestCase {
+
+ // Verify the functionality of the 'Go' button
+ public function testPageSearchBtnGo() {
+
+ $this->open( $this->getUrl() .
+ '/index.php?title=Main_Page&action=edit' );
+ $this->type( "searchInput", "calcey qa" );
+ $this->click( "searchGoButton" );
+ $this->waitForPageToLoad( "600000" );
+
+ // Verify no page matched with the entered search text
+ $source = $this->gettext( "//div[@id='bodyContent']/div[4]/p/b" );
+ $correct = strstr ( $source, "Create the page \"Calcey qa\" on this wiki!" );
+ $this->assertEquals( $correct, true );
+
+ $this->click( "link=Calcey qa" );
+ $this->waitForPageToLoad( "600000" );
+
+ $this->type( "wpTextbox1", "Calcey QA team" );
+ $this->click( "wpSave" );
+ $this->waitForPageToLoad( "600000" );
+
+ }
+
+ // Verify the functionality of the 'Search' button
+ public function testPageSearchBtnSearch() {
+
+ $this->open( $this->getUrl() .
+ '/index.php?title=Main_Page&action=edit' );
+ $this->type( "searchInput", "Calcey web" );
+ $this->click( "mw-searchButton" );
+ $this->waitForPageToLoad( "30000" );
+
+ // Verify no page is available as the search text
+ $source = $this->gettext( "//div[@id='bodyContent']/div[4]/p[2]/b" );
+ $correct = strstr ( $source, "Create the page \"Calcey web\" on this wiki!" );
+ $this->assertEquals( $correct, true );
+
+ $this->click( "link=Calcey web" );
+ $this->waitForPageToLoad( "600000" );
+
+ $this->type( "wpTextbox1", "Calcey web team" );
+ $this->click( "wpSave" );
+ $this->waitForPageToLoad( "600000" );
+
+ // Verify saved page is opened when the exact page name is given
+ $this->type( "searchInput", "Calcey web" );
+ $this->click( "mw-searchButton" );
+ $this->waitForPageToLoad( "30000" );
+
+ // Verify exact page matched with the entered search text using 'Search' button
+ $source = $this->getText( "//*[@id='bodyContent']/div[4]/p/b" );
+ $correct = strstr( $source, "There is a page named \"Calcey web\" on this wiki." );
+ $this->assertEquals( $correct, true );
+
+ // Verify resutls available when partial page name is entered as the search text
+ $this->type( "searchInput", "Calcey" );
+ $this->click( "mw-searchButton" );
+ $this->waitForPageToLoad( "30000" );
+
+ // Verify text avaialble in the search result under the page titles
+ if($this->isElementPresent( "Page_title_matches" )) {
+ $textPageTitle = $this->getText( "//*[@id='bodyContent']/div[4]/ul[1]/li[1]/div[1]/a" );
+ $this->assertContains( 'Calcey', $textPageTitle );
+ }
+
+ // Verify text avaialble in the search result under the page text
+ if($this->isElementPresent( "Page_text_matches" )) {
+ $textPageText = $this->getText( "//*[@id='bodyContent']/div[4]/ul[2]/li[2]/div[2]/span" );
+ $this->assertContains( 'Calcey', $textPageText );
+ }
+ $this->deletePage("Calcey QA");
+ $this->deletePage("Calcey web");
+ }
}
--- /dev/null
+<?php\r
+\r
+/**\r
+ * Selenium server manager\r
+ *\r
+ * @file\r
+ * @ingroup Maintenance\r
+ * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>\r
+ * http://citizendium.org/\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License along\r
+ * with this program; if not, write to the Free Software Foundation, Inc.,\r
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\r
+ * http://www.gnu.org/copyleft/gpl.html\r
+ *\r
+ * @addtogroup Maintenance\r
+ *\r
+ */\r
+\r
+class PreviewPageTestCase extends SeleniumTestCase {\r
+\r
+ // Verify adding a new page\r
+ public function testPreviewPage() {\r
+ $wikiText = "Adding this page to test the \n Preview button functionality";\r
+ $newPage = "Test Preview Page";\r
+ $this->open( $this->getUrl() .\r
+ '/index.php?title=Main_Page&action=edit' );\r
+ $this->getNewPage( $newPage );\r
+ $this->type( "wpTextbox1", $wikiText."" );\r
+ $this->assertTrue($this->isElementPresent( "//*[@id='wpPreview']" ));\r
+\r
+ $this->click( "wpPreview" );\r
+\r
+ // Verify saved page available\r
+ $source = $this->gettext( "firstHeading" );\r
+ $correct = strstr( $source, "Test Preview Page" );\r
+ $this->assertEquals( $correct, true);\r
+\r
+ // Verify page content previewed succesfully\r
+ $contentOfPreviewPage = $this->getText( "//*[@id='content']" );\r
+ $this->assertContains( $wikiText, $contentOfPreviewPage );\r
+ }\r
+}\r
--- /dev/null
+<?php\r
+\r
+/**\r
+ * Selenium server manager\r
+ *\r
+ * @file\r
+ * @ingroup Maintenance\r
+ * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>\r
+ * http://citizendium.org/\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License along\r
+ * with this program; if not, write to the Free Software Foundation, Inc.,\r
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\r
+ * http://www.gnu.org/copyleft/gpl.html\r
+ *\r
+ * @addtogroup Maintenance\r
+ *\r
+ */\r
+\r
+class SavePageTestCase extends SeleniumTestCase {\r
+\r
+ // Verify adding a new page\r
+ public function testSavePage() {\r
+ $wikiText = "Adding this page to test the Save button functionality";\r
+ $newPage = "Test Save Page";\r
+\r
+ $this->open( $this->getUrl() .\r
+ '/index.php?title=Main_Page&action=edit' );\r
+ $this->getNewPage($newPage);\r
+ $this->type("wpTextbox1", $wikiText);\r
+\r
+ // verify 'Save' button available\r
+ $this->assertTrue($this->isElementPresent( "wpSave" ));\r
+ $this->click( "wpSave" );\r
+\r
+ // Verify saved page available\r
+ $source = $this->gettext( "firstHeading" );\r
+ $correct = strstr( $source, "Test Save Page" );\r
+\r
+ // Verify Saved page name displayed correctly\r
+ $this->assertEquals( $correct, true );\r
+\r
+ // Verify page content saved succesfully\r
+ $contentOfSavedPage = $this->getText( "//*[@id='content']" );\r
+ $this->assertContains( $wikiText, $contentOfSavedPage );\r
+ $this->deletePage( $newPage );\r
+ }\r
+}\r
--- /dev/null
+<?php
+
+/**
+ * Selenium server manager
+ *
+ * @file
+ * @ingroup Maintenance
+ * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>
+ * http://citizendium.org/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @addtogroup Maintenance
+ *
+ */
+
+class UserPreferencesTestCase extends SeleniumTestCase {
+
+ // Verify user information
+ public function testUserInfoDisplay() {
+
+ $this->open( $this->getUrl() .
+ '/index.php?title=Main_Page&action=edit' );
+ $this->click( "link=My preferences" );
+ $this->waitForPageToLoad( "30000" );
+
+ // Verify correct username displayed in User Preferences
+ $this->assertEquals( $this->getText( "//li[@id='pt-userpage']/a" ),
+ $this->getText( "//table[@id='mw-htmlform-info']/tbody/tr[1]/td[2]" ));
+
+ // Verify existing Signature Displayed correctly
+ $this->assertEquals( $this->selenium->getUser(),
+ $this->getTable( "mw-htmlform-signature.0.1" ) );
+ }
+
+ // Verify change password
+ public function testChangePassword() {
+
+ $this->open( $this->getUrl() .
+ '/index.php?title=Main_Page&action=edit' );
+ $this->click( "link=My preferences" );
+ $this->waitForPageToLoad( "30000" );
+
+ $this->click( "link=Change password" );
+ $this->waitForPageToLoad( "30000" );
+
+ $this->type( "wpPassword", "12345" );
+ $this->type( "wpNewPassword", "54321" );
+ $this->type( "wpRetype", "54321" );
+ $this->click( "//input[@value='Change password']" );
+ $this->waitForPageToLoad( "30000" );
+
+ $this->assertEquals( "Preferences", $this->getText( "firstHeading" ));
+
+ $this->click( "link=Change password" );
+ $this->waitForPageToLoad( "30000" );
+
+ $this->type( "wpPassword", "54321" );
+ $this->type( "wpNewPassword", "12345" );
+ $this->type( "wpRetype", "12345" );
+ $this->click( "//input[@value='Change password']" );
+ $this->waitForPageToLoad( "30000" );
+ $this->assertEquals( "Preferences", $this->getText( "firstHeading" ));
+
+ $this->click( "link=Change password" );
+ $this->waitForPageToLoad( "30000" );
+
+ $this->type( "wpPassword", "54321" );
+ $this->type( "wpNewPassword", "12345" );
+ $this->type( "wpRetype", "12345" );
+ $this->click( "//input[@value='Change password']" );
+ $this->waitForPageToLoad( "30000" );
+ }
+
+ // Verify successful preferences save
+ public function testSuccessfullSave() {
+
+ $this->open( $this->getUrl() .
+ '/index.php?title=Main_Page&action=edit' );
+ $this->click( "link=My preferences" );
+ $this->waitForPageToLoad( "30000" );
+
+ $this->type( "mw-input-realname", "Test User" );
+ $this->click( "prefcontrol" );
+ $this->waitForPageToLoad( "30000" );
+
+ // Verify "Your preferences have been saved." message
+ $this->assertEquals( "Your preferences have been saved.",
+ $this->getText( "//div[@id='bodyContent']/div[4]/strong/p" ));
+ $this->type( "mw-input-realname", "" );
+ $this->click( "prefcontrol" );
+ $this->waitForPageToLoad( "30000" );
+
+ }
+
+ // Verify change signature
+ public function testChangeSignature() {
+
+ $this->open( $this->getUrl() .
+ '/index.php?title=Main_Page&action=edit' );
+ $this->click( "link=My preferences" );
+ $this->waitForPageToLoad( "30000" );
+
+ $this->type( "mw-input-nickname", "TestSignature" );
+ $this->click( "prefcontrol" );
+ $this->waitForPageToLoad( "30000" );
+
+ // Verify change user signature
+ $this->assertEquals( "TestSignature", $this->getText( "link=TestSignature" ));
+ $this->type( "mw-input-nickname", "Test" );
+ $this->click( "prefcontrol" );
+ $this->waitForPageToLoad("30000");
+ }
+
+ // Verify change date format
+ public function testChangeDateFormatTimeZone() {
+
+ $this->open( $this->getUrl() .
+ '/index.php?title=Main_Page&action=edit' );
+
+ $this->click( "link=My preferences" );
+ $this->waitForPageToLoad( "30000" );
+ $this->click( "link=Date and time" );
+ $this->waitForPageToLoad( "30000" );
+
+ $this->click( "mw-input-date-dmy" );
+ $this->select( "mw-input-timecorrection", "label=Asia/Colombo" );
+ $this->click( "prefcontrol" );
+ $this->waitForPageToLoad( "30000" );
+
+ // Verify Date format and time zome saved
+ $this->assertEquals( "Your preferences have been saved.",
+ $this->getText( "//div[@id='bodyContent']/div[4]/strong/p" ));
+ }
+
+ // Verify restoring all default settings
+ public function testSetAllDefault() {
+
+ $this->open( $this->getUrl() .
+ '/index.php?title=Main_Page&action=edit' );
+ $this->click( "link=My preferences" );
+ $this->waitForPageToLoad( "30000" );
+
+ // Verify restoring all default settings
+ $this->assertEquals( "Restore all default settings",
+ $this->getText( "link=Restore all default settings" ));
+
+ $this->click("//*[@id='preferences']/div/a");
+ $this->waitForPageToLoad("30000");
+
+ // Verify 'This can not be undone' warning message displayed
+ $this->assertTrue($this->isElementPresent("//input[@value='Restore all default settings']"));
+
+ // Verify 'Restore all default settings' button available
+ $this->assertEquals("You can use this page to reset your preferences to the site defaults. This cannot be undone.",
+ $this->getText("//div[@id='bodyContent']/p"));
+
+ $this->click("//input[@value='Restore all default settings']");
+ $this->waitForPageToLoad("30000");
+
+ // Verify preferences saved successfully
+ $this->assertEquals("Your preferences have been saved.",
+ $this->getText("//div[@id='bodyContent']/div[4]/strong/p"));
+ }
+}
+?>