MediaWiki
REL1_21
|
00001 <?php 00026 require_once 'PHPUnit/Extensions/SeleniumTestCase.php'; 00027 require_once ( __DIR__ . '/MediaWikiInstallationConfig.php' ); 00028 require_once ( __DIR__ . '/MediaWikiInstallationMessage.php' ); 00029 require_once ( __DIR__ . '/MediaWikiInstallationVariables.php' ); 00030 00031 class MediaWikiInstallationCommonFunction extends PHPUnit_Extensions_SeleniumTestCase { 00032 function setUp() { 00033 $this->setBrowser( TEST_BROWSER ); 00034 $this->setBrowserUrl( "http://" . HOST_NAME . ":" . PORT . "/" . DIRECTORY_NAME . "/" ); 00035 } 00036 00037 public function navigateInitialpage() { 00038 $this->open( "http://" . HOST_NAME . ":" . PORT . "/" . DIRECTORY_NAME . "/" ); 00039 } 00040 00041 // Navigate to the 'Language' page 00042 public function navigateLanguagePage() { 00043 $this->open( "http://" . HOST_NAME . ":" . PORT . "/" . DIRECTORY_NAME . "/config/index.php" ); 00044 } 00045 00046 // Navigate to the 'Welcome to MediaWiki' page 00047 public function navigateWelcometoMediaWikiPage() { 00048 $this->open( "http://" . HOST_NAME . ":" . PORT . "/" . DIRECTORY_NAME . "/config/index.php" ); 00049 $this->click( "submit-continue " ); 00050 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00051 } 00052 00053 // Navigate yo 'Connect to Database' page 00054 public function navigateConnetToDatabasePage() { 00055 $this->open( "http://" . HOST_NAME . ":" . PORT . "/" . DIRECTORY_NAME . "/config/index.php" ); 00056 00057 // 'Welcome to MediaWiki!' page 00058 $this->click( "submit-continue" ); 00059 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00060 00061 // 'Connect to Database' page 00062 $this->click( "submit-continue" ); 00063 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00064 } 00065 00066 // Navigate to the 'Database Settings' page 00067 public function navigateDatabaseSettingsPage( $databaseName ) { 00068 $this->open( "http://" . HOST_NAME . ":" . PORT . "/" . DIRECTORY_NAME . "/config/index.php" ); 00069 00070 // 'Welcome to MediaWiki!' page 00071 $this->click( "submit-continue" ); 00072 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00073 00074 // 'Connect to Database' page 00075 $this->click( "submit-continue" ); 00076 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00077 00078 $this->type( "mysql_wgDBname", $databaseName ); 00079 $this->click( "submit-continue" ); 00080 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00081 } 00082 00083 // Navigate to the 'Name' page 00084 public function navigateNamePage( $databaseName ) { 00085 $this->open( "http://" . HOST_NAME . ":" . PORT . "/" . DIRECTORY_NAME . "/config/index.php" ); 00086 00087 // 'Welcome to MediaWiki!' page 00088 $this->click( "submit-continue" ); 00089 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00090 00091 // 'Connect to Database' page 00092 $this->click( "submit-continue" ); 00093 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00094 00095 $this->type( "mysql_wgDBname", $databaseName ); 00096 $this->click( "submit-continue" ); 00097 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00098 00099 // Database settings 00100 $this->click( "submit-continue" ); 00101 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00102 } 00103 00104 // Navigate 'Options' page 00105 public function navigateOptionsPage( $databaseName ) { 00106 $this->open( "http://" . HOST_NAME . ":" . PORT . "/" . DIRECTORY_NAME . "/config/index.php" ); 00107 00108 // 'Welcome to MediaWiki!' page 00109 $this->click( "submit-continue" ); 00110 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00111 00112 // 'Connect to Database' page 00113 $this->click( "submit-continue" ); 00114 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00115 00116 $this->type( "mysql_wgDBname", $databaseName ); 00117 $this->click( "submit-continue" ); 00118 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00119 00120 // Database settings 00121 $this->click( "submit-continue" ); 00122 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00123 00124 // Name 00125 $this->type( "config_wgSitename", NAME_OF_WIKI ); 00126 $this->type( "config__AdminName", ADMIN_USER_NAME ); 00127 $this->type( "config__AdminPassword", ADMIN_PASSWORD ); 00128 $this->type( "config__AdminPassword2", ADMIN_RETYPE_PASSWORD ); 00129 $this->type( "config__AdminEmail", ADMIN_EMAIL_ADDRESS ); 00130 00131 $this->click( "submit-continue" ); 00132 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00133 } 00134 00135 // Navigate 'Install' page 00136 public function navigateInstallPage( $databaseName ) { 00137 $this->open( "http://" . HOST_NAME . ":" . PORT . "/" . DIRECTORY_NAME . "/config/index.php" ); 00138 00139 // 'Welcome to MediaWiki!' page 00140 $this->click( "submit-continue" ); 00141 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00142 00143 // 'Connect to Database' page 00144 $this->click( "submit-continue" ); 00145 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00146 00147 $this->type( "mysql_wgDBname", $databaseName ); 00148 $this->click( "submit-continue" ); 00149 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00150 00151 // Database settings 00152 $this->click( "submit-continue" ); 00153 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00154 00155 // Name 00156 $this->type( "config_wgSitename", NAME_OF_WIKI ); 00157 $this->type( "config__AdminName", ADMIN_USER_NAME ); 00158 $this->type( "config__AdminPassword", ADMIN_PASSWORD ); 00159 $this->type( "config__AdminPassword2", ADMIN_RETYPE_PASSWORD ); 00160 $this->type( "config__AdminEmail", ADMIN_EMAIL_ADDRESS ); 00161 00162 $this->click( "submit-continue" ); 00163 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00164 00165 // Options page 00166 $this->click( "submit-continue" ); 00167 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00168 } 00169 00170 // Navigate to 'Complete' page 00171 public function navigateCompletePage( $databaseName ) { 00172 $this->open( "http://" . HOST_NAME . ":" . PORT . "/" . DIRECTORY_NAME . "/config/index.php" ); 00173 00174 // 'Welcome to MediaWiki!' page 00175 $this->click( "submit-continue" ); 00176 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00177 00178 // 'Connect to Database' page 00179 $this->click( "submit-continue" ); 00180 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00181 00182 $this->type( "mysql_wgDBname", $databaseName ); 00183 $this->click( "submit-continue" ); 00184 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00185 00186 // Database settings 00187 $this->click( "submit-continue" ); 00188 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00189 00190 // Name 00191 $this->type( "config_wgSitename", NAME_OF_WIKI ); 00192 $this->type( "config__AdminName", ADMIN_USER_NAME ); 00193 $this->type( "config__AdminPassword", ADMIN_PASSWORD ); 00194 $this->type( "config__AdminPassword2", ADMIN_RETYPE_PASSWORD ); 00195 $this->type( "config__AdminEmail", ADMIN_EMAIL_ADDRESS ); 00196 00197 $this->click( "submit-continue" ); 00198 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00199 00200 // Options page 00201 $this->click( "submit-continue" ); 00202 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00203 00204 // Install page 00205 $this->click( "submit-continue" ); 00206 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00207 $this->chooseCancelOnNextConfirmation(); 00208 } 00209 00210 // Complete the Name page fields 00211 public function completeNamePage() { 00212 $this->type( "config_wgSitename", NAME_OF_WIKI ); 00213 $this->type( "config__AdminName", ADMIN_USER_NAME ); 00214 $this->type( "config__AdminPassword", ADMIN_PASSWORD ); 00215 $this->type( "config__AdminPassword2", ADMIN_RETYPE_PASSWORD ); 00216 $this->type( "config__AdminEmail", ADMIN_EMAIL_ADDRESS ); 00217 $this->click( "submit-continue" ); 00218 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00219 } 00220 00221 // Clicking on the 'Continue' button in any MediaWiki page 00222 public function clickContinueButton() { 00223 $this->click( "submit-continue" ); 00224 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00225 } 00226 00227 // Clicking on the 'Back' button in any MediaWiki page 00228 public function clickBackButton() { 00229 $this->click( "submit-back" ); 00230 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00231 } 00232 00233 // Restarting the installation 00234 public function restartInstallation() { 00235 $this->click( "link=Restart installation" ); 00236 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00237 $this->click( "submit-restart" ); 00238 $this->waitForPageToLoad( PAGE_LOAD_TIME ); 00239 } 00240 00241 // Verify 'MediaWiki' logo available in the initial screen 00242 public function mediaWikiLogoPresentInitialScreen() { 00243 $this->assertTrue( $this->isElementPresent( "//img[@alt='The MediaWiki logo']" ) ); 00244 } 00245 00246 // Verify 'MediaWiki' logo available 00247 public function mediaWikiLogoPresent() { 00248 $this->assertTrue( $this->isElementPresent( "//div[@id='p-logo']/a" ) ); 00249 } 00250 00251 public function completePageSuccessfull() { 00252 $this->assertEquals( "Complete!", 00253 $this->getText( "//div[@id='bodyContent']/div/div/h2" ) ); 00254 00255 // 'Congratulations!' text should be available in the 'Complete!' page. 00256 $this->assertEquals( "Congratulations!", 00257 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/div[1]/div[2]/p[1]/b" ) ); 00258 } 00259 }