|
7 | 7 | import static org.junit.Assert.assertTrue; |
8 | 8 |
|
9 | 9 | import java.io.IOException; |
| 10 | +import java.nio.file.Path; |
| 11 | +import java.nio.file.Paths; |
10 | 12 | import java.util.Arrays; |
11 | 13 | import java.util.Optional; |
12 | 14 |
|
|
21 | 23 | import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; |
22 | 24 | import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; |
23 | 25 | import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; |
| 26 | +import org.eclipse.swtbot.swt.finder.widgets.SWTBotText; |
24 | 27 | import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton; |
25 | 28 | import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; |
26 | 29 | import org.junit.After; |
@@ -186,6 +189,15 @@ public void givenNewProjectCreatedDfuBuiltThenHasDfuBin() throws Exception |
186 | 189 | Fixture.thenProjectHasTheFile("dfu.bin", "/build"); |
187 | 190 | Fixture.turnOffDfu(); |
188 | 191 | } |
| 192 | + |
| 193 | + @Test |
| 194 | + public void creatingNewDebugLaunchConfig() throws Exception |
| 195 | + { |
| 196 | + Fixture.givenNewEspressifIDFProjectIsSelected("EspressIf", "Espressif IDF Project"); |
| 197 | + Fixture.givenProjectNameIs("NewProjectTest"); |
| 198 | + Fixture.whenNewProjectIsSelected(); |
| 199 | + Fixture.selectNewDebugLaunchConfig(); |
| 200 | + } |
189 | 201 |
|
190 | 202 | private static class Fixture |
191 | 203 | { |
@@ -277,6 +289,32 @@ private static void turnOnDfu() |
277 | 289 | bot.comboBox().setSelection("DFU"); |
278 | 290 | bot.button("OK").click(); |
279 | 291 | } |
| 292 | + |
| 293 | + private static void givenESP32LaunchTargetIsSelected() |
| 294 | + { |
| 295 | + launchBarTargetSelector.select("esp32"); |
| 296 | + } |
| 297 | + |
| 298 | + private static void selectNewDebugLaunchConfig() { |
| 299 | + givenESP32LaunchTargetIsSelected(); |
| 300 | + launchBarConfigSelector.select("New Launch Configuration..."); |
| 301 | + bot.table(0).select("Debug"); |
| 302 | + bot.table(1).select("ESP-IDF GDB OpenOCD Debugging"); |
| 303 | + bot.button("Next >").click(); |
| 304 | + SWTBotText textWidget = bot.textWithLabel("Project:"); |
| 305 | + assertTrue(textWidget.getText().equals(projectName)); |
| 306 | + bot.cTabItem("Debugger").activate(); |
| 307 | + SWTBotText textWidget1 = bot.textWithLabel("Actual Executable:"); |
| 308 | + String pathtoexe = System.getProperty("user.home"); |
| 309 | + Path p = Paths.get(pathtoexe |
| 310 | + + "\\.espressif\\tools\\xtensa-esp-elf-gdb\\12.1_20221002\\xtensa-esp-elf-gdb\\bin\\xtensa-esp32-elf-gdb.exe"); |
| 311 | + p.toAbsolutePath().toString(); |
| 312 | + assertTrue(textWidget1.getText().equals(p.toAbsolutePath().toString())); |
| 313 | + bot.cTabItem("SVD Path").activate(); |
| 314 | + SWTBotText textWidget2 = bot.textWithLabel("File path:"); |
| 315 | + assertTrue(textWidget2.getText().contains("esp32.svd")); |
| 316 | + bot.button("Finish").click(); |
| 317 | + } |
280 | 318 |
|
281 | 319 | private static void whenProjectIsBuiltUsingContextMenu() throws IOException |
282 | 320 | { |
|
0 commit comments