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