Difference between revisions of "Selenium.php"

From Organic Design wiki
m
m
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{legacy}}
 +
<php>
 
<?php
 
<?php
 
/**
 
/**
 
  * Selenium extension
 
  * Selenium extension
  * {{php}}
+
  *
 
  * See http://www.mediawiki.org/Extension:Selenium for installation and usage details
 
  * See http://www.mediawiki.org/Extension:Selenium for installation and usage details
 
  * See http://www.organicdesign.co.nz/Extension_talk:Selenium.php for development notes and disucssion
 
  * See http://www.organicdesign.co.nz/Extension_talk:Selenium.php for development notes and disucssion
Line 15: Line 17:
 
if (!defined('MEDIAWIKI')) die('Not an entry point.');
 
if (!defined('MEDIAWIKI')) die('Not an entry point.');
  
define('SELENIUM_VERSION', '0.8.0, 2008-08-02');
+
define('SELENIUM_VERSION', '0.8.1, 2008-08-27');
  
 
$dir                = dirname(__FILE__);
 
$dir                = dirname(__FILE__);
$egSeleniumPath    = preg_replace('|^.+(?=[/\\\\]extensions)|', $wgScriptPath, $dir).'/selenium-core';
+
$egSeleniumPath    = preg_replace("|^.+(?=[/\\\\]extensions)|", $wgScriptPath, $dir)."/selenium-core";
 
$egResultsUrlPath  = "../../tmp/results.php";
 
$egResultsUrlPath  = "../../tmp/results.php";
$egSeleniumCategory = "Selenium test suites"         # Category that selenium tests will automatically be categorised in
+
$egSeleniumCategory = "Selenium test suites"# Category that selenium tests will automatically be categorised in
$egSeleniumTag      = "selenium";                     # Name of tags to wrap selenium tests in
+
$egSeleniumTag      = 'selenium';               # Name of tags to wrap selenium tests in
$egSeleniumSchdeule = array('03:00','10:30','23:20'); # Times each day that the enabled tests should be run
+
$egSeleniumSchdeule = array();                 # Times, tests and domains, see http://www.mediawiki.org/wiki/Extension:Selenium
$egSeleniumEnabled  = "Mediawiki:Scheduled tests";    # Article in which the test to run on the schedule are listed
+
$egSeleniumLog      = "MediaWiki:Selenium log"; # Article that scheduled test runs should be logged to
$egSeleniumLog      = "MediaWiki:Scheduled test log"; # Article that scheduled test runs should be logged to
 
  
 
$wgSpecialPages['Selenium']          = 'SpecialSelenium';
 
$wgSpecialPages['Selenium']          = 'SpecialSelenium';
Line 33: Line 34:
 
$wgExtensionCredits['specialpage'][]  = array(
 
$wgExtensionCredits['specialpage'][]  = array(
 
'name'        => 'Selenium',
 
'name'        => 'Selenium',
'author'      => '[http://www.organicdesign.co.nz/User:Sven Sven], [http://www.organicdesign.co.nz/User:Nad Nad]',
+
'author'      => "[http://www.organicdesign.co.nz/User:Sven Sven], [http://www.organicdesign.co.nz/User:Nad Nad]",
'description' => 'Incorporating [http://selenium-core.openqa.org Selenium tests] into the MediaWiki environment',
+
'description' => "Incorporating [http://selenium-core.openqa.org Selenium tests] into the MediaWiki environment",
'url'        => 'http://www.mediawiki.org/Extension:Selenium',
+
'url'        => "http://www.mediawiki.org/wiki/Extension:Selenium",
 
'version'    => SELENIUM_VERSION
 
'version'    => SELENIUM_VERSION
 
);
 
);
Line 52: Line 53:
 
$wgMessageCache->addMessages(array(
 
$wgMessageCache->addMessages(array(
 
'selenium'            => "Selenium test management",
 
'selenium'            => "Selenium test management",
'selenium-select'    => "Select a test suite to run",
+
'selenium-run'       => "Run test manually",
'selenium-runmanual'  => "Run tests manually",
+
'selenium-last'       => "Last log entry",
'selenium-manage'     => "Manage automatic testing schedule",
+
'selenium-schedule'  => "Run suite on these domains daily at $1",
'selenium-schedule'  => "Select which test suites should be run automatically at $1 each day",
 
 
'selenium-create'    => "Create new tests",
 
'selenium-create'    => "Create new tests",
 
'selenium-createinfo' => "Use the [$1 Selenium IDE] environrment to create new tests.",
 
'selenium-createinfo' => "Use the [$1 Selenium IDE] environrment to create new tests.",
'selenium-failinfo'   => "When tests fail, the information will be appended to [[$1]]."
+
'selenium-loginfo'   => "Information from tests run on schedule is logged in [[$1]]."
 
));
 
));
 
}
 
}
Line 75: Line 75:
 
return true;
 
return true;
 
}
 
}
 +
</php>

Latest revision as of 00:15, 25 September 2013

Legacy.svg Legacy: This article describes a concept that has been superseded in the course of ongoing development on the Organic Design wiki. Please do not develop this any further or base work on this concept, this is only useful for a historic record of work done. You may find a link to the currently used concept or function in this article, if not you can contact the author to find out what has taken the place of this legacy item.

<php> <?php /**

* Selenium extension
*
* See http://www.mediawiki.org/Extension:Selenium for installation and usage details
* See http://www.organicdesign.co.nz/Extension_talk:Selenium.php for development notes and disucssion
* 
* @package MediaWiki
* @subpackage Extensions
* @author Marcus Davy User:Sven
* @copyright © 2007 Marcus Davy
* @licence GNU General Public Licence 2.0 or later
*/

if (!defined('MEDIAWIKI')) die('Not an entry point.');

define('SELENIUM_VERSION', '0.8.1, 2008-08-27');

$dir = dirname(__FILE__); $egSeleniumPath = preg_replace("|^.+(?=[/\\\\]extensions)|", $wgScriptPath, $dir)."/selenium-core"; $egResultsUrlPath = "../../tmp/results.php"; $egSeleniumCategory = "Selenium test suites"; # Category that selenium tests will automatically be categorised in $egSeleniumTag = 'selenium'; # Name of tags to wrap selenium tests in $egSeleniumSchdeule = array(); # Times, tests and domains, see http://www.mediawiki.org/wiki/Extension:Selenium $egSeleniumLog = "MediaWiki:Selenium log"; # Article that scheduled test runs should be logged to

$wgSpecialPages['Selenium'] = 'SpecialSelenium'; $wgAutoloadClasses['SpecialSelenium'] = "$dir/SpecialSelenium.php"; $wgAutoloadClasses['Selenium'] = "$dir/Selenium.class.php"; $wgExtensionFunctions[] = 'efSetupSelenium'; $wgHooks['LanguageGetMagic'][] = 'efSeleniumLanguageGetMagic'; $wgExtensionCredits['specialpage'][] = array( 'name' => 'Selenium', 'author' => "Sven, Nad", 'description' => "Incorporating Selenium tests into the MediaWiki environment", 'url' => "http://www.mediawiki.org/wiki/Extension:Selenium", 'version' => SELENIUM_VERSION );

function efSetupSelenium() { global $wgRequest, $wgOut, $egSelenium, $wgLanguageCode, $wgMessageCache;

# If requesting a suite or inidividual test, then output will be raw if ($wgRequest->getText('suite')) { $wgOut->disable(); wfResetOutputBuffers(); }

# Add the messages used by the specialpage if ($wgLanguageCode == 'en') { $wgMessageCache->addMessages(array( 'selenium' => "Selenium test management", 'selenium-run' => "Run test manually", 'selenium-last' => "Last log entry", 'selenium-schedule' => "Run suite on these domains daily at $1", 'selenium-create' => "Create new tests", 'selenium-createinfo' => "Use the [$1 Selenium IDE] environrment to create new tests.", 'selenium-loginfo' => "Information from tests run on schedule is logged in $1." )); }

# Add specialpage and create an instance of the class SpecialPage::addPage(new SpecialSelenium()); $egSelenium = new Selenium(); }

/**

* Needed in MediaWiki >1.8.0 for magic word hooks to work properly
*/

function efSeleniumLanguageGetMagic(&$magicWords, $langCode = 0) { global $egSeleniumMagic; $magicWords[$egSeleniumMagic] = array($langCode, $egSeleniumMagic); return true; } </php>