4
* Selenium server manager
8
* Copyright (C) 2010 Nadeesha Weerasinghe <nadeesha@calcey.com>
9
* http://www.calcey.com/
11
* This program is free software; you can redistribute it and/or modify
12
* it under the terms of the GNU General Public License as published by
13
* the Free Software Foundation; either version 2 of the License, or
14
* (at your option) any later version.
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU General Public License for more details.
21
* You should have received a copy of the GNU General Public License along
22
* with this program; if not, write to the Free Software Foundation, Inc.,
23
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
* http://www.gnu.org/copyleft/gpl.html
30
class EmailPasswordTestCase extends SeleniumTestCase {
32
// change user name for each and every test (with in 24 hours)
33
private $userName = "test1";
35
public function testEmailPasswordButton() {
37
$this->click( SeleniumTestConstants::LINK_START."Log out" );
38
$this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
40
$this->open( $this->getUrl().'/index.php?title=Main_Page' );
42
// click Log in / create account link to open Log in / create account' page
43
$this->click( SeleniumTestConstants::LINK_START."Log in / create account" );
44
$this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
45
$this->assertTrue($this->isElementPresent( "wpMailmypassword" ));
48
// Verify Email password functionality
49
public function testEmailPasswordMessages() {
51
$this->click( SeleniumTestConstants::LINK_START."Log out" );
52
$this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
54
$this->open( $this->getUrl().'/index.php?title=Main_Page' );
56
// click Log in / create account link to open Log in / create account' page
57
$this->click( SeleniumTestConstants::LINK_START."Log in / create account" );
58
$this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
60
$this->type( "wpName1", "" );
61
$this->click( "wpMailmypassword" );
62
$this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
63
$this->assertEquals( "Login error\n You have not specified a valid user name.",
64
$this->getText("//div[@id='bodyContent']/div[4]"));
66
$this->type( "wpName1", $this->userName );
67
$this->click( "wpMailmypassword" );
68
$this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
70
// Can not run on localhost
71
$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.",
72
$this->getText("//div[@id='bodyContent']/div[4]" ));
74
$this->type( "wpName1", $this->userName );
75
$this->click( "wpMailmypassword" );
76
$this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
77
$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.",
78
$this->getText( "//div[@id='bodyContent']/div[4]" ));