diff options
author | Andrew Ferrazzutti | 2014-03-14 19:16:28 +0000 |
---|---|---|
committer | Andrew Ferrazzutti | 2014-03-16 01:31:09 +0000 |
commit | dedaecc306519205d829b600805baf2d4a966bed (patch) | |
tree | 6503cef86e5c264a61a3736e861f9e535c9b9966 | |
parent | fa254e87e0fff128447c9ed30d9e59bee8143203 (diff) | |
download | org.eclipse.linuxtools-dedaecc306519205d829b600805baf2d4a966bed.tar.gz org.eclipse.linuxtools-dedaecc306519205d829b600805baf2d4a966bed.tar.xz org.eclipse.linuxtools-dedaecc306519205d829b600805baf2d4a966bed.zip |
gcov: Attempt to stabilize SWTBot tests.
Add an extra wait condition and extend an existing one
to avoid missing "Delete Resources" shells.
Change-Id: I7d3d9f9b301e33144567f9978ed8e1dd413fa8df
Signed-off-by: Andrew Ferrazzutti <aferrazz@redhat.com>
Reviewed-on: https://git.eclipse.org/r/23406
Tested-by: Hudson CI
-rw-r--r-- | gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTest.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTest.java b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTest.java index f253c9d5b9..367d8074a2 100644 --- a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTest.java +++ b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTest.java @@ -30,7 +30,6 @@ import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; import org.eclipse.swtbot.swt.finder.SWTBot; import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; -import org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory; import org.eclipse.swtbot.swt.finder.results.VoidResult; import org.eclipse.swtbot.swt.finder.waits.Conditions; import org.eclipse.swtbot.swt.finder.waits.DefaultCondition; @@ -236,19 +235,22 @@ public abstract class GcovTest { SWTBotTreeItem treeItem) { String shellTitle = "Delete Resources"; treeItem.contextMenu("Delete").click(); + Matcher<Shell> withText = withText(shellTitle); + bot.waitUntil(Conditions.waitForShell(withText)); SWTBotShell deleteShell = bot.shell(shellTitle); deleteShell.activate(); bot.button("OK").click(); // Another shell (with the same name!) may appear if resources aren't synced. // If it does appear, it will be a child of the first shell. try { - bot.waitUntil(Conditions.shellCloses(deleteShell), 1000); + bot.waitUntil(Conditions.shellCloses(deleteShell)); } catch (TimeoutException e) { SWTBotShell deleteShell2; try { deleteShell2 = bot.shell(shellTitle, deleteShell.widget); } catch (WidgetNotFoundException e2) { // If the other shell isn't found, that means the first one just didn't close. + System.out.println("ERROR: \"Delete Resources\" shell did not close, and no extra shell appeared"); throw e; } System.out.println("Deleting out-of-sync resources - new \"Delete Resources\" shell found"); @@ -347,7 +349,7 @@ public abstract class GcovTest { // name such as [x86_64/le]. So, we look at all nodes of the project and look for the one that // starts with our binary file name. We can then select the node. projectExplorer.bot().tree().select(projectName).contextMenu("Go Into").click(); - bot.waitUntil(Conditions.waitForWidget(WidgetMatcherFactory.withText(projectName), projectExplorer.getWidget())); + bot.waitUntil(Conditions.waitForWidget(withText(projectName), projectExplorer.getWidget())); SWTBotTreeItem[] nodes = treeBot.getAllItems(); String binNodeName = binFile.getName(); |