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