diff options
author | Andrey Loskutov | 2015-02-19 18:27:08 +0000 |
---|---|---|
committer | Andrey Loskutov | 2015-02-19 18:27:08 +0000 |
commit | 2933611584f0d365d5b8f3aa736ab8b5fa94525d (patch) | |
tree | 05cb0b23b23e13b66dfe0e595a1b89cb8f6dc36d | |
parent | 17bf706bbe0cc9dfe03a7f312ce5af6aa7c2cc20 (diff) | |
download | egit-2933611584f0d365d5b8f3aa736ab8b5fa94525d.tar.gz egit-2933611584f0d365d5b8f3aa736ab8b5fa94525d.tar.xz egit-2933611584f0d365d5b8f3aa736ab8b5fa94525d.zip |
Close opened views on teardown to avoid broken StagingView tests
Another attempt to fix unstable tests which I can't reproduce locally.
They fail on Hudson with this stack:
Tree item element containg text "GeneralProject/folder/test.txt" was not
found. Existing tree items:
ProjectWithoutDotProject/.project
Stacktrace
org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException: Tree
item element containg text "GeneralProject/folder/test.txt" was not
found. Existing tree items:
ProjectWithoutDotProject/.project
at org.eclipse.egit.ui.test.TestUtil.getNode(TestUtil.java:495)
at
org.eclipse.egit.ui.common.StagingViewTester.stageFile(StagingViewTester.java:65)
at
org.eclipse.egit.ui.test.stagview.StagingViewTest.testCommitSingleFile(StagingViewTest.java:70)
Change-Id: Ib42b28f79b3ff9fcf8f5d35e039ba7fc1803588b
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Change-Id: I6f48af116b3e908ab8d0ac5fc346daaad2756a9d
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r-- | org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java | 17 | ||||
-rw-r--r-- | org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/stagview/StagingViewTest.java | 3 |
2 files changed, 20 insertions, 0 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java index 87fda4ad74..b71c1da62f 100644 --- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java +++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java @@ -583,6 +583,23 @@ public class TestUtil { return viewbot; } + public static void hideView(final String viewId) { + Display.getDefault().syncExec(new Runnable() { + public void run() { + IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench() + .getActiveWorkbenchWindow(); + IWorkbenchPage workbenchPage = workbenchWindow.getActivePage(); + IViewReference[] views = workbenchPage.getViewReferences(); + for (int i = 0; i < views.length; i++) { + IViewReference view = views[i]; + if (viewId.equals(view.getId())) { + workbenchPage.hideView(view); + } + } + } + }); + } + public static SWTBotView showHistoryView() { return showView("org.eclipse.team.ui.GenericHistoryView"); } diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/stagview/StagingViewTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/stagview/StagingViewTest.java index fd118739a3..739e989729 100644 --- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/stagview/StagingViewTest.java +++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/stagview/StagingViewTest.java @@ -21,6 +21,7 @@ import org.eclipse.egit.ui.Activator; import org.eclipse.egit.ui.common.LocalRepositoryTestCase; import org.eclipse.egit.ui.common.StagingViewTester; import org.eclipse.egit.ui.internal.repository.RepositoriesView; +import org.eclipse.egit.ui.internal.staging.StagingView; import org.eclipse.egit.ui.test.CommitMessageUtil; import org.eclipse.egit.ui.test.TestUtil; import org.eclipse.egit.ui.view.repositories.GitRepositoriesViewTestUtils; @@ -57,6 +58,8 @@ public class StagingViewTest extends LocalRepositoryTestCase { @After public void after() { + TestUtil.hideView(RepositoriesView.VIEW_ID); + TestUtil.hideView(StagingView.VIEW_ID); Activator.getDefault().getRepositoryUtil().removeDir(repositoryFile); } |