summaryrefslogtreecommitdiff
path: root/tests/selenium/installer/MediaWikiHelpFieldHintTestCase.php
blob: f0efce6e5a7dc0f9b7c1a448c98371299a93d39a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<?php
/**
 * MediaWikiHelpFieldHintTestCase
 *
 * @file
 * @ingroup Maintenance
 * Copyright (C) 2010 Nadeesha Weerasinghe <nadeesha@calcey.com>
 * http://www.calcey.com/
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 * http://www.gnu.org/copyleft/gpl.html
 */

require_once ( __DIR__ . '/MediaWikiInstallationCommonFunction.php' );

/**
 * Test Case ID   : 29 (http://www.mediawiki.org/wiki/New_installer/Test_plan)
 * Test Case Name : Help field hint availability for the fields.
 * Version        : MediaWiki 1.18alpha
 */
class MediaWikiHelpFieldHintTestCase extends MediaWikiInstallationCommonFunction {
	function setUp() {
		parent::setUp();
	}

	// Verify help field availability for the fields
	public function testMySQLConnectToDatabaseFieldHint() {

		parent::navigateConnetToDatabasePage();

		// Verify help field for 'Database host'
		$this->click( "//div[@id='DB_wrapper_mysql']/div/div[1]/div/span[1]" );
		$this->assertEquals( MYSQL_DATABASE_HOST_HELP,
			$this->getText( "//div[@id='DB_wrapper_mysql']/div/div[1]/div/span[2]" ) );

		// Verify help field for 'Database name'
		$this->click( "//div[@id='DB_wrapper_mysql']/fieldset[1]/div[1]/div[1]/div/span[1]" );
		$this->assertEquals( MYSQL_DATABASE_NAME_HELP,
			$this->getText( "//div[@id='DB_wrapper_mysql']/fieldset[1]/div[1]/div[1]/div/span[2]" ) );


		// Verify help field for 'Database table prefix'
		$this->click( "//div[@id='DB_wrapper_mysql']/fieldset[1]/div[2]/div[1]/div/span[1]" );
		$this->assertEquals( MYSQL_DATABASE_TABLE_PREFIX_HELP,
			$this->getText( "//div[@id='DB_wrapper_mysql']/fieldset[1]/div[1]/div[1]/div/span[2]/p[1]" ) );

		// Verify help field for 'Database username'
		$this->click( "//div[@id='DB_wrapper_mysql']/fieldset[2]/div[1]/div[1]/div/span[1]" );
		$this->assertEquals( MYSQL_DATBASE_USERNAME_HELP,
			$this->getText( "//div[@id='DB_wrapper_mysql']/fieldset[2]/div[1]/div[1]/div/span[2]" ) );

		// Verify help field for 'Database password'
		$this->click( "//div[@id='DB_wrapper_mysql']/fieldset[2]/div[2]/div[1]/div/span[1]" );
		$this->assertEquals( MYSQL_DATABASE_PASSWORD_HELP,
			$this->getText( "//div[@id='DB_wrapper_mysql']/fieldset[2]/div[2]/div[1]/div/span[2]/p" ) );
	}

	public function testSQLiteConnectToDatabaseFieldHint() {
		parent::navigateConnetToDatabasePage();
		$this->click( "DBType_sqlite" );

		//  Verify help field for 'SQLite data directory'
		$this->click( "//div[@id='DB_wrapper_sqlite']/div[1]/div[1]/div/span[1]" );
		$this->assertEquals( SQLITE_DATA_DIRECTORY_HELP,
			$this->getText( "//div[@id='DB_wrapper_sqlite']/div[1]/div[1]/div/span[2]" ) );

		// Verify help field for 'Database name'
		$this->click( "//div[@id='DB_wrapper_sqlite']/div[2]/div[1]/div/span[1]" );
		$this->assertEquals( SQLITE_DATABASE_NAME_HELP, $this->getText( "//div[@id='DB_wrapper_sqlite']/div[2]/div[1]/div/span[2]/p" ) );
	}

	public function testDatabaseSettingsFieldHint() {

		$databaseName = DB_NAME_PREFIX . "_db_field";
		parent::navigateDatabaseSettingsPage( $databaseName );

		// Verify help field for 'Search engine'
		$this->click( LINK_FORM . "div[2]/span[1]" );
		$this->assertEquals( SEARCH_ENGINE_HELP,
			$this->getText( LINK_FORM . "div[2]/span[2]" ) );

		// Verify help field for 'Database character set'
		$this->click( LINK_FORM . "div[4]/span[1]" );
		$this->assertEquals( DATABASE_CHARACTER_SET_HELP,
			$this->getText( LINK_FORM . "div[4]/span[2]" ) );
		parent::restartInstallation();
	}

	public function testNameFieldHint() {
		$databaseName = DB_NAME_PREFIX . "_name_field";
		parent::navigateNamePage( $databaseName );

		// Verify help field for 'Name of Wiki'
		$this->click( LINK_FORM . "div[1]/div[1]/div/span[1]" );
		$this->assertEquals( NAME_OF_WIKI_HELP,
			$this->getText( LINK_FORM . "div[1]/div[1]/div/span[2]/p" ) );

		// Verify help field for 'Project namespace'
		$this->click( LINK_FORM . "div[2]/div[1]/div/span[1]" );
		$this->assertEquals( PROJECT_NAMESPACE_HELP,
			$this->getText( LINK_FORM . "div[2]/div[1]/div/span[2]/p" ) );

		// Verify help field for 'Your Name'
		$this->click( LINK_FORM . "fieldset/div[1]/div[1]/div/span[1]" );
		$this->assertEquals( USER_NAME_HELP,
			$this->getText( LINK_FORM . "fieldset/div[1]/div[1]/div/span[2]/p" ) );

		// Verify help field for 'E mail address'
		$this->click( LINK_FORM . "fieldset/div[4]/div[1]/div/span[1]" );
		$this->assertEquals( EMAIL_ADDRESS_HELP,
			$this->getText( LINK_FORM . "fieldset/div[4]/div[1]/div/span[2]/p" ) );

		parent::restartInstallation();
	}
}