コード例 #1
0
    /**
     * Test for dropping event
     *
     * @return void
     */
    public function testDropEvent()
    {
        $this->_eventSQL();
        $more = $this->_helper->waitForElement("byLinkText", "More");
        $this->moveto($more);
        $ele = $this->_helper->waitForElement("byPartialLinkText", "Events");
        $ele->click();

        $this->_helper->waitForElement(
            "byXPath",
            "//legend[contains(., 'Events')]"
        );

        $this->byLinkText("Drop")->click();
        $this->_helper->waitForElement(
            "byXPath", "//button[contains(., 'OK')]"
        )->click();

        $this->_helper->waitForElement("byId", "nothing2display");

        usleep(1000000);
        $result = $this->_helper->dbQuery(
            "SHOW EVENTS WHERE Db='" . $this->_dbname . "' AND Name='test_event'"
        );
        $this->assertEquals(0, $result->num_rows);
    }
コード例 #2
0
    /**
     * Test for dropping Trigger
     *
     * @return void
     */
    public function testDropTrigger()
    {
        $this->_triggerSQL();
        $more = $this->_helper->waitForElement("byLinkText", "More");
        $this->moveto($more);
        $ele = $this->_helper->waitForElement("byPartialLinkText", "Triggers");
        $ele->click();

        $this->_helper->waitForElement(
            "byXPath",
            "//legend[contains(., 'Triggers')]"
        );

        $this->byLinkText("Drop")->click();
        $this->_helper->waitForElement(
            "byXPath", "//button[contains(., 'OK')]"
        )->click();

        $this->_helper->waitForElement("byId", "nothing2display");

        $result = $this->_helper->dbQuery(
            "SHOW TRIGGERS FROM `" . $this->_dbname . "`;"
        );
        $this->assertEquals(0, $result->num_rows);
    }
コード例 #3
0
    /**
     * Tests if hiding the logo works or not
     *
     * @return void
     */
    public function testHideLogo()
    {
        $this->byLinkText("Navigation panel")->click();

        $this->_helper->waitForElement("byName", "NavigationDisplayLogo")
            ->click();
        $this->byName("submit_save")->click();
        $this->_helper->waitForElement(
            "byXPath",
            "//div[@class='success' and contains(., 'Configuration has been saved')]"
        );
        $this->assertFalse(
            $this->_helper->isElementPresent("byId", "imgpmalogo")
        );

        $this->byCssSelector("a[href='#NavigationDisplayLogo']")->click();
        $this->byName("submit_save")->click();
        $this->_helper->waitForElement(
            "byXPath",
            "//div[@class='success' and contains(., 'Configuration has been saved')]"
        );
        $this->assertTrue(
            $this->_helper->isElementPresent("byId", "imgpmalogo")
        );
    }
コード例 #4
0
    /**
     * Creates and removes a user
     *
     * @return void
     */
    public function testCreateRemoveUser()
    {
        $this->_helper->login(TESTSUITE_USER, TESTSUITE_PASSWORD);
        $this->byLinkText("Users")->click();

        $link = $this->_helper->waitForElement("byLinkText", "Add user");
        $link->click();

        $userField = $this->_helper->waitForElement("byName", "username");
        $userField->value($this->_txtUsername);

        $select = $this->select($this->byId("select_pred_hostname"));
        $select->selectOptionByLabel("Local");

        $this->byId("button_generate_password")->click();
        $this->assertNotEquals("", $this->byId("text_pma_pw")->value());
        $this->assertNotEquals("", $this->byId("text_pma_pw2")->value());
        $this->assertNotEquals("", $this->byId("generated_pw")->value());

        $this->byId("text_pma_pw")->value($this->_txtPassword);
        $this->byId("text_pma_pw2")->value($this->_txtPassword);
        $this->byId("createdb-1")->click();
        $this->byId("createdb-2")->click();
        $this->byId("addUsersForm_checkall")->click();
        $this->byName("adduser_submit")->click();

        $success = $this->_helper->waitForElement("byCssSelector", "div.success");
        $this->assertContains('You have added a new user', $success->text());

        $el = $this->_helper->waitForElement("byId", "usersForm");
        $temp = $this->_txtUsername."localhost";

        $this->byXPath(
            "(//input[@name='selected_usr[]'])[@value='".$temp."']"
        )->click();

        $this->byId("checkbox_drop_users_db")->click();
        $this->acceptAlert();
        $this->byId("buttonGo")->click();

        $success = $this->_helper->waitForElement("byCssSelector", "div.success");
        $this->assertContains(
            'The selected users have been deleted',
            $success->text()
        );
    }
コード例 #5
0
 /**
  * Execute procedure
  *
  * @param string $text   String to pass as inp param
  * @param int    $length Expected output length
  *
  * @return void
  */
 private function _executeProcedure($text, $length)
 {
     $this->_helper->waitForElement("byLinkText", "Execute")->click();
     $this->_helper->waitForElement("byName", "params[inp]")->value($text);
     $this->byCssSelector("div.ui-dialog-buttonset button:nth-child(1)")->click();
     $this->_helper->waitForElement(
         "byCssSelector",
         "span#PMA_slidingMessage table tbody"
     );
     $head = $this->byCssSelector("span#PMA_slidingMessage table tbody")->text();
     $this->assertEquals("outp\n$length", $head);
 }
コード例 #6
0
 /**
  * Function that goes to the import page, uploads a file and submit form
  *
  * @param string $type level: server, db or import
  *
  * @return void
  */
 private function _doImport($type)
 {
     $this->byLinkText("Import")->click();
     $ele = $this->_helper->waitForElement("byId", "input_import_file");
     $ele->value(
         dirname(__FILE__) . "/../test_data/" . $type . "_import.sql"
     );
     $this->byId("buttonGo")->click();
     $this->_helper->waitForElement(
         "byXPath",
         "//div[@class='success' and contains(., 'Import has been successfully')]"
     );
 }
コード例 #7
0
    /**
     * Assert various data present in results table
     *
     * @return void
     */
    private function _assertDataPresent()
    {
        $this->byLinkText("Browse")->click();
        $this->_helper->waitForElement("byId", "table_results");

        $this->assertEquals(
            "1",
            $this->_helper->getTable("table_results.1.5")
        );

        $this->assertEquals(
            "abcd",
            $this->_helper->getTable("table_results.1.6")
        );

        $this->assertEquals(
            "2011-01-20 02:00:02",
            $this->_helper->getTable("table_results.1.7")
        );

        $this->assertEquals(
            "2",
            $this->_helper->getTable("table_results.2.5")
        );

        $this->assertEquals(
            "foo",
            $this->_helper->getTable("table_results.2.6")
        );

        $this->assertEquals(
            "2010-01-20 02:00:02",
            $this->_helper->getTable("table_results.2.7")
        );

        $this->assertEquals(
            "3",
            $this->_helper->getTable("table_results.3.5")
        );

        $this->assertEquals(
            "Abcd",
            $this->_helper->getTable("table_results.3.6")
        );

        $this->assertEquals(
            "2012-01-20 02:00:02",
            $this->_helper->getTable("table_results.3.7")
        );
    }
コード例 #8
0
    /**
     * Tests for dropping multiple tables
     *
     * @return void
     */
    public function testDropMultipleTables()
    {
        $this->byCssSelector("label[for='tablesForm_checkall']")->click();
        $this->select($this->byName("submit_mult"))
            ->selectOptionByLabel("Drop");
        $this->_helper->waitForElement("byCssSelector", "input[id='buttonYes']")
            ->click();

        $this->_helper->waitForElement(
            "byXPath",
            "//p[contains(., 'No tables found in database')]"
        );

        $result = $this->_helper->dbQuery("SHOW TABLES;");
        $this->assertEquals(0, $result->num_rows);

    }
コード例 #9
0
    /**
     * Test delete multiple records
     *
     * @return void
     */
    public function testDeleteRecords()
    {
        $this->byId("id_rows_to_delete1_left")->click();
        $this->byId("id_rows_to_delete2_left")->click();

        $this->byCssSelector("button[value=delete]")->click();
        $this->_helper->waitForElement("byCssSelector", "fieldset.confirmation");

        $this->byId("buttonYes")->click();
        $success = $this->_helper->waitForElement("byClassName", "success");
        $this->assertContains("Showing rows", $success->text());

        $this->assertFalse(
            $this->_helper->isElementPresent(
                "byCssSelector", "table#table_results tbody tr:nth-child(2)"
            )
        );

    }
コード例 #10
0
    /**
     * Test for copying database
     *
     * @return void
     */
    public function testCopyDb()
    {
        $this->byCssSelector("form#copy_db_form input[name=newname]")
            ->value("pma_test_db_copy");

        $this->byXPath("(//input[@value='Go'])[4]")->click();

        $this->_helper->waitForElement(
            "byXPath",
            "//div[@class='success' and contains(., 'Database " . $this->_dbname ." "
            . "has been copied to pma_test_db_copy')]"
        );

        $result = $this->_helper->dbQuery(
            "SHOW DATABASES LIKE 'pma_test_db_copy';"
        );
        $this->assertEquals(1, $result->num_rows);

        $this->_helper->dbQuery("DROP DATABASE pma_test_db_copy");
    }
コード例 #11
0
    /**
     * Test for dropping a table
     *
     * @return void
     */
    public function testDropTable()
    {
        $this->byId("drop_tbl_anchor")->click();
        $this->byXPath("//button[contains(., 'OK')]")->click();

        $this->_helper->waitForElement(
            "byXPath",
            "//div[@class='success' and "
            . "contains(., 'MySQL returned an empty result set')]"
        );

        $this->_helper->waitForElement(
            "byXPath",
            "//a[@class='tabactive' and contains(., 'Structure')]"
        );

        $result = $this->_helper->dbQuery("SHOW TABLES");
        $this->assertEquals(
            0,
            $result->num_rows
        );
    }
コード例 #12
0
    /**
     * Drops a database, called after testCreateDropDatabase
     *
     * @return void
     */
    private function _dropDatabase()
    {
        $this->_helper->gotoHomepage();

        $this->byLinkText("Databases")->click();
        $this->_helper->waitForElementNotPresent('byCssSelector', 'div#loading_parent');

        $this->byCssSelector(
            "input[name='selected_dbs[]'][value='" . $this->_dbname . "']"
        )->click();

        $this->byCssSelector("button.mult_submit")->click();
        $this->byCssSelector("span.ui-button-text:nth-child(1)")->click();

        $this->_helper->waitForElementNotPresent(
            "byCssSelector", "input[name='selected_dbs[]'][value='" . $this->_dbname . "']"
        );

        $this->_helper->waitForElement(
            "byCssSelector", "span.ajax_notification div.success"
        );
    }
コード例 #13
0
    /**
     * Test for dropping columns
     *
     * @return void
     */
    public function testDropColumns()
    {
        $this->byCssSelector('label[for=checkbox_row_2]')->click();
        $this->byCssSelector('label[for=checkbox_row_3]')->click();
        $this->byXPath(
            "//button[@class='mult_submit' and contains(., 'Drop')]"
        )->click();

        $this->_helper->waitForElement(
            "byCssSelector", "input[id='buttonYes']"
        )->click();

        $this->_helper->waitForElement(
            "byXPath",
            "//div[@class='success' and contains(., "
            . "'Your SQL query has been executed successfully')]"
        );

        $this->assertFalse(
            $this->_helper->isElementPresent(
                'byCssSelector', 'label[for=checkbox_row_2]'
            )
        );
    }
コード例 #14
0
    /**
     * Make assertions for table structure
     *
     * @return void
     */
    private function _tableStructureAssertions()
    {
        // go to structure page
        $this->byLinkText("Structure")->click();
        $this->_helper->waitForElement("byId", "tablestructure");

        // make assertions for first row
        $this->assertContains(
            "test_id",
            $this->byCssSelector('label[for=checkbox_row_1]')->text()
        );

        $this->assertEquals(
            "int(14)",
            $this->_helper->getTable("tablestructure.1.4")
        );

        $this->assertEquals(
            "UNSIGNED",
            $this->_helper->getTable("tablestructure.1.6")
        );

        $this->assertEquals(
            "No",
            $this->_helper->getTable("tablestructure.1.7")
        );

        $this->assertEquals(
            "None",
            $this->_helper->getTable("tablestructure.1.8")
        );

        $this->assertEquals(
            "AUTO_INCREMENT",
            $this->_helper->getTable("tablestructure.1.9")
        );

        $this->assertFalse(
            $this->_helper->isElementPresent(
                'byCssSelector',
                'table#tablestructure tbody tr:nth-child(1) "
                . "ul.table-structure-actions li.primary a'
            )
        );

        // make assertions for second row
        $this->assertContains(
            "test_column",
            $this->byCssSelector('label[for=checkbox_row_2]')->text()
        );

        $this->assertEquals(
            "varchar(10)",
            $this->_helper->getTable("tablestructure.2.4")
        );

        $this->assertEquals(
            "utf8_general_ci",
            $this->_helper->getTable("tablestructure.2.5")
        );

        $this->assertEquals(
            "Yes",
            $this->_helper->getTable("tablestructure.2.7")
        );

        $this->assertEquals(
            "def",
            $this->_helper->getTable("tablestructure.2.8")
        );

        $this->assertFalse(
            $this->_helper->isElementPresent(
                'byCssSelector',
                'css=ul.table-structure-actions:nth-child(2) li.primary a'
            )
        );
    }