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( str_replace('//','/',dirname(__FILE__
).'/') .'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
{
47 public function testInitialPageUI() {
49 parent
::navigateInitialpage();
51 // MediaWiki logo available
52 $this->assertTrue( $this->isElementPresent( "//img[@alt='The MediaWiki logo']" ));
54 // 'MediaWiki 1.18alpha' text available
55 $this->assertEquals( "MediaWiki 1.18alpha", $this->getText( "//h1" ));
57 // 'LocalSettings.php not found.' text available
58 $this->assertEquals( "LocalSettings.php not found.", $this->getText( "//p[1]" ));
60 // 'Please set up the wiki first' text available
61 $this->assertEquals( "Please set up the wiki first.", $this->getText( "//p[2]" ));
63 // 'set up the wiki' link available
64 $this->assertTrue($this->isElementPresent( "link=set up the wiki" ));
68 public function testlanguagePageUI() {
70 parent
::navigateLanguagePage();
72 // Verify 'Language' heading
73 $this->assertEquals( "Language", $this->getText( "//div[@id='bodyContent']/div/div/h2" ));
75 // 'Your language' label available
76 $this->assertEquals( "Your language:",
77 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/div[1]/div[1]/label" ));
79 // 'Your language' dropdown available
80 $this->assertTrue( $this->isElementPresent( "UserLang" ));
82 // 'Wiki language' label available
83 $this->assertEquals( "Wiki language:",
84 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/div[2]/div[1]/label" ));
86 // 'Wiki language' dropdown available
87 $this->assertTrue($this->isElementPresent( "ContLang" ));
91 public function testWelcometoMediaWikiUI() {
93 parent
::navigateWelcometoMediaWikiPage();
95 // Verify 'Welcome to MediaWiki!' heading
96 $this->assertEquals( "Welcome to MediaWiki!",
97 $this->getText( "//div[@id='bodyContent']/div/div/h2" ));
99 // Verify environment ok text displayed.
100 $this->assertEquals( "The environment has been checked.You can install MediaWiki.",
101 $this->getText( "//div[@id='bodyContent']/div/div/div[7]/span" ));
105 public function testConnectToDatabaseUI() {
107 parent
::navigateConnetToDatabasePage();
109 // 'MYSQL radio button available
110 $this->assertEquals( "MySQL",
111 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/div[2]/div[2]/ul/li[1]/label" ));
112 $this->assertTrue( $this->isElementPresent( "//div[@id='bodyContent']/div/div/div[2]/form/div[2]/div[2]/ul/li[1]" ));
114 // 'SQLite' radio button available
115 $this->assertTrue( $this->isElementPresent( "//div[@id='bodyContent']/div/div/div[2]/form/div[2]/div[2]/ul/li[2]" ));
116 $this->assertEquals( "SQLite", $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/div[2]/div[2]/ul/li[2]/label "));
118 // 'Database host' label available
119 $this->assertEquals( "Database host:", $this->getText( "//div[@id='DB_wrapper_mysql']/div/div[1]/label" ));
121 // 'Database host' text box default to 'localhost'
122 $this->assertEquals( "localhost", $this->getValue( "mysql_wgDBserver" ));
124 // 'Identify this wiki' section available
125 $this->assertTrue( $this->isElementPresent( "//div[@id='DB_wrapper_mysql']/fieldset[1]/legend" ));
127 // 'Identify this wiki' label available
128 $this->assertEquals( "Identify this wiki", $this->getText( "//div[@id='DB_wrapper_mysql']/fieldset[1]/legend" ));
130 // 'Database name' lable available
131 $this->assertEquals( "Database name:",
132 $this->getText( "//div[@id='DB_wrapper_mysql']/fieldset[1]/div[1]/div[1]/label" ));
134 // Verify 'Database name:' text box is default to 'my_wiki'
135 $this->assertEquals( "my_wiki", $this->getValue( "mysql_wgDBname" ));
137 // Verify 'Database table prefix:' label available
138 $this->assertEquals( "Database table prefix:",
139 $this->getText( "//div[@id='DB_wrapper_mysql']/fieldset[1]/div[2]/div[1]/label" ));
141 // 'User account for installation' section available
142 $this->assertTrue( $this->isElementPresent( "//div[@id='DB_wrapper_mysql']/fieldset[2]/legend" ));
144 // 'User account for installation' label available
145 $this->assertEquals( "User account for installation", $this->getText( "//div[@id='DB_wrapper_mysql']/fieldset[2]/legend" ));
147 // 'Database username' label available
148 $this->assertEquals( "Database username:",
149 $this->getText( "//div[@id='DB_wrapper_mysql']/fieldset[2]/div[1]/div[1]/label" ));
151 // 'Database username' text box defaults to 'root'
152 $this->assertEquals("root", $this->getValue( "mysql__InstallUser" ));
154 // 'Database password' label available
155 $this->assertEquals( "Database password:",
156 $this->getText( "//div[@id='DB_wrapper_mysql']/fieldset[2]/div[2]/div[1]/label" ));
161 public function testDatabaseSettingsUI() {
163 $databaseName = DB_NAME_PREFIX
."_db_settings_UI";
164 parent
::navigateDatabaseSettingsPage( $databaseName );
166 // 'Database settings' text available.
167 $this->assertEquals( "Database settings", $this->getText( "//div[@id='bodyContent']/div/div/h2" ));
169 // 'Database account for web access' section available
170 $this->assertTrue( $this->isElementPresent( "//div[@id='bodyContent']/div/div/div[2]/form/fieldset" ));
172 // 'Database account for web access' label available
173 $this->assertEquals( "Database account for web access", $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/fieldset/legend" ));
175 // 'Use the same account as for installation' check box available
176 $this->assertEquals( "Use the same account as for installation", $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/fieldset/div[1]/label" ));
178 // 'Use the same account as for installation' check box is selected by default
179 $this->assertEquals( "on", $this->getValue( "mysql__SameAccount" ));
181 // 'Use the same account as for installation' check box deselected
182 $this->click( "mysql__SameAccount" );
184 // verify 'Use the same account as for installation' check box is not selected
185 $this->assertEquals( "off", $this->getValue( "mysql__SameAccount" ));
187 // 'Database username' label available
188 $this->assertEquals( "Database username:", $this->getText( "//div[@id='dbOtherAccount']/div[1]/div[1]/label" ));
190 // 'Database username' text box is default to the 'wikiuser'
191 $this->assertEquals( "wikiuser", $this->getValue( "mysql_wgDBuser" ));
193 // 'Database password' label available
194 $this->assertEquals( "Database password:", $this->getText( "//div[@id='dbOtherAccount']/div[2]/div[1]/label" ));
196 // 'Create the account if it does not already exist' label available
197 $this->assertEquals( "Create the account if it does not already exist", $this->getText( "//div[@id='dbOtherAccount']/div[4]/label" ));
199 // 'Create the account if it does not already exist' check box is not selected by default
200 $this->assertEquals( "off" , $this->getValue( "mysql__CreateDBAccount" ));
202 // 'Create the account if it does not already exist' check box selected
203 $this->click( "mysql__CreateDBAccount" );
205 // Verify 'Create the account if it does not already exist' check box is selected
206 $this->assertEquals( "on" , $this->getValue( "mysql__CreateDBAccount" ));
207 $this->click( "mysql__SameAccount" );
208 $this->assertEquals( "on", $this->getValue( "mysql__SameAccount" ));
210 // 'Storage engine' label available
211 $this->assertEquals( "Storage engine:",
212 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/div[1]/div[1]/label"));
214 // 'InnoDB' label available
215 $this->assertEquals( "InnoDB",
216 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/div[1]/div[2]/ul/li[1]/label" ));
218 // 'InnoDB' radio button available
219 $this->assertTrue( $this->isElementPresent( "mysql__MysqlEngine_InnoDB" ));
221 // 'MyISAM' label available
222 $this->assertEquals( "MyISAM", $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/div[1]/div[2]/ul/li[2]/label" ));
224 // 'MyISAM' radio button available
225 $this->assertTrue($this->isElementPresent( "mysql__MysqlEngine_MyISAM" ));
227 // 'Database character set' label available
228 $this->assertEquals( "Database character set:",
229 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/div[3]/div[1]/label" ));
231 // 'Binary' radio button available
232 $this->assertTrue( $this->isElementPresent( "mysql__MysqlCharset_binary" ));
234 // 'Binary' radio button available
235 $this->assertEquals( "Binary", $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/div[3]/div[2]/ul/li[1]/label" ));
237 // 'UTF-8' radio button available
238 $this->assertTrue( $this->isElementPresent( "mysql__MysqlCharset_utf8" ));
240 // 'UTF-8' label available
241 $this->assertEquals( "UTF-8", $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/div[3]/div[2]/ul/li[2]/label" ));
243 // 'Binary' radio button is selected
244 $this->assertEquals( "on", $this->getValue( "mysql__MysqlCharset_binary" ));
247 public function testNamePageUI() {
249 $databaseName = DB_NAME_PREFIX
."_name_UI";
250 parent
::navigateNamePage($databaseName);
252 // 'Name of wiki' text box available
253 $this->assertEquals( "Name of wiki:",
254 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/div[1]/div[1]/label" ));
256 $this->assertTrue( $this->isElementPresent( "config_wgSitename" ));
258 // 'Project namespace' label available
259 $this->assertEquals( "Project namespace:",
260 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/div[2]/div[1]/label" ));
262 // 'Same as the wiki name' radio button available
263 $this->assertTrue( $this->isElementPresent( "config__NamespaceType_site-name" ));
265 // 'Project' radio button available
266 $this->assertTrue( $this->isElementPresent( "config__NamespaceType_generic" ));
268 // 'Project' radio button available
269 $this->assertTrue( $this->isElementPresent( "config__NamespaceType_other" ));
271 // 'Same as the wiki name' label available
272 $this->assertEquals( "Same as the wiki name:",
273 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/div[2]/div[2]/ul/li[1]/label" ));
275 // 'Project' label available
276 $this->assertEquals("Project",
277 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/div[2]/div[2]/ul/li[2]/label" ));
279 // 'Project' label available
280 $this->assertEquals( "Other (specify)",
281 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/div[2]/div[2]/ul/li[3]/label" ));
283 // 'Same as the wiki name' radio button selected by default
284 $this->assertEquals( "on", $this->getValue( "config__NamespaceType_site-name" ));
286 // 'Administrator account' section available
287 $this->assertTrue( $this->isElementPresent( "//div[@id='bodyContent']/div/div/div[2]/form/fieldset" ));
289 // 'Administrator account' label available
290 $this->assertEquals( "Administrator account",
291 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/fieldset/legend" ));
293 // 'Your Name' label available
294 $this->assertEquals( "Your name:",
295 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/fieldset/div[1]/div[1]/label" ));
297 // 'Your Name' text box available
298 $this->assertTrue( $this->isElementPresent( "config__AdminName" ));
300 // 'Password' label available
301 $this->assertEquals( "Password:",
302 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/fieldset/div[2]/div[1]/label" ));
304 // 'Password' text box available
305 $this->assertTrue( $this->isElementPresent( "config__AdminPassword" ));
307 // 'Password again' label available
308 $this->assertEquals( "Password again:",
309 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/fieldset/div[3]/div[1]/label" ));
311 // 'Password again' text box available
312 $this->assertTrue( $this->isElementPresent( "config__AdminPassword2" ));
314 // 'Email address' label avaialble
315 $this->assertEquals( "E-mail address:",
316 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/fieldset/div[4]/div[1]/label" ));
318 // 'Email address' text box available
319 $this->assertTrue( $this->isElementPresent( "config__AdminEmail" ));
321 // 'Subscribe to the release announcements mailing list. ' check box available
322 $this->assertTrue( $this->isElementPresent( "config__Subscribe" ));
324 // 'Subscribe to the release announcements mailing list. ' label avaialble
325 $this->assertEquals( "Subscribe to the release announcements mailing list.",
326 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/fieldset/div[5]/label" ));
328 // 'release announcements mailing list' link available
329 $this->assertTrue( $this->isElementPresent( "link=release announcements mailing list" ));
332 $this->assertEquals( "You are almost done! You can now skip the remaining configuration and install the wiki right now.",
333 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/div[4]/div[2]" ));
335 // 'Ask me more questions.' radio button available
336 $this->assertTrue( $this->isElementPresent( "config__SkipOptional_continue" ));
338 // 'Ask me more questions.' label available
339 $this->assertEquals( "Ask me more questions.",
340 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/div[5]/div[2]/ul/li[1]/label" ));
342 // 'I'm bored already, just install the wiki' radio button is avaiable
343 $this->assertTrue( $this->isElementPresent( "config__SkipOptional_skip" ));
345 // 'I'm bored already, just install the wiki' label available
346 $this->assertEquals( "I'm bored already, just install the wiki.",
347 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/div[5]/div[2]/ul/li[2]/label" ));
349 // 'Ask me more questions.' radio button is default selected
350 $this->assertEquals( "on", $this->getValue( "config__SkipOptional_continue" ));
355 public function testOptionPageUI() {
357 $databaseName = DB_NAME_PREFIX
."_options_UI";
358 parent
::navigateOptionsPage($databaseName);
360 // 'Options' label available
361 $this->assertEquals( "Options", $this->getText("//div[@id='bodyContent']/div/div/h2"));
363 // 'Return e-mail address' label available
364 $this->assertEquals( "Return e-mail address:", $this->getText( "//div[@id='emailwrapper']/div[1]/div[1]/label" ));
366 // 'Return e-mail address' text box available
367 $this->assertTrue( $this->isElementPresent( "config_wgPasswordSender" ));
369 // Text 'apache@localhost' is default value of the 'Return e-mail address' text box
370 $this->assertEquals( "apache@localhost", $this->getValue( "config_wgPasswordSender" ));
372 // 'Logo URL' label available
373 $this->assertEquals( "Logo URL:", $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/fieldset[2]/div[3]/div[1]/label" ));
375 // 'Logo URL' text box available
376 $this->assertTrue( $this->isElementPresent( "config_wgLogo" ));
378 // Correct path available in the 'Logo URL' text box
379 $this->assertEquals( "/wiki/skins/common/images/wiki.png", $this->getValue( "config_wgLogo" ));
381 // 'Enable file uploads' radio button available
382 $this->assertTrue( $this->isElementPresent( "config_wgEnableUploads" ));
384 // 'Enable file uploads' label available
385 $this->assertEquals( "Enable file uploads",
386 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/fieldset[2]/div[1]/label" ));
388 // 'Enable file uploads' check box is not selected
389 $this->assertEquals( "off", $this->getValue( "config_wgEnableUploads" ));
391 $this->click( "config_wgEnableUploads" );
393 // 'Directory for deleted files' label available
394 $this->assertEquals( "Directory for deleted files:",
395 $this->getText( "//div[@id='uploadwrapper']/div/div[1]/label" ));
397 // 'Directory for deleted files' text box available
398 $this->assertTrue( $this->isElementPresent( "config_wgDeletedDirectory" ));
400 // Correct path available in the 'Directory for deleted files' text box
401 $this->assertEquals( "C:\\wamp\\www\\".DIRECTORY_NAME
."/images/deleted",
402 $this->getValue( "config_wgDeletedDirectory" ));
407 public function testInstallPageUI() {
409 $databaseName = DB_NAME_PREFIX
."_install_UI";
410 parent
::navigateInstallPage( $databaseName );
412 // Verify installation done messages display
413 $this->assertEquals( "Setting up database... done",
414 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/ul/li[1]" ));
415 $this->assertEquals( "Creating tables... done",
416 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/ul/li[2]" ));
417 $this->assertEquals( "Creating database user... done",
418 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/ul/li[3]" ));
419 $this->assertEquals( "Populating default interwiki table... done",
420 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/ul/li[4]" ));
421 $this->assertEquals( "Generating secret key... done",
422 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/ul/li[5]" ));
423 $this->assertEquals( "Generating default upgrade key... done",
424 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/ul/li[6]" ));
425 $this->assertEquals( "Creating administrator user account... done",
426 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/ul/li[7]" ));
427 $this->assertEquals( "Creating main page with default content... done",
428 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/ul/li[8]" ));
433 public function testCompletePageUI() {
435 $databaseName = DB_NAME_PREFIX
."_complete_UI";
436 parent
::navigateCompletePage( $databaseName );
438 // 'Congratulations!' text display
439 $this->assertEquals("Congratulations!",
440 $this->getText("//div[@id='bodyContent']/div/div/div[2]/form/div[1]/div[2]/p[1]/b"));
441 // 'LocalSettings.php' generated message display
442 $this->assertEquals( "The installer has generated a LocalSettings.php file. It contains all your configuration.",
443 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/div[1]/div[2]/p[2]" ));
445 // 'Download LocalSettings.php'' link available
446 $this->assertTrue( $this->isElementPresent( "link=Download LocalSettings.php" ));
448 // 'enter your wiki' link available
449 $this->assertTrue( $this->isElementPresent( "link=enter your wiki" ));
454 public function testRestartInstallation() {
456 parent
::navigateConnetToDatabasePage();
457 $this->click( "link=Restart installation" );
458 $this->waitForPageToLoad( PAGE_LOAD_TIME
);
460 // Restart installation' label should be available.
461 $this->assertEquals( "Restart installation", $this->getText( "//div[@id='bodyContent']/div/div/h2" ));
463 //'Do you want to clear all saved data that you have entered and restart the installation process?' label available
464 $this->assertEquals( "Do you want to clear all saved data that you have entered and restart the installation process?",
465 $this->getText( "//*[@id='bodyContent']/div/div/div[2]/form/div[1]/div[2]" ));
466 // 'Back' button available
467 $this->assertTrue($this->isElementPresent( "submit-back" ));
469 // 'Restart' button available
470 $this->assertTrue($this->isElementPresent( "submit-restart" ));
475 public function testMediaWikiLogoAvailability() {
477 $databaseName = DB_NAME_PREFIX
."_mediawiki_logo";
478 parent
::navigateInitialpage();
479 parent
::mediaWikiLogoPresentInitialScreen();
480 $this->click( "link=set up the wiki" );
481 $this->waitForPageToLoad( PAGE_LOAD_TIME
);
484 parent
::mediaWikiLogoPresent();
485 parent
::clickContinueButton();
487 // 'Welcome to MediaWiki' page
488 parent
::mediaWikiLogoPresent();
489 parent
::clickContinueButton();
491 // 'Connet to database' page
492 parent
::mediaWikiLogoPresent();
493 $this->type("mysql_wgDBname", $databaseName );
494 parent
::clickContinueButton();
496 // 'Database setting' page
497 parent
::mediaWikiLogoPresent();
498 parent
::clickContinueButton();
501 parent
::mediaWikiLogoPresent();
502 parent
::completeNamePage();
503 parent
::clickContinueButton();
506 parent
::mediaWikiLogoPresent();
507 parent
::clickContinueButton();
510 parent
::mediaWikiLogoPresent();
514 public function testRightFramework() {
516 parent
::navigateLanguagePage();
517 // Verfy right framework texts display
518 $this->assertEquals( "Language",
519 $this->getText( "//div[@id='bodyContent']/div/div/div[1]/ul[1]/li[1]" ));
520 $this->assertEquals( "Existing wiki",
521 $this->getText( "//div[@id='bodyContent']/div/div/div[1]/ul[1]/li[2]" ));
522 $this->assertEquals( "Welcome to MediaWiki!",
523 $this->getText( "//div[@id='bodyContent']/div/div/div[1]/ul[1]/li[3]" ));
524 $this->assertEquals( "Connect to database",
525 $this->getText( "//div[@id='bodyContent']/div/div/div[1]/ul[1]/li[4]" ));
526 $this->assertEquals( "Upgrade existing installation",
527 $this->getText( "//div[@id='bodyContent']/div/div/div[1]/ul[1]/li[5]" ));
528 $this->assertEquals( "Database settings",
529 $this->getText( "//div[@id='bodyContent']/div/div/div[1]/ul[1]/li[6]" ));
530 $this->assertEquals( "Name",
531 $this->getText( "//div[@id='bodyContent']/div/div/div[1]/ul[1]/li[7]" ));
532 $this->assertEquals( "Options",
533 $this->getText( "//div[@id='bodyContent']/div/div/div[1]/ul[1]/li[8]" ));
534 $this->assertEquals( "Install",
535 $this->getText( "//div[@id='bodyContent']/div/div/div[1]/ul[1]/li[9]" ));
536 $this->assertEquals( "Complete!",
537 $this->getText( "//div[@id='bodyContent']/div/div/div[1]/ul[1]/li[10]/span" ));