tmf: Fix FetchRemoteTracesTest on Mac
authorMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Mon, 13 Jul 2015 15:09:06 +0000 (11:09 -0400)
committerMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Wed, 29 Jul 2015 17:11:09 +0000 (13:11 -0400)
1) Opening the Preferences through the menu doesn't work...anymore?
I have gone back to Eclipse 4.4 and SWTBot 2.2.1 to see if it worked and it doesn't.
I suspect it might be a change in OSX but I don't have access to an older one.
I am also not 100% sure this ever worked but I thought it did.

2) We need to wait for the Preferences dialog to be active before looking
for the tree in it. That seems like a good fix for all platforms.

Change-Id: Ib9b3ed6edee75d368d3238451dc57a982f65ee0a
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/51861
Reviewed-by: Hudson CI
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
tmf/org.eclipse.tracecompass.tmf.remote.ui.swtbot.tests/src/org/eclipse/tracecompass/tmf/remote/ui/swtbot/tests/fetch/FetchRemoteTracesTest.java

index c6b79de9ec92eaa8c7a53feaa83cbfc2706f5ff3..2985ba84924917be1e3412b5ac6a64e2c8a4a0b0 100644 (file)
@@ -15,6 +15,7 @@ package org.eclipse.tracecompass.tmf.remote.ui.swtbot.tests.fetch;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.io.File;
 import java.io.IOException;
@@ -27,6 +28,9 @@ import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.bindings.keys.IKeyLookup;
+import org.eclipse.jface.bindings.keys.KeyStroke;
+import org.eclipse.jface.bindings.keys.ParseException;
 import org.eclipse.osgi.util.NLS;
 import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
 import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
@@ -420,11 +424,19 @@ public class FetchRemoteTracesTest {
     private static void openRemoteProfilePreferences() {
         if (SWTUtils.isMac()) {
             // On Mac, the Preferences menu item is under the application name.
-            fBot.menu("Eclipse").menu("Preferences").click();
+            // For some reason, we can't access the application menu anymore so
+            // we use the keyboard shortcut.
+            try {
+                fBot.activeShell().pressShortcut(KeyStroke.getInstance(IKeyLookup.COMMAND_NAME + "+"), KeyStroke.getInstance(","));
+            } catch (ParseException e) {
+                fail();
+            }
         } else {
             fBot.menu("Window").menu("Preferences").click();
         }
 
+        fBot.waitUntil(Conditions.shellIsActive("Preferences"));
+
         // The first tree is the preference "categories" on the left side
         SWTBotTree tree = fBot.tree(0);
         SWTBotTreeItem treeNode = tree.getTreeItem("Tracing");
This page took 0.041371 seconds and 5 git commands to generate.