[JobQueue] Added missing delete query.
[mediawiki.git] / tests / selenium / suites / CreateAccountTestCase.php
blob5708bcff68c1aaddd4566c1db762aa33fcde81f0
1 <?php
3 /**
4 * Selenium server manager
6 * @file
7 * @ingroup Testing
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
26 * @addtogroup Testing
30 Class CreateAccountTestCase extends SeleniumTestCase {
32 // Change these values before run the test
33 private $userName = "yourname4000";
34 private $password = "yourpass4000";
36 // Verify 'Log in/create account' link existance in Main page.
37 public function testMainPageLink() {
39 $this->click( "link=Log out" );
40 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
42 $this->open( $this->getUrl().'/index.php?title=Main_Page' );
43 $this->assertTrue($this->isElementPresent( "link=Log in / create account" ));
46 // Verify 'Create an account' link existance in 'Log in / create account' Page.
47 public function testCreateAccountPageLink() {
49 $this->click( "link=Log out" );
50 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
52 $this->open( $this->getUrl().'/index.php?title=Main_Page' );
54 // click Log in / create account link to open Log in / create account' page
55 $this->click( "link=Log in / create account" );
56 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
57 $this->assertTrue($this->isElementPresent( "link=Create an account" ));
60 // Verify Create account
61 public function testCreateAccount() {
63 $this->click( "link=Log out" );
64 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
66 $this->open( $this->getUrl().'/index.php?title=Main_Page' );
68 $this->click( "link=Log in / create account" );
69 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
71 $this->click( "link=Create an account" );
72 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
74 // Verify for blank user name
75 $this->type( "wpName2", "" );
76 $this->click( "wpCreateaccount" );
77 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
78 $this->assertEquals( "Login error\n You have not specified a valid user name.",
79 $this->getText( "//div[@id='bodyContent']/div[4]" ));
81 // Verify for invalid user name
82 $this->type( "wpName2", "@" );
83 $this->click("wpCreateaccount" );
84 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
85 $this->assertEquals( "Login error\n You have not specified a valid user name.",
86 $this->getText( "//div[@id='bodyContent']/div[4]" ));
88 // start of test for blank password
89 $this->type( "wpName2", $this->userName);
90 $this->type( "wpPassword2", "" );
91 $this->click( "wpCreateaccount" );
92 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
93 $this->assertEquals( "Login error\n Passwords must be at least 1 character.",
94 $this->getText("//div[@id='bodyContent']/div[4]" ));
96 $this->type( "wpName2", $this->userName );
97 $this->type( "wpPassword2", $this->password );
98 $this->click( "wpCreateaccount" );
99 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
100 $this->assertEquals( "Login error\n The passwords you entered do not match.",
101 $this->getText( "//div[@id='bodyContent']/div[4]" ));
103 $this->type( "wpName2", $this->userName );
104 $this->type( "wpPassword2", $this->password );
105 $this->type( "wpRetype", $this->password );
106 $this->click( "wpCreateaccount" );
107 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
109 // Verify successful account creation for valid combination of 'Username', 'Password', 'Retype password'
110 $this->assertEquals( "Welcome, ".ucfirst( $this->userName )."!",
111 $this->getText( "Welcome,_".ucfirst( $this->userName )."!" ));