Skip to content

Commit

Permalink
Merge pull request #19132 from MauricioFauth/table-create-e2e-test-fix
Browse files Browse the repository at this point in the history
Fix failing E2E tests
  • Loading branch information
MauricioFauth committed Apr 26, 2024
2 parents 2e4a709 + 2cb2ce7 commit de9a89e
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 39 deletions.
12 changes: 6 additions & 6 deletions test/selenium/Database/EventsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ function (): void {

sleep(2);
$this->dbQuery(
'SELECT val FROM `' . $this->databaseName . '`.`test_table`',
'SELECT * FROM `' . $this->databaseName . '`.`test_table`',
function (): void {
$this->assertTrue($this->isElementPresent('className', 'table_results'));
$this->scrollToElement($this->waitForElement('className', 'table_results'), 0, 20);
// [ ] | Edit | Copy | Delete | 1 | <number>
$this->assertGreaterThan(2, (int) $this->getCellByTableClass('table_results', 1, 5));
$this->assertGreaterThan(2, (int) $this->getCellByTableClass('table_results', 1, 6));
}
);
}
Expand Down Expand Up @@ -183,11 +183,11 @@ public function testEditEvents(): void

sleep(2);
$this->dbQuery(
'SELECT val FROM `' . $this->databaseName . '`.`test_table`',
'SELECT * FROM `' . $this->databaseName . '`.`test_table`',
function (): void {
$this->assertTrue($this->isElementPresent('className', 'table_results'));
$this->scrollToElement($this->waitForElement('className', 'table_results'), 0, 20);
// [ ] | Edit | Copy | Delete | 4
$this->assertGreaterThan(3, (int) $this->getCellByTableClass('table_results', 1, 5));
$this->assertGreaterThan(3, (int) $this->getCellByTableClass('table_results', 1, 6));
}
);
}
Expand Down
22 changes: 11 additions & 11 deletions test/selenium/Database/QueryByExampleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,56 +119,56 @@ public function testQueryByExample(): void
$submitButton->click();
$this->waitAjax();

$this->waitForElement('cssSelector', 'table.table_results');
$this->scrollToElement($this->waitForElement('className', 'table_results'), 0, 20);

/* Assert Row 1 */
$this->assertEquals(
4,
$this->getCellByTableClass('table_results', 1, 5)
$this->getCellByTableClass('table_results', 1, 1)
);
$this->assertEquals(
3,
$this->getCellByTableClass('table_results', 1, 6)
$this->getCellByTableClass('table_results', 1, 2)
);

/* Assert Row 2 */
$this->assertEquals(
6,
$this->getCellByTableClass('table_results', 2, 5)
$this->getCellByTableClass('table_results', 2, 1)
);
$this->assertEquals(
4,
$this->getCellByTableClass('table_results', 2, 6)
$this->getCellByTableClass('table_results', 2, 2)
);

/* Assert Row 3 */
$this->assertEquals(
5,
$this->getCellByTableClass('table_results', 3, 5)
$this->getCellByTableClass('table_results', 3, 1)
);
$this->assertEquals(
4,
$this->getCellByTableClass('table_results', 3, 6)
$this->getCellByTableClass('table_results', 3, 2)
);

/* Assert Row 4 */
$this->assertEquals(
7,
$this->getCellByTableClass('table_results', 4, 5)
$this->getCellByTableClass('table_results', 4, 1)
);
$this->assertEquals(
5,
$this->getCellByTableClass('table_results', 4, 6)
$this->getCellByTableClass('table_results', 4, 2)
);

/* Assert Row 5 */
$this->assertEquals(
3,
$this->getCellByTableClass('table_results', 5, 5)
$this->getCellByTableClass('table_results', 5, 1)
);
$this->assertEquals(
5,
$this->getCellByTableClass('table_results', 5, 6)
$this->getCellByTableClass('table_results', 5, 2)
);
}
}
18 changes: 9 additions & 9 deletions test/selenium/Database/TriggersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ function (): void {
// test trigger
$this->dbQuery('USE `' . $this->databaseName . '`;INSERT INTO `test_table` (val) VALUES (1);');
$this->dbQuery(
'SELECT val FROM `' . $this->databaseName . '`.`test_table2`;',
'SELECT * FROM `' . $this->databaseName . '`.`test_table2`;',
function (): void {
$this->assertTrue($this->isElementPresent('className', 'table_results'));
$this->scrollToElement($this->waitForElement('className', 'table_results'), 0, 20);
// [ ] | Edit | Copy | Delete | 1 | 3
$this->assertEquals('3', $this->getCellByTableClass('table_results', 1, 5));
$this->assertEquals('3', $this->getCellByTableClass('table_results', 1, 6));
}
);
}
Expand Down Expand Up @@ -157,11 +157,11 @@ public function testEditTriggers(): void
// test trigger
$this->dbQuery('USE `' . $this->databaseName . '`;INSERT INTO `test_table` (val) VALUES (1);');
$this->dbQuery(
'SELECT val FROM `' . $this->databaseName . '`.`test_table2`;',
'SELECT * FROM `' . $this->databaseName . '`.`test_table2`;',
function (): void {
$this->assertTrue($this->isElementPresent('className', 'table_results'));
$this->scrollToElement($this->waitForElement('className', 'table_results'), 0, 20);
// [ ] | Edit | Copy | Delete | 1 | 12
$this->assertEquals('12', $this->getCellByTableClass('table_results', 1, 5));
$this->assertEquals('12', $this->getCellByTableClass('table_results', 1, 6));
}
);
}
Expand Down Expand Up @@ -189,11 +189,11 @@ public function testDropTrigger(): void
// test trigger
$this->dbQuery('USE `' . $this->databaseName . '`;INSERT INTO `test_table` (val) VALUES (1);');
$this->dbQuery(
'SELECT val FROM `' . $this->databaseName . '`.`test_table2`;',
'SELECT * FROM `' . $this->databaseName . '`.`test_table2`;',
function (): void {
$this->assertTrue($this->isElementPresent('className', 'table_results'));
$this->scrollToElement($this->waitForElement('className', 'table_results'), 0, 20);
// [ ] | Edit | Copy | Delete | 1 | 2
$this->assertEquals('2', $this->getCellByTableClass('table_results', 1, 5));
$this->assertEquals('2', $this->getCellByTableClass('table_results', 1, 6));
}
);

Expand Down
21 changes: 8 additions & 13 deletions test/selenium/Table/CreateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,10 @@ private function tableStructureAssertions(): void
$this->getCellByTableId('tablestructure', 1, 10)
);

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

// make assertions for second row
$this->assertStringContainsString(
Expand Down Expand Up @@ -172,11 +169,9 @@ private function tableStructureAssertions(): void
$this->getCellByTableId('tablestructure', 2, 8)
);

$this->assertFalse(
$this->isElementPresent(
'cssSelector',
'css=ul.table-structure-actions:nth-child(2) li.primary a'
)
);
self::assertTrue($this->isElementPresent(
'cssSelector',
'table#tablestructure tbody tr:nth-child(2) ul li.primary a'
));
}
}

0 comments on commit de9a89e

Please sign in to comment.