-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi, I'm starting with ZATS, but having a problem with DesktopAgent.query. If I use it with tags (label, textbox, etc.), it works ok. If I try to use it with id's (#customerName, etc.), it always returns null. Any hints?
Thanks in advance!
Hi guto,
have you found any solution for this? I'm having the same problem...
This works fine:
ComponentAgent usernameInput = desktop.query("textbox");
whereas this:
ComponentAgent usernameInput = desktop.query("#username");
returns "null" every time.
Test case:
public class LoginMimicTest
extends AbstractBaseTestCase
{
public void setUp()
throws Exception
{
super.setUp();
//set secureTransfer into test mode
setTestModeAndDummySCContext();
//initialise the application path
Zats.init("/");
}
public void testLogin()
{
//create client to connect to the zul-file
DesktopAgent desktop = Zats.newClient().connect("/LoginContent.zul");
//get the username input field
ComponentAgent usernameInput = desktop.query("#username");
assertNotNull(usernameInput); //and check if its not null
}
public void tearDown()
throws Exception
{
super.tearDown();
Zats.cleanup();
Zats.end();
}
}
Test-Page:
<zk xmlns:h="native" xmlns:zk="http://www.zkoss.org/2005/zk">
<script type="text/javascript" src="/javascript/input.min.js" />
<script>
<![CDATA[ window.setTimeout("overrideInput();", 500); ]]>
</script>
<window width="100%" height="100%" border="none" id="loginWindow"
onCreate="loginWindow.onCreate();" sclass="login-window"
use="[...]">
<!-- Timer used for keeping up session timeout (PE-1654) -->
<timer repeats="true" running="true" delay="1800000"
apply="[...]" />
<h:div class="login-content">
<h:div class="login-image-div">
<image src="${dd:getImagePath('[...]')}" sclass="[...]"/>
<h:div class="login-mask">
<h:div class="login-mask-inner">
<h:div class="login-mask-row">
<h:span
class="login-label login-label-username">
${c:l('login.username')}
</h:span>
<textbox width="225px"
value="${loginWindow.developmentLogin}" id="username"
tabindex="1" focus="true" onOK="password.focus()" />
</h:div>
.... ....
(I left a few things out, see [...] ).
I have the same problem with zats-1.1.0
I got it: You must query one level by one level.
For your code above,you must do like this: desktop.query("#loginWindow").query("#username")
Asked: 2013-01-31 01:17:45 +0800
Seen: 52 times
Last updated: Aug 28 '13
ZATS: Error 500 when connecting to ZUL due to missing class org.zkoss.xel.zel.XelELResolver
ZATS: NoSuchMethodError getContextPath()
ZATS Mimic - Replacing Server Emulator (Jetty Lite) with Glassfish
ZATS does not work with combobox MVVM @save
What is ZATS version 1.1.0.FL.20120710?
Please post test case code and testing page code
ashishd ( 2013-02-01 01:27:32 +0800 )edit