3 * Selenium TestCase for normalization
5 declare(strict_types
=1);
7 namespace PhpMyAdmin\Tests\Selenium
;
10 * PMA_SeleniumNormalizationTest class
14 class NormalizationTest
extends TestBase
17 * Setup the browser environment to run the selenium test case
19 protected function setUp(): void
23 'CREATE TABLE `test_table` ('
24 . ' `id` int(11) NOT NULL AUTO_INCREMENT,'
25 . ' `val` int(11) NOT NULL,'
26 . ' `val2` varchar(64) NOT NULL,'
32 $this->navigateTable('test_table');
33 $this->waitForElement(
35 "(//a[contains(., 'Structure')])"
40 $this->waitForElement('id', 'tablestructure');
41 $this->byPartialLinkText('Normalize')->click();
42 $this->waitForElement('id', 'normalizeTable');
46 * Test for normalization to 1NF
52 public function testNormalizationTo1NF()
55 $this->isElementPresent('cssSelector', 'fieldset')
58 'First step of normalization (1NF)',
59 $this->byCssSelector('label[for=normalizeToRadio1]')->getText()
62 $this->isElementPresent(
64 'input[id=normalizeToRadio1][type=radio]:checked'
67 $this->byCssSelector('input[name=submit_normalize]')->click();
68 $this->waitForElement('id', 'mainContent');
69 $this->_test1NFSteps();
73 * assertions in 1NF steps 1.1, 1.2, 1.3
77 private function _test1NFSteps()
80 'First step of normalization (1NF)',
81 $this->byCssSelector('#page_content h3')->getText()
84 $this->isElementPresent(
90 $this->isElementPresent(
92 '#mainContent #newCols'
96 $this->isElementPresent(
102 $this->isElementPresent(
104 '#selectNonAtomicCol option[value=val2]'
108 $this->isElementPresent(
110 '#selectNonAtomicCol option[value=val]'
114 $this->isElementPresent(
116 '#selectNonAtomicCol option[value=no_such_col]'
120 $this->selectByValue(
121 $this->byId('selectNonAtomicCol'),
125 $this->waitForElement(
127 "//legend[contains(., 'Step 1.2 Have a primary key')]"
129 $text = $this->byCssSelector('#mainContent h4')->getText();
130 $this->assertStringContainsString('Primary key already exists.', $text);
131 $this->waitForElement(
133 "//legend[contains(., 'Step 1.3 Move repeating groups')]"
135 $this->byCssSelector('input[value="No repeating group"]')->click();
136 $this->waitForElement(
138 "//legend[contains(., 'Step 1.4 Remove redundant columns')]"
141 $this->isElementPresent(
143 '#mainContent #extra'
147 $this->isElementPresent(
149 '#extra input[value=val2][type=checkbox]'
153 $this->isElementPresent(
155 '#extra input[value=id][type=checkbox]'
158 $this->byCssSelector('#extra input[value=val][type=checkbox]')->click();
159 $this->byCssSelector('#removeRedundant')->click();
160 $this->waitForElement(
162 "//legend[contains(., 'End of step')]"
164 $this->assertStringContainsString(
165 "The first step of normalization is complete for table 'test_table'.",
166 $this->byCssSelector('#mainContent h4')->getText()