diff options
author | Carsten Reckord | 2016-09-07 17:21:19 +0000 |
---|---|---|
committer | Carsten Reckord | 2016-09-07 17:21:19 +0000 |
commit | 36b6456f27d32ece0802d9824a3aaa5ea91f8a87 (patch) | |
tree | 66f5b1a7894bb31ac00d36333be7b301cec086a9 | |
parent | 563db9a9dda02a18796044bdbded5a860a6693e6 (diff) | |
download | org.eclipse.epp.mpc-36b6456f27d32ece0802d9824a3aaa5ea91f8a87.tar.gz org.eclipse.epp.mpc-36b6456f27d32ece0802d9824a3aaa5ea91f8a87.tar.xz org.eclipse.epp.mpc-36b6456f27d32ece0802d9824a3aaa5ea91f8a87.zip |
501013: Fix UI test failures due to uncontrollable entries
Bug: 501013
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=501013
5 files changed, 78 insertions, 10 deletions
diff --git a/org.eclipse.epp.mpc.tests/.classpath b/org.eclipse.epp.mpc.tests/.classpath index 098194ca..eca7bdba 100644 --- a/org.eclipse.epp.mpc.tests/.classpath +++ b/org.eclipse.epp.mpc.tests/.classpath @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> <classpathentry kind="output" path="bin"/> diff --git a/org.eclipse.epp.mpc.tests/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.epp.mpc.tests/.settings/org.eclipse.jdt.core.prefs index 865f6c21..98e0bde7 100644 --- a/org.eclipse.epp.mpc.tests/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.epp.mpc.tests/.settings/org.eclipse.jdt.core.prefs @@ -8,9 +8,9 @@ org.eclipse.jdt.core.codeComplete.localSuffixes= org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -81,7 +81,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disa org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.7 +org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,HIGH,HIGH,LOW org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,WIP,DEBUG,DISCUSS diff --git a/org.eclipse.epp.mpc.tests/META-INF/MANIFEST.MF b/org.eclipse.epp.mpc.tests/META-INF/MANIFEST.MF index 93f9cd40..e5b6b6e2 100644 --- a/org.eclipse.epp.mpc.tests/META-INF/MANIFEST.MF +++ b/org.eclipse.epp.mpc.tests/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-Name: Marketplace Client Tests Bundle-SymbolicName: org.eclipse.epp.mpc.tests Bundle-Version: 1.5.1.qualifier Bundle-Vendor: Eclipse Marketplace Client -Bundle-RequiredExecutionEnvironment: JavaSE-1.7 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Require-Bundle: org.eclipse.osgi;bundle-version="3.6.0", org.eclipse.core.runtime;bundle-version="3.6.0", org.eclipse.epp.mpc.core;bundle-version="1.5.1", diff --git a/org.eclipse.epp.mpc.tests/src/org/eclipse/epp/mpc/tests/ui/wizard/AbstractMarketplaceWizardBotTest.java b/org.eclipse.epp.mpc.tests/src/org/eclipse/epp/mpc/tests/ui/wizard/AbstractMarketplaceWizardBotTest.java index 13270ea3..989a7185 100644 --- a/org.eclipse.epp.mpc.tests/src/org/eclipse/epp/mpc/tests/ui/wizard/AbstractMarketplaceWizardBotTest.java +++ b/org.eclipse.epp.mpc.tests/src/org/eclipse/epp/mpc/tests/ui/wizard/AbstractMarketplaceWizardBotTest.java @@ -22,20 +22,26 @@ import java.lang.management.ThreadInfo; import java.lang.management.ThreadMXBean; import java.lang.reflect.Method; import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import org.apache.log4j.Logger; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; +import org.eclipse.epp.internal.mpc.core.model.Node; import org.eclipse.epp.internal.mpc.ui.commands.MarketplaceWizardCommand; import org.eclipse.epp.internal.mpc.ui.wizards.AbstractTagFilter; import org.eclipse.epp.internal.mpc.ui.wizards.ComboTagFilter; import org.eclipse.epp.internal.mpc.ui.wizards.FeatureSelectionWizardPage; import org.eclipse.epp.internal.mpc.ui.wizards.MarketplaceWizard; +import org.eclipse.epp.internal.mpc.ui.wizards.MarketplaceWizard.WizardState; import org.eclipse.epp.internal.mpc.ui.wizards.MarketplaceWizardDialog; import org.eclipse.epp.mpc.core.model.ICategory; import org.eclipse.epp.mpc.core.model.IMarket; +import org.eclipse.epp.mpc.core.model.INode; +import org.eclipse.epp.mpc.core.service.QueryHelper; import org.eclipse.epp.mpc.tests.ui.wizard.matcher.NodeMatcher; import org.eclipse.equinox.internal.p2.discovery.model.Tag; import org.eclipse.equinox.internal.p2.ui.discovery.wizards.CatalogFilter; @@ -52,6 +58,7 @@ import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; import org.eclipse.swtbot.eclipse.finder.matchers.WidgetMatcherFactory; import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor; 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.junit.ScreenshotCaptureListener; import org.eclipse.swtbot.swt.finder.results.ArrayResult; @@ -76,6 +83,7 @@ import org.eclipse.swtbot.swt.finder.widgets.TimeoutException; import org.eclipse.ui.IEditorReference; import org.hamcrest.Matcher; import org.hamcrest.Matchers; +import org.junit.AssumptionViolatedException; import org.junit.Before; import org.junit.Rule; import org.junit.rules.TestRule; @@ -85,6 +93,31 @@ import org.junit.runners.model.Statement; public abstract class AbstractMarketplaceWizardBotTest { + protected static final INode[] TEST_NODES = new INode[] { // + testNode("206", "http://marketplace.eclipse.org/content/mylyn", "Mylyn"), // + testNode("311881", "http://marketplace.eclipse.org/content/eclipse-4-tools-css-spy", + "Eclipse 4 Tools: CSS Spy"), // + testNode("311774", "http://marketplace.eclipse.org/content/eclipse-4-tools-lightweight-css-editor", + "Eclipse 4 Tools: Lightweight CSS Editor"), // + testNode("311838", "http://marketplace.eclipse.org/content/eclipse-4-tools-application-model-editor", ""), // + testNode("2780381", "http://marketplace.eclipse.org/content/trace-compass", "Trace Compass"), // + testNode("2410217", "http://marketplace.eclipse.org/content/memory-analyzer-0", "Memory Analyzer"), // + testNode("1336", "http://marketplace.eclipse.org/content/egit-git-team-provider", + "EGit - Git Team Provider"), // + testNode("2706327", "http://marketplace.eclipse.org/content/eclipse-docker-tooling", + "Eclipse Docker Tooling"), // + testNode("2706342", "http://marketplace.eclipse.org/content/eclipse-vagrant-tooling", + "Eclipse Vagrant Tooling"), // + testNode("2579663", "http://marketplace.eclipse.org/content/egerrit", "EGerrit") // + }; + + private static INode testNode(String id, String url, String name) { + Node node = (Node) QueryHelper.nodeById(id); + node.setUrl(url); + node.setName(name); + return node; + } + private static long PROGRESS_TIMEOUT = Long.getLong("org.eclipse.epp.mpc.tests.progress.timeout", 30000); private static final Logger logger = Logger.getLogger(AbstractMarketplaceWizardBotTest.class); @@ -144,6 +177,11 @@ public abstract class AbstractMarketplaceWizardBotTest { protected void launchMarketplaceWizard() { final MarketplaceWizardCommand marketplaceWizardCommand = new MarketplaceWizardCommand(); + WizardState wizardState = new WizardState(); + wizardState.setContent(new LinkedHashSet<INode>(Arrays.asList(TEST_NODES))); + wizardState.setProceedWithInstallation(false); + marketplaceWizardCommand.setWizardDialogState(wizardState); + UIThreadRunnable.asyncExec(new VoidResult() { public void run() { @@ -587,4 +625,36 @@ public abstract class AbstractMarketplaceWizardBotTest { return getWizardDialog().getWizard(); } + protected SWTBot assume(SWTBot bot) { + return new SWTBot(bot.getFinder()) { + @Override + public void waitUntilWidgetAppears(ICondition waitForWidget) { + try { + super.waitUntilWidgetAppears(waitForWidget); + } catch (TimeoutException e) { + throw new AssumptionViolatedException(e.getMessage(), e); + } catch (WidgetNotFoundException e) { + throw new AssumptionViolatedException(e.getMessage(), e); + } + } + + @Override + public void waitUntil(ICondition condition, long timeout, long interval) throws TimeoutException { + try { + super.waitUntil(condition, timeout, interval); + } catch (TimeoutException e) { + throw new AssumptionViolatedException(e.getMessage(), e); + } + } + + @Override + public void waitWhile(ICondition condition, long timeout, long interval) throws TimeoutException { + try { + super.waitWhile(condition, timeout, interval); + } catch (TimeoutException e) { + throw new AssumptionViolatedException(e.getMessage(), e); + } + } + }; + } }
\ No newline at end of file diff --git a/org.eclipse.epp.mpc.tests/src/org/eclipse/epp/mpc/tests/ui/wizard/MarketplaceWizardTest.java b/org.eclipse.epp.mpc.tests/src/org/eclipse/epp/mpc/tests/ui/wizard/MarketplaceWizardTest.java index 3a9fc05b..07e93e53 100644 --- a/org.eclipse.epp.mpc.tests/src/org/eclipse/epp/mpc/tests/ui/wizard/MarketplaceWizardTest.java +++ b/org.eclipse.epp.mpc.tests/src/org/eclipse/epp/mpc/tests/ui/wizard/MarketplaceWizardTest.java @@ -28,6 +28,7 @@ import org.eclipse.epp.mpc.tests.ui.wizard.widgets.SWTBotClickableStyledText; import org.eclipse.swt.custom.StyleRange; import org.eclipse.swt.custom.StyledText; import org.eclipse.swt.widgets.Widget; +import org.eclipse.swtbot.swt.finder.SWTBot; import org.eclipse.swtbot.swt.finder.waits.DefaultCondition; import org.eclipse.swtbot.swt.finder.widgets.SWTBotBrowser; import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton; @@ -126,13 +127,10 @@ public class MarketplaceWizardTest extends AbstractMarketplaceWizardBotTest { checkMarketplaceBrowser(); } - @Ignore("We currently filter out non-installable items in MPC") @Test public void testNoninstallableLearnMore() { - searchField().setFocus(); - searchField().setText("nodeclipse"); - filterMarket("RCP Applications"); - SWTBotClickableStyledText learnMoreLabel = SWTBotClickableStyledText.from(bot.styledTextWithId( + SWTBot assumeLearnMoreBot = assume(bot); + SWTBotClickableStyledText learnMoreLabel = SWTBotClickableStyledText.from(assumeLearnMoreBot.styledTextWithId( AbstractMarketplaceDiscoveryItem.WIDGET_ID_KEY, DiscoveryItem.WIDGET_ID_LEARNMORE)); StyleRange linkRange = findLink(learnMoreLabel); learnMoreLabel.click(linkRange); |