Fix some failing Selenium tests

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2023-05-23 17:12:01 -03:00
parent 9e56194fc0
commit d1c6861b2c
No known key found for this signature in database
GPG Key ID: 6A16FD38AFC89CC8
7 changed files with 22 additions and 46 deletions

View File

@ -113,10 +113,8 @@ class EventsTest extends TestBase
$this->byCssSelector('div.ui-dialog-buttonset button:nth-child(1)')->click();
$this->waitForElement(
'xpath',
'//div[@class=\'alert alert-success\' and contains(., \'Event `test_event` has been created\')]',
);
$success = $this->waitForElement('cssSelector', '.alert-success');
$this->assertStringContainsString('Event `test_event` has been created', $success->getText());
$this->waitForElementNotPresent(
'xpath',
'//div[@id=\'alertLabel\' and not(contains(@style,\'display: none;\'))]',
@ -176,10 +174,8 @@ class EventsTest extends TestBase
$this->byCssSelector('div.ui-dialog-buttonset button:nth-child(1)')->click();
$this->waitForElement(
'xpath',
'//div[@class=\'alert alert-success\' and contains(., \'Event `test_event` has been modified\')]',
);
$success = $this->waitForElement('cssSelector', '.alert-success');
$this->assertStringContainsString('Event `test_event` has been modified', $success->getText());
sleep(2);
$this->dbQuery(

View File

@ -145,10 +145,8 @@ class ProceduresTest extends TestBase
$this->byCssSelector('div.ui-dialog-buttonset button:nth-child(1)')->click();
$this->waitForElement(
'xpath',
'//div[@class=\'alert alert-success\' and contains(., \'Routine `test_procedure` has been created\')]',
);
$success = $this->waitForElement('cssSelector', '.alert-success');
$this->assertStringContainsString('Routine `test_procedure` has been created', $success->getText());
$this->dbQuery(
"SHOW PROCEDURE STATUS WHERE Db='" . $this->databaseName . "'",
@ -181,10 +179,8 @@ class ProceduresTest extends TestBase
$this->byCssSelector('div.ui-dialog-buttonset button:nth-child(1)')->click();
$this->waitForElement(
'xpath',
'//div[@class=\'alert alert-success\' and contains(., \'Routine `test_procedure` has been modified\')]',
);
$success = $this->waitForElement('cssSelector', '.alert-success');
$this->assertStringContainsString('Routine `test_procedure` has been modified', $success->getText());
$this->executeProcedure('test_procedure', 14);
}

View File

@ -50,12 +50,8 @@ class StructureTest extends TestBase
$this->waitForElement('id', 'functionConfirmOkButton')->click();
$this->assertNotNull(
$this->waitForElement(
'xpath',
'//div[@class=\'alert alert-success\' and contains(., \'MySQL returned an empty result\')]',
),
);
$success = $this->waitForElement('cssSelector', '.alert-success');
$this->assertStringContainsString('MySQL returned an empty result', $success->getText());
$this->dbQuery(
'SELECT CONCAT("Count: ", COUNT(*)) as c FROM `' . $this->databaseName . '`.`test_table`',

View File

@ -93,10 +93,8 @@ class TriggersTest extends TestBase
$this->byCssSelector('div.ui-dialog-buttonset button:nth-child(1)')->click();
$this->waitForElement(
'xpath',
'//div[@class=\'alert alert-success\' and contains(., \'Trigger `test_trigger` has been created\')]',
);
$success = $this->waitForElement('cssSelector', '.alert-success');
$this->assertStringContainsString('Trigger `test_trigger` has been created', $success->getText());
$this->assertTrue(
$this->isElementPresent(
@ -148,10 +146,8 @@ class TriggersTest extends TestBase
$this->byCssSelector('div.ui-dialog-buttonset button:nth-child(1)')->click();
$this->waitForElement(
'xpath',
'//div[@class=\'alert alert-success\' and contains(., \'Trigger `test_trigger` has been modified\')]',
);
$success = $this->waitForElement('cssSelector', '.alert-success');
$this->assertStringContainsString('Trigger `test_trigger` has been modified', $success->getText());
// test trigger
$this->dbQuery('USE `' . $this->databaseName . '`;INSERT INTO `test_table` (val) VALUES (1);');

View File

@ -186,10 +186,8 @@ class OperationsTest extends TestBase
$this->waitForElement('id', 'functionConfirmOkButton')->click();
$this->waitAjax();
$this->waitForElement(
'xpath',
'//div[@class=\'alert alert-success\' and contains(., \'MySQL returned an empty result set\')]',
);
$success = $this->waitForElement('cssSelector', '.alert-success');
$this->assertStringContainsString('MySQL returned an empty result set', $success->getText());
$this->dbQuery(
'SELECT CONCAT("Count: ", COUNT(*)) as c FROM `' . $this->databaseName . '`.test_table',
@ -213,10 +211,8 @@ class OperationsTest extends TestBase
$this->waitForElement('id', 'functionConfirmOkButton')->click();
$this->waitAjax();
$this->waitForElement(
'xpath',
'//div[@class=\'alert alert-success\' and contains(., \'MySQL returned an empty result set\')]',
);
$success = $this->waitForElement('cssSelector', '.alert-success');
$this->assertStringContainsString('MySQL returned an empty result set', $success->getText());
$this->dbQuery(
'USE `' . $this->databaseName . '`;'

View File

@ -108,10 +108,8 @@ class StructureTest extends TestBase
$this->waitForElement('cssSelector', "input[id='buttonYes']")->click();
$this->waitForElement(
'xpath',
'//div[@class=\'alert alert-success\' and contains(., \'2 columns have been dropped successfully.\')]',
);
$success = $this->waitForElement('cssSelector', '.alert-success');
$this->assertStringContainsString('2 columns have been dropped successfully.', $success->getText());
$this->waitAjax();
$this->assertFalse(

View File

@ -159,10 +159,8 @@ class TrackingTest extends TestBase
$this->waitForElement('id', 'functionConfirmOkButton')->click();
$this->waitAjax();
$this->waitForElement(
'xpath',
'//div[@class=\'alert alert-success\' and contains(., \'Tracking data deleted successfully.\')]',
);
$success = $this->waitForElement('cssSelector', '.alert-success');
$this->assertStringContainsString('Tracking data deleted successfully.', $success->getText());
// Can not use getCellByTableId,
// since this is under 'th' and not 'td'