|
10 | 10 | import org.apache.commons.lang3.SystemUtils; |
11 | 11 | import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; |
12 | 12 | import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; |
| 13 | +import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox; |
13 | 14 | import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; |
14 | 15 | import org.junit.After; |
15 | 16 | import org.junit.BeforeClass; |
@@ -60,18 +61,22 @@ public void afterEachTest() |
60 | 61 | } |
61 | 62 |
|
62 | 63 | @Test |
63 | | - public void givenNewProjectCreatedWhenSelectDebugWhenBuiltThenCheckDebugSuccessfully() throws Exception |
| 64 | + public void givenNewProjectCreatedWhenFlashedAndDebuggedThenDebuggingWorks() throws Exception |
64 | 65 | { |
65 | 66 | if (SystemUtils.IS_OS_LINUX) //temporary solution until new ESP boards arrive for Windows |
66 | 67 | { |
67 | 68 | Fixture.givenNewEspressifIDFProjectIsSelected("EspressIf", "Espressif IDF Project"); |
68 | 69 | Fixture.givenProjectNameIs("NewProjecDebugTest"); |
69 | 70 | Fixture.whenNewProjectIsSelected(); |
| 71 | + Fixture.whenTurnOffOpenSerialMonitorAfterFlashingInLaunchConfig(); |
| 72 | + Fixture.whenProjectIsBuiltUsingContextMenu(); |
| 73 | + Fixture.whenSelectLaunchTargetSerialPort(); |
| 74 | + Fixture.whenFlashProject(); |
| 75 | + Fixture.thenVerifyFlashDoneSuccessfully(); |
70 | 76 | Fixture.whenSelectDebugConfig(); |
71 | 77 | Fixture.whenSelectLaunchTargetBoard(); |
72 | | - Fixture.whenProjectIsBuiltUsingContextMenu(); |
73 | | - Fixture.whenDebugProject(); |
74 | | - Fixture.thenVerifyJTAGflashDone(); |
| 78 | +// Fixture.whenDebugProject(); |
| 79 | +// Fixture.whenSwitchPerspective(); |
75 | 80 | } |
76 | 81 | else |
77 | 82 | { |
@@ -146,9 +151,52 @@ private static void whenSelectLaunchTargetBoard() throws Exception |
146 | 151 | bot.button("Finish").click(); |
147 | 152 | } |
148 | 153 |
|
149 | | - private static void thenVerifyJTAGflashDone() throws Exception |
| 154 | + private static void whenSwitchPerspective() throws Exception |
| 155 | + { |
| 156 | + TestWidgetWaitUtility.waitForDialogToAppear(bot, "Confirm Perspective Switch", 20000); |
| 157 | + bot.button("Switch").click(); |
| 158 | + } |
| 159 | + |
| 160 | + private static void whenTurnOffOpenSerialMonitorAfterFlashingInLaunchConfig() throws Exception |
| 161 | + { |
| 162 | + LaunchBarConfigSelector configSelector = new LaunchBarConfigSelector(bot); |
| 163 | + configSelector.clickEdit(); |
| 164 | + TestWidgetWaitUtility.waitForDialogToAppear(bot, "Edit Configuration", 20000); |
| 165 | + bot.cTabItem("Main").show(); |
| 166 | + bot.cTabItem("Main").setFocus(); |
| 167 | + SWTBotCheckBox checkBox = bot.checkBox("Open Serial Monitor After Flashing"); |
| 168 | + if (checkBox.isChecked()) { |
| 169 | + checkBox.click(); |
| 170 | + } |
| 171 | + bot.button("OK").click(); |
| 172 | + } |
| 173 | + |
| 174 | + private static void whenSelectLaunchTargetSerialPort() throws Exception |
| 175 | + { |
| 176 | + LaunchBarTargetSelector targetSelector = new LaunchBarTargetSelector(bot); |
| 177 | + targetSelector.clickEdit(); |
| 178 | + TestWidgetWaitUtility.waitForDialogToAppear(bot, "New ESP Target", 20000); |
| 179 | + SWTBotShell shell = bot.shell("New ESP Target"); |
| 180 | + bot.comboBoxWithLabel("Serial Port:").setSelection("/dev/ttyUSB1 Dual RS232-HS"); |
| 181 | + TestWidgetWaitUtility.waitForOperationsInProgressToFinishSync(bot); |
| 182 | + shell.setFocus(); |
| 183 | + bot.button("Finish").click(); |
| 184 | + } |
| 185 | + |
| 186 | + private static void whenFlashProject() throws IOException |
| 187 | + { |
| 188 | + ProjectTestOperations.launchCommandUsingContextMenu(projectName, bot, "Run Configurations..."); |
| 189 | + TestWidgetWaitUtility.waitForDialogToAppear(bot, "Run Configurations", 10000); |
| 190 | + bot.tree().getTreeItem("ESP-IDF Application").select(); |
| 191 | + bot.tree().getTreeItem("ESP-IDF Application").expand(); |
| 192 | + bot.tree().getTreeItem("ESP-IDF Application").getNode(projectName).select(); |
| 193 | + bot.waitUntil(widgetIsEnabled(bot.button("Run")), 5000); |
| 194 | + bot.button("Run").click(); |
| 195 | + } |
| 196 | + |
| 197 | + private static void thenVerifyFlashDoneSuccessfully() throws Exception |
150 | 198 | { |
151 | | - ProjectTestOperations.verifyTheConsoleOutput(bot, "** Flashing done for partition_table/partition-table.bin"); |
| 199 | + ProjectTestOperations.waitForProjectFlash(bot); |
152 | 200 | } |
153 | 201 |
|
154 | 202 | private static void cleanTestEnv() |
|
0 commit comments