Skip to content

Commit 70b7206

Browse files
ci: improve first test
1 parent 4b4df68 commit 70b7206

File tree

1 file changed

+54
-6
lines changed

1 file changed

+54
-6
lines changed

tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/IDFProjectDebugProcessTest.java

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import org.apache.commons.lang3.SystemUtils;
1111
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
1212
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
13+
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
1314
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
1415
import org.junit.After;
1516
import org.junit.BeforeClass;
@@ -60,18 +61,22 @@ public void afterEachTest()
6061
}
6162

6263
@Test
63-
public void givenNewProjectCreatedWhenSelectDebugWhenBuiltThenCheckDebugSuccessfully() throws Exception
64+
public void givenNewProjectCreatedWhenFlashedAndDebuggedThenDebuggingWorks() throws Exception
6465
{
6566
if (SystemUtils.IS_OS_LINUX) //temporary solution until new ESP boards arrive for Windows
6667
{
6768
Fixture.givenNewEspressifIDFProjectIsSelected("EspressIf", "Espressif IDF Project");
6869
Fixture.givenProjectNameIs("NewProjecDebugTest");
6970
Fixture.whenNewProjectIsSelected();
71+
Fixture.whenTurnOffOpenSerialMonitorAfterFlashingInLaunchConfig();
72+
Fixture.whenProjectIsBuiltUsingContextMenu();
73+
Fixture.whenSelectLaunchTargetSerialPort();
74+
Fixture.whenFlashProject();
75+
Fixture.thenVerifyFlashDoneSuccessfully();
7076
Fixture.whenSelectDebugConfig();
7177
Fixture.whenSelectLaunchTargetBoard();
72-
Fixture.whenProjectIsBuiltUsingContextMenu();
73-
Fixture.whenDebugProject();
74-
Fixture.thenVerifyJTAGflashDone();
78+
// Fixture.whenDebugProject();
79+
// Fixture.whenSwitchPerspective();
7580
}
7681
else
7782
{
@@ -146,9 +151,52 @@ private static void whenSelectLaunchTargetBoard() throws Exception
146151
bot.button("Finish").click();
147152
}
148153

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
150198
{
151-
ProjectTestOperations.verifyTheConsoleOutput(bot, "** Flashing done for partition_table/partition-table.bin");
199+
ProjectTestOperations.waitForProjectFlash(bot);
152200
}
153201

154202
private static void cleanTestEnv()

0 commit comments

Comments
 (0)