Skip to content

Commit d1c6861

Browse files
committed
Fix some failing Selenium tests
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
1 parent 9e56194 commit d1c6861

7 files changed

Lines changed: 22 additions & 46 deletions

File tree

‎test/selenium/Database/EventsTest.php‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,8 @@ public function testAddEvent(): void
113113

114114
$this->byCssSelector('div.ui-dialog-buttonset button:nth-child(1)')->click();
115115

116-
$this->waitForElement(
117-
'xpath',
118-
'//div[@class=\'alert alert-success\' and contains(., \'Event `test_event` has been created\')]',
119-
);
116+
$success = $this->waitForElement('cssSelector', '.alert-success');
117+
$this->assertStringContainsString('Event `test_event` has been created', $success->getText());
120118
$this->waitForElementNotPresent(
121119
'xpath',
122120
'//div[@id=\'alertLabel\' and not(contains(@style,\'display: none;\'))]',
@@ -176,10 +174,8 @@ public function testEditEvents(): void
176174

177175
$this->byCssSelector('div.ui-dialog-buttonset button:nth-child(1)')->click();
178176

179-
$this->waitForElement(
180-
'xpath',
181-
'//div[@class=\'alert alert-success\' and contains(., \'Event `test_event` has been modified\')]',
182-
);
177+
$success = $this->waitForElement('cssSelector', '.alert-success');
178+
$this->assertStringContainsString('Event `test_event` has been modified', $success->getText());
183179

184180
sleep(2);
185181
$this->dbQuery(

‎test/selenium/Database/ProceduresTest.php‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,8 @@ public function testAddProcedure(): void
145145

146146
$this->byCssSelector('div.ui-dialog-buttonset button:nth-child(1)')->click();
147147

148-
$this->waitForElement(
149-
'xpath',
150-
'//div[@class=\'alert alert-success\' and contains(., \'Routine `test_procedure` has been created\')]',
151-
);
148+
$success = $this->waitForElement('cssSelector', '.alert-success');
149+
$this->assertStringContainsString('Routine `test_procedure` has been created', $success->getText());
152150

153151
$this->dbQuery(
154152
"SHOW PROCEDURE STATUS WHERE Db='" . $this->databaseName . "'",
@@ -181,10 +179,8 @@ public function testEditProcedure(): void
181179

182180
$this->byCssSelector('div.ui-dialog-buttonset button:nth-child(1)')->click();
183181

184-
$this->waitForElement(
185-
'xpath',
186-
'//div[@class=\'alert alert-success\' and contains(., \'Routine `test_procedure` has been modified\')]',
187-
);
182+
$success = $this->waitForElement('cssSelector', '.alert-success');
183+
$this->assertStringContainsString('Routine `test_procedure` has been modified', $success->getText());
188184

189185
$this->executeProcedure('test_procedure', 14);
190186
}

‎test/selenium/Database/StructureTest.php‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,8 @@ public function testTruncateTable(): void
5050

5151
$this->waitForElement('id', 'functionConfirmOkButton')->click();
5252

53-
$this->assertNotNull(
54-
$this->waitForElement(
55-
'xpath',
56-
'//div[@class=\'alert alert-success\' and contains(., \'MySQL returned an empty result\')]',
57-
),
58-
);
53+
$success = $this->waitForElement('cssSelector', '.alert-success');
54+
$this->assertStringContainsString('MySQL returned an empty result', $success->getText());
5955

6056
$this->dbQuery(
6157
'SELECT CONCAT("Count: ", COUNT(*)) as c FROM `' . $this->databaseName . '`.`test_table`',

‎test/selenium/Database/TriggersTest.php‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,8 @@ public function testAddTrigger(): void
9393

9494
$this->byCssSelector('div.ui-dialog-buttonset button:nth-child(1)')->click();
9595

96-
$this->waitForElement(
97-
'xpath',
98-
'//div[@class=\'alert alert-success\' and contains(., \'Trigger `test_trigger` has been created\')]',
99-
);
96+
$success = $this->waitForElement('cssSelector', '.alert-success');
97+
$this->assertStringContainsString('Trigger `test_trigger` has been created', $success->getText());
10098

10199
$this->assertTrue(
102100
$this->isElementPresent(
@@ -148,10 +146,8 @@ public function testEditTriggers(): void
148146

149147
$this->byCssSelector('div.ui-dialog-buttonset button:nth-child(1)')->click();
150148

151-
$this->waitForElement(
152-
'xpath',
153-
'//div[@class=\'alert alert-success\' and contains(., \'Trigger `test_trigger` has been modified\')]',
154-
);
149+
$success = $this->waitForElement('cssSelector', '.alert-success');
150+
$this->assertStringContainsString('Trigger `test_trigger` has been modified', $success->getText());
155151

156152
// test trigger
157153
$this->dbQuery('USE `' . $this->databaseName . '`;INSERT INTO `test_table` (val) VALUES (1);');

‎test/selenium/Table/OperationsTest.php‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,8 @@ public function testTruncateTable(): void
186186
$this->waitForElement('id', 'functionConfirmOkButton')->click();
187187
$this->waitAjax();
188188

189-
$this->waitForElement(
190-
'xpath',
191-
'//div[@class=\'alert alert-success\' and contains(., \'MySQL returned an empty result set\')]',
192-
);
189+
$success = $this->waitForElement('cssSelector', '.alert-success');
190+
$this->assertStringContainsString('MySQL returned an empty result set', $success->getText());
193191

194192
$this->dbQuery(
195193
'SELECT CONCAT("Count: ", COUNT(*)) as c FROM `' . $this->databaseName . '`.test_table',
@@ -213,10 +211,8 @@ public function testDropTable(): void
213211
$this->waitForElement('id', 'functionConfirmOkButton')->click();
214212
$this->waitAjax();
215213

216-
$this->waitForElement(
217-
'xpath',
218-
'//div[@class=\'alert alert-success\' and contains(., \'MySQL returned an empty result set\')]',
219-
);
214+
$success = $this->waitForElement('cssSelector', '.alert-success');
215+
$this->assertStringContainsString('MySQL returned an empty result set', $success->getText());
220216

221217
$this->dbQuery(
222218
'USE `' . $this->databaseName . '`;'

‎test/selenium/Table/StructureTest.php‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,8 @@ public function testDropColumns(): void
108108

109109
$this->waitForElement('cssSelector', "input[id='buttonYes']")->click();
110110

111-
$this->waitForElement(
112-
'xpath',
113-
'//div[@class=\'alert alert-success\' and contains(., \'2 columns have been dropped successfully.\')]',
114-
);
111+
$success = $this->waitForElement('cssSelector', '.alert-success');
112+
$this->assertStringContainsString('2 columns have been dropped successfully.', $success->getText());
115113
$this->waitAjax();
116114

117115
$this->assertFalse(

‎test/selenium/TrackingTest.php‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,8 @@ public function testDropTracking(): void
159159
$this->waitForElement('id', 'functionConfirmOkButton')->click();
160160

161161
$this->waitAjax();
162-
$this->waitForElement(
163-
'xpath',
164-
'//div[@class=\'alert alert-success\' and contains(., \'Tracking data deleted successfully.\')]',
165-
);
162+
$success = $this->waitForElement('cssSelector', '.alert-success');
163+
$this->assertStringContainsString('Tracking data deleted successfully.', $success->getText());
166164

167165
// Can not use getCellByTableId,
168166
// since this is under 'th' and not 'td'

0 commit comments

Comments
 (0)