MediaWiki  REL1_19
EmailPasswordTestCase.php
Go to the documentation of this file.
00001 <?php
00002 
00030 class EmailPasswordTestCase extends SeleniumTestCase {
00031 
00032     // change user name for each and every test (with in 24 hours)
00033     private $userName = "test1";
00034 
00035     public function testEmailPasswordButton() {
00036 
00037         $this->click( SeleniumTestConstants::LINK_START."Log out" );
00038         $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
00039 
00040         $this->open( $this->getUrl().'/index.php?title=Main_Page' );
00041 
00042         // click Log in / create account link to open Log in / create account' page
00043         $this->click( SeleniumTestConstants::LINK_START."Log in / create account" );
00044         $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
00045         $this->assertTrue($this->isElementPresent( "wpMailmypassword" ));
00046     }
00047 
00048     // Verify Email password functionality
00049     public function testEmailPasswordMessages() {
00050 
00051         $this->click( SeleniumTestConstants::LINK_START."Log out" );
00052         $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
00053 
00054         $this->open( $this->getUrl().'/index.php?title=Main_Page' );
00055 
00056         // click Log in / create account link to open Log in / create account' page
00057         $this->click( SeleniumTestConstants::LINK_START."Log in / create account" );
00058         $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
00059 
00060         $this->type( "wpName1", "" );
00061         $this->click( "wpMailmypassword" );
00062         $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
00063         $this->assertEquals( "Login error\n You have not specified a valid user name.",
00064                 $this->getText("//div[@id='bodyContent']/div[4]"));
00065 
00066         $this->type( "wpName1", $this->userName );
00067         $this->click( "wpMailmypassword" );
00068         $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
00069 
00070         //  Can not run on localhost
00071         $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.",
00072                 $this->getText("//div[@id='bodyContent']/div[4]" ));
00073 
00074         $this->type( "wpName1", $this->userName );
00075         $this->click( "wpMailmypassword" );
00076         $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
00077         $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.",
00078                 $this->getText( "//div[@id='bodyContent']/div[4]" ));
00079     }
00080 }
00081