Merge "phpcs: Normalize methods declarations to "[final abstract] [visibility]"."
[lhc/web/wiklou.git] / tests / selenium / suites / EmailPasswordTestCase.php
1 <?php
2
3 /**
4 * Selenium server manager
5 *
6 * @file
7 * @ingroup Testing
8 * Copyright (C) 2010 Nadeesha Weerasinghe <nadeesha@calcey.com>
9 * http://www.calcey.com/
10 *
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.
15 *
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.
20 *
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
25 *
26 * @addtogroup Testing
27 *
28 */
29
30 class EmailPasswordTestCase extends SeleniumTestCase {
31 // change user name for each and every test (with in 24 hours)
32 private $userName = "test1";
33
34 public function testEmailPasswordButton() {
35 $this->click( SeleniumTestConstants::LINK_START . "Log out" );
36 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
37
38 $this->open( $this->getUrl() . '/index.php?title=Main_Page' );
39
40 // click Log in / create account link to open Log in / create account' page
41 $this->click( SeleniumTestConstants::LINK_START . "Log in / create account" );
42 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
43 $this->assertTrue( $this->isElementPresent( "wpMailmypassword" ) );
44 }
45
46 // Verify Email password functionality
47 public function testEmailPasswordMessages() {
48 $this->click( SeleniumTestConstants::LINK_START . "Log out" );
49 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
50
51 $this->open( $this->getUrl() . '/index.php?title=Main_Page' );
52
53 // click Log in / create account link to open Log in / create account' page
54 $this->click( SeleniumTestConstants::LINK_START . "Log in / create account" );
55 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
56
57 $this->type( "wpName1", "" );
58 $this->click( "wpMailmypassword" );
59 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
60 $this->assertEquals( "Login error\n You have not specified a valid user name.",
61 $this->getText( "//div[@id='bodyContent']/div[4]" ) );
62
63 $this->type( "wpName1", $this->userName );
64 $this->click( "wpMailmypassword" );
65 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
66
67 // Can not run on localhost
68 $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.",
69 $this->getText( "//div[@id='bodyContent']/div[4]" ) );
70
71 $this->type( "wpName1", $this->userName );
72 $this->click( "wpMailmypassword" );
73 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
74 $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.",
75 $this->getText( "//div[@id='bodyContent']/div[4]" ) );
76 }
77 }
78