MediaWiki
REL1_21
|
00001 <?php 00026 require_once ( __DIR__ . '/MediaWikiInstallationCommonFunction.php' ); 00027 00034 class MediaWikiUserInterfaceTestCase extends MediaWikiInstallationCommonFunction { 00035 function setUp() { 00036 parent::setUp(); 00037 } 00038 00039 public function testInitialPageUI() { 00040 00041 parent::navigateInitialpage(); 00042 00043 // MediaWiki logo available 00044 $this->assertTrue( $this->isElementPresent( "//img[@alt='The MediaWiki logo']" ) ); 00045 00046 // 'MediaWiki 1.18alpha' text available 00047 $this->assertEquals( "MediaWiki 1.18alpha", $this->getText( "//h1" ) ); 00048 00049 // 'LocalSettings.php not found.' text available 00050 $this->assertEquals( "LocalSettings.php not found.", $this->getText( "//p[1]" ) ); 00051 00052 // 'Please set up the wiki first' text available 00053 $this->assertEquals( "Please set up the wiki first.", $this->getText( "//p[2]" ) ); 00054 00055 // 'set up the wiki' link available 00056 $this->assertTrue( $this->isElementPresent( "link=set up the wiki" ) ); 00057 } 00058 00059 public function testlanguagePageUI() { 00060 parent::navigateLanguagePage(); 00061 00062 // Verify 'Language' heading 00063 $this->assertEquals( "Language", $this->getText( LINK_DIV . "h2" ) ); 00064 00065 // 'Your language' label available 00066 $this->assertEquals( "Your language:", 00067 $this->getText( LINK_FORM . "div[1]/div[1]/label" ) ); 00068 00069 // 'Your language' dropdown available 00070 $this->assertTrue( $this->isElementPresent( "UserLang" ) ); 00071 00072 // 'Wiki language' label available 00073 $this->assertEquals( "Wiki language:", 00074 $this->getText( LINK_FORM . "div[2]/div[1]/label" ) ); 00075 00076 // 'Wiki language' dropdown available 00077 $this->assertTrue( $this->isElementPresent( "ContLang" ) ); 00078 } 00079 00080 public function testWelcometoMediaWikiUI() { 00081 parent::navigateWelcometoMediaWikiPage(); 00082 00083 // Verify 'Welcome to MediaWiki!' heading 00084 $this->assertEquals( "Welcome to MediaWiki!", 00085 $this->getText( LINK_DIV . "h2" ) ); 00086 00087 // Verify environment ok text displayed. 00088 $this->assertEquals( "The environment has been checked.You can install MediaWiki.", 00089 $this->getText( LINK_DIV . "div[6]/span" ) ); 00090 } 00091 00092 public function testConnectToDatabaseUI() { 00093 parent::navigateConnetToDatabasePage(); 00094 00095 // 'MYSQL radio button available 00096 $this->assertEquals( "MySQL", 00097 $this->getText( LINK_FORM . "div[2]/div[2]/ul/li[1]/label" ) ); 00098 $this->assertTrue( $this->isElementPresent( LINK_FORM . "div[2]/div[2]/ul/li[1]" ) ); 00099 00100 // 'SQLite' radio button available 00101 $this->assertTrue( $this->isElementPresent( LINK_FORM . "div[2]/div[2]/ul/li[2]" ) ); 00102 $this->assertEquals( "SQLite", $this->getText( LINK_FORM . "div[2]/div[2]/ul/li[2]/label " ) ); 00103 00104 // 'Database host' label available 00105 $this->assertEquals( "Database host:", $this->getText( "//div[@id='DB_wrapper_mysql']/div/div[1]/label" ) ); 00106 00107 // 'Database host' text box default to 'localhost' 00108 $this->assertEquals( "localhost", $this->getValue( "mysql_wgDBserver" ) ); 00109 00110 // 'Identify this wiki' section available 00111 $this->assertTrue( $this->isElementPresent( "//div[@id='DB_wrapper_mysql']/fieldset[1]/legend" ) ); 00112 00113 // 'Identify this wiki' label available 00114 $this->assertEquals( "Identify this wiki", $this->getText( "//div[@id='DB_wrapper_mysql']/fieldset[1]/legend" ) ); 00115 00116 // 'Database name' lable available 00117 $this->assertEquals( "Database name:", 00118 $this->getText( "//div[@id='DB_wrapper_mysql']/fieldset[1]/div[1]/div[1]/label" ) ); 00119 00120 // Verify 'Database name:' text box is default to 'my_wiki' 00121 $this->assertEquals( "my_wiki", $this->getValue( "mysql_wgDBname" ) ); 00122 00123 // Verify 'Database table prefix:' label available 00124 $this->assertEquals( "Database table prefix:", 00125 $this->getText( "//div[@id='DB_wrapper_mysql']/fieldset[1]/div[2]/div[1]/label" ) ); 00126 00127 // 'User account for installation' section available 00128 $this->assertTrue( $this->isElementPresent( "//div[@id='DB_wrapper_mysql']/fieldset[2]/legend" ) ); 00129 00130 // 'User account for installation' label available 00131 $this->assertEquals( "User account for installation", $this->getText( "//div[@id='DB_wrapper_mysql']/fieldset[2]/legend" ) ); 00132 00133 // 'Database username' label available 00134 $this->assertEquals( "Database username:", 00135 $this->getText( "//div[@id='DB_wrapper_mysql']/fieldset[2]/div[1]/div[1]/label" ) ); 00136 00137 // 'Database username' text box defaults to 'root' 00138 $this->assertEquals( "root", $this->getValue( "mysql__InstallUser" ) ); 00139 00140 // 'Database password' label available 00141 $this->assertEquals( "Database password:", 00142 $this->getText( "//div[@id='DB_wrapper_mysql']/fieldset[2]/div[2]/div[1]/label" ) ); 00143 } 00144 00145 public function testDatabaseSettingsUI() { 00146 $databaseName = DB_NAME_PREFIX . "_db_settings_UI"; 00147 parent::navigateDatabaseSettingsPage( $databaseName ); 00148 00149 // 'Database settings' text available. 00150 $this->assertEquals( "Database settings", $this->getText( LINK_DIV . "h2" ) ); 00151 00152 // 'Database account for web access' section available 00153 $this->assertTrue( $this->isElementPresent( LINK_FORM . "fieldset" ) ); 00154 00155 // 'Database account for web access' label available 00156 $this->assertEquals( "Database account for web access", $this->getText( LINK_FORM . "fieldset/legend" ) ); 00157 00158 // 'Use the same account as for installation' check box available 00159 $this->assertEquals( "Use the same account as for installation", $this->getText( LINK_FORM . "fieldset/div[1]/label" ) ); 00160 00161 // 'Use the same account as for installation' check box is selected by default 00162 $this->assertEquals( "on", $this->getValue( "mysql__SameAccount" ) ); 00163 00164 // 'Use the same account as for installation' check box deselected 00165 $this->click( "mysql__SameAccount" ); 00166 00167 // verify 'Use the same account as for installation' check box is not selected 00168 $this->assertEquals( "off", $this->getValue( "mysql__SameAccount" ) ); 00169 00170 // 'Database username' label available 00171 $this->assertEquals( "Database username:", $this->getText( "//div[@id='dbOtherAccount']/div[1]/div[1]/label" ) ); 00172 00173 // 'Database username' text box is default to the 'wikiuser' 00174 $this->assertEquals( "wikiuser", $this->getValue( "mysql_wgDBuser" ) ); 00175 00176 // 'Database password' label available 00177 $this->assertEquals( "Database password:", $this->getText( "//div[@id='dbOtherAccount']/div[2]/div[1]/label" ) ); 00178 00179 // 'Create the account if it does not already exist' label available 00180 $this->assertEquals( "Create the account if it does not already exist", $this->getText( "//div[@id='dbOtherAccount']/div[4]/label" ) ); 00181 00182 // 'Create the account if it does not already exist' check box is not selected by default 00183 $this->assertEquals( "off", $this->getValue( "mysql__CreateDBAccount" ) ); 00184 00185 // 'Create the account if it does not already exist' check box selected 00186 $this->click( "mysql__CreateDBAccount" ); 00187 00188 // Verify 'Create the account if it does not already exist' check box is selected 00189 $this->assertEquals( "on", $this->getValue( "mysql__CreateDBAccount" ) ); 00190 $this->click( "mysql__SameAccount" ); 00191 $this->assertEquals( "on", $this->getValue( "mysql__SameAccount" ) ); 00192 00193 // 'Storage engine' label available 00194 $this->assertEquals( "Storage engine:", 00195 $this->getText( LINK_FORM . "div[1]/div[1]/label" ) ); 00196 00197 // 'InnoDB' label available 00198 $this->assertEquals( "InnoDB", 00199 $this->getText( LINK_FORM . "div[1]/div[2]/ul/li[1]/label" ) ); 00200 00201 // 'InnoDB' radio button available 00202 $this->assertTrue( $this->isElementPresent( "mysql__MysqlEngine_InnoDB" ) ); 00203 00204 // 'MyISAM' label available 00205 $this->assertEquals( "MyISAM", $this->getText( LINK_FORM . "div[1]/div[2]/ul/li[2]/label" ) ); 00206 00207 // 'MyISAM' radio button available 00208 $this->assertTrue( $this->isElementPresent( "mysql__MysqlEngine_MyISAM" ) ); 00209 00210 // 'Database character set' label available 00211 $this->assertEquals( "Database character set:", 00212 $this->getText( LINK_FORM . "div[3]/div[1]/label" ) ); 00213 00214 // 'Binary' radio button available 00215 $this->assertTrue( $this->isElementPresent( "mysql__MysqlCharset_binary" ) ); 00216 00217 // 'Binary' radio button available 00218 $this->assertEquals( "Binary", $this->getText( LINK_FORM . "div[3]/div[2]/ul/li[1]/label" ) ); 00219 00220 // 'UTF-8' radio button available 00221 $this->assertTrue( $this->isElementPresent( "mysql__MysqlCharset_utf8" ) ); 00222 00223 // 'UTF-8' label available 00224 $this->assertEquals( "UTF-8", $this->getText( LINK_FORM . "div[3]/div[2]/ul/li[2]/label" ) ); 00225 00226 // 'Binary' radio button is selected 00227 $this->assertEquals( "on", $this->getValue( "mysql__MysqlCharset_binary" ) ); 00228 } 00229 00230 public function testNamePageUI() { 00231 $databaseName = DB_NAME_PREFIX . "_name_UI"; 00232 parent::navigateNamePage( $databaseName ); 00233 00234 // 'Name of wiki' text box available 00235 $this->assertEquals( "Name of wiki:", 00236 $this->getText( LINK_FORM . "div[1]/div[1]/label" ) ); 00237 00238 $this->assertTrue( $this->isElementPresent( "config_wgSitename" ) ); 00239 00240 // 'Project namespace' label available 00241 $this->assertEquals( "Project namespace:", 00242 $this->getText( LINK_FORM . "div[2]/div[1]/label" ) ); 00243 00244 // 'Same as the wiki name' radio button available 00245 $this->assertTrue( $this->isElementPresent( "config__NamespaceType_site-name" ) ); 00246 00247 // 'Project' radio button available 00248 $this->assertTrue( $this->isElementPresent( "config__NamespaceType_generic" ) ); 00249 00250 // 'Project' radio button available 00251 $this->assertTrue( $this->isElementPresent( "config__NamespaceType_other" ) ); 00252 00253 // 'Same as the wiki name' label available 00254 $this->assertEquals( "Same as the wiki name:", 00255 $this->getText( LINK_FORM . "div[2]/div[2]/ul/li[1]/label" ) ); 00256 00257 // 'Project' label available 00258 $this->assertEquals( "Project", 00259 $this->getText( LINK_FORM . "div[2]/div[2]/ul/li[2]/label" ) ); 00260 00261 // 'Project' label available 00262 $this->assertEquals( "Other (specify)", 00263 $this->getText( LINK_FORM . "div[2]/div[2]/ul/li[3]/label" ) ); 00264 00265 // 'Same as the wiki name' radio button selected by default 00266 $this->assertEquals( "on", $this->getValue( "config__NamespaceType_site-name" ) ); 00267 00268 // 'Administrator account' section available 00269 $this->assertTrue( $this->isElementPresent( LINK_FORM . "fieldset" ) ); 00270 00271 // 'Administrator account' label available 00272 $this->assertEquals( "Administrator account", 00273 $this->getText( LINK_FORM . "fieldset/legend" ) ); 00274 00275 // 'Your Name' label available 00276 $this->assertEquals( "Your name:", 00277 $this->getText( LINK_FORM . "fieldset/div[1]/div[1]/label" ) ); 00278 00279 // 'Your Name' text box available 00280 $this->assertTrue( $this->isElementPresent( "config__AdminName" ) ); 00281 00282 // 'Password' label available 00283 $this->assertEquals( "Password:", 00284 $this->getText( LINK_FORM . "fieldset/div[2]/div[1]/label" ) ); 00285 00286 // 'Password' text box available 00287 $this->assertTrue( $this->isElementPresent( "config__AdminPassword" ) ); 00288 00289 // 'Password again' label available 00290 $this->assertEquals( "Password again:", 00291 $this->getText( LINK_FORM . "fieldset/div[3]/div[1]/label" ) ); 00292 00293 // 'Password again' text box available 00294 $this->assertTrue( $this->isElementPresent( "config__AdminPassword2" ) ); 00295 00296 // 'Email address' label avaialble 00297 $this->assertEquals( "E-mail address:", 00298 $this->getText( LINK_FORM . "fieldset/div[4]/div[1]/label" ) ); 00299 00300 // 'Email address' text box available 00301 $this->assertTrue( $this->isElementPresent( "config__AdminEmail" ) ); 00302 00303 // Message displayed 00304 $this->assertEquals( "You are almost done! You can now skip the remaining configuration and install the wiki right now.", 00305 $this->getText( LINK_FORM . "/div[4]/div[2]/p" ) ); 00306 00307 // 'Ask me more questions.' radio button available 00308 $this->assertTrue( $this->isElementPresent( "config__SkipOptional_continue" ) ); 00309 00310 // 'Ask me more questions.' label available 00311 $this->assertEquals( "Ask me more questions.", 00312 $this->getText( LINK_FORM . "div[5]/div[2]/ul/li[1]/label" ) ); 00313 00314 // 'I'm bored already, just install the wiki' radio button is avaiable 00315 $this->assertTrue( $this->isElementPresent( "config__SkipOptional_skip" ) ); 00316 00317 // 'I'm bored already, just install the wiki' label available 00318 $this->assertEquals( "I'm bored already, just install the wiki.", 00319 $this->getText( LINK_FORM . "div[5]/div[2]/ul/li[2]/label" ) ); 00320 00321 // 'Ask me more questions.' radio button is default selected 00322 $this->assertEquals( "on", $this->getValue( "config__SkipOptional_continue" ) ); 00323 } 00324 00325 public function testOptionPageUI() { 00326 $databaseName = DB_NAME_PREFIX . "_options_UI"; 00327 parent::navigateOptionsPage( $databaseName ); 00328 00329 // 'Options' label available 00330 $this->assertEquals( "Options", $this->getText( LINK_DIV . "h2" ) ); 00331 00332 // 'Return e-mail address' label available 00333 $this->assertEquals( "Return e-mail address:", $this->getText( "//div[@id='emailwrapper']/div[1]/div[1]/label" ) ); 00334 00335 // 'Return e-mail address' text box available 00336 $this->assertTrue( $this->isElementPresent( "config_wgPasswordSender" ) ); 00337 00338 // Text 'apache@localhost' is default value of the 'Return e-mail address' text box 00339 $this->assertEquals( "apache@localhost", $this->getValue( "config_wgPasswordSender" ) ); 00340 00341 // 'Logo URL' label available 00342 $this->assertEquals( "Logo URL:", $this->getText( LINK_FORM . "fieldset[2]/div[3]/div[1]/label" ) ); 00343 00344 // 'Logo URL' text box available 00345 $this->assertTrue( $this->isElementPresent( "config_wgLogo" ) ); 00346 00347 // Correct path available in the 'Logo URL' text box 00348 $this->assertEquals( "/wiki/skins/common/images/wiki.png", $this->getValue( "config_wgLogo" ) ); 00349 00350 // 'Enable file uploads' radio button available 00351 $this->assertTrue( $this->isElementPresent( "config_wgEnableUploads" ) ); 00352 00353 // 'Enable file uploads' label available 00354 $this->assertEquals( "Enable file uploads", 00355 $this->getText( LINK_FORM . "fieldset[2]/div[1]/label" ) ); 00356 00357 // 'Enable file uploads' check box is not selected 00358 $this->assertEquals( "off", $this->getValue( "config_wgEnableUploads" ) ); 00359 00360 $this->click( "config_wgEnableUploads" ); 00361 00362 // 'Directory for deleted files' label available 00363 $this->assertEquals( "Directory for deleted files:", 00364 $this->getText( "//div[@id='uploadwrapper']/div/div[1]/label" ) ); 00365 00366 // 'Directory for deleted files' text box available 00367 $this->assertTrue( $this->isElementPresent( "config_wgDeletedDirectory" ) ); 00368 00369 // Correct path available in the 'Directory for deleted files' text box 00370 $this->assertEquals( "C:\\wamp\\www\\" . DIRECTORY_NAME . "/images/deleted", 00371 $this->getValue( "config_wgDeletedDirectory" ) ); 00372 } 00373 00374 public function testInstallPageUI() { 00375 $databaseName = DB_NAME_PREFIX . "_install_UI"; 00376 parent::navigateInstallPage( $databaseName ); 00377 00378 // Verify installation done messages display 00379 $this->assertEquals( "Setting up database... done", 00380 $this->getText( LINK_FORM . "ul/li[1]" ) ); 00381 $this->assertEquals( "Creating tables... done", 00382 $this->getText( LINK_FORM . "ul/li[2]" ) ); 00383 $this->assertEquals( "Creating database user... done", 00384 $this->getText( LINK_FORM . "ul/li[3]" ) ); 00385 $this->assertEquals( "Populating default interwiki table... done", 00386 $this->getText( LINK_FORM . "ul/li[4]" ) ); 00387 $this->assertEquals( "Generating secret key... done", 00388 $this->getText( LINK_FORM . "ul/li[5]" ) ); 00389 $this->assertEquals( "Generating default upgrade key... done", 00390 $this->getText( LINK_FORM . "ul/li[6]" ) ); 00391 $this->assertEquals( "Creating administrator user account... done", 00392 $this->getText( LINK_FORM . "ul/li[7]" ) ); 00393 $this->assertEquals( "Creating main page with default content... done", 00394 $this->getText( LINK_FORM . "ul/li[8]" ) ); 00395 } 00396 00397 public function testCompletePageUI() { 00398 $databaseName = DB_NAME_PREFIX . "_complete_UI"; 00399 parent::navigateCompletePage( $databaseName ); 00400 00401 // 'Congratulations!' text display 00402 $this->assertEquals( "Congratulations!", 00403 $this->getText( LINK_FORM . "div[1]/div[2]/p[1]/b" ) ); 00404 // 'LocalSettings.php' generated message display 00405 $this->assertEquals( "The installer has generated a LocalSettings.php file. It contains all your configuration.", 00406 $this->getText( LINK_FORM . "div[1]/div[2]/p[2]" ) ); 00407 00408 // 'Download LocalSettings.php'' link available 00409 $this->assertTrue( $this->isElementPresent( "link=Download LocalSettings.php" ) ); 00410 00411 // 'enter your wiki' link available 00412 $this->assertTrue( $this->isElementPresent( "link=Folder/index.php enter your wiki" ) ); 00413 } 00414 00415 public function testRestartInstallation() { 00416 parent::navigateConnetToDatabasePage(); 00417 $this->click( "link=Restart installation" ); 00418 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00419 00420 // Restart installation' label should be available. 00421 $this->assertEquals( "Restart installation", $this->getText( LINK_DIV . "h2" ) ); 00422 00423 //'Do you want to clear all saved data that you have entered and restart the installation process?' label available 00424 $this->assertEquals( "Do you want to clear all saved data that you have entered and restart the installation process?", 00425 $this->getText( "//*[@id='bodyContent']/div/div/div[2]/form/div[1]/div[2]" ) ); 00426 // 'Back' button available 00427 $this->assertTrue( $this->isElementPresent( "submit-back" ) ); 00428 00429 // 'Restart' button available 00430 $this->assertTrue( $this->isElementPresent( "submit-restart" ) ); 00431 } 00432 00433 public function testMediaWikiLogoAvailability() { 00434 $databaseName = DB_NAME_PREFIX . "_mediawiki_logo"; 00435 parent::navigateInitialpage(); 00436 parent::mediaWikiLogoPresentInitialScreen(); 00437 $this->click( "link=set up the wiki" ); 00438 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00439 00440 // 'Language' page 00441 parent::mediaWikiLogoPresent(); 00442 parent::clickContinueButton(); 00443 00444 // 'Welcome to MediaWiki' page 00445 parent::mediaWikiLogoPresent(); 00446 parent::clickContinueButton(); 00447 00448 // 'Connet to database' page 00449 parent::mediaWikiLogoPresent(); 00450 $this->type( "mysql_wgDBname", $databaseName ); 00451 parent::clickContinueButton(); 00452 00453 // 'Database setting' page 00454 parent::mediaWikiLogoPresent(); 00455 parent::clickContinueButton(); 00456 00457 // 'Name' page 00458 parent::mediaWikiLogoPresent(); 00459 parent::completeNamePage(); 00460 parent::clickContinueButton(); 00461 00462 // 'Options' page 00463 parent::mediaWikiLogoPresent(); 00464 parent::clickContinueButton(); 00465 00466 // 'Install' page 00467 parent::mediaWikiLogoPresent(); 00468 } 00469 00470 public function testRightFramework() { 00471 parent::navigateLanguagePage(); 00472 // Verfy right framework texts display 00473 $this->assertEquals( "Language", 00474 $this->getText( LINK_RIGHT_FRAMEWORK . "li[1]" ) ); 00475 $this->assertEquals( "Existing wiki", 00476 $this->getText( LINK_RIGHT_FRAMEWORK . "li[2]" ) ); 00477 $this->assertEquals( "Welcome to MediaWiki!", 00478 $this->getText( LINK_RIGHT_FRAMEWORK . "li[3]" ) ); 00479 $this->assertEquals( "Connect to database", 00480 $this->getText( LINK_RIGHT_FRAMEWORK . "li[4]" ) ); 00481 $this->assertEquals( "Upgrade existing installation", 00482 $this->getText( LINK_RIGHT_FRAMEWORK . "li[5]" ) ); 00483 $this->assertEquals( "Database settings", 00484 $this->getText( LINK_RIGHT_FRAMEWORK . "li[6]" ) ); 00485 $this->assertEquals( "Name", 00486 $this->getText( LINK_RIGHT_FRAMEWORK . "li[7]" ) ); 00487 $this->assertEquals( "Options", 00488 $this->getText( LINK_RIGHT_FRAMEWORK . "li[8]" ) ); 00489 $this->assertEquals( "Install", 00490 $this->getText( LINK_RIGHT_FRAMEWORK . "li[9]" ) ); 00491 $this->assertEquals( "Complete!", 00492 $this->getText( LINK_RIGHT_FRAMEWORK . "li[10]/span" ) ); 00493 } 00494 }