Merge "Minor CSS cleanup for Vector and Monobook skins"
[mediawiki.git] / tests / selenium / installer / MediaWikiInstallationCommonFunction.php
bloba9a8fc3821068f24218b169e56df1b3a703f16b6
1 <?php
2 /**
3 * MediaWikiInstallationCommonFunction
5 * @file
6 * @ingroup Maintenance
7 * Copyright (C) 2010 Nadeesha Weerasinghe <nadeesha@calcey.com>
8 * http://www.calcey.com/
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 * http://www.gnu.org/copyleft/gpl.html
26 require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
27 require_once ( __DIR__ . '/MediaWikiInstallationConfig.php' );
28 require_once ( __DIR__ . '/MediaWikiInstallationMessage.php' );
29 require_once ( __DIR__ . '/MediaWikiInstallationVariables.php' );
31 class MediaWikiInstallationCommonFunction extends PHPUnit_Extensions_SeleniumTestCase {
32 function setUp() {
33 $this->setBrowser( TEST_BROWSER );
34 $this->setBrowserUrl( "http://" . HOST_NAME . ":" . PORT . "/" . DIRECTORY_NAME . "/" );
37 public function navigateInitialpage() {
38 $this->open( "http://" . HOST_NAME . ":" . PORT . "/" . DIRECTORY_NAME . "/" );
41 // Navigate to the 'Language' page
42 public function navigateLanguagePage() {
43 $this->open( "http://" . HOST_NAME . ":" . PORT . "/" . DIRECTORY_NAME . "/config/index.php" );
46 // Navigate to the 'Welcome to MediaWiki' page
47 public function navigateWelcometoMediaWikiPage() {
48 $this->open( "http://" . HOST_NAME . ":" . PORT . "/" . DIRECTORY_NAME . "/config/index.php" );
49 $this->click( "submit-continue " );
50 $this->waitForPageToLoad( PAGE_LOAD_TIME );
53 // Navigate yo 'Connect to Database' page
54 public function navigateConnetToDatabasePage() {
55 $this->open( "http://" . HOST_NAME . ":" . PORT . "/" . DIRECTORY_NAME . "/config/index.php" );
57 // 'Welcome to MediaWiki!' page
58 $this->click( "submit-continue" );
59 $this->waitForPageToLoad( PAGE_LOAD_TIME );
61 // 'Connect to Database' page
62 $this->click( "submit-continue" );
63 $this->waitForPageToLoad( PAGE_LOAD_TIME );
66 // Navigate to the 'Database Settings' page
67 public function navigateDatabaseSettingsPage( $databaseName ) {
68 $this->open( "http://" . HOST_NAME . ":" . PORT . "/" . DIRECTORY_NAME . "/config/index.php" );
70 // 'Welcome to MediaWiki!' page
71 $this->click( "submit-continue" );
72 $this->waitForPageToLoad( PAGE_LOAD_TIME );
74 // 'Connect to Database' page
75 $this->click( "submit-continue" );
76 $this->waitForPageToLoad( PAGE_LOAD_TIME );
78 $this->type( "mysql_wgDBname", $databaseName );
79 $this->click( "submit-continue" );
80 $this->waitForPageToLoad( PAGE_LOAD_TIME );
83 // Navigate to the 'Name' page
84 public function navigateNamePage( $databaseName ) {
85 $this->open( "http://" . HOST_NAME . ":" . PORT . "/" . DIRECTORY_NAME . "/config/index.php" );
87 // 'Welcome to MediaWiki!' page
88 $this->click( "submit-continue" );
89 $this->waitForPageToLoad( PAGE_LOAD_TIME );
91 // 'Connect to Database' page
92 $this->click( "submit-continue" );
93 $this->waitForPageToLoad( PAGE_LOAD_TIME );
95 $this->type( "mysql_wgDBname", $databaseName );
96 $this->click( "submit-continue" );
97 $this->waitForPageToLoad( PAGE_LOAD_TIME );
99 // Database settings
100 $this->click( "submit-continue" );
101 $this->waitForPageToLoad( PAGE_LOAD_TIME );
104 // Navigate 'Options' page
105 public function navigateOptionsPage( $databaseName ) {
106 $this->open( "http://" . HOST_NAME . ":" . PORT . "/" . DIRECTORY_NAME . "/config/index.php" );
108 // 'Welcome to MediaWiki!' page
109 $this->click( "submit-continue" );
110 $this->waitForPageToLoad( PAGE_LOAD_TIME );
112 // 'Connect to Database' page
113 $this->click( "submit-continue" );
114 $this->waitForPageToLoad( PAGE_LOAD_TIME );
116 $this->type( "mysql_wgDBname", $databaseName );
117 $this->click( "submit-continue" );
118 $this->waitForPageToLoad( PAGE_LOAD_TIME );
120 // Database settings
121 $this->click( "submit-continue" );
122 $this->waitForPageToLoad( PAGE_LOAD_TIME );
124 // Name
125 $this->type( "config_wgSitename", NAME_OF_WIKI );
126 $this->type( "config__AdminName", ADMIN_USER_NAME );
127 $this->type( "config__AdminPassword", ADMIN_PASSWORD );
128 $this->type( "config__AdminPassword2", ADMIN_RETYPE_PASSWORD );
129 $this->type( "config__AdminEmail", ADMIN_EMAIL_ADDRESS );
131 $this->click( "submit-continue" );
132 $this->waitForPageToLoad( PAGE_LOAD_TIME );
135 // Navigate 'Install' page
136 public function navigateInstallPage( $databaseName ) {
137 $this->open( "http://" . HOST_NAME . ":" . PORT . "/" . DIRECTORY_NAME . "/config/index.php" );
139 // 'Welcome to MediaWiki!' page
140 $this->click( "submit-continue" );
141 $this->waitForPageToLoad( PAGE_LOAD_TIME );
143 // 'Connect to Database' page
144 $this->click( "submit-continue" );
145 $this->waitForPageToLoad( PAGE_LOAD_TIME );
147 $this->type( "mysql_wgDBname", $databaseName );
148 $this->click( "submit-continue" );
149 $this->waitForPageToLoad( PAGE_LOAD_TIME );
151 // Database settings
152 $this->click( "submit-continue" );
153 $this->waitForPageToLoad( PAGE_LOAD_TIME );
155 // Name
156 $this->type( "config_wgSitename", NAME_OF_WIKI );
157 $this->type( "config__AdminName", ADMIN_USER_NAME );
158 $this->type( "config__AdminPassword", ADMIN_PASSWORD );
159 $this->type( "config__AdminPassword2", ADMIN_RETYPE_PASSWORD );
160 $this->type( "config__AdminEmail", ADMIN_EMAIL_ADDRESS );
162 $this->click( "submit-continue" );
163 $this->waitForPageToLoad( PAGE_LOAD_TIME );
165 // Options page
166 $this->click( "submit-continue" );
167 $this->waitForPageToLoad( PAGE_LOAD_TIME );
170 // Navigate to 'Complete' page
171 public function navigateCompletePage( $databaseName ) {
172 $this->open( "http://" . HOST_NAME . ":" . PORT . "/" . DIRECTORY_NAME . "/config/index.php" );
174 // 'Welcome to MediaWiki!' page
175 $this->click( "submit-continue" );
176 $this->waitForPageToLoad( PAGE_LOAD_TIME );
178 // 'Connect to Database' page
179 $this->click( "submit-continue" );
180 $this->waitForPageToLoad( PAGE_LOAD_TIME );
182 $this->type( "mysql_wgDBname", $databaseName );
183 $this->click( "submit-continue" );
184 $this->waitForPageToLoad( PAGE_LOAD_TIME );
186 // Database settings
187 $this->click( "submit-continue" );
188 $this->waitForPageToLoad( PAGE_LOAD_TIME );
190 // Name
191 $this->type( "config_wgSitename", NAME_OF_WIKI );
192 $this->type( "config__AdminName", ADMIN_USER_NAME );
193 $this->type( "config__AdminPassword", ADMIN_PASSWORD );
194 $this->type( "config__AdminPassword2", ADMIN_RETYPE_PASSWORD );
195 $this->type( "config__AdminEmail", ADMIN_EMAIL_ADDRESS );
197 $this->click( "submit-continue" );
198 $this->waitForPageToLoad( PAGE_LOAD_TIME );
200 // Options page
201 $this->click( "submit-continue" );
202 $this->waitForPageToLoad( PAGE_LOAD_TIME );
204 // Install page
205 $this->click( "submit-continue" );
206 $this->waitForPageToLoad( PAGE_LOAD_TIME );
207 $this->chooseCancelOnNextConfirmation();
210 // Complete the Name page fields
211 public function completeNamePage() {
212 $this->type( "config_wgSitename", NAME_OF_WIKI );
213 $this->type( "config__AdminName", ADMIN_USER_NAME );
214 $this->type( "config__AdminPassword", ADMIN_PASSWORD );
215 $this->type( "config__AdminPassword2", ADMIN_RETYPE_PASSWORD );
216 $this->type( "config__AdminEmail", ADMIN_EMAIL_ADDRESS );
217 $this->click( "submit-continue" );
218 $this->waitForPageToLoad( PAGE_LOAD_TIME );
221 // Clicking on the 'Continue' button in any MediaWiki page
222 public function clickContinueButton() {
223 $this->click( "submit-continue" );
224 $this->waitForPageToLoad( PAGE_LOAD_TIME );
227 // Clicking on the 'Back' button in any MediaWiki page
228 public function clickBackButton() {
229 $this->click( "submit-back" );
230 $this->waitForPageToLoad( PAGE_LOAD_TIME );
233 // Restarting the installation
234 public function restartInstallation() {
235 $this->click( "link=Restart installation" );
236 $this->waitForPageToLoad( PAGE_LOAD_TIME );
237 $this->click( "submit-restart" );
238 $this->waitForPageToLoad( PAGE_LOAD_TIME );
241 // Verify 'MediaWiki' logo available in the initial screen
242 public function mediaWikiLogoPresentInitialScreen() {
243 $this->assertTrue( $this->isElementPresent( "//img[@alt='The MediaWiki logo']" ) );
246 // Verify 'MediaWiki' logo available
247 public function mediaWikiLogoPresent() {
248 $this->assertTrue( $this->isElementPresent( "//div[@id='p-logo']/a" ) );
251 public function completePageSuccessfull() {
252 $this->assertEquals( "Complete!",
253 $this->getText( "//div[@id='bodyContent']/div/div/h2" ) );
255 // 'Congratulations!' text should be available in the 'Complete!' page.
256 $this->assertEquals( "Congratulations!",
257 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/div[1]/div[2]/p[1]/b" ) );