Remove the MaxFileSize HTML generator
[phpmyadmin.git] / test / selenium / NormalizationTest.php
blob8ed7090cb47f4e59ed9d6e081c6841f68ad7fac3
1 <?php
2 /**
3 * Selenium TestCase for normalization
4 */
5 declare(strict_types=1);
7 namespace PhpMyAdmin\Tests\Selenium;
9 /**
10 * PMA_SeleniumNormalizationTest class
12 * @group selenium
14 class NormalizationTest extends TestBase
16 /**
17 * Setup the browser environment to run the selenium test case
19 protected function setUp(): void
21 parent::setUp();
22 $this->dbQuery(
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,'
27 . 'PRIMARY KEY(id)'
28 . ')'
31 $this->login();
32 $this->navigateTable('test_table');
33 $this->waitForElement(
34 'xpath',
35 "(//a[contains(., 'Structure')])"
36 )->click();
38 $this->waitAjax();
40 $this->waitForElement('id', 'tablestructure');
41 $this->byPartialLinkText('Normalize')->click();
42 $this->waitForElement('id', 'normalizeTable');
45 /**
46 * Test for normalization to 1NF
48 * @return void
50 * @group large
52 public function testNormalizationTo1NF()
54 $this->assertTrue(
55 $this->isElementPresent('cssSelector', 'fieldset')
57 $this->assertEquals(
58 'First step of normalization (1NF)',
59 $this->byCssSelector('label[for=normalizeToRadio1]')->getText()
61 $this->assertTrue(
62 $this->isElementPresent(
63 'cssSelector',
64 'input[id=normalizeToRadio1][type=radio]:checked'
67 $this->byCssSelector('input[name=submit_normalize]')->click();
68 $this->waitForElement('id', 'mainContent');
69 $this->_test1NFSteps();
72 /**
73 * assertions in 1NF steps 1.1, 1.2, 1.3
75 * @return void
77 private function _test1NFSteps()
79 $this->assertEquals(
80 'First step of normalization (1NF)',
81 $this->byCssSelector('#page_content h3')->getText()
83 $this->assertTrue(
84 $this->isElementPresent(
85 'cssSelector',
86 '#mainContent h4'
89 $this->assertTrue(
90 $this->isElementPresent(
91 'cssSelector',
92 '#mainContent #newCols'
95 $this->assertTrue(
96 $this->isElementPresent(
97 'cssSelector',
98 '.tblFooters'
101 $this->assertTrue(
102 $this->isElementPresent(
103 'cssSelector',
104 '#selectNonAtomicCol option[value=val2]'
107 $this->assertFalse(
108 $this->isElementPresent(
109 'cssSelector',
110 '#selectNonAtomicCol option[value=val]'
113 $this->assertTrue(
114 $this->isElementPresent(
115 'cssSelector',
116 '#selectNonAtomicCol option[value=no_such_col]'
120 $this->selectByValue(
121 $this->byId('selectNonAtomicCol'),
122 'no_such_col'
125 $this->waitForElement(
126 'xpath',
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(
132 'xpath',
133 "//legend[contains(., 'Step 1.3 Move repeating groups')]"
135 $this->byCssSelector('input[value="No repeating group"]')->click();
136 $this->waitForElement(
137 'xpath',
138 "//legend[contains(., 'Step 1.4 Remove redundant columns')]"
140 $this->assertTrue(
141 $this->isElementPresent(
142 'cssSelector',
143 '#mainContent #extra'
146 $this->assertTrue(
147 $this->isElementPresent(
148 'cssSelector',
149 '#extra input[value=val2][type=checkbox]'
152 $this->assertTrue(
153 $this->isElementPresent(
154 'cssSelector',
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(
161 'xpath',
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()