diff options
author | Leif Åstrand <leif@vaadin.com> | 2013-10-04 12:00:00 +0300 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2013-10-04 12:00:00 +0300 |
commit | 30484511f88fb29797b0ef8a7e02433f38d15cd3 (patch) | |
tree | cc59833aae1ac13a56667beae5294f04f722781c | |
parent | 2bebf738b2c6cc393b3e8d21a56535e9f1b180ea (diff) | |
parent | b235d9c4e166197f3369694feec8d8f12a93c49d (diff) | |
download | vaadin-framework-30484511f88fb29797b0ef8a7e02433f38d15cd3.tar.gz vaadin-framework-30484511f88fb29797b0ef8a7e02433f38d15cd3.zip |
Merge changes from origin/7.1
8ce6565 Fixes normal drag and drop events (regression since 7.1) and html5 style D&D in IE10 (#12339)
5fb1da2 Publish error artifacts immediatly in TeamCity
649735f Added user agent for IE 11 (#12631)
a5795f3 Prefixes GET parameters in Liferay with portlet namespace #12602
b235d9c Refactor how TB3 tests are written (#12572)
Change-Id: Ia8281fb81d371dd4813371d62890a1ed34990d35
21 files changed, 184 insertions, 109 deletions
diff --git a/client/src/com/vaadin/client/ApplicationConfiguration.java b/client/src/com/vaadin/client/ApplicationConfiguration.java index da8f521799..7a70080c7e 100644 --- a/client/src/com/vaadin/client/ApplicationConfiguration.java +++ b/client/src/com/vaadin/client/ApplicationConfiguration.java @@ -246,6 +246,23 @@ public class ApplicationConfiguration implements EntryPoint { ApplicationConstants.SERVICE_URL_PATH_AS_PARAMETER) == Boolean.TRUE; } + /** + * Return the name of the parameter used to to send data to the service url. + * This method should only be called if {@link #useServiceUrlPathParam()} is + * true. + * + * @since 7.1.6 + * @return The parameter name, by default <code>v-resourcePath</code> + */ + public String getServiceUrlParameterName() { + String prefix = getJsoConfiguration(id).getConfigString( + ApplicationConstants.SERVICE_URL_PARAMETER_NAMESPACE); + if (prefix == null) { + prefix = ""; + } + return prefix + ApplicationConstants.V_RESOURCE_PATH; + } + public String getRootPanelId() { return id; } diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java index cd1f8a206d..08c755ef79 100644 --- a/client/src/com/vaadin/client/ApplicationConnection.java +++ b/client/src/com/vaadin/client/ApplicationConnection.java @@ -3003,7 +3003,7 @@ public class ApplicationConnection { if (!path.startsWith("/")) { path = '/' + path; } - String pathParam = ApplicationConstants.V_RESOURCE_PATH + "=" + String pathParam = conf.getServiceUrlParameterName() + "=" + URL.encodeQueryString(path); serviceUrl = addGetParameters(serviceUrl, pathParam); uidlUri = serviceUrl; diff --git a/client/src/com/vaadin/client/ui/VDragAndDropWrapper.java b/client/src/com/vaadin/client/ui/VDragAndDropWrapper.java index 1c1173c295..ccd7e2758e 100644 --- a/client/src/com/vaadin/client/ui/VDragAndDropWrapper.java +++ b/client/src/com/vaadin/client/ui/VDragAndDropWrapper.java @@ -332,11 +332,16 @@ public class VDragAndDropWrapper extends VCustomComponent implements vaadinDragEvent.setCurrentGwtEvent(event); getDropHandler().dragOver(vaadinDragEvent); - String s = event.getEffectAllowed(); - if ("all".equals(s) || s.contains("opy")) { - event.setDropEffect("copy"); - } else { - event.setDropEffect(s); + try { + String s = event.getEffectAllowed(); + if ("all".equals(s) || s.contains("opy")) { + event.setDropEffect("copy"); + } else { + event.setDropEffect(s); + } + } catch (Exception e) { + // IE10 throws exception here in getEffectAllowed, ignore it, let + // drop effect be whatever it is } try { diff --git a/client/src/com/vaadin/client/ui/dd/VDragAndDropManager.java b/client/src/com/vaadin/client/ui/dd/VDragAndDropManager.java index b4cf008a38..b911c28a07 100644 --- a/client/src/com/vaadin/client/ui/dd/VDragAndDropManager.java +++ b/client/src/com/vaadin/client/ui/dd/VDragAndDropManager.java @@ -374,6 +374,17 @@ public class VDragAndDropManager { public void onPreviewNativeEvent( NativePreviewEvent event) { int typeInt = event.getTypeInt(); + if (typeInt == -1 + && event.getNativeEvent().getType() + .contains("MSPointer")) { + /* + * Ignore MSPointer events, until they are + * properly used (might improve usability on + * touch devices). + */ + return; + } + switch (typeInt) { case Event.ONMOUSEOVER: if (dragElement == null) { diff --git a/server/src/com/vaadin/server/VaadinPortlet.java b/server/src/com/vaadin/server/VaadinPortlet.java index adef90c45f..a41f301219 100644 --- a/server/src/com/vaadin/server/VaadinPortlet.java +++ b/server/src/com/vaadin/server/VaadinPortlet.java @@ -422,16 +422,37 @@ public class VaadinPortlet extends GenericPortlet implements Constants, * @return A wrapped version of the PorletRequest */ protected VaadinPortletRequest createVaadinRequest(PortletRequest request) { - String portalInfo = request.getPortalContext().getPortalInfo() - .toLowerCase(); - if (portalInfo.contains("liferay")) { + if (isLiferay(request)) { return new VaadinLiferayRequest(request, getService()); - } else if (portalInfo.contains("gatein")) { + } else if (isGateIn(request)) { return new VaadinGateinRequest(request, getService()); } else { return new VaadinPortletRequest(request, getService()); } + } + /** + * Returns true if the portlet request is from Liferay. + * + * @param request + * @return True if Liferay, false otherwise + */ + private static boolean isLiferay(PortletRequest request) { + String portalInfo = request.getPortalContext().getPortalInfo() + .toLowerCase(); + return portalInfo.contains("liferay"); + } + + /** + * Returns true if the portlet request if from GateIn + * + * @param request + * @return True if GateIn, false otherwise + */ + private static boolean isGateIn(PortletRequest request) { + String portalInfo = request.getPortalContext().getPortalInfo() + .toLowerCase(); + return portalInfo.contains("gatein"); } private VaadinPortletResponse createVaadinResponse(PortletResponse response) { diff --git a/server/src/com/vaadin/server/communication/PortletBootstrapHandler.java b/server/src/com/vaadin/server/communication/PortletBootstrapHandler.java index 2458951ada..dd6d3c9283 100644 --- a/server/src/com/vaadin/server/communication/PortletBootstrapHandler.java +++ b/server/src/com/vaadin/server/communication/PortletBootstrapHandler.java @@ -31,6 +31,7 @@ import org.json.JSONObject; import com.vaadin.server.BootstrapHandler; import com.vaadin.server.PaintException; import com.vaadin.server.VaadinPortlet; +import com.vaadin.server.VaadinPortlet.VaadinLiferayRequest; import com.vaadin.server.VaadinPortletRequest; import com.vaadin.server.VaadinPortletResponse; import com.vaadin.server.VaadinRequest; @@ -98,6 +99,8 @@ public class PortletBootstrapHandler extends BootstrapHandler { JSONObject parameters = super.getApplicationParameters(context); VaadinPortletResponse response = (VaadinPortletResponse) context .getResponse(); + VaadinPortletRequest request = (VaadinPortletRequest) context + .getRequest(); MimeResponse portletResponse = (MimeResponse) response .getPortletResponse(); ResourceURL resourceURL = portletResponse.createResourceURL(); @@ -108,6 +111,14 @@ public class PortletBootstrapHandler extends BootstrapHandler { parameters .put(ApplicationConstants.SERVICE_URL_PATH_AS_PARAMETER, true); + // If we are running in Liferay then we need to prefix all parameters + // with the portlet namespace + if (request instanceof VaadinLiferayRequest) { + parameters.put( + ApplicationConstants.SERVICE_URL_PARAMETER_NAMESPACE, + response.getPortletResponse().getNamespace()); + } + return parameters; } }
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ApplicationConstants.java b/shared/src/com/vaadin/shared/ApplicationConstants.java index 8e66afbb32..a81f29b77c 100644 --- a/shared/src/com/vaadin/shared/ApplicationConstants.java +++ b/shared/src/com/vaadin/shared/ApplicationConstants.java @@ -49,6 +49,10 @@ public class ApplicationConstants implements Serializable { public static final String SERVICE_URL_PATH_AS_PARAMETER = "usePathParameter"; + // Denotes the namespace which parameters should be prefixed with when + // passed as GET parameters. Currently only used by Liferay. + public static final String SERVICE_URL_PARAMETER_NAMESPACE = "pathParameterNS"; + // Javadocs in ApplicationConfiguration should be updated if this is changed public static final String V_RESOURCE_PATH = "v-resourcePath"; diff --git a/uitest/src/com/vaadin/tests/VerifyBrowserVersion.java b/uitest/src/com/vaadin/tests/VerifyBrowserVersion.java index 59663a78d6..47c09bdfd7 100644 --- a/uitest/src/com/vaadin/tests/VerifyBrowserVersion.java +++ b/uitest/src/com/vaadin/tests/VerifyBrowserVersion.java @@ -32,6 +32,9 @@ public class VerifyBrowserVersion extends TestBase { .put(BrowserUtil.ie(10), "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)"); expectedUserAgent + .put(BrowserUtil.ie(11), + "Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko"); + expectedUserAgent .put(BrowserUtil.chrome(29), "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.76 Safari/537.36"); expectedUserAgent @@ -42,6 +45,7 @@ public class VerifyBrowserVersion extends TestBase { @Test public void verifyUserAgent() { + openTestURL(); Assert.assertEquals( expectedUserAgent.get(getDesiredCapabilities()), vaadinElementById("userAgent").getText()); diff --git a/uitest/src/com/vaadin/tests/components/label/LabelModes.java b/uitest/src/com/vaadin/tests/components/label/LabelModes.java index 1959447a4b..9e51978743 100644 --- a/uitest/src/com/vaadin/tests/components/label/LabelModes.java +++ b/uitest/src/com/vaadin/tests/components/label/LabelModes.java @@ -10,6 +10,7 @@ public class LabelModes extends ComponentTestCase<Label> { public static class LabelModesTest extends SimpleMultiBrowserTest { @Override public void test() throws Exception { + openTestURL(); compareScreen("labelmodes"); } diff --git a/uitest/src/com/vaadin/tests/components/ui/UIAccess.java b/uitest/src/com/vaadin/tests/components/ui/UIAccess.java index 057dcaa917..7515b3ede8 100644 --- a/uitest/src/com/vaadin/tests/components/ui/UIAccess.java +++ b/uitest/src/com/vaadin/tests/components/ui/UIAccess.java @@ -40,13 +40,10 @@ import com.vaadin.util.CurrentInstance; public class UIAccess extends AbstractTestUIWithLog { public static class UIAccessTest extends MultiBrowserTest { - @Override - protected boolean isPushEnabled() { - return true; - } - @Test public void testThreadLocals() { + setPush(true); + openTestURL(); getCurrentInstanceWhenPushingButton().click(); waitUntil(ExpectedConditions.textToBePresentInElement( vaadinLocatorById("Log_row_0"), "1.")); diff --git a/uitest/src/com/vaadin/tests/push/BarInUIDL.java b/uitest/src/com/vaadin/tests/push/BarInUIDL.java index ef2568bebe..ebf349683d 100644 --- a/uitest/src/com/vaadin/tests/push/BarInUIDL.java +++ b/uitest/src/com/vaadin/tests/push/BarInUIDL.java @@ -35,6 +35,7 @@ public class BarInUIDL extends AbstractTestUI { public static class BarInUIDLTest extends MultiBrowserTest { @Test public void sendBarInUIDL() { + openTestURL(); getButton().click(); Assert.assertEquals( "Thank you for clicking | bar", diff --git a/uitest/src/com/vaadin/tests/push/BasicPush.java b/uitest/src/com/vaadin/tests/push/BasicPush.java index 1f184863f7..d1a9fb575f 100644 --- a/uitest/src/com/vaadin/tests/push/BasicPush.java +++ b/uitest/src/com/vaadin/tests/push/BasicPush.java @@ -39,6 +39,8 @@ public class BasicPush extends AbstractTestUI { @Test public void testPush() { + openTestURL(); + // Test client initiated push Assert.assertEquals(0, getClientCounter()); getIncrementButton().click(); diff --git a/uitest/src/com/vaadin/tests/push/BasicPushStreaming.java b/uitest/src/com/vaadin/tests/push/BasicPushStreaming.java index 29534e1f5c..b63f782cc9 100644 --- a/uitest/src/com/vaadin/tests/push/BasicPushStreaming.java +++ b/uitest/src/com/vaadin/tests/push/BasicPushStreaming.java @@ -15,8 +15,6 @@ */ package com.vaadin.tests.push; -import org.junit.Test; - import com.vaadin.annotations.Push; import com.vaadin.server.VaadinRequest; import com.vaadin.shared.ui.ui.Transport; @@ -32,11 +30,5 @@ public class BasicPushStreaming extends BasicPush { } public static class BasicPushStreamingTest extends BasicPushTest { - @Override - @Test - public void testPush() { - super.testPush(); - } } - } diff --git a/uitest/src/com/vaadin/tests/push/PushConfigurationTest.java b/uitest/src/com/vaadin/tests/push/PushConfigurationTest.java index f4a537392d..5100e8a4ea 100644 --- a/uitest/src/com/vaadin/tests/push/PushConfigurationTest.java +++ b/uitest/src/com/vaadin/tests/push/PushConfigurationTest.java @@ -37,13 +37,10 @@ public class PushConfigurationTest extends AbstractTestUI { public static class PushConfigurationWebsocket extends WebsocketTest { - @Override - protected boolean isDebug() { - return true; - } - @Test public void testWebsocketAndStreaming() { + setDebug(true); + openTestURL(); // Websocket Assert.assertEquals(1, getServerCounter()); new Select(getTransportSelect()).selectByVisibleText("WEBSOCKET"); diff --git a/uitest/src/com/vaadin/tests/push/PushFromInit.java b/uitest/src/com/vaadin/tests/push/PushFromInit.java index 000d5c0bce..de3334f707 100644 --- a/uitest/src/com/vaadin/tests/push/PushFromInit.java +++ b/uitest/src/com/vaadin/tests/push/PushFromInit.java @@ -28,6 +28,8 @@ public class PushFromInit extends AbstractTestUIWithLog { public static class PushFromInitTB3 extends MultiBrowserTest { @Test public void testPushFromInit() { + openTestURL(); + for (int second = 0;; second++) { if (second >= 30) { Assert.fail("timeout"); diff --git a/uitest/src/com/vaadin/tests/push/PushReattachedComponent.java b/uitest/src/com/vaadin/tests/push/PushReattachedComponent.java index 35934273a4..0bc796e0ee 100644 --- a/uitest/src/com/vaadin/tests/push/PushReattachedComponent.java +++ b/uitest/src/com/vaadin/tests/push/PushReattachedComponent.java @@ -28,17 +28,15 @@ import com.vaadin.tests.tb3.MultiBrowserTest; public class PushReattachedComponent extends MultiBrowserTest { @Override - protected boolean isPushEnabled() { - return true; - } - - @Override protected Class<?> getUIClass() { return PanelChangeContents.class; } @Test public void testReattachComponentUsingPush() { + setPush(true); + openTestURL(); + Assert.assertEquals( "stats", vaadinElement( diff --git a/uitest/src/com/vaadin/tests/push/TogglePush.java b/uitest/src/com/vaadin/tests/push/TogglePush.java index f59ef83fe7..3ef369b408 100644 --- a/uitest/src/com/vaadin/tests/push/TogglePush.java +++ b/uitest/src/com/vaadin/tests/push/TogglePush.java @@ -34,30 +34,12 @@ import com.vaadin.ui.CheckBox; import com.vaadin.ui.Label; public class TogglePush extends AbstractTestUI { - public static class TogglePushInInitTB3 extends MultiBrowserTest { - @Override - protected boolean isPushEnabled() { - return true; - } - - /* - * (non-Javadoc) - * - * @see com.vaadin.tests.tb3.AbstractTB3Test#getTestUrl() - */ - @Override - protected String getTestUrl() { - return null; - } + public static class TogglePushTB3 extends MultiBrowserTest { @Test public void togglePushInInit() { - String baseUrl = getBaseURL(); - if (baseUrl.endsWith("/")) { - baseUrl = baseUrl.substring(0, baseUrl.length() - 1); - } - - String url = baseUrl + getDeploymentPath(); + setPush(true); + String url = getTestUrl(); // Open with push disabled driver.get(addParameter(url, "push=disabled")); @@ -80,12 +62,6 @@ public class TogglePush extends AbstractTestUI { } - /** - * @since - * @param url - * @param string - * @return - */ private String addParameter(String url, String queryParameter) { if (url.contains("?")) { return url + "&" + queryParameter; @@ -94,31 +70,10 @@ public class TogglePush extends AbstractTestUI { } } - private String getCounterText() { - return vaadinElement( - "/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VLabel[0]") - .getText(); - } - - private WebElement getPushToggle() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VCheckBox[0]/domChild[0]"); - } - - private WebElement getDelayedCounterUpdateButton() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]"); - } - - } - - public static class TogglePushTB3 extends MultiBrowserTest { - - @Override - protected boolean isPushEnabled() { - return true; - } - @Test public void togglePush() { + setPush(true); + openTestURL(); getDelayedCounterUpdateButton().click(); sleep(2000); @@ -157,15 +112,16 @@ public class TogglePush extends AbstractTestUI { return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VCheckBox[0]/domChild[0]"); } + private WebElement getDelayedCounterUpdateButton() { + return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]"); + } + private String getCounterText() { return vaadinElement( "/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VLabel[0]") .getText(); } - private WebElement getDelayedCounterUpdateButton() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]"); - } } private final Label counterLabel = new Label(); diff --git a/uitest/src/com/vaadin/tests/push/TrackMessageSizeUnitTests.java b/uitest/src/com/vaadin/tests/push/TrackMessageSizeUnitTests.java index d7459f83ab..cb3033aa58 100644 --- a/uitest/src/com/vaadin/tests/push/TrackMessageSizeUnitTests.java +++ b/uitest/src/com/vaadin/tests/push/TrackMessageSizeUnitTests.java @@ -43,6 +43,7 @@ public class TrackMessageSizeUnitTests extends AbstractTestUIWithLog { public static class TrackMessageSizeUnitTestsTB3 extends MultiBrowserTest { @Test public void runTests() { + openTestURL(); Assert.assertEquals("1. All tests run", vaadinElementById("Log_row_0").getText()); } diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java index 1897728366..054492444d 100644 --- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java +++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java @@ -47,11 +47,10 @@ import com.vaadin.ui.UI; * <ul> * <li>Helpers for browser selection</li> * <li>Hub connection setup and teardown</li> - * <li>Automatic opening of a given test on the development server using - * {@link #getUIClass()} or by automatically finding an enclosing UI class</li> + * <li>Automatic generation of URL for a given test on the development server + * using {@link #getUIClass()} or by automatically finding an enclosing UI class + * and based on requested features, e.g. {@link #isDebug()}, {@link #isPush()}</li> * <li>Generic helpers for creating TB3+ tests</li> - * <li>Automatic URL generation based on needed features, e.g. - * {@link #isDebug()}, {@link #isPushEnabled()}</li> * </ul> * * @author Vaadin Ltd @@ -69,6 +68,10 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { private static final int SCREENSHOT_WIDTH = 1500; private DesiredCapabilities desiredCapabilities; + + private boolean debug = false; + + private boolean push = false; { // Default browser to run on unless setDesiredCapabilities is called desiredCapabilities = BrowserUtil.firefox(24); @@ -83,11 +86,6 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { @Before public void setup() throws Exception { setupDriver(); - - String testUrl = getTestUrl(); - if (testUrl != null) { - driver.get(testUrl); - } } /** @@ -125,9 +123,20 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { } /** - * Returns the full URL to be opened when the test starts. + * Opens the given test (defined by {@link #getTestUrl(boolean, boolean)}, + * optionally with debug window and/or push + * + * @param debug + * @param push + */ + protected void openTestURL() { + driver.get(getTestUrl()); + } + + /** + * Returns the full URL to be used for the test * - * @return the full URL to open or null to not open any URL automatically + * @return the full URL for the test */ protected String getTestUrl() { String baseUrl = getBaseURL(); @@ -292,7 +301,12 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { * Returns the path that should be used for the test. The path contains the * full path (appended to hostname+port) and must start with a slash. * - * @return The path to open automatically when the test starts + * @param push + * true if "?debug" should be added + * @param debug + * true if /run-push should be used instead of /run + * + * @return The URL path to the UI class to test */ protected String getDeploymentPath() { Class<?> uiClass = getUIClass(); @@ -325,24 +339,47 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { } /** - * Determines whether to run the test in debug mode (with the debug console + * Returns whether to run the test in debug mode (with the debug console * open) or not * * @return true to run with the debug window open, false by default */ - protected boolean isDebug() { - return false; + protected final boolean isDebug() { + return debug; } /** - * Determines whether to run the test with push enabled (using /run-push) or + * Sets whether to run the test in debug mode (with the debug console open) + * or not. + * + * @param debug + * true to open debug window, false otherwise + */ + protected final void setDebug(boolean debug) { + this.debug = debug; + } + + /** + * Returns whether to run the test with push enabled (using /run-push) or * not. Note that push tests can and should typically be created using @Push * on the UI instead of overriding this method * - * @return true to use push in the test, false to use whatever UI specifies + * @return true if /run-push is used, false otherwise + */ + protected final boolean isPush() { + return push; + } + + /** + * Sets whether to run the test with push enabled (using /run-push) or not. + * Note that push tests can and should typically be created using @Push on + * the UI instead of overriding this method + * + * @param push + * true to use /run-push in the test, false otherwise */ - protected boolean isPushEnabled() { - return false; + protected final void setPush(boolean push) { + this.push = push; } /** @@ -350,15 +387,19 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { * The path contains the full path (appended to hostname+port) and must * start with a slash. * - * This method takes into account {@link #isPushEnabled()} and - * {@link #isDebug()} when the path is generated. + * This method takes into account {@link #isPush()} and {@link #isDebug()} + * when the path is generated. * * @param uiClass + * @param push + * true if "?debug" should be added + * @param debug + * true if /run-push should be used instead of /run * @return The path to the given UI class */ private String getDeploymentPath(Class<?> uiClass) { String runPath = "/run"; - if (isPushEnabled()) { + if (isPush()) { runPath = "/run-push"; } diff --git a/uitest/src/com/vaadin/tests/tb3/ScreenshotTB3Test.java b/uitest/src/com/vaadin/tests/tb3/ScreenshotTB3Test.java index 645d9cd0cb..565d04fdb9 100644 --- a/uitest/src/com/vaadin/tests/tb3/ScreenshotTB3Test.java +++ b/uitest/src/com/vaadin/tests/tb3/ScreenshotTB3Test.java @@ -31,6 +31,7 @@ import org.junit.Before; import org.junit.Rule; import org.junit.rules.TestRule; import org.junit.rules.TestWatcher; +import org.junit.runner.Description; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.remote.DesiredCapabilities; @@ -65,7 +66,16 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test { } screenshotBaseName = className + "-" + testMethod; - }; + } + + @Override + protected void failed(Throwable e, Description description) { + + // Notify Teamcity of failed test + System.out.print("##teamcity[publishArtifacts '"); + System.out.println(getScreenshotErrorDirectory() + "/" + + getScreenshotBaseName() + "* => screenshot-errors']"); + } }; /** diff --git a/uitest/test.xml b/uitest/test.xml index dd6964e59c..88b5238c09 100644 --- a/uitest/test.xml +++ b/uitest/test.xml @@ -134,6 +134,10 @@ </batchtest> </junit> + <!-- Have teamcity publish each test error artifact immediatly if there are any --> + <basename property="basename" file="${target}" suffix="java" /> + <echo>##teamcity[publishArtifacts '${com.vaadin.testbench.screenshot.directory}/errors/${basename}* => screenshot-errors']</echo> + </target> <!-- Remove temporary source and compiled java files --> |