Hi,
I created a test case based on the html from you:
<table id="helloForm:outGrid" border="10">
<tbody>
<tr>
<td><input id="helloForm:textCol1" name="helloForm:textCol1"
type="text"></td>
<td>TextCol-1</td>
<td><a href="#"
onclick="document.forms['helloForm']['helloForm:_idcl'].value='helloForm:_id2';document.forms['helloForm'].submit();
return false;">Go for another page.</a></td>
<td><input id="helloForm:buttonCol1" name="helloForm:buttonCol1"
value="Button-1" type="submit"></td>
</tr>
</tbody>
</table>
I defined the UI module as follows:
class DataGridModule extends DslContext{
public void defineUi() {
ui.StandardTable(uid: "HelloFormoutGrid", clocator: [tag: "table",
id: "helloForm:outGrid"]){
InputBox(uid: "{tbody: 1, row: all, column: 1}", clocator:
[name:"*helloForm:textCol"])
TextBox(uid: "{tbody: 1, row: all, column: 2}", clocator: [tag:
"td"], self: true)
UrlLink(uid: "{tbody: 1, row: all, column: 3}", clocator: [:])
SubmitButton(uid: "{tbody: 1, row: all, column: 4}", clocator:
[:])
}
ui.StandardTable(uid: "HelloFormoutGrid2", clocator: [tag: "table",
id: "helloForm:outGrid"]){
InputBox(uid: "{row: all, column: 1}", clocator: [:])
TextBox(uid: "{row: all, column: 2}", clocator: [tag: "td"],
self: true)
UrlLink(uid: "{row: all, column: 3}", clocator: [:])
SubmitButton(uid: "{row: all, column: 4}", clocator: [:])
}
}
public void testSubmit1(){
type "HelloFormoutGrid[1][1][1]", "Hello there"
println getText("HelloFormoutGrid[1][1][2]")
click "HelloFormoutGrid[1][1][4]"
pause 500
}
public void testLink1(){
type "HelloFormoutGrid[1][1][1]", "Hello there"
println getText("HelloFormoutGrid[1][1][2]")
click "HelloFormoutGrid[1][1][3]"
pause 500
}
public void testSubmit2(){
type "HelloFormoutGrid[1][1]", "Hello there"
println getText("HelloFormoutGrid[1][2]")
click "HelloFormoutGrid[1][4]"
pause 500
}
public void testLink2(){
type "HelloFormoutGrid[1][1]", "Hello there"
println getText("HelloFormoutGrid[1][2]")
click "HelloFormoutGrid[1][3]"
pause 500
}
}
The second UI module "HelloFormoutGrid2" is defined to see what I suggested
works.
Here is the test case
public class DataGridTestCase extends TelluriumMockJUnitTestCase {
private static DataGridModule dgm;
@BeforeClass
public static void initUi() {
registerHtml("DataGrid");
dgm = new DataGridModule();
dgm.defineUi();
}
@Before
public void connectToLocal() {
connect("DataGrid");
}
@Test
public void testLink1WithXPath(){
useCssSelector(false);
dgm.testLink1();
}
@Test
public void testLink1WithCSS(){
useCssSelector(true);
dgm.testLink1();
}
@Test
public void testLink1WithNewEngine(){
useTelluriumEngine(true);
dgm.testLink1();
useTelluriumEngine(false);
}
@Test
public void testLink2WithXPath(){
useCssSelector(false);
dgm.testLink2();
}
@Test
public void testLink2WithCSS(){
useCssSelector(true);
dgm.testLink2();
}
@Test
public void testLink2WithNewEngine(){
useTelluriumEngine(true);
dgm.testLink1();
useTelluriumEngine(false);
}
@Test
public void testSubmit1WithXPath(){
useCssSelector(false);
dgm.testSubmit1();
}
@Test
public void testSubmit2WithXPath(){
useCssSelector(false);
dgm.testSubmit2();
}
@Test
public void testSubmit1WithNewEngine(){
useTelluriumEngine(true);
dgm.testSubmit1();
useTelluriumEngine(false);
}
@Test
public void testSubmit2WithNewEngine(){
useTelluriumEngine(true);
dgm.testSubmit1();
useTelluriumEngine(false);
}
@AfterClass
public static void tearDown(){
showTrace();
}
}
The tests passed except the following test cases that used CSS selectors
public void testLink1WithCSS()
public void testLink2WithCSS()
That is to say, you should either XPath locator or the new Engine if you
have custom namespaces in your UIs.
This problem comes from the fact that jQuery has no selectors that
understand XML namespaces, see the following
posts:
http://stackoverflow.com/questions/91518/jquery-attribute-selectors-how-to-query-for-an-attribute-with-a-custom-namespace
http://www.xml.com/lpt/a/1717
There was a ticket opened for this issue in jQuery, but not sure if this is
closed for 1.4.1 or not.
http://dev.jquery.com/ticket/155
Thanks,
Jian
On Mon, Sep 20, 2010 at 10:06 AM, Jian Fang <[email protected]>wrote:
> For your UI module as follows:
>
>
> public void defineUi() {
> ui.StandardTable(uid: "HelloFormoutGrid", clocator: [tag: "table",
> id: "helloForm:outGrid"]){
> InputBox(uid: "{tbody: 1, row: all, column: 1}", clocator:
> [name:"helloForm:textCol*"])
> }
> }
>
> Could you change it to
>
> public void defineUi() {
> ui.StandardTable(uid: "HelloFormoutGrid", clocator: [tag: "table",
> id: "helloForm:outGrid"]){
> InputBox(uid: "{row: all, column: 1}", clocator: [:])
> }
> }
>
> For table, the element can be referenced by its index unless the position
> keeps changing.
>
> Thanks,
>
> Jian
>
>
>
> On Mon, Sep 20, 2010 at 9:53 AM, Jian Fang <[email protected]>wrote:
>
>> Sorry, I thought your problem was resolved since I didn't hear back from
>> you. Do you mind sending me the runtime
>> html source generated from the JSF tags? Also show me your UI module
>> definition for that piece of html. I can
>> wrap up a test case based on the information you provide to debug what was
>> the problem.
>>
>> Tellurium UI templates are targeted for dynamic grids and we will try our
>> best to help you out. You can chat we me via GMail if I am available on
>> line.
>>
>> Thanks,
>>
>> Jian
>>
>>
>> On Mon, Sep 20, 2010 at 9:09 AM, Eric Gokavi <[email protected]>wrote:
>>
>>> Hello Jian,
>>>
>>> I am still struggling to get this below mentioned Grid Problem right.
>>> I was involved in some other tasks for some days and was away from
>>> Tellurium till today, today i started the POC again but with no success.
>>>
>>> Tellurium as a testing framework, is very suitable for our application.
>>> The only problem is we have lot of girds in our application and we are
>>> facing the dynamic grid problem.
>>>
>>> I request you to please get back to me if you are not getting the exact
>>> problem, if possible for you we can have a WebEx too.
>>>
>>> Request your response soon.
>>>
>>> Thanks,
>>> -Eric.
>>>
>>>
>>> On Tue, Aug 24, 2010 at 6:48 PM, Jian Fang <[email protected]>wrote:
>>>
>>>> The partial match String "*" should be at the beginning of the string,
>>>> i.e., not "helloForm:textCol*" and should be "*helloForm:textCol".
>>>>
>>>> If you only have one tbody tag, the tbody section can be omitted and you
>>>> don't really need the partial matching since the Table is accessed by row
>>>> and column. I would suggest you try the following UI module
>>>>
>>>>
>>>> ui.StandardTable(uid: "HelloFormoutGrid", clocator: [tag:
>>>> "table", id: "helloForm:outGrid"]){
>>>> InputBox(uid: "{row: all, column: 1}", clocator: [type:
>>>> "text"])
>>>> }
>>>>
>>>> Thanks,
>>>>
>>>> Jian
>>>>
>>>> On Tue, Aug 24, 2010 at 1:15 AM, Eric Gokavi <[email protected]>wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> As you had suggested i used the getHTMLSource() method on my grid.
>>>>> I am just posting the results, unfortunately my solution is still not
>>>>> working.. :(
>>>>> The problem i posted in the last post still persists.
>>>>>
>>>>> My JSF Grid code is :
>>>>> ------------------------------------
>>>>>
>>>>> <h:form id="helloForm">
>>>>> <h:panelGrid columns="4" border="10" id="outGrid">
>>>>> <f:facet name="header">
>>>>> <h:outputText value="Input Box Column"/>
>>>>> </f:facet>
>>>>> <h:inputText id="textCol1"/>
>>>>> <h:outputText value="TextCol-1"/>
>>>>> <h:commandLink action="greeting" value="Go for
>>>>> another page."/>
>>>>> <h:commandButton id="buttonCol1" value="Button-1"
>>>>> action="greeting"/>
>>>>> </h:panelGrid>
>>>>> </h:form>
>>>>>
>>>>> My .groovy file code is
>>>>> ---------------------------------
>>>>>
>>>>> public void defineUi() {
>>>>> ui.StandardTable(uid: "HelloFormoutGrid", clocator: [tag:
>>>>> "table", id: "helloForm:outGrid"]){
>>>>> InputBox(uid: "{tbody: 1, row: all, column: 1}", clocator:
>>>>> [name:"helloForm:textCol*"])
>>>>> }
>>>>> }
>>>>>
>>>>> public void testLink(){
>>>>> pause 3000
>>>>> getHTMLSource("HelloFormoutGrid");
>>>>> type "HelloFormoutGrid[1][1][1]", "Hello there"
>>>>> }
>>>>>
>>>>> The output of the getHTMLSource() method called above is
>>>>>
>>>>> ----------------------------------------------------------------------------------------
>>>>>
>>>>> HelloFormoutGrid:
>>>>> <table id="helloForm:outGrid" border="10">
>>>>> <tbody>
>>>>> <tr>
>>>>> <td><input id="helloForm:textCol1"
>>>>> name="helloForm:textCol1" type="text"></td>
>>>>> <td>TextCol-1</td>
>>>>> <td><a href="#"
>>>>> onclick="document.forms['helloForm']['helloForm:_idcl'].value='helloForm:_id2';document.forms['helloForm'].submit();
>>>>> return false;">Go for another page.</a></td>
>>>>> <td><input id="helloForm:buttonCol1"
>>>>> name="helloForm:buttonCol1" value="Button-1" type="submit"></td>
>>>>> </tr>
>>>>> </tbody>
>>>>> </table>
>>>>>
>>>>> HelloFormoutGrid[1][1][1]:
>>>>> <td><input id="helloForm:textCol1" name="helloForm:textCol1"
>>>>> type="text"></td>
>>>>>
>>>>> HelloFormoutGrid[1][1][2]:
>>>>> <td>TextCol-1</td>
>>>>>
>>>>> HelloFormoutGrid[1][1][3]:
>>>>> <td><a href="#"
>>>>> onclick="document.forms['helloForm']['helloForm:_idcl'].value='helloForm:_id2';
>>>>> document.forms['helloForm'].submit(); return false;">Go for another
>>>>> page.</a></td>
>>>>>
>>>>> HelloFormoutGrid[1][1][4]:
>>>>> <td><input id="helloForm:buttonCol1" name="helloForm:buttonCol1"
>>>>> value="Button-1" type="submit"></td>
>>>>>
>>>>>
>>>>>
>>>>> Can you suggest what is going wrong here now by looking a the
>>>>> getHTMLSource method output?
>>>>>
>>>>> Please reply, waiting for your response.
>>>>>
>>>>> Thanks,
>>>>> -Eric.
>>>>>
>>>>>
>>>>>
>>>>> On Thu, Aug 19, 2010 at 6:58 PM, Jian Fang
>>>>> <[email protected]>wrote:
>>>>>
>>>>>> Eric,
>>>>>>
>>>>>> I suspect there are some problems with your UI module, for the first
>>>>>> UI module, you need to use
>>>>>> UDL to define it since StandardTable uses UI template.
>>>>>>
>>>>>>
>>>>>> ui.Form(uid: "HelloForm", clocator: [tag: "form", method: "post", id:
>>>>>> "helloForm"]){
>>>>>> StandardTable(uid: "HelloFormoutGrid", clocator: [tag: "table",
>>>>>> id: "helloForm:outGrid"]){
>>>>>> InputBox(uid: "HelloFormtextCol1", clocator:[id:
>>>>>> "helloForm:textCol1"])
>>>>>> }
>>>>>> }
>>>>>>
>>>>>> For instance, you could use
>>>>>>
>>>>>>
>>>>>> ui.Form(uid: "HelloForm", clocator: [tag: "form", method: "post",
>>>>>> id:"helloForm"]){
>>>>>> StandardTable(uid: "HelloFormoutGrid", clocator: [tag:
>>>>>> "table",id: "helloForm:outGrid"]){
>>>>>> InputBox(uid: "{row: 1, column: 1} as
>>>>>> HelloFormtextCol1", clocator:[id:"helloForm:textCol1"])
>>>>>> }
>>>>>> }
>>>>>>
>>>>>> Be aware you should not use the same ID attribute for multiple
>>>>>> elements.
>>>>>>
>>>>>> Thus, for your second UI module, you could define it as
>>>>>>
>>>>>>
>>>>>>
>>>>>> ui.Form(uid: "HelloForm", clocator: [tag: "form", method: "post",
>>>>>> id:"helloForm"]){
>>>>>> StandardTable(uid: "HelloFormoutGrid", clocator: [tag:
>>>>>> "table",id: "helloForm:outGrid"]){
>>>>>> InputBox(uid: "{row: all, column: 1}", clocator: [:])
>>>>>> }
>>>>>> }
>>>>>>
>>>>>> Or use partial match (
>>>>>> http://code.google.com/p/aost/wiki/UserGuide070AppendixB#How_to_do_Attribute_Partial_Matching_in_Tellurium)
>>>>>> for the id attribute
>>>>>>
>>>>>>
>>>>>> ui.Form(uid: "HelloForm", clocator: [tag: "form", method: "post",
>>>>>> id:"helloForm"]){
>>>>>> StandardTable(uid: "HelloFormoutGrid", clocator: [tag:
>>>>>> "table",id: "helloForm:outGrid"]){
>>>>>> InputBox(uid: "{row: all, column: 1}", clocator:
>>>>>> [id:"*^*helloForm:textCol"])
>>>>>> }
>>>>>> }
>>>>>>
>>>>>> I need to see the runtime html source so that I can figure out what
>>>>>> the correct UI module works for you.
>>>>>> (Sorry, Trump does not support UI module yet).
>>>>>>
>>>>>> You could get the runtime html source using DOM inspector or by
>>>>>> calling the following method in Telllurium:
>>>>>>
>>>>>> getHTMLSource("HelloForm");
>>>>>>
>>>>>>
>>>>>> http://code.google.com/p/aost/wiki/UserGuide070TelluriumAPIs#getHTMLSource
>>>>>>
>>>>>> The tellurium-website reference project included data grids, for
>>>>>> example, the issue search result.
>>>>>> But we do appreciate if some users could provide their examples to
>>>>>> help Eric. Telluirum cannot really grow without
>>>>>> a good community support.
>>>>>>
>>>>>> Thanks in advance,
>>>>>>
>>>>>> Jian
>>>>>>
>>>>>>
>>>>>> On Thu, Aug 19, 2010 at 6:10 AM, Eric Gokavi <[email protected]>wrote:
>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> I had posted a project regarding a JSF Grid not working few days
>>>>>>> back.
>>>>>>> Now the progress is i am able to test everything except :(,
>>>>>>>
>>>>>>> Taking the example by code.
>>>>>>> This is my small Grid Code(This is JSF Grid):
>>>>>>> =======================
>>>>>>> <h:form id="helloForm">
>>>>>>> <h:panelGrid columns="1" border="10" id="outGrid">
>>>>>>> <h:inputText id="textCol1"/>
>>>>>>> <h:inputText id="textCol2"/>
>>>>>>> <h:inputText id="textCol3"/>
>>>>>>> <h:inputText id="textCol4"/>
>>>>>>> </h:panelGrid>
>>>>>>> </h:form>
>>>>>>>
>>>>>>> Now i generate a .groovy code using the TrUMP utility by clicking on
>>>>>>> the Grid and the 1st Text box.
>>>>>>>
>>>>>>> Scenario : 1
>>>>>>> =========
>>>>>>> The code is:
>>>>>>>
>>>>>>> ui.Form(uid: "HelloForm", clocator: [tag: "form", method: "post", id:
>>>>>>> "helloForm"]){
>>>>>>> StandardTable(uid: "HelloFormoutGrid", clocator: [tag: "table",
>>>>>>> id: "helloForm:outGrid"]){
>>>>>>> InputBox(uid: "HelloFormtextCol1", clocator:[id:
>>>>>>> "helloForm:textCol1"])
>>>>>>> }
>>>>>>> }
>>>>>>>
>>>>>>> i write a method in groovy file
>>>>>>>
>>>>>>> public void sayHello(){
>>>>>>> pause 3000
>>>>>>> type "HelloForm.HelloFormoutGrid.HelloFormtextCol1", "One"
>>>>>>> }
>>>>>>>
>>>>>>> i run the mvn test
>>>>>>>
>>>>>>> What happen is:
>>>>>>> ============
>>>>>>> 1. Tellurium tests runs
>>>>>>> 2. New Browser opens
>>>>>>> 3. "One" value gets typed in the first column of grid.
>>>>>>> 4. Test passes.
>>>>>>>
>>>>>>> Scenario : 2
>>>>>>> =========
>>>>>>>
>>>>>>> ui.Form(uid: "HelloForm", clocator: [tag: "form", method: "post", id:
>>>>>>> "helloForm"]){
>>>>>>> StandardTable(uid: "HelloFormoutGrid", clocator: [tag: "table",
>>>>>>> id: "helloForm:outGrid"]){
>>>>>>> InputBox(uid: "{row: all, column: 1}", clocator:[id:
>>>>>>> "helloForm:textCol1"])
>>>>>>> }
>>>>>>> }
>>>>>>>
>>>>>>> ------------------------------------------------------------------------------------------------------------------------------------------------
>>>>>>> NOTE: This time the INPUT BOX UID is changed from "HelloFormtextCol1"
>>>>>>> to "{row: all, column: 1}"
>>>>>>>
>>>>>>> -------------------------------------------------------------------------------------------------------------------------------------------------
>>>>>>>
>>>>>>> i write a method in groovy file
>>>>>>>
>>>>>>> public void sayHello(){
>>>>>>> pause 3000
>>>>>>> type "HelloForm.HelloFormoutGrid.[1][1]", "One"
>>>>>>> }
>>>>>>>
>>>>>>> i run the mvn test
>>>>>>>
>>>>>>> What happen is:
>>>>>>> ============
>>>>>>> 1. Tellurium tests runs
>>>>>>> 2. New Browser opens
>>>>>>> 3. Test passes.
>>>>>>>
>>>>>>> NOTE : "One" value DOSE NOT get typed in the first column of grid
>>>>>>> although the test passes.
>>>>>>>
>>>>>>> When i use the code
>>>>>>>
>>>>>>> public void sayHello(){
>>>>>>> pause 3000
>>>>>>> type "HelloForm.HelloFormoutGrid[1][1]", "test"
>>>>>>> def x = getValue("HelloForm.HelloFormoutGrid[1][1]")
>>>>>>> println " Getting Value from Inbox Row One :: - "+x
>>>>>>> assertEquals("test", x)
>>>>>>> println " :: TEST PASSED :: - "
>>>>>>> }
>>>>>>>
>>>>>>> output on console is :
>>>>>>>
>>>>>>> Getting Value from Inbox Row One :: - One
>>>>>>> :: TEST PASSED :: -
>>>>>>>
>>>>>>> This means the value is getting set in the grid component and when we
>>>>>>> call getValue method is comes back too.
>>>>>>>
>>>>>>> The only problem is i cannot see this in the browser (Firefox).
>>>>>>> The other problem is the links and buttons are not getting clicked
>>>>>>> this way so the flow dose not go to other pages i am doing this in
>>>>>>> local env and none of the links are from outside env or domain. So
>>>>>>> the
>>>>>>> timeout, proxies are not a problem
>>>>>>>
>>>>>>> Then again when i refer the direct id ( eg: click
>>>>>>> HelloForm.HelloFormoutGrid.HelloFormLink1") all the links and buttons
>>>>>>> work fine, when i give dynamic reference (eg:
>>>>>>> HelloForm.HelloFormoutGrid[1][2] , second column is link column in
>>>>>>> grid) it does not work .
>>>>>>>
>>>>>>> Is the functionality tested by any one of the uses, if yes kindly let
>>>>>>> me know whats going wrong with me?
>>>>>>> If any one can give me a small code snippet of grid component
>>>>>>> and .groovy it will be gr8.
>>>>>>>
>>>>>>> Thanks in advance,
>>>>>>> -Eric.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "tellurium-users" group.
>>>>>>> To post to this group, send email to
>>>>>>> [email protected].
>>>>>>> To unsubscribe from this group, send email to
>>>>>>> [email protected]<tellurium-users%[email protected]>
>>>>>>> .
>>>>>>> For more options, visit this group at
>>>>>>> http://groups.google.com/group/tellurium-users?hl=en.
>>>>>>>
>>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "tellurium-users" group.
>>>>>> To post to this group, send email to [email protected]
>>>>>> .
>>>>>> To unsubscribe from this group, send email to
>>>>>> [email protected]<tellurium-users%[email protected]>
>>>>>> .
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/tellurium-users?hl=en.
>>>>>>
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "tellurium-users" group.
>>>>> To post to this group, send email to [email protected].
>>>>> To unsubscribe from this group, send email to
>>>>> [email protected]<tellurium-users%[email protected]>
>>>>> .
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/tellurium-users?hl=en.
>>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "tellurium-users" group.
>>>> To post to this group, send email to [email protected].
>>>> To unsubscribe from this group, send email to
>>>> [email protected]<tellurium-users%[email protected]>
>>>> .
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/tellurium-users?hl=en.
>>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "tellurium-users" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected]<tellurium-users%[email protected]>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/tellurium-users?hl=en.
>>>
>>
>>
>
--
You received this message because you are subscribed to the Google Groups
"tellurium-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/tellurium-users?hl=en.