|
11 | 11 | import org.eclipse.swt.widgets.Event; |
12 | 12 | import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; |
13 | 13 | import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; |
| 14 | +import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; |
14 | 15 | import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; |
15 | 16 | import org.eclipse.swtbot.swt.finder.widgets.SWTBotCanvas; |
| 17 | +import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton; |
16 | 18 | import org.junit.BeforeClass; |
17 | 19 | import org.junit.Test; |
18 | 20 | import org.junit.runner.RunWith; |
@@ -41,7 +43,30 @@ public void testOpenTerminalView() throws Exception |
41 | 43 | File outputFile = tempFile.toFile(); |
42 | 44 | outputFile.deleteOnExit(); // ensure cleanup after JVM exits |
43 | 45 |
|
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(); |
45 | 70 | bot.comboBox().setSelection("ESP-IDF Terminal"); |
46 | 71 | bot.button("OK").click(); |
47 | 72 | SWTBotView terminalView = bot.viewByTitle("Terminal"); |
|
0 commit comments