From 5a532855823b2631e61e59b447fe559c4118f70a Mon Sep 17 00:00:00 2001 From: Thomas Wolf Date: Tue, 22 Mar 2016 07:43:20 +0100 Subject: Test stability: fix FeatureFinishSquashTest The test didn't wait for the shell to open in AbstractFeatureFinishHandlerTest.finishFeature(). Unfortunately, that shell didn't have a title, and was thus a bit inconvenient to wait for. * Give that shell (a TitleAreaDialog) a title. TitleAreaDialog.setTitle() does not set the shell's title! * Simplify the code: use the async clickContextMenu instead of the sync variant wrapped in an asyncExec. Change-Id: I5e26490682821888b4f62da8a323cbc1aeeaded4 Signed-off-by: Thomas Wolf --- .../ui/internal/dialogs/FinishFeatureDialog.java | 1 + .../gitflow/AbstractFeatureFinishHandlerTest.java | 24 +++++----------------- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/FinishFeatureDialog.java b/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/FinishFeatureDialog.java index ddd88429a5..44a5bd45b3 100644 --- a/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/FinishFeatureDialog.java +++ b/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/FinishFeatureDialog.java @@ -59,6 +59,7 @@ public class FinishFeatureDialog extends TitleAreaDialog { public void create() { super.create(); setTitle(UIText.FinishFeatureDialog_title); + getShell().setText(UIText.FinishFeatureDialog_title); setMessage(NLS.bind( UIText.FinishFeatureDialog_setParameterForFinishing, featureBranch), IMessageProvider.INFORMATION); diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/AbstractFeatureFinishHandlerTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/AbstractFeatureFinishHandlerTest.java index c6c17998a2..8b60cfd9e4 100644 --- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/AbstractFeatureFinishHandlerTest.java +++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/AbstractFeatureFinishHandlerTest.java @@ -21,7 +21,6 @@ import org.eclipse.egit.ui.test.TestUtil; import org.eclipse.swtbot.eclipse.finder.waits.Conditions; import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; -import org.eclipse.ui.PlatformUI; import org.junit.runner.RunWith; /** @@ -37,12 +36,9 @@ public abstract class AbstractFeatureFinishHandlerTest extends AbstractGitflowHa util.getPluginLocalizedValue("TeamMenu.label"), util.getPluginLocalizedValue("TeamGitFlowMenu.name", false, Activator.getDefault().getBundle()), util.getPluginLocalizedValue("TeamGitFlowFeatureFinish.name", false, Activator.getDefault().getBundle()) }; - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { - @Override - public void run() { - ContextMenuHelper.clickContextMenuSync(projectExplorerTree, menuPath); - } - }); + + ContextMenuHelper.clickContextMenu(projectExplorerTree, menuPath); + bot.waitUntil(shellIsActive(UIText.FinishFeatureDialog_title)); selectOptions(); bot.checkBox(UIText.FinishFeatureDialog_saveAsDefault).click(); bot.button("OK").click(); @@ -65,12 +61,7 @@ public abstract class AbstractFeatureFinishHandlerTest extends AbstractGitflowHa util.getPluginLocalizedValue("TeamGitFlowMenu.name", false, Activator.getDefault().getBundle()), util.getPluginLocalizedValue("TeamGitFlowFeatureStart.name", false, Activator.getDefault().getBundle()) }; - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { - @Override - public void run() { - ContextMenuHelper.clickContextMenuSync(projectExplorerTree, menuPath); - } - }); + ContextMenuHelper.clickContextMenu(projectExplorerTree, menuPath); bot.waitUntil(shellIsActive(UIText.FeatureStartHandler_provideFeatureName)); bot.text().setText(featureName); @@ -87,12 +78,7 @@ public abstract class AbstractFeatureFinishHandlerTest extends AbstractGitflowHa util.getPluginLocalizedValue("TeamGitFlowMenu.name", false, Activator.getDefault().getBundle()), util.getPluginLocalizedValue("TeamGitFlowFeatureCheckout.name", false, Activator.getDefault().getBundle()) }; - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { - @Override - public void run() { - ContextMenuHelper.clickContextMenuSync(projectExplorerTree, menuPath); - } - }); + ContextMenuHelper.clickContextMenu(projectExplorerTree, menuPath); bot.waitUntil(shellIsActive(UIText.FeatureCheckoutHandler_selectFeature)); bot.text().setText("these are not the features you're looking for"); -- cgit v1.2.3