summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur.signell@itmill.com>2009-04-03 09:14:07 +0000
committerArtur Signell <artur.signell@itmill.com>2009-04-03 09:14:07 +0000
commitc0e35f4ea8fcc7c61ae2b2d4882373217da1b3af (patch)
tree760de7fa3f063d9070eb7ee77a36e677387fe324
parent1216fd25d6ee545db3b205369d7624d3201fba5f (diff)
downloadvaadin-framework-c0e35f4ea8fcc7c61ae2b2d4882373217da1b3af.tar.gz
vaadin-framework-c0e35f4ea8fcc7c61ae2b2d4882373217da1b3af.zip
Merged Testing Tools branch
svn changeset:7298/svn branch:6.0
-rw-r--r--src/com/itmill/toolkit/terminal/gwt/client/ApplicationConfiguration.java8
-rwxr-xr-xsrc/com/itmill/toolkit/terminal/gwt/client/ApplicationConnection.java110
-rw-r--r--src/com/itmill/toolkit/terminal/gwt/client/ComponentLocator.java278
-rw-r--r--src/com/itmill/toolkit/terminal/gwt/client/ui/IFilterSelect.java8
-rw-r--r--src/com/itmill/toolkit/terminal/gwt/client/ui/SubPartAware.java11
-rw-r--r--src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java51
-rw-r--r--tests/com/itmill/toolkit/tests/sampler/SamplerSmokeTest.java32
-rw-r--r--tests/com/itmill/toolkit/tests/sampler/SamplerSmokeTest2.java57
8 files changed, 431 insertions, 124 deletions
diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ApplicationConfiguration.java b/src/com/itmill/toolkit/terminal/gwt/client/ApplicationConfiguration.java
index 69006a81e2..0560385799 100644
--- a/src/com/itmill/toolkit/terminal/gwt/client/ApplicationConfiguration.java
+++ b/src/com/itmill/toolkit/terminal/gwt/client/ApplicationConfiguration.java
@@ -21,6 +21,7 @@ public class ApplicationConfiguration {
private String communicationErrorCaption;
private String communicationErrorMessage;
private String communicationErrorUrl;
+ private boolean useDebugIdInDom = true;
private static ArrayList<ApplicationConnection> unstartedApplications = new ArrayList<ApplicationConnection>();
private static ArrayList<ApplicationConnection> runningApplications = new ArrayList<ApplicationConnection>();
@@ -85,6 +86,9 @@ public class ApplicationConfiguration {
if(jsobj.windowName) {
this.@com.itmill.toolkit.terminal.gwt.client.ApplicationConfiguration::windowName = jsobj.windowName;
}
+ if('useDebugIdInDom' in jsobj && typeof(jsobj.useDebugIdInDom) == "boolean") {
+ this.@com.itmill.toolkit.terminal.gwt.client.ApplicationConfiguration::useDebugIdInDom = jsobj.useDebugIdInDom;
+ }
if(jsobj.versionInfo) {
this.@com.itmill.toolkit.terminal.gwt.client.ApplicationConfiguration::versionInfo = jsobj.versionInfo;
}
@@ -190,4 +194,8 @@ public class ApplicationConfiguration {
/*-{
return this.@com.itmill.toolkit.terminal.gwt.client.ApplicationConfiguration::versionInfo.applicationVersion;
}-*/;
+
+ public boolean useDebugIdInDOM() {
+ return useDebugIdInDom;
+ }
}
diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ApplicationConnection.java b/src/com/itmill/toolkit/terminal/gwt/client/ApplicationConnection.java
index df0f9f5519..f3541b5bb3 100755
--- a/src/com/itmill/toolkit/terminal/gwt/client/ApplicationConnection.java
+++ b/src/com/itmill/toolkit/terminal/gwt/client/ApplicationConnection.java
@@ -31,7 +31,6 @@ import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.WindowCloseListener;
import com.google.gwt.user.client.impl.HTTPRequestImpl;
import com.google.gwt.user.client.ui.FocusWidget;
import com.google.gwt.user.client.ui.HasWidgets;
@@ -72,8 +71,6 @@ public class ApplicationConnection {
private static Console console;
- private static boolean testingMode;
-
private final Vector<String> pendingVariables = new Vector<String>();
private final ComponentDetailMap idToPaintableDetail = ComponentDetailMap
@@ -92,21 +89,6 @@ public class ApplicationConnection {
private boolean applicationRunning = false;
- /**
- * True if each Paintable objects id is injected to DOM. Used for Testing
- * Tools.
- */
- private boolean usePaintableIdsInDOM = false;
-
- /**
- * Contains reference for client wrapper given to Testing Tools.
- *
- * Used in JSNI functions
- *
- */
- @SuppressWarnings("unused")
- private final JavaScriptObject ttClientWrapper = null;
-
private int activeRequests = 0;
/** Parameters for this application connection loaded from the web-page */
@@ -137,26 +119,19 @@ public class ApplicationConnection {
this.widgetSet = widgetSet;
configuration = cnf;
windowName = configuration.getInitialWindowName();
-
if (isDebugMode()) {
console = new IDebugConsole(this, cnf, !isQuietDebugMode());
} else {
console = new NullConsole();
}
- if (checkTestingMode()) {
- usePaintableIdsInDOM = true;
- initializeTestingTools();
- Window.addWindowCloseListener(new WindowCloseListener() {
- public void onWindowClosed() {
- uninitializeTestingTools();
- }
+ ComponentLocator componentLocator = new ComponentLocator(this);
- public String onWindowClosing() {
- return null;
- }
- });
- }
+ String appRootPanelName = cnf.getRootPanelId();
+ // remove the end (window name) of autogenarated rootpanel id
+ appRootPanelName = appRootPanelName.replaceFirst("-\\d+$", "");
+
+ initializeTestingToolsHooks(componentLocator, appRootPanelName);
initializeClientHooks();
@@ -176,33 +151,8 @@ public class ApplicationConnection {
makeUidlRequest("", true, false, false);
}
- /**
- * Method to check if application is in testing mode. Can be used after
- * application init.
- *
- * @return true if in testing mode
- */
- public static boolean isTestingMode() {
- return testingMode;
- }
-
- /**
- * Check is application is run in testing mode.
- *
- * @return true if in testing mode
- */
- private native static boolean checkTestingMode()
- /*-{
- try {
- @com.itmill.toolkit.terminal.gwt.client.ApplicationConnection::testingMode = $wnd.top.itmill && $wnd.top.itmill.registerToTT ? true : false;
- return @com.itmill.toolkit.terminal.gwt.client.ApplicationConnection::testingMode;
- } catch(e) {
- // if run in iframe SOP may cause exception, return false then
- return false;
- }
- }-*/;
-
- private native void initializeTestingTools()
+ private native void initializeTestingToolsHooks(
+ ComponentLocator componentLocator, String TTAppId)
/*-{
var ap = this;
var client = {};
@@ -215,8 +165,19 @@ public class ApplicationConnection {
return vi;
}
}
- $wnd.top.itmill.registerToTT(client);
- this.@com.itmill.toolkit.terminal.gwt.client.ApplicationConnection::ttClientWrapper = client;
+
+ client.getElementByPath = function(id) {
+ return componentLocator.@com.itmill.toolkit.terminal.gwt.client.ComponentLocator::getElementByPath(Ljava/lang/String;)(id);
+ }
+ client.getPathForElement = function(element) {
+ return componentLocator.@com.itmill.toolkit.terminal.gwt.client.ComponentLocator::getPathForElement(Lcom/google/gwt/user/client/Element;)(element);
+ }
+
+ if(!$wnd.itmill.clients) {
+ $wnd.itmill.clients = {};
+ }
+
+ $wnd.itmill.clients[TTAppId] = client;
}-*/;
/**
@@ -227,11 +188,6 @@ public class ApplicationConnection {
return configuration.getVersionInfoJSObject();
}
- private native void uninitializeTestingTools()
- /*-{
- $wnd.top.itmill.unregisterFromTT(this.@com.itmill.toolkit.terminal.gwt.client.ApplicationConnection::ttClientWrapper);
- }-*/;
-
/**
* Publishes a JavaScript API for mash-up applications.
* <ul>
@@ -804,15 +760,19 @@ public class ApplicationConnection {
el.tkPid = pid;
}-*/;
- private String getPid(Paintable paintable) {
+ public String getPid(Paintable paintable) {
return getPid(((Widget) paintable).getElement());
}
- private native String getPid(Element el)
+ public native String getPid(Element el)
/*-{
return el.tkPid;
}-*/;
+ public Element getElementByPid(String pid) {
+ return ((Widget) getPaintable(pid)).getElement();
+ }
+
public void unregisterPaintable(Paintable p) {
if (p == null) {
ApplicationConnection.getConsole().error(
@@ -1165,8 +1125,9 @@ public class ApplicationConnection {
}
}
- if (usePaintableIdsInDOM) {
- DOM.setElementProperty(component.getElement(), "id", uidl.getId());
+ if (configuration.useDebugIdInDOM() && uidl.getId().startsWith("PID_S")) {
+ DOM.setElementProperty(component.getElement(), "id", uidl.getId()
+ .substring(5));
}
/*
@@ -1499,10 +1460,8 @@ public class ApplicationConnection {
public IContextMenu getContextMenu() {
if (contextMenu == null) {
contextMenu = new IContextMenu();
- if (usePaintableIdsInDOM) {
- DOM.setElementProperty(contextMenu.getElement(), "id",
- "PID_TOOLKIT_CM");
- }
+ DOM.setElementProperty(contextMenu.getElement(), "id",
+ "PID_TOOLKIT_CM");
}
return contextMenu;
}
@@ -1660,4 +1619,9 @@ public class ApplicationConnection {
public void analyzeLayouts() {
makeUidlRequest("", true, false, true);
}
+
+ public IView getView() {
+ return view;
+ }
+
}
diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ComponentLocator.java b/src/com/itmill/toolkit/terminal/gwt/client/ComponentLocator.java
new file mode 100644
index 0000000000..b0078868dc
--- /dev/null
+++ b/src/com/itmill/toolkit/terminal/gwt/client/ComponentLocator.java
@@ -0,0 +1,278 @@
+package com.itmill.toolkit.terminal.gwt.client;
+
+import java.util.Iterator;
+
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.ui.HasWidgets;
+import com.google.gwt.user.client.ui.Widget;
+import com.itmill.toolkit.terminal.gwt.client.ui.IView;
+import com.itmill.toolkit.terminal.gwt.client.ui.SubPartAware;
+
+/**
+ * Helper class for TestingTools that builds appropriate locators for browser
+ * bot.
+ */
+public class ComponentLocator {
+
+ private static final String PARENTCHILD_SEPARATOR = "/";
+ private static final String SUBPART_SEPARATOR = "#";
+
+ private ApplicationConnection client;
+
+ public ComponentLocator(ApplicationConnection client) {
+ this.client = client;
+ }
+
+ public String getPathForElement(Element targetElement) {
+ String pid = null;
+
+ Element e = targetElement;
+
+ while (true) {
+ pid = client.getPid(e);
+ if (pid != null) {
+ break;
+ }
+
+ e = DOM.getParent(e);
+ if (e == null) {
+ break;
+ }
+ }
+
+ if (e == null || pid == null) {
+ return null;
+ }
+
+ Widget w = (Widget) client.getPaintable(pid);
+ if (w == null) {
+ return null;
+ }
+ // ApplicationConnection.getConsole().log(
+ // "First parent widget: " + Util.getSimpleName(w));
+
+ String path = getPathForWidget(w);
+ // ApplicationConnection.getConsole().log(
+ // "getPathFromWidget returned " + path);
+ if (w.getElement() == targetElement) {
+ // ApplicationConnection.getConsole().log(
+ // "Path for " + Util.getSimpleName(w) + ": " + path);
+
+ return path;
+ } else if (w instanceof SubPartAware) {
+ return path + SUBPART_SEPARATOR
+ + ((SubPartAware) w).getSubPartName(targetElement);
+ } else {
+ path = path + getDOMPathForElement(targetElement, w.getElement());
+ // ApplicationConnection.getConsole().log(
+ // "Path with dom addition for " + Util.getSimpleName(w)
+ // + ": " + path);
+
+ return path;
+ }
+ }
+
+ private Element getElementByDOMPath(Element baseElement, String path) {
+ String parts[] = path.split(PARENTCHILD_SEPARATOR);
+ Element element = baseElement;
+
+ for (String part : parts) {
+ if (part.startsWith("domChild[")) {
+ String childIndexString = part.substring("domChild[".length(),
+ part.length() - 1);
+ try {
+ int childIndex = Integer.parseInt(childIndexString);
+ element = DOM.getChild(element, childIndex);
+ } catch (Exception e) {
+ // ApplicationConnection.getConsole().error(
+ // "Failed to parse integer in " + childIndexString);
+ return null;
+ }
+ }
+ }
+
+ return element;
+ }
+
+ private String getDOMPathForElement(Element element, Element baseElement) {
+ Element e = element;
+ String path = "";
+ while (true) {
+ Element parent = DOM.getParent(e);
+ if (parent == null) {
+ return "ERROR, baseElement is not a parent to element";
+ }
+
+ int childIndex = -1;
+
+ int childCount = DOM.getChildCount(parent);
+ for (int i = 0; i < childCount; i++) {
+ if (e == DOM.getChild(parent, i)) {
+ childIndex = i;
+ break;
+ }
+ }
+ if (childIndex == -1) {
+ return "ERROR, baseElement is not a parent to element.";
+ }
+
+ path = PARENTCHILD_SEPARATOR + "domChild[" + childIndex + "]"
+ + path;
+
+ if (parent == baseElement) {
+ break;
+ }
+
+ e = parent;
+ }
+
+ return path;
+ }
+
+ public Element getElementByPath(String path) {
+ // ApplicationConnection.getConsole()
+ // .log("getElementByPath(" + path + ")");
+
+ // Path is of type "PID/componentPart"
+ String parts[] = path.split(SUBPART_SEPARATOR, 2);
+ String widgetPath = parts[0];
+ Widget w = getWidgetFromPath(widgetPath);
+ if (w == null) {
+ return null;
+ }
+
+ if (parts.length == 1) {
+ int pos = widgetPath.indexOf("domChild");
+ if (pos == -1) {
+ return w.getElement();
+ }
+
+ // Contains dom reference to a sub element of the widget
+ String subPath = widgetPath.substring(pos);
+ return getElementByDOMPath(w.getElement(), subPath);
+ } else if (parts.length == 2) {
+ if (w instanceof SubPartAware) {
+ // ApplicationConnection.getConsole().log(
+ // "subPartAware: " + parts[1]);
+ return ((SubPartAware) w).getSubPartElement(parts[1]);
+ } else {
+ // ApplicationConnection.getConsole().error(
+ // "getElementByPath failed because "
+ // + Util.getSimpleName(w)
+ // + " is not SubPartAware");
+ return null;
+ }
+ }
+
+ return null;
+ }
+
+ private String getPathForWidget(Widget w) {
+ String pid = client.getPid(w.getElement());
+ if (isStaticPid(pid)) {
+ return pid;
+ }
+
+ if (w instanceof IView) {
+ return "";
+ }
+
+ Widget parent = w.getParent();
+
+ String basePath = getPathForWidget(parent);
+
+ String simpleName = Util.getSimpleName(w);
+
+ Iterator i = ((HasWidgets) parent).iterator();
+ int pos = 0;
+ while (i.hasNext()) {
+ Object child = i.next();
+ if (child == w) {
+ return basePath + PARENTCHILD_SEPARATOR + simpleName + "["
+ + pos + "]";
+ }
+ String simpleName2 = Util.getSimpleName(child);
+ if (simpleName.equals(simpleName2)) {
+ pos++;
+ }
+ }
+
+ return "NOTFOUND";
+ }
+
+ private Widget getWidgetFromPath(String path) {
+ Widget w = null;
+ String parts[] = path.split(PARENTCHILD_SEPARATOR);
+
+ // ApplicationConnection.getConsole().log(
+ // "getWidgetFromPath(" + path + ")");
+
+ for (String part : parts) {
+ // ApplicationConnection.getConsole().log("Part: " + part);
+ // ApplicationConnection.getConsole().log(
+ // "Widget: " + Util.getSimpleName(w));
+ if (part.equals("")) {
+ w = client.getView();
+ } else if (w == null) {
+ w = (Widget) client.getPaintable(part);
+ } else if (part.startsWith("domChild[")) {
+ break;
+ } else if (w instanceof HasWidgets) {
+ HasWidgets parent = (HasWidgets) w;
+
+ String simpleName = Util.getSimpleName(parent);
+
+ Iterator i = parent.iterator();
+
+ boolean ok = false;
+ String[] split = part.split("\\[");
+ int pos = Integer.parseInt(split[1].substring(0, split[1]
+ .length() - 1));
+ // ApplicationConnection.getConsole().log(
+ // "Looking for child " + pos);
+ while (i.hasNext()) {
+ // ApplicationConnection.getConsole().log("- child found");
+
+ Widget child = (Widget) i.next();
+ String simpleName2 = Util.getSimpleName(child);
+
+ if (split[0].equals(simpleName2)) {
+ if (pos == 0) {
+ w = child;
+ ok = true;
+ break;
+ }
+ pos--;
+ }
+ }
+
+ if (!ok) {
+ // Did not find the child
+ // ApplicationConnection.getConsole().error(
+ // "getWidgetFromPath(" + path + ") - did not find '"
+ // + part + "' for "
+ // + Util.getSimpleName(parent));
+
+ return null;
+ }
+ } else {
+ // ApplicationConnection.getConsole().error(
+ // "getWidgetFromPath(" + path + ") - failed for '" + part
+ // + "'");
+ return null;
+ }
+ }
+
+ return w;
+ }
+
+ private boolean isStaticPid(String pid) {
+ if (pid == null) {
+ return false;
+ }
+
+ return pid.startsWith("PID_S");
+ }
+
+}
diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IFilterSelect.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IFilterSelect.java
index e76374cfc2..3b0fdd7927 100644
--- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IFilterSelect.java
+++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IFilterSelect.java
@@ -131,11 +131,9 @@ public class IFilterSelect extends Composite implements Paintable, Field,
Collection<FilterSelectSuggestion> currentSuggestions,
int currentPage, int totalSuggestions) {
- if (ApplicationConnection.isTestingMode()) {
- // Add TT anchor point
- DOM.setElementProperty(getElement(), "id", paintableId
- + "_OPTIONLIST");
- }
+ // Add TT anchor point
+ DOM.setElementProperty(getElement(), "id",
+ "TOOLKIT_COMBOBOX_OPTIONLIST");
menu.setSuggestions(currentSuggestions);
final int x = IFilterSelect.this.getAbsoluteLeft();
diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/SubPartAware.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/SubPartAware.java
new file mode 100644
index 0000000000..76ba7524be
--- /dev/null
+++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/SubPartAware.java
@@ -0,0 +1,11 @@
+package com.itmill.toolkit.terminal.gwt.client.ui;
+
+import com.google.gwt.user.client.Element;
+
+public interface SubPartAware {
+
+ Element getSubPartElement(String subPart);
+
+ String getSubPartName(Element subElement);
+
+} \ No newline at end of file
diff --git a/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java b/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java
index bada4af66f..b9c8d58ff5 100644
--- a/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java
+++ b/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java
@@ -10,7 +10,6 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
-import java.io.Writer;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -165,10 +164,6 @@ public class ApplicationServlet extends HttpServlet {
private ClassLoader classLoader;
- private boolean testingToolsActive = false;
-
- private String testingToolsServerUri = null;
-
/**
* Called by the servlet container to indicate to a servlet that the servlet
* is being placed into service.
@@ -234,14 +229,6 @@ public class ApplicationServlet extends HttpServlet {
System.err.println(NOT_PRODUCTION_MODE_INFO);
}
- // Gets Testing Tools parameters if feature is activated
- if (getApplicationOrSystemProperty("testingToolsActive", "false")
- .equals("true")) {
- testingToolsActive = true;
- testingToolsServerUri = getApplicationOrSystemProperty(
- "testingToolsServerUri", null);
- }
-
// Gets custom class loader
final String classLoaderName = getApplicationOrSystemProperty(
"ClassLoader", null);
@@ -844,9 +831,6 @@ public class ApplicationServlet extends HttpServlet {
themeUri = staticFilePath + "/" + THEME_DIRECTORY_PATH + themeName;
}
- boolean testingApplication = testingToolsActive
- && request.getParameter("TT") != null;
-
if (!fragment) {
// Window renders are not cacheable
response.setHeader("Cache-Control", "no-cache");
@@ -879,12 +863,6 @@ public class ApplicationServlet extends HttpServlet {
page.write("<title>" + title + "</title>");
- if (testingApplication) {
- // TT script needs to be in head as it needs to be the first
- // to hook capturing event listeners
- writeTestingToolsScripts(page, request);
- }
-
page
.write("\n</head>\n<body scroll=\"auto\" class=\"i-generated-body\">\n");
}
@@ -896,7 +874,11 @@ public class ApplicationServlet extends HttpServlet {
appId = appId.replaceAll("[^a-zA-Z0-9]", "");
// Add hashCode to the end, so that it is still (sort of) predictable,
// but indicates that it should not be used in CSS and such:
- appId = appId + appId.hashCode();
+ int hashCode = appId.hashCode();
+ if (hashCode < 0) {
+ hashCode = -hashCode;
+ }
+ appId = appId + "-" + hashCode;
// Get system messages
Application.SystemMessages systemMessages = null;
@@ -1119,29 +1101,6 @@ public class ApplicationServlet extends HttpServlet {
return false;
}
- private void writeTestingToolsScripts(Writer page,
- HttpServletRequest request) throws IOException {
- // Testing Tools script and CSS files are served from Testing Tools
- // Server
- String ext = getTestingToolsUri(request);
- ext = ext.substring(0, ext.lastIndexOf('/'));
- page.write("<script src=\"" + ext + "/ext/TT.js"
- + "\" type=\"text/javascript\"></script>\n");
- page.write("<link rel=\"stylesheet\" href=\"" + ext + "/ext/TT.css"
- + "\" type=\"text/css\" />\n");
-
- }
-
- private String getTestingToolsUri(HttpServletRequest request) {
- if (testingToolsServerUri == null) {
- // Default behavior is that Testing Tools Server application exists
- // on same host as current application does in port 8099.
- testingToolsServerUri = "http" + "://" + request.getServerName()
- + ":8099" + "/TestingToolsServer";
- }
- return testingToolsServerUri;
- }
-
/**
* Handles the requested URI. An application can add handlers to do special
* processing, when a certain URI is requested. The handlers are invoked
diff --git a/tests/com/itmill/toolkit/tests/sampler/SamplerSmokeTest.java b/tests/com/itmill/toolkit/tests/sampler/SamplerSmokeTest.java
new file mode 100644
index 0000000000..125423633a
--- /dev/null
+++ b/tests/com/itmill/toolkit/tests/sampler/SamplerSmokeTest.java
@@ -0,0 +1,32 @@
+package com.itmill.toolkit.tests.sampler;
+
+import com.itmill.testingtools.runner.TestRunner;
+
+public class SamplerSmokeTest extends TestRunner {
+
+ public void testNew() throws Exception {
+ selenium.open("/sampler?restartApplication");
+ waitForITMillToolkit();
+ selenium
+ .click("itmilltoolkit=sampler::/IVerticalLayout[0]/ChildComponentContainer[1]/ISplitPanelHorizontal[0]/IPanel[0]/IGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[1]/IButton[0]");
+ waitForITMillToolkit();
+ assertEquals(
+ "Tooltips",
+ selenium
+ .getText("itmilltoolkit=sampler::/IVerticalLayout[0]/ChildComponentContainer[1]/ISplitPanelHorizontal[0]/IHorizontalLayout[0]/ChildComponentContainer[0]/IVerticalLayout[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]"));
+ selenium
+ .click("itmilltoolkit=sampler::/IVerticalLayout[0]/ChildComponentContainer[1]/ISplitPanelHorizontal[0]/IHorizontalLayout[0]/ChildComponentContainer[0]/IVerticalLayout[0]/ChildComponentContainer[1]/IVerticalLayout[0]/ChildComponentContainer[3]/IButton[0]");
+ waitForITMillToolkit();
+ selenium
+ .click("itmilltoolkit=sampler::/IVerticalLayout[0]/ChildComponentContainer[1]/ISplitPanelHorizontal[0]/IHorizontalLayout[0]/ChildComponentContainer[0]/IVerticalLayout[0]/ChildComponentContainer[1]/IVerticalLayout[0]/ChildComponentContainer[3]/IButton[0]");
+ waitForITMillToolkit();
+ selenium
+ .click("itmilltoolkit=sampler::/IVerticalLayout[0]/ChildComponentContainer[1]/ISplitPanelHorizontal[0]/IHorizontalLayout[0]/ChildComponentContainer[0]/IVerticalLayout[0]/ChildComponentContainer[0]/IVerticalLayout[0]/ChildComponentContainer[0]/IHorizontalLayout[0]/ChildComponentContainer[2]/IActiveLink[0]/domChild[0]/domChild[0]");
+ waitForITMillToolkit();
+ verifyTrue(selenium
+ .isTextPresent("'m terribly sorry, but it seems the source could not be found.\nPlease try adding the source folder to the classpath for your server, or tell the administrator to do so!"));
+ waitForITMillToolkit();
+ selenium.click("PID141_window_close");
+ waitForITMillToolkit();
+ }
+}
diff --git a/tests/com/itmill/toolkit/tests/sampler/SamplerSmokeTest2.java b/tests/com/itmill/toolkit/tests/sampler/SamplerSmokeTest2.java
new file mode 100644
index 0000000000..3a6b3d8191
--- /dev/null
+++ b/tests/com/itmill/toolkit/tests/sampler/SamplerSmokeTest2.java
@@ -0,0 +1,57 @@
+package com.itmill.toolkit.tests.sampler;
+
+import com.itmill.testingtools.runner.TestRunner;
+
+public class SamplerSmokeTest2 extends TestRunner {
+
+ public void testNew() throws Exception {
+ selenium.open("/sampler?restartApplication");
+ waitForITMillToolkit();
+ selenium
+ .click("itmilltoolkit=sampler::/IVerticalLayout[0]/ChildComponentContainer[1]/ISplitPanelHorizontal[0]/IPanel[0]/IGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[16]/IButton[0]");
+ waitForITMillToolkit();
+ selenium
+ .click("itmilltoolkit=sampler::/IVerticalLayout[0]/ChildComponentContainer[0]/IHorizontalLayout[0]/ChildComponentContainer[6]/IHorizontalLayout[0]/ChildComponentContainer[1]/IButton[0]");
+ waitForITMillToolkit();
+ selenium
+ .type(
+ "itmilltoolkit=sampler::/IVerticalLayout[0]/ChildComponentContainer[1]/ISplitPanelHorizontal[0]/IHorizontalLayout[0]/ChildComponentContainer[0]/IVerticalLayout[0]/ChildComponentContainer[1]/IVerticalLayout[0]/ChildComponentContainer[0]/IForm[0]/IFormLayout[0]/IFormLayout$IFormLayoutTable[0]/ITextField[0]",
+ "Peter");
+ waitForITMillToolkit();
+ selenium
+ .type(
+ "itmilltoolkit=sampler::/IVerticalLayout[0]/ChildComponentContainer[1]/ISplitPanelHorizontal[0]/IHorizontalLayout[0]/ChildComponentContainer[0]/IVerticalLayout[0]/ChildComponentContainer[1]/IVerticalLayout[0]/ChildComponentContainer[0]/IForm[0]/IFormLayout[0]/IFormLayout$IFormLayoutTable[0]/ITextField[1]",
+ "Person");
+ waitForITMillToolkit();
+ selenium
+ .type(
+ "itmilltoolkit=sampler::/IVerticalLayout[0]/ChildComponentContainer[1]/ISplitPanelHorizontal[0]/IHorizontalLayout[0]/ChildComponentContainer[0]/IVerticalLayout[0]/ChildComponentContainer[1]/IVerticalLayout[0]/ChildComponentContainer[0]/IForm[0]/IFormLayout[0]/IFormLayout$IFormLayoutTable[0]/IFilterSelect[0]/domChild[1]",
+ "finland");
+ waitForITMillToolkit();
+ selenium
+ .type(
+ "itmilltoolkit=sampler::/IVerticalLayout[0]/ChildComponentContainer[1]/ISplitPanelHorizontal[0]/IHorizontalLayout[0]/ChildComponentContainer[0]/IVerticalLayout[0]/ChildComponentContainer[1]/IVerticalLayout[0]/ChildComponentContainer[0]/IForm[0]/IFormLayout[0]/IFormLayout$IFormLayoutTable[0]/IPasswordField[0]",
+ "mypass");
+ waitForITMillToolkit();
+ selenium
+ .click("itmilltoolkit=sampler::/IVerticalLayout[0]/ChildComponentContainer[1]/ISplitPanelHorizontal[0]/IHorizontalLayout[0]/ChildComponentContainer[0]/IVerticalLayout[0]/ChildComponentContainer[1]/IVerticalLayout[0]/ChildComponentContainer[0]/IForm[0]/IFormLayout[0]/IFormLayout$IFormLayoutTable[0]/IPopupCalendar[0]/domChild[1]");
+ waitForITMillToolkit();
+ selenium
+ .click("//table[@id='PID_TOOLKIT_POPUPCAL']/tbody/tr[4]/td[2]/span");
+ waitForITMillToolkit();
+ selenium
+ .type(
+ "itmilltoolkit=sampler::/IVerticalLayout[0]/ChildComponentContainer[1]/ISplitPanelHorizontal[0]/IHorizontalLayout[0]/ChildComponentContainer[0]/IVerticalLayout[0]/ChildComponentContainer[1]/IVerticalLayout[0]/ChildComponentContainer[0]/IForm[0]/IFormLayout[0]/IFormLayout$IFormLayoutTable[0]/ITextField[2]",
+ "45");
+ waitForITMillToolkit();
+ selenium
+ .click("itmilltoolkit=sampler::/IVerticalLayout[0]/ChildComponentContainer[1]/ISplitPanelHorizontal[0]/IHorizontalLayout[0]/ChildComponentContainer[0]/IVerticalLayout[0]/ChildComponentContainer[1]/IVerticalLayout[0]/ChildComponentContainer[0]/IForm[0]/IFormLayout[0]/IFormLayout$IFormLayoutTable[0]/IHorizontalLayout[0]/ChildComponentContainer[1]/IButton[0]");
+ waitForITMillToolkit();
+ selenium
+ .click("itmilltoolkit=sampler::/IVerticalLayout[0]/ChildComponentContainer[1]/ISplitPanelHorizontal[0]/IHorizontalLayout[0]/ChildComponentContainer[0]/IVerticalLayout[0]/ChildComponentContainer[1]/IVerticalLayout[0]/ChildComponentContainer[1]/IButton[0]");
+ waitForITMillToolkit();
+ verifyTrue(selenium
+ .isTextPresent("First name: Peter\nLast name: Person\nCountry:"));
+ verifyTrue(selenium.isTextPresent("Shoe size: 45\nPassword: mypass"));
+ }
+}