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