Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Baumgart2010-09-03 15:34:56 +0000
committerJens Baumgart2010-09-03 15:34:56 +0000
commitb9a3efd1a9fffe1682a61d6897663bc96d6a681b (patch)
tree51a10921a1976db823b51168767fdad0aecc4e0c
parentf097acc40d92a5ba7a24ced49ba9da6b2d7092bc (diff)
downloadegit-b9a3efd1a9fffe1682a61d6897663bc96d6a681b.tar.gz
egit-b9a3efd1a9fffe1682a61d6897663bc96d6a681b.tar.xz
egit-b9a3efd1a9fffe1682a61d6897663bc96d6a681b.zip
Fix UI tests on Mac
GlobalConfigurationPageTest is not working on Mac because the preferences dialog is triggered via Eclipse->settings on Mac. Now the preferences dialog is opened programmatically. Remove usage of mnemonics to select radio buttons since mnemonics are not supported on Mac. Change-Id: I46fc0dab7acbd17e3a933f42bec183c80a00d0cd Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java12
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/prefpages/configuration/GlobalConfigurationPageTest.java11
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java3
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTagHandlingTest.java2
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java35
5 files changed, 23 insertions, 40 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java
index a07d752555..aaae4f2632 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java
@@ -498,16 +498,4 @@ public abstract class LocalRepositoryTestCase extends EGitTestCase {
display.post(evt);
}
- /**
- * Activates the item by "pressing" ALT + the character after '&'
- *
- * @param shell
- * @param itemWithShortcut
- */
- protected void activateItemByKeyboard(SWTBotShell shell,
- String itemWithShortcut) {
- int index = itemWithShortcut.indexOf('&');
- if (index >= 0 && index < itemWithShortcut.length())
- pressAltAndChar(shell, itemWithShortcut.charAt(index + 1));
- }
}
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/prefpages/configuration/GlobalConfigurationPageTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/prefpages/configuration/GlobalConfigurationPageTest.java
index 28cd450344..924aa4ca6e 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/prefpages/configuration/GlobalConfigurationPageTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/prefpages/configuration/GlobalConfigurationPageTest.java
@@ -31,6 +31,8 @@ import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.internal.OpenPreferencesAction;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
@@ -73,7 +75,14 @@ public class GlobalConfigurationPageTest {
if (preferencePage != null)
preferencePage.close();
bot.perspectiveById("org.eclipse.ui.resourcePerspective").activate();
- bot.menu("Window").menu("Preferences").click();
+ // This does not work on Mac
+ // bot.menu("Window").menu("Preferences").click();
+ // Launch preferences programmatically instead
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ new OpenPreferencesAction().run();
+ }
+ });
preferencePage = bot.shell("Preferences").activate();
SWTBotTreeItem team = preferencePage.bot().tree().getTreeItem("Team");
team
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java
index 397f3899b7..e34c4e315b 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java
@@ -117,8 +117,7 @@ public class BranchAndResetActionTest extends LocalRepositoryTestCase {
SWTBotShell resetDialog = openResetDialog();
resetDialog.bot().tree().getTreeItem(LOCAL_BRANCHES).getNode("stable")
.select();
- activateItemByKeyboard(resetDialog,
- UIText.ResetTargetSelectionDialog_ResetTypeHardButton);
+ resetDialog.bot().radio(UIText.ResetTargetSelectionDialog_ResetTypeHardButton).click();
resetDialog.bot().button(UIText.ResetTargetSelectionDialog_ResetButton)
.click();
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTagHandlingTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTagHandlingTest.java
index 0020b843c0..a18808102c 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTagHandlingTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTagHandlingTest.java
@@ -138,7 +138,7 @@ public class GitRepositoriesViewTagHandlingTest extends
SWTBotShell resetDialog = bot
.shell(UIText.ResetCommand_WizardTitle);
- activateItemByKeyboard(resetDialog, UIText.ResetTargetSelectionDialog_ResetTypeHardButton);
+ resetDialog.bot().radio(UIText.ResetTargetSelectionDialog_ResetTypeHardButton).click();
waitInUI();
resetDialog.bot().button(IDialogConstants.FINISH_LABEL).click();
waitInUI();
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java
index 992010331b..009245bd3d 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java
@@ -214,13 +214,9 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
ContextMenuHelper.clickContextMenu(tree, myUtil
.getPluginLocalizedValue("ImportProjectsCommand"));
SWTBotShell shell = bot.shell(wizardTitle);
- // we can't find the check box, so let's use the keyboard activator
- // to select the import as existing project button
- activateItemByKeyboard(shell,
- UIText.GitSelectWizardPage_ImportExistingButton);
+ bot.radio(UIText.GitSelectWizardPage_ImportExistingButton).click();
// auto share
- activateItemByKeyboard(shell,
- UIText.GitSelectWizardPage_AutoShareButton);
+ bot.radio(UIText.GitSelectWizardPage_AutoShareButton).click();
TableCollection selected = shell.bot().tree().selection();
String wizardNode = selected.get(0, 0);
// wizard directory should be working dir
@@ -274,11 +270,9 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
SWTBotShell shell = bot.shell(wizardTitle);
shell = bot.shell(wizardTitle);
// try import existing project first
- activateItemByKeyboard(shell,
- UIText.GitSelectWizardPage_ImportExistingButton);
+ bot.radio(UIText.GitSelectWizardPage_ImportExistingButton).click();
// auto share
- activateItemByKeyboard(shell,
- UIText.GitSelectWizardPage_AutoShareButton);
+ bot.radio(UIText.GitSelectWizardPage_AutoShareButton).click();
TableCollection selected = shell.bot().tree().selection();
String wizardNode = selected.get(0, 0);
// wizard directory should be PROJ2
@@ -288,8 +282,7 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
assertTrue(shell.bot().tree().getAllItems().length == 0);
shell.bot().button(IDialogConstants.BACK_LABEL).click();
// import as general
- activateItemByKeyboard(shell,
- UIText.GitSelectWizardPage_ImportAsGeneralButton);
+ shell.bot().radio(UIText.GitSelectWizardPage_ImportAsGeneralButton).click();
shell.bot().button(IDialogConstants.NEXT_LABEL).click();
assertEquals(PROJ2, shell.bot().textWithLabel(
UIText.GitCreateGeneralProjectPage_ProjectNameLabel).getText());
@@ -329,11 +322,9 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
SWTBotShell shell = bot.shell(wizardTitle);
shell = bot.shell(wizardTitle);
// try import existing project first
- activateItemByKeyboard(shell,
- UIText.GitSelectWizardPage_ImportExistingButton);
+ bot.radio(UIText.GitSelectWizardPage_ImportExistingButton).click();
// auto share
- activateItemByKeyboard(shell,
- UIText.GitSelectWizardPage_AutoShareButton);
+ bot.radio(UIText.GitSelectWizardPage_AutoShareButton).click();
shell.bot().button(IDialogConstants.NEXT_LABEL).click();
waitInUI();
shell.bot().tree().getAllItems()[0].check();
@@ -388,11 +379,9 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
SWTBotShell shell = bot.shell(wizardTitle);
shell = bot.shell(wizardTitle);
// import as general
- activateItemByKeyboard(shell,
- UIText.GitSelectWizardPage_ImportAsGeneralButton);
+ bot.radio(UIText.GitSelectWizardPage_ImportAsGeneralButton).click();
// share manual
- activateItemByKeyboard(shell,
- UIText.GitSelectWizardPage_InteractiveShareButton);
+ bot.radio(UIText.GitSelectWizardPage_InteractiveShareButton).click();
shell.bot().button(IDialogConstants.NEXT_LABEL).click();
assertEquals(PROJ2, shell.bot().textWithLabel(
UIText.GitCreateGeneralProjectPage_ProjectNameLabel).getText());
@@ -424,11 +413,9 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
SWTBotShell shell = bot.shell(wizardTitle);
shell = bot.shell(wizardTitle);
// import as general
- activateItemByKeyboard(shell,
- UIText.GitSelectWizardPage_ImportAsGeneralButton);
+ bot.radio(UIText.GitSelectWizardPage_ImportAsGeneralButton).click();
// share manual
- activateItemByKeyboard(shell,
- UIText.GitSelectWizardPage_InteractiveShareButton);
+ bot.radio(UIText.GitSelectWizardPage_InteractiveShareButton).click();
shell.bot().button(IDialogConstants.NEXT_LABEL).click();
assertEquals(PROJ2, shell.bot().textWithLabel(
UIText.GitCreateGeneralProjectPage_ProjectNameLabel).getText());

Back to the top