I have refactored the Create/Drop Database test to handle the AJAX content, it uses waitForElementPresent() method to wait for an ajax response which should be more reliable than sleep(). Next, I have tried to use more of cssSelectors rather than xpaths as cssselectors cope up well with structural changes on the page. Not yet added to AllSeleniumTests.php, waiting for approval.
40 lines
1.3 KiB
PHP
40 lines
1.3 KiB
PHP
<?php
|
|
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
|
/**
|
|
* Selenium TestCase for login related tests
|
|
*
|
|
* @package PhpMyAdmin-test
|
|
* @subpackage Selenium
|
|
*/
|
|
require_once 'PmaSeleniumTestCase.php';
|
|
require_once 'Helper.php';
|
|
|
|
class PmaSeleniumCreateDropDatabaseTest extends PHPUnit_Extensions_SeleniumTestCase
|
|
{
|
|
|
|
public function setUp()
|
|
{
|
|
$helper = new Helper();
|
|
$this->setBrowser(Helper::getBrowserString());
|
|
$this->setBrowserUrl(TESTSUITE_PHPMYADMIN_HOST . TESTSUITE_PHPMYADMIN_URL);
|
|
}
|
|
|
|
public function testCreateDropDatabase()
|
|
{
|
|
$log = new PmaSeleniumTestCase($this);
|
|
$dbname = "pma" . time();
|
|
$log->login(TESTSUITE_USER, TESTSUITE_PASSWORD);
|
|
$this->click("link=Databases");
|
|
$this->waitForElementPresent("id=text_create_db");
|
|
$this->type("id=text_create_db", $dbname);
|
|
$this->click("id=buttonGo");
|
|
$this->waitForElementPresent("css=span.ajax_notification");
|
|
$this->assertElementPresent("css=span.ajax_notification div.success");
|
|
$this->click("css=input[name='selected_dbs[]'][value='". $dbname ."']");
|
|
$this->click("css=button.mult_submit");
|
|
$this->click("css=button:contains('OK')");
|
|
$this->waitForElementPresent("css=span.ajax_notification");
|
|
$this->assertElementPresent("css=span.ajax_notification div.error");
|
|
}
|
|
}
|