2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Selenium TestCase for table related tests
6 * @package PhpMyAdmin-test
10 require_once 'TestBase.php';
13 * PmaSeleniumDbStructureTest class
15 * @package PhpMyAdmin-test
16 * @subpackage Selenium
19 class PMA_SeleniumDbStructureTest
extends PMA_SeleniumBase
22 * Setup the browser environment to run the selenium test case
26 public function setUp()
30 "CREATE TABLE `test_table` ("
31 . " `id` int(11) NOT NULL AUTO_INCREMENT,"
32 . " `val` int(11) NOT NULL,"
33 . " PRIMARY KEY (`id`)"
37 "CREATE TABLE `test_table2` ("
38 . " `id` int(11) NOT NULL AUTO_INCREMENT,"
39 . " `val` int(11) NOT NULL,"
40 . " PRIMARY KEY (`id`)"
44 "INSERT INTO `test_table` (val) VALUES (2);"
49 * setUp function that can use the selenium session (called before each test)
53 public function setUpPage()
56 $this->waitForElement('byLinkText', $this->database_name
)->click();
57 $this->waitForElement(
61 $this->waitForElement(
62 "byXPath", "//a[contains(., 'test_table')]"
67 * Test for truncating a table
73 public function testTruncateTable()
75 $this->byXPath("(//a[contains(., 'Empty')])[1]")->click();
77 $this->waitForElement(
79 "//button[contains(., 'OK')]"
83 $this->waitForElement(
85 "//div[@class='success' and contains(., "
86 . "'MySQL returned an empty result')]"
90 $result = $this->dbQuery("SELECT count(*) as c FROM test_table");
91 $row = $result->fetch_assoc();
92 $this->assertEquals(0, $row['c']);
96 * Tests for dropping multiple tables
102 public function testDropMultipleTables()
104 $this->byCssSelector("label[for='tablesForm_checkall']")->click();
105 $this->select($this->byName("submit_mult"))
106 ->selectOptionByLabel("Drop");
107 $this->waitForElement("byId", "buttonYes")
110 $this->waitForElement(
112 "//p[contains(., 'No tables found in database')]"
115 $result = $this->dbQuery("SHOW TABLES;");
116 $this->assertEquals(0, $result->num_rows
);