2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Selenium parent class for TestCases
6 * @package phpMyAdmin-test
9 // Optionally add the php-client-driver to your include path
10 set_include_path(get_include_path() . PATH_SEPARATOR
. '/opt/selenium-remote-control-1.0.1/selenium-php-client-driver-1.0.1/PEAR/');
12 require_once 'PHPUnit/Framework/TestCase.php';
13 require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
14 require_once 'Testing/Selenium.php';
16 // Include the main phpMyAdmin user config
17 // currently only $cfg['Test'] is used
18 require_once '../config.inc.php';
22 class PmaSeleniumTestCase
extends PHPUnit_Extensions_SeleniumTestCase
27 // TODO: find a way to get this from config.inc.php???
28 // PHPUnit also has a way to use XML configuration... maybe we should use that
29 public static $browsers = array(
32 'name' => 'Firefox on Windows XP',
33 'browser' => '*firefox',
34 'host' => 'my.windowsxp.box',
40 'name' => 'Internet Explorer on Windows XP',
41 'browser' => '*iexplore',
42 'host' => 'my.windowsxp.box',
49 public function setUp()
53 //PHPUnit_Extensions_SeleniumTestCase::$browsers = $this->cfg['Test']['broswers'];
55 // Check if the test configuration is available
56 if ( empty($cfg['Test']['pma_host'])
57 ||
empty($cfg['Test']['pma_url'])
58 //|| empty($cfg['Test']['browsers'])
60 $this->fail("Missing Selenium configuration in config.inc.php"); // TODO add doc ref?
63 $this->setBrowserUrl($cfg['Test']['pma_host'] . $cfg['Test']['pma_url']);
68 public function tearDown()
76 public function doLogin()
78 $this->open($this->cfg
['Test']['pma_url']);
79 // Somehow selenium does not like the language selection on the cookie login page, forced English in the config for now.
80 //$this->select("lang", "label=English");
82 $this->waitForPageToLoad("30000");
83 $this->type("input_username", $this->cfg
['Test']['testuser']['username']);
84 $this->type("input_password", $this->cfg
['Test']['testuser']['password']);
85 $this->click("input_go");
86 $this->waitForPageToLoad("30001");
90 * Just a dummy to show some example statements
92 public function mockTest()
94 // Slow down the testing speed, ideal for debugging
95 //$this->setSpeed(4000);