4 * TODO: remove this feature
7 class SpecialSelenium
extends SpecialPage
{
8 function __construct() {
9 parent
::__construct( 'Selenium', 'selenium', false );
12 function getDescription() {
17 global $wgUser, $wgOut, $wgEnableSelenium, $wgRequest;
19 if ( !$wgEnableSelenium ) {
20 throw new MWException(
21 'Selenium special page invoked when it should not be registered!' );
25 if ( !$this->userCanExecute( $wgUser ) ) {
26 $this->displayRestrictionError();
30 if ( $wgRequest->wasPosted() && $wgUser->matchEditToken( $wgRequest->getVal( 'token' ) ) ) {
34 Html
::openElement( 'form', array(
36 'action' => $this->getTitle()->getLocalUrl(),
38 Html
::input( 'submit', 'Run tests', 'submit' ) .
39 Html
::hidden( 'token', $wgUser->editToken() ) .
45 global $wgSeleniumTests, $wgOut;
46 SeleniumLoader
::load();
48 $result = new PHPUnit_Framework_TestResult
;
49 $logger = new SeleniumTestHTMLLogger
;
50 $result->addListener( new SeleniumTestListener( $logger ) );
51 $logger->setHeaders();
54 $suite = new SeleniumTestSuite
;
55 foreach ( $wgSeleniumTests as $testClass ) {
56 $suite->addTest( new $testClass );
58 $wgOut->addHTML( '<div class="selenium">' );
59 $suite->run( $result );
60 $wgOut->addHTML( '</div>' );