Skip to content

Commit 91d8aa7

Browse files
committed
fix: cover all possible tooltips
1 parent da6cf75 commit 91d8aa7

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/TerminalViewTest.java

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
import org.eclipse.swt.widgets.Event;
1212
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
1313
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
14+
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
1415
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
1516
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCanvas;
17+
import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton;
1618
import org.junit.BeforeClass;
1719
import org.junit.Test;
1820
import org.junit.runner.RunWith;
@@ -41,7 +43,30 @@ public void testOpenTerminalView() throws Exception
4143
File outputFile = tempFile.toFile();
4244
outputFile.deleteOnExit(); // ensure cleanup after JVM exits
4345

44-
bot.toolbarButtonWithTooltip("Open a Terminal (Ctrl+Alt+Shift+T)").click();
46+
String[] tooltips = { "Open a Terminal (Ctrl+Alt+Shift+T)", "Open a Terminal (Shift+Ctrl+Alt+T)",
47+
"Open a Terminal" };
48+
49+
SWTBotToolbarButton openTerminalButton = null;
50+
51+
for (String tooltip : tooltips)
52+
{
53+
try
54+
{
55+
openTerminalButton = bot.toolbarButtonWithTooltip(tooltip);
56+
break; // stop at the first one found
57+
}
58+
catch (WidgetNotFoundException ignored)
59+
{
60+
// try next tooltip
61+
}
62+
}
63+
64+
if (openTerminalButton == null)
65+
{
66+
throw new WidgetNotFoundException("Toolbar button 'Open a Terminal' not found with any known tooltip");
67+
}
68+
69+
openTerminalButton.click();
4570
bot.comboBox().setSelection("ESP-IDF Terminal");
4671
bot.button("OK").click();
4772
SWTBotView terminalView = bot.viewByTitle("Terminal");

0 commit comments

Comments
 (0)