Fix support for TestSwarm on SpecialJavaScriptTest/qunit
[lhc/web/wiklou.git] / tests / qunit / index.html
index abd4104..c0557ec 100644 (file)
@@ -2,13 +2,53 @@
 <html>
 <head>
        <title>MediaWiki JavaScript Test Suite</title>
-
+       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <!-- MediaWiki Modules -->
 
        <!-- MW: startup -->
        <script>
        function startUp(){
                mw.config = new mw.Map( false );
+
+               /**
+                * Simulate an average mw.config context
+                */
+               /* StartUp module */
+               mw.config.set({"wgLoadScript": "/mw/trunk/phase3/load.php", "debug": true, "skin": "vector", "stylepath": "/mw/trunk/phase3/skins", "wgUrlProtocols": "http\\:\\/\\/|https\\:\\/\\/|ftp\\:\\/\\/|irc\\:\\/\\/|ircs\\:\\/\\/|gopher\\:\\/\\/|telnet\\:\\/\\/|nntp\\:\\/\\/|worldwind\\:\\/\\/|mailto\\:|news\\:|svn\\:\\/\\/|git\\:\\/\\/|mms\\:\\/\\/|\\/\\/", "wgArticlePath": "/mw/trunk/phase3/index.php/$1", "wgScriptPath": "/mw/trunk/phase3", "wgScriptExtension": ".php", "wgScript": "/mw/trunk/phase3/index.php", "wgVariantArticlePath": false, "wgActionPaths": [], "wgServer": "http://localhost", "wgUserLanguage": "en", "wgContentLanguage": "en", "wgVersion": "1.19alpha", "wgEnableAPI": true, "wgEnableWriteAPI": true, "wgDefaultDateFormat": "dmy", "wgMonthNames": ["", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], "wgMonthNamesShort": ["", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], "wgMainPageTitle": "Main Page", "wgFormattedNamespaces": {"-2": "Media", "-1": "Special", "0": "", "1": "Talk", "2": "User", "3": "User talk", "4": "Testopedia", "5": "Testopedia talk", "6": "File", "7": "File talk", "8": "MediaWiki", "9": "MediaWiki talk", "10": "Template", "11": "Template talk", "12": "Help", "13": "Help talk", "14": "Category", "15": "Category talk"}, "wgNamespaceIds": {"media": -2, "special": -1, "": 0, "talk": 1, "user": 2, "user_talk": 3, "testopedia": 4, "testopedia_talk": 5, "file": 6, "file_talk": 7, "mediawiki": 8, "mediawiki_talk": 9, "template": 10, "template_talk": 11, "help": 12, "help_talk": 13, "category": 14, "category_talk": 15, "image": 6, "image_talk": 7, "project": 4, "project_talk": 5}, "wgSiteName": "Testopedia", "wgFileExtensions": ["png", "gif", "jpg", "jpeg"], "wgDBname": "mediawiki", "wgFileCanRotate": true, "wgAvailableSkins": {"chick": "Chick", "cologneblue": "CologneBlue", "modern": "Modern", "monobook": "MonoBook", "myskin": "MySkin", "nostalgia": "Nostalgia", "simple": "Simple", "standard": "Standard", "vector": "Vector"}, "wgExtensionAssetsPath": "/mw/trunk/phase3/extensions", "wgCookiePrefix": "mediawiki", "wgResourceLoaderMaxQueryLength": -1, "wgCaseSensitiveNamespaces": []});
+               
+               /* WikiPage specific */
+               mw.config.set({"wgCanonicalNamespace": "", "wgCanonicalSpecialPageName": false, "wgNamespaceNumber": 0, "wgPageName": "Sandbox", "wgTitle": "Sandbox", "wgCurRevisionId": 486, "wgArticleId": 84, "wgIsArticle": true, "wgAction": "view", "wgUserName": null, "wgUserGroups": ["*"], "wgCategories": [], "wgBreakFrames": false, "wgPageContentLanguage": "en", "wgSeparatorTransformTable": ["", ""], "wgDigitTransformTable": ["", ""], "wgRestrictionEdit": [], "wgRestrictionMove": [], "wgRedirectedFrom": "Sandbox"});
+
+               /* Special:JavaScriptTest/qunit specific */
+               mw.config.set({"QUnitTestSwarmInjectJSPath": false});
+
+               /**
+                * Fix wgScriptPath and the like to the real thing,
+                * instead of fake ones (for access to /tests/qunit/data/)
+                */
+
+               // Regular expression to extract the path for the QUnit tests
+               // Takes into account that tests could be run from a file:// URL
+               // by excluding the 'index.html' part from the URL
+               var rePath = /(?:[^#\?](?!index.html))*\/?/;
+
+               // Extract path to /tests/qunit/
+               var qunitTestsPath = rePath.exec( location.pathname )[0];
+
+               // Traverse up to script path
+               var pathParts = qunitTestsPath.split( '/' );
+               pathParts.pop(); pathParts.pop(); pathParts.pop();
+               var scriptPath = pathParts.join( '/' );
+               
+               mw.config.set({
+                       "wgServer": location.protocol + '//' + location.host,
+                       "wgScriptPath": scriptPath,
+                       "wgLoadScript": scriptPath + '/load.php',
+                       "stylepath": scriptPath + '/skins',
+                       "wgArticlePath": scriptPath + '/index.php/$1',
+                       "wgScript": scriptPath + '/index.php',
+                       "wgExtensionAssetsPath": scriptPath + '/extensions'
+               });
        }
        </script>
 
        <script src="../../resources/jquery/jquery.js"></script>
        <script src="../../resources/mediawiki/mediawiki.js"></script>
 
-       <!-- MW: mediawiki.page.startup -->
+       <!-- MW: mediawiki.user|mediawiki.util|mediawiki.page.startup|mediawiki.page.ready -->
        <script src="../../resources/jquery/jquery.client.js"></script>
-       <script src="../../resources/mediawiki.page/mediawiki.page.startup.js"></script>
-
-       <!-- MW: mediawiki.user|mediawiki.util|mediawiki.page.ready -->
        <script src="../../resources/jquery/jquery.cookie.js"></script>
        <script src="../../resources/mediawiki/mediawiki.user.js"></script>
 
        <script src="../../resources/jquery/jquery.messageBox.js"></script>
        <script src="../../resources/jquery/jquery.mwExtension.js"></script>
        <script src="../../resources/mediawiki/mediawiki.util.js"></script>
+       <script src="../../resources/mediawiki.page/mediawiki.page.startup.js"></script>
 
        <script src="../../resources/jquery/jquery.checkboxShiftClick.js"></script>
        <script src="../../resources/jquery/jquery.makeCollapsible.js"></script>
        <script src="../../resources/jquery/jquery.byteLength.js"></script>
        <script src="../../resources/jquery/jquery.byteLimit.js"></script>
        <script src="../../resources/jquery/jquery.colorUtil.js"></script>
+       <script src="../../resources/jquery/jquery.delayedBind.js"></script>
        <script src="../../resources/jquery/jquery.getAttrs.js"></script>
        <script src="../../resources/jquery/jquery.highlightText.js"></script>
        <script src="../../resources/jquery/jquery.localize.js"></script>
        <script src="../../resources/jquery/jquery.tabIndex.js"></script>
        <script src="../../resources/jquery/jquery.tablesorter.js"></script>
        <script src="../../resources/jquery/jquery.textSelection.js"></script>
-       <script src="../../resources/mediawiki/mediawiki.title.js"></script>
+       <script src="../../resources/mediawiki/mediawiki.Title.js"></script>
+       <script src="../../resources/mediawiki.language/mediawiki.language.js"></script>
+       <script src="../../resources/mediawiki/mediawiki.jqueryMsg.js"></script>
        <script src="../../resources/mediawiki.special/mediawiki.special.js"></script>
        <script src="../../resources/mediawiki.special/mediawiki.special.recentchanges.js"></script>
 
        <script src="data/testrunner.js"></script>
 
        <!-- QUnit: Load test suites (maintain the same order as above please) -->
+       <script src="suites/resources/mediawiki/mediawiki.jscompat.test.js"></script>
        <script src="suites/resources/mediawiki/mediawiki.test.js"></script>
        <script src="suites/resources/mediawiki/mediawiki.user.test.js"></script>
 
        <script src="suites/resources/jquery/jquery.byteLength.test.js"></script>
        <script src="suites/resources/jquery/jquery.byteLimit.test.js"></script>
        <script src="suites/resources/jquery/jquery.colorUtil.test.js"></script>
+       <script src="suites/resources/jquery/jquery.delayedBind.test.js"></script>
        <script src="suites/resources/jquery/jquery.getAttrs.test.js"></script>
        <script src="suites/resources/jquery/jquery.highlightText.test.js"></script>
        <script src="suites/resources/jquery/jquery.localize.test.js"></script>
        <script src="suites/resources/jquery/jquery.tabIndex.test.js"></script>
        <script src="suites/resources/jquery/jquery.tablesorter.test.js" charset="UTF-8"></script>
        <script src="suites/resources/jquery/jquery.textSelection.test.js" charset="UTF-8"></script>
-       <script src="suites/resources/mediawiki/mediawiki.title.test.js"></script>
+       <script src="suites/resources/mediawiki/mediawiki.Title.test.js"></script>
+       <script src="suites/resources/mediawiki/mediawiki.jqueryMsg.test.js"></script>
        <script src="suites/resources/mediawiki.special/mediawiki.special.recentchanges.test.js"></script>
 </head>
 <body>
        </div>
        <h2 id="qunit-userAgent"></h2>
        <ol id="qunit-tests"></ol>
+       <div id="qunit-fixture"></div>
 
 <!-- Scripts inserting stuff here shall remove it themselfs! -->
 <div id="content"></div>