4 * MediaWikiUserInterfaceTestCase
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 Maintenance
30 require_once ( __DIR__
. '/' . 'MediaWikiInstallationCommonFunction.php' );
33 * Test Case ID : 18 - 27 (http://www.mediawiki.org/wiki/New_installer/Test_plan)
34 * Test Case Name : UI of MediaWiki initial/ Language/ Welcome to MediaWiki!/ Connect to database/
35 * Database settings/ Name/ Options/ Install/ Complete/ Restart Inslation pages
36 * Version : MediaWiki 1.18alpha
40 class MediaWikiUserInterfaceTestCase
extends MediaWikiInstallationCommonFunction
{
45 public function testInitialPageUI() {
47 parent
::navigateInitialpage();
49 // MediaWiki logo available
50 $this->assertTrue( $this->isElementPresent( "//img[@alt='The MediaWiki logo']" ) );
52 // 'MediaWiki 1.18alpha' text available
53 $this->assertEquals( "MediaWiki 1.18alpha", $this->getText( "//h1" ) );
55 // 'LocalSettings.php not found.' text available
56 $this->assertEquals( "LocalSettings.php not found.", $this->getText( "//p[1]" ) );
58 // 'Please set up the wiki first' text available
59 $this->assertEquals( "Please set up the wiki first.", $this->getText( "//p[2]" ) );
61 // 'set up the wiki' link available
62 $this->assertTrue( $this->isElementPresent( "link=set up the wiki" ) );
65 public function testlanguagePageUI() {
66 parent
::navigateLanguagePage();
68 // Verify 'Language' heading
69 $this->assertEquals( "Language", $this->getText( LINK_DIV
. "h2" ) );
71 // 'Your language' label available
72 $this->assertEquals( "Your language:",
73 $this->getText( LINK_FORM
. "div[1]/div[1]/label" ) );
75 // 'Your language' dropdown available
76 $this->assertTrue( $this->isElementPresent( "UserLang" ) );
78 // 'Wiki language' label available
79 $this->assertEquals( "Wiki language:",
80 $this->getText( LINK_FORM
. "div[2]/div[1]/label" ) );
82 // 'Wiki language' dropdown available
83 $this->assertTrue( $this->isElementPresent( "ContLang" ) );
86 public function testWelcometoMediaWikiUI() {
87 parent
::navigateWelcometoMediaWikiPage();
89 // Verify 'Welcome to MediaWiki!' heading
90 $this->assertEquals( "Welcome to MediaWiki!",
91 $this->getText( LINK_DIV
. "h2" ) );
93 // Verify environment ok text displayed.
94 $this->assertEquals( "The environment has been checked.You can install MediaWiki.",
95 $this->getText( LINK_DIV
. "div[6]/span" ) );
98 public function testConnectToDatabaseUI() {
99 parent
::navigateConnetToDatabasePage();
101 // 'MYSQL radio button available
102 $this->assertEquals( "MySQL",
103 $this->getText( LINK_FORM
. "div[2]/div[2]/ul/li[1]/label" ) );
104 $this->assertTrue( $this->isElementPresent( LINK_FORM
. "div[2]/div[2]/ul/li[1]" ) );
106 // 'SQLite' radio button available
107 $this->assertTrue( $this->isElementPresent( LINK_FORM
. "div[2]/div[2]/ul/li[2]" ) );
108 $this->assertEquals( "SQLite", $this->getText( LINK_FORM
. "div[2]/div[2]/ul/li[2]/label " ) );
110 // 'Database host' label available
111 $this->assertEquals( "Database host:", $this->getText( "//div[@id='DB_wrapper_mysql']/div/div[1]/label" ) );
113 // 'Database host' text box default to 'localhost'
114 $this->assertEquals( "localhost", $this->getValue( "mysql_wgDBserver" ) );
116 // 'Identify this wiki' section available
117 $this->assertTrue( $this->isElementPresent( "//div[@id='DB_wrapper_mysql']/fieldset[1]/legend" ) );
119 // 'Identify this wiki' label available
120 $this->assertEquals( "Identify this wiki", $this->getText( "//div[@id='DB_wrapper_mysql']/fieldset[1]/legend" ) );
122 // 'Database name' lable available
123 $this->assertEquals( "Database name:",
124 $this->getText( "//div[@id='DB_wrapper_mysql']/fieldset[1]/div[1]/div[1]/label" ) );
126 // Verify 'Database name:' text box is default to 'my_wiki'
127 $this->assertEquals( "my_wiki", $this->getValue( "mysql_wgDBname" ) );
129 // Verify 'Database table prefix:' label available
130 $this->assertEquals( "Database table prefix:",
131 $this->getText( "//div[@id='DB_wrapper_mysql']/fieldset[1]/div[2]/div[1]/label" ) );
133 // 'User account for installation' section available
134 $this->assertTrue( $this->isElementPresent( "//div[@id='DB_wrapper_mysql']/fieldset[2]/legend" ) );
136 // 'User account for installation' label available
137 $this->assertEquals( "User account for installation", $this->getText( "//div[@id='DB_wrapper_mysql']/fieldset[2]/legend" ) );
139 // 'Database username' label available
140 $this->assertEquals( "Database username:",
141 $this->getText( "//div[@id='DB_wrapper_mysql']/fieldset[2]/div[1]/div[1]/label" ) );
143 // 'Database username' text box defaults to 'root'
144 $this->assertEquals( "root", $this->getValue( "mysql__InstallUser" ) );
146 // 'Database password' label available
147 $this->assertEquals( "Database password:",
148 $this->getText( "//div[@id='DB_wrapper_mysql']/fieldset[2]/div[2]/div[1]/label" ) );
151 public function testDatabaseSettingsUI() {
152 $databaseName = DB_NAME_PREFIX
. "_db_settings_UI";
153 parent
::navigateDatabaseSettingsPage( $databaseName );
155 // 'Database settings' text available.
156 $this->assertEquals( "Database settings", $this->getText( LINK_DIV
. "h2" ) );
158 // 'Database account for web access' section available
159 $this->assertTrue( $this->isElementPresent( LINK_FORM
. "fieldset" ) );
161 // 'Database account for web access' label available
162 $this->assertEquals( "Database account for web access", $this->getText( LINK_FORM
. "fieldset/legend" ) );
164 // 'Use the same account as for installation' check box available
165 $this->assertEquals( "Use the same account as for installation", $this->getText( LINK_FORM
. "fieldset/div[1]/label" ) );
167 // 'Use the same account as for installation' check box is selected by default
168 $this->assertEquals( "on", $this->getValue( "mysql__SameAccount" ) );
170 // 'Use the same account as for installation' check box deselected
171 $this->click( "mysql__SameAccount" );
173 // verify 'Use the same account as for installation' check box is not selected
174 $this->assertEquals( "off", $this->getValue( "mysql__SameAccount" ) );
176 // 'Database username' label available
177 $this->assertEquals( "Database username:", $this->getText( "//div[@id='dbOtherAccount']/div[1]/div[1]/label" ) );
179 // 'Database username' text box is default to the 'wikiuser'
180 $this->assertEquals( "wikiuser", $this->getValue( "mysql_wgDBuser" ) );
182 // 'Database password' label available
183 $this->assertEquals( "Database password:", $this->getText( "//div[@id='dbOtherAccount']/div[2]/div[1]/label" ) );
185 // 'Create the account if it does not already exist' label available
186 $this->assertEquals( "Create the account if it does not already exist", $this->getText( "//div[@id='dbOtherAccount']/div[4]/label" ) );
188 // 'Create the account if it does not already exist' check box is not selected by default
189 $this->assertEquals( "off", $this->getValue( "mysql__CreateDBAccount" ) );
191 // 'Create the account if it does not already exist' check box selected
192 $this->click( "mysql__CreateDBAccount" );
194 // Verify 'Create the account if it does not already exist' check box is selected
195 $this->assertEquals( "on", $this->getValue( "mysql__CreateDBAccount" ) );
196 $this->click( "mysql__SameAccount" );
197 $this->assertEquals( "on", $this->getValue( "mysql__SameAccount" ) );
199 // 'Storage engine' label available
200 $this->assertEquals( "Storage engine:",
201 $this->getText( LINK_FORM
. "div[1]/div[1]/label" ) );
203 // 'InnoDB' label available
204 $this->assertEquals( "InnoDB",
205 $this->getText( LINK_FORM
. "div[1]/div[2]/ul/li[1]/label" ) );
207 // 'InnoDB' radio button available
208 $this->assertTrue( $this->isElementPresent( "mysql__MysqlEngine_InnoDB" ) );
210 // 'MyISAM' label available
211 $this->assertEquals( "MyISAM", $this->getText( LINK_FORM
. "div[1]/div[2]/ul/li[2]/label" ) );
213 // 'MyISAM' radio button available
214 $this->assertTrue( $this->isElementPresent( "mysql__MysqlEngine_MyISAM" ) );
216 // 'Database character set' label available
217 $this->assertEquals( "Database character set:",
218 $this->getText( LINK_FORM
. "div[3]/div[1]/label" ) );
220 // 'Binary' radio button available
221 $this->assertTrue( $this->isElementPresent( "mysql__MysqlCharset_binary" ) );
223 // 'Binary' radio button available
224 $this->assertEquals( "Binary", $this->getText( LINK_FORM
. "div[3]/div[2]/ul/li[1]/label" ) );
226 // 'UTF-8' radio button available
227 $this->assertTrue( $this->isElementPresent( "mysql__MysqlCharset_utf8" ) );
229 // 'UTF-8' label available
230 $this->assertEquals( "UTF-8", $this->getText( LINK_FORM
. "div[3]/div[2]/ul/li[2]/label" ) );
232 // 'Binary' radio button is selected
233 $this->assertEquals( "on", $this->getValue( "mysql__MysqlCharset_binary" ) );
236 public function testNamePageUI() {
237 $databaseName = DB_NAME_PREFIX
. "_name_UI";
238 parent
::navigateNamePage( $databaseName );
240 // 'Name of wiki' text box available
241 $this->assertEquals( "Name of wiki:",
242 $this->getText( LINK_FORM
. "div[1]/div[1]/label" ) );
244 $this->assertTrue( $this->isElementPresent( "config_wgSitename" ) );
246 // 'Project namespace' label available
247 $this->assertEquals( "Project namespace:",
248 $this->getText( LINK_FORM
. "div[2]/div[1]/label" ) );
250 // 'Same as the wiki name' radio button available
251 $this->assertTrue( $this->isElementPresent( "config__NamespaceType_site-name" ) );
253 // 'Project' radio button available
254 $this->assertTrue( $this->isElementPresent( "config__NamespaceType_generic" ) );
256 // 'Project' radio button available
257 $this->assertTrue( $this->isElementPresent( "config__NamespaceType_other" ) );
259 // 'Same as the wiki name' label available
260 $this->assertEquals( "Same as the wiki name:",
261 $this->getText( LINK_FORM
. "div[2]/div[2]/ul/li[1]/label" ) );
263 // 'Project' label available
264 $this->assertEquals( "Project",
265 $this->getText( LINK_FORM
. "div[2]/div[2]/ul/li[2]/label" ) );
267 // 'Project' label available
268 $this->assertEquals( "Other (specify)",
269 $this->getText( LINK_FORM
. "div[2]/div[2]/ul/li[3]/label" ) );
271 // 'Same as the wiki name' radio button selected by default
272 $this->assertEquals( "on", $this->getValue( "config__NamespaceType_site-name" ) );
274 // 'Administrator account' section available
275 $this->assertTrue( $this->isElementPresent( LINK_FORM
. "fieldset" ) );
277 // 'Administrator account' label available
278 $this->assertEquals( "Administrator account",
279 $this->getText( LINK_FORM
. "fieldset/legend" ) );
281 // 'Your Name' label available
282 $this->assertEquals( "Your name:",
283 $this->getText( LINK_FORM
. "fieldset/div[1]/div[1]/label" ) );
285 // 'Your Name' text box available
286 $this->assertTrue( $this->isElementPresent( "config__AdminName" ) );
288 // 'Password' label available
289 $this->assertEquals( "Password:",
290 $this->getText( LINK_FORM
. "fieldset/div[2]/div[1]/label" ) );
292 // 'Password' text box available
293 $this->assertTrue( $this->isElementPresent( "config__AdminPassword" ) );
295 // 'Password again' label available
296 $this->assertEquals( "Password again:",
297 $this->getText( LINK_FORM
. "fieldset/div[3]/div[1]/label" ) );
299 // 'Password again' text box available
300 $this->assertTrue( $this->isElementPresent( "config__AdminPassword2" ) );
302 // 'Email address' label avaialble
303 $this->assertEquals( "E-mail address:",
304 $this->getText( LINK_FORM
. "fieldset/div[4]/div[1]/label" ) );
306 // 'Email address' text box available
307 $this->assertTrue( $this->isElementPresent( "config__AdminEmail" ) );
310 $this->assertEquals( "You are almost done! You can now skip the remaining configuration and install the wiki right now.",
311 $this->getText( LINK_FORM
. "/div[4]/div[2]/p" ) );
313 // 'Ask me more questions.' radio button available
314 $this->assertTrue( $this->isElementPresent( "config__SkipOptional_continue" ) );
316 // 'Ask me more questions.' label available
317 $this->assertEquals( "Ask me more questions.",
318 $this->getText( LINK_FORM
. "div[5]/div[2]/ul/li[1]/label" ) );
320 // 'I'm bored already, just install the wiki' radio button is avaiable
321 $this->assertTrue( $this->isElementPresent( "config__SkipOptional_skip" ) );
323 // 'I'm bored already, just install the wiki' label available
324 $this->assertEquals( "I'm bored already, just install the wiki.",
325 $this->getText( LINK_FORM
. "div[5]/div[2]/ul/li[2]/label" ) );
327 // 'Ask me more questions.' radio button is default selected
328 $this->assertEquals( "on", $this->getValue( "config__SkipOptional_continue" ) );
331 public function testOptionPageUI() {
332 $databaseName = DB_NAME_PREFIX
. "_options_UI";
333 parent
::navigateOptionsPage( $databaseName );
335 // 'Options' label available
336 $this->assertEquals( "Options", $this->getText( LINK_DIV
. "h2" ) );
338 // 'Return e-mail address' label available
339 $this->assertEquals( "Return e-mail address:", $this->getText( "//div[@id='emailwrapper']/div[1]/div[1]/label" ) );
341 // 'Return e-mail address' text box available
342 $this->assertTrue( $this->isElementPresent( "config_wgPasswordSender" ) );
344 // Text 'apache@localhost' is default value of the 'Return e-mail address' text box
345 $this->assertEquals( "apache@localhost", $this->getValue( "config_wgPasswordSender" ) );
347 // 'Logo URL' label available
348 $this->assertEquals( "Logo URL:", $this->getText( LINK_FORM
. "fieldset[2]/div[3]/div[1]/label" ) );
350 // 'Logo URL' text box available
351 $this->assertTrue( $this->isElementPresent( "config_wgLogo" ) );
353 // Correct path available in the 'Logo URL' text box
354 $this->assertEquals( "/wiki/skins/common/images/wiki.png", $this->getValue( "config_wgLogo" ) );
356 // 'Enable file uploads' radio button available
357 $this->assertTrue( $this->isElementPresent( "config_wgEnableUploads" ) );
359 // 'Enable file uploads' label available
360 $this->assertEquals( "Enable file uploads",
361 $this->getText( LINK_FORM
. "fieldset[2]/div[1]/label" ) );
363 // 'Enable file uploads' check box is not selected
364 $this->assertEquals( "off", $this->getValue( "config_wgEnableUploads" ) );
366 $this->click( "config_wgEnableUploads" );
368 // 'Directory for deleted files' label available
369 $this->assertEquals( "Directory for deleted files:",
370 $this->getText( "//div[@id='uploadwrapper']/div/div[1]/label" ) );
372 // 'Directory for deleted files' text box available
373 $this->assertTrue( $this->isElementPresent( "config_wgDeletedDirectory" ) );
375 // Correct path available in the 'Directory for deleted files' text box
376 $this->assertEquals( "C:\\wamp\\www\\" . DIRECTORY_NAME
. "/images/deleted",
377 $this->getValue( "config_wgDeletedDirectory" ) );
380 public function testInstallPageUI() {
381 $databaseName = DB_NAME_PREFIX
. "_install_UI";
382 parent
::navigateInstallPage( $databaseName );
384 // Verify installation done messages display
385 $this->assertEquals( "Setting up database... done",
386 $this->getText( LINK_FORM
. "ul/li[1]" ) );
387 $this->assertEquals( "Creating tables... done",
388 $this->getText( LINK_FORM
. "ul/li[2]" ) );
389 $this->assertEquals( "Creating database user... done",
390 $this->getText( LINK_FORM
. "ul/li[3]" ) );
391 $this->assertEquals( "Populating default interwiki table... done",
392 $this->getText( LINK_FORM
. "ul/li[4]" ) );
393 $this->assertEquals( "Generating secret key... done",
394 $this->getText( LINK_FORM
. "ul/li[5]" ) );
395 $this->assertEquals( "Generating default upgrade key... done",
396 $this->getText( LINK_FORM
. "ul/li[6]" ) );
397 $this->assertEquals( "Creating administrator user account... done",
398 $this->getText( LINK_FORM
. "ul/li[7]" ) );
399 $this->assertEquals( "Creating main page with default content... done",
400 $this->getText( LINK_FORM
. "ul/li[8]" ) );
403 public function testCompletePageUI() {
404 $databaseName = DB_NAME_PREFIX
. "_complete_UI";
405 parent
::navigateCompletePage( $databaseName );
407 // 'Congratulations!' text display
408 $this->assertEquals( "Congratulations!",
409 $this->getText( LINK_FORM
. "div[1]/div[2]/p[1]/b" ) );
410 // 'LocalSettings.php' generated message display
411 $this->assertEquals( "The installer has generated a LocalSettings.php file. It contains all your configuration.",
412 $this->getText( LINK_FORM
. "div[1]/div[2]/p[2]" ) );
414 // 'Download LocalSettings.php'' link available
415 $this->assertTrue( $this->isElementPresent( "link=Download LocalSettings.php" ) );
417 // 'enter your wiki' link available
418 $this->assertTrue( $this->isElementPresent( "link=Folder/index.php enter your wiki" ) );
421 public function testRestartInstallation() {
422 parent
::navigateConnetToDatabasePage();
423 $this->click( "link=Restart installation" );
424 $this->waitForPageToLoad( PAGE_LOAD_TIME
);
426 // Restart installation' label should be available.
427 $this->assertEquals( "Restart installation", $this->getText( LINK_DIV
. "h2" ) );
429 //'Do you want to clear all saved data that you have entered and restart the installation process?' label available
430 $this->assertEquals( "Do you want to clear all saved data that you have entered and restart the installation process?",
431 $this->getText( "//*[@id='bodyContent']/div/div/div[2]/form/div[1]/div[2]" ) );
432 // 'Back' button available
433 $this->assertTrue( $this->isElementPresent( "submit-back" ) );
435 // 'Restart' button available
436 $this->assertTrue( $this->isElementPresent( "submit-restart" ) );
439 public function testMediaWikiLogoAvailability() {
440 $databaseName = DB_NAME_PREFIX
. "_mediawiki_logo";
441 parent
::navigateInitialpage();
442 parent
::mediaWikiLogoPresentInitialScreen();
443 $this->click( "link=set up the wiki" );
444 $this->waitForPageToLoad( PAGE_LOAD_TIME
);
447 parent
::mediaWikiLogoPresent();
448 parent
::clickContinueButton();
450 // 'Welcome to MediaWiki' page
451 parent
::mediaWikiLogoPresent();
452 parent
::clickContinueButton();
454 // 'Connet to database' page
455 parent
::mediaWikiLogoPresent();
456 $this->type( "mysql_wgDBname", $databaseName );
457 parent
::clickContinueButton();
459 // 'Database setting' page
460 parent
::mediaWikiLogoPresent();
461 parent
::clickContinueButton();
464 parent
::mediaWikiLogoPresent();
465 parent
::completeNamePage();
466 parent
::clickContinueButton();
469 parent
::mediaWikiLogoPresent();
470 parent
::clickContinueButton();
473 parent
::mediaWikiLogoPresent();
476 public function testRightFramework() {
477 parent
::navigateLanguagePage();
478 // Verfy right framework texts display
479 $this->assertEquals( "Language",
480 $this->getText( LINK_RIGHT_FRAMEWORK
. "li[1]" ) );
481 $this->assertEquals( "Existing wiki",
482 $this->getText( LINK_RIGHT_FRAMEWORK
. "li[2]" ) );
483 $this->assertEquals( "Welcome to MediaWiki!",
484 $this->getText( LINK_RIGHT_FRAMEWORK
. "li[3]" ) );
485 $this->assertEquals( "Connect to database",
486 $this->getText( LINK_RIGHT_FRAMEWORK
. "li[4]" ) );
487 $this->assertEquals( "Upgrade existing installation",
488 $this->getText( LINK_RIGHT_FRAMEWORK
. "li[5]" ) );
489 $this->assertEquals( "Database settings",
490 $this->getText( LINK_RIGHT_FRAMEWORK
. "li[6]" ) );
491 $this->assertEquals( "Name",
492 $this->getText( LINK_RIGHT_FRAMEWORK
. "li[7]" ) );
493 $this->assertEquals( "Options",
494 $this->getText( LINK_RIGHT_FRAMEWORK
. "li[8]" ) );
495 $this->assertEquals( "Install",
496 $this->getText( LINK_RIGHT_FRAMEWORK
. "li[9]" ) );
497 $this->assertEquals( "Complete!",
498 $this->getText( LINK_RIGHT_FRAMEWORK
. "li[10]/span" ) );