Small changes in Selenium tests configuration

This commit is contained in:
Zarubin Stas 2011-07-14 07:45:20 +03:00
parent 05a79cbbf8
commit b309cf3e98
3 changed files with 20 additions and 22 deletions

View File

@ -19,7 +19,7 @@
</target>
<target name="phpunit" description="Run unit tests using PHPUnit and generates junit.xml and clover.xml">
<exec executable="phpunit" failonerror="true">
<exec executable="phpunit">
<arg line="--configuration phpunit.xml.dist"/>
</exec>
</target>

View File

@ -11,13 +11,20 @@
host="127.0.0.1"
port="4444"
timeout="30000"/>
<browser name="Google Chrome on localhost"
browser="googlechrome"
host="127.0.0.1"
port="4444"
timeout="30000"/>
</selenium>
<php>
<const name="TESTSUITE_SERVER" value="localhost"/>
<const name="TESTSUITE_DATABASE" value="test_database"/>
<const name="TESTSUITE_USER" value="test_user"/>
<const name="TESTSUITE_PASSWORD" value="test_password"/>
<const name="TESTSUITE_SERVER" value="localhost"/>
<const name="TESTSUITE_USER" value="root"/>
<const name="TESTSUITE_PASSWORD" value=""/>
<const name="TESTSUITE_DATABASE" value="test"/>
<const name="TESTSUITE_PHPMYADMIN_HOST" value="http://localhost" />
<const name="TESTSUITE_PHPMYADMIN_URL" value="/phpmyadmin" />
</php>
<testsuites>
@ -27,8 +34,11 @@
<directory suffix="_test.php">test/libraries/common</directory>
<directory suffix="_test.php">test/libraries</directory>
</testsuite>
<testsuite name="Classes">
<directory suffix="_test.php">test/classes</directory>
</testsuite>
<testsuite name="Selenium">
<!--<directory suffix="Test.php">test/selenium</directory>-->
<directory suffix="Test.php">test/selenium</directory>
</testsuite>
</testsuites>

View File

@ -10,10 +10,6 @@
// Optionally add the php-client-driver to your include path
//set_include_path(get_include_path() . PATH_SEPARATOR . '/opt/selenium-remote-control-1.0.1/selenium-php-client-driver-1.0.1/PEAR/');
require_once 'PHPUnit/Framework/TestCase.php';
require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
require_once 'Testing/Selenium.php';
// Include the main phpMyAdmin user config
// currently only $cfg['Test'] is used
require_once 'config.sample.inc.php';
@ -35,15 +31,7 @@ class PmaSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase
$this->cfg =& $cfg;
//PHPUnit_Extensions_SeleniumTestCase::$browsers = $this->cfg['Test']['broswers'];
// Check if the test configuration is available
if ( empty($cfg['Test']['pma_host'])
|| empty($cfg['Test']['pma_url'])
//|| empty($cfg['Test']['browsers'])
) {
$this->markTestSkipped("Missing Selenium configuration in config.inc.php"); // TODO add doc ref?
}
$this->setBrowserUrl($cfg['Test']['pma_host'] . $cfg['Test']['pma_url']);
$this->setBrowserUrl(TESTSUITE_PHPMYADMIN_HOST . TESTSUITE_PHPMYADMIN_URL);
$this->start();
}
@ -58,13 +46,13 @@ class PmaSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase
*/
public function doLogin()
{
$this->open($this->cfg['Test']['pma_url']);
$this->open(TESTSUITE_PHPMYADMIN_URL);
// Somehow selenium does not like the language selection on the cookie login page, forced English in the config for now.
//$this->select("lang", "label=English");
$this->waitForPageToLoad("30000");
$this->type("input_username", $this->cfg['Test']['testuser']['username']);
$this->type("input_password", $this->cfg['Test']['testuser']['password']);
$this->type("input_username", TESTSUITE_USER);
$this->type("input_password", TESTSUITE_PASSWORD);
$this->click("input_go");
$this->waitForPageToLoad("30001");
}