List is fine. The remaining task for 0.7.0 is to refactor List and Table so
that you can reference them not by position only, but this should be after
the RC1 release.

I will create another test case for you tonight.

Thanks,

Jian

On Tue, Feb 2, 2010 at 10:26 AM, Jonathan Share <[email protected]> wrote:

> Thanks for the response, your solution looks nice, however my example
> html was perhaps a little oversimplified, the "option" div is repeated
> several times within the "segment clearfix" div and the whole "segment
> clearfix" div is also repeated several times, meaning there exists
> more than one list with class fares in the form (see more detailed
> outline below).
>
> Is there any better way to handle this situation? While creating the
> below outline I have just come up with an idea of trying to make a
> list out of the "segment clearfix" divs, instead of referencing them
> with xpath, disadvantage of this is that my uids will be slightly less
> expressive.
>
> Thanks for the help so far.
>
> Jonathan
>
> <form name="selectedSailingsForm">
>    <h1>Choose ship</h1>
>    <h3 class="inbound-outbound">Outbound</h3>
>    <h2 class="content-header"><!-- Route description --></h2>
>     <div class="segment clearfix">
>        <div class="option">
>            <ul class="fares">
>                <li>
>                     <input type="radio">&nbsp;
>                    <label>Economy</label>
>                </li>
>                <li>
>                    <input type="radio">&nbsp;
>                    <label>Flexible</label>
>                </li>
>            </ul>
>            <div class="details">
>                <dl>
>                    <dt>Ship:</dt>
>                    <dd><!-- Ship Name --></dd>
>                    <dt>Departs</dt>
>                    <dd>
>                        <em>08:00</em>
>                    </dd>
>                    <dt>Arrives</dt>
>                    <dd>
>                        <em>11:45</em>
>                    </dd>
>                </dl>
>            </div>
>        </div>
>         <div class="option">
>            <ul class="fares">
>                <li>
>                     <input type="radio">&nbsp;
>                    <label>Economy</label>
>                </li>
>                <li>
>                    <input type="radio">&nbsp;
>                    <label>Flexible</label>
>                </li>
>            </ul>
>            <div class="details">
>                <dl>
>                    <dt>Ship:</dt>
>                    <dd><!-- Ship Name --></dd>
>                    <dt>Departs</dt>
>                    <dd>
>                        <em>17:30</em>
>                    </dd>
>                    <dt>Arrives</dt>
>                    <dd>
>                        <em>21:15</em>
>                    </dd>
>                </dl>
>            </div>
>        </div>
>    </div>
>    <h3 class="inbound-outbound">Return</h3>
>
>    <h2 class="content-header"><!-- Route description --></h2>
>
>    <div class="segment clearfix">
>        <div class="option">
>            <ul class="fares">
>                <li>
>                     <input type="radio">&nbsp;
>                    <label>Economy</label>
>                </li>
>                <li>
>                    <input type="radio">&nbsp;
>                    <label>Flexible</label>
>                </li>
>            </ul>
>            <div class="details">
>                <div class="photo"><img></div>
>                <dl>
>                    <dt>Ship:</dt>
>                    <dd><!-- Ship Name --></dd>
>                    <dt>Departs</dt>
>                    <dd>
>                        <em>02:00</em>
>                    </dd>
>                    <dt>Arrives</dt>
>                    <dd>
>                        <em>06:00</em>
>                    </dd>
>                </dl>
>            </div>
>        </div>
>         <div class="option">
>            <ul class="fares">
>                <li>
>                     <input type="radio">&nbsp;
>                    <label>Economy</label>
>                </li>
>                <li>
>                    <input type="radio">&nbsp;
>                    <label>Flexible</label>
>                </li>
>            </ul>
>            <div class="details">
>                <dl>
>                    <dt>Ship:</dt>
>                    <dd><!-- Ship Name --></dd>
>                    <dt>Departs</dt>
>                    <dd>
>                        <em>12:45</em>
>                    </dd>
>                    <dt>Arrives</dt>
>                    <dd>
>                        <em>16:30</em>
>                    </dd>
>                </dl>
>            </div>
>        </div>
>    </div>
>    <div class="segment clearfix">
>        <!-- Other boring stuff -->
>    </div>
> </form>
>
> 2010/2/1 Jian Fang <[email protected]>:
> > Here is my test code
> >
> > UI Module
> >
> >
> ----------------------------------------------------------------------------
> > package org.telluriumsource.module
> >
> > import org.telluriumsource.dsl.DslContext
> >
> > class JListModule extends DslContext {
> >
> >   public void defineUi(){
> >     ui.Form(uid: "selectedSailings", clocator: [name:
> > "selectedSailingsForm"]) {
> >       List(uid: "outgoingSailings", locator: "/div[1]") {
> >         Container(uid: "all", clocator: [tag: "div", 'class': "option"])
> {
> >           List(uid: "fares", clocator: [tag: "ul"]) {
> >             Container(uid: "all", clocator: [tag: "li"]) {
> >               RadioButton(uid: "radio", clocator: [:], respond:
> ["click"])
> >               TextBox(uid: "label", clocator: [tag: "label"])
> >             }
> >           }
> >           TextBox(uid: "departureTime", locator: "/div/dl/dd/em[1]")
> >         }
> >       }
> >     }
> >
> >     ui.Form(uid: "Sailings", clocator: [name: "selectedSailingsForm"]){
> >       List(uid: "Fares", clocator: [tag: "ul", class: "fares"],
> separator:
> > "li"){
> >         Container(uid: "all"){
> >             RadioButton(uid: "radio", clocator: [:], respond: ["click"])
> >             TextBox(uid: "label", clocator: [tag: "label"])
> >         }
> >       }
> >     }
> >   }
> > }
> >
> --------------------------------------------------------------------------------------------------
> >
> > Test Case
> >
> >
> -------------------------------------------------------------------------------------------------
> > package org.telluriumsource.ft;
> >
> > import org.junit.AfterClass;
> > import org.junit.Before;
> > import org.junit.BeforeClass;
> > import org.junit.Test;
> > import org.telluriumsource.module.JListModule;
> > import org.telluriumsource.test.java.TelluriumMockJUnitTestCase;
> >
> > public class JListTestJUnitCase extends TelluriumMockJUnitTestCase {
> >    private static JListModule jlm;
> >
> >     @BeforeClass
> >     public static void initUi() {
> >         registerHtmlBody("JList");
> >
> >         jlm = new JListModule();
> >         jlm.defineUi();
> > //        useCssSelector(true);
> > //        useTelluriumApi(true);
> >         useTrace(true);
> > //        useCache(true);
> > //        useMacroCmd(true);
> >         useEngineLog(true);
> >     }
> >
> >     @Before
> >     public void connectToLocal() {
> >         connect("JList");
> >     }
> >
> >     @Test   //This works fine if the following two commands are used:
> > useCache(true); useTelluriumApi(true);
> >     public void testGetListSize(){
> >         int size =
> > jlm.getListSize("selectedSailings.outgoingSailings[1].fares");
> >         System.out.println("List Size " + size);
> >     }
> >
> >     @Test
> >     public void testGetNewListSize(){
> >         int size = jlm.getListSize("Sailings.Fares");
> >         System.out.println("List Size " + size);
> >
> >     }
> >
> >     @AfterClass
> >     public static void tearDown(){
> >         showTrace();
> >     }
> > }
> >
> >
> >
> > On Mon, Feb 1, 2010 at 11:05 AM, Jian Fang <[email protected]>
> wrote:
> >>
> >> Hi,
> >>
> >> Your UI module definition might be problematic. I used the following one
> >> and can get back the list size 2 correctly
> >>
> >>     ui.Form(uid: "Sailings", clocator: [name: "selectedSailingsForm"]){
> >>       List(uid: "Fares", clocator: [tag: "ul", class: "fares"],
> separator:
> >> "li"){
> >>         Container(uid: "all"){
> >>             RadioButton(uid: "radio", clocator: [:], respond: ["click"])
> >>             TextBox(uid: "label", clocator: [tag: "label"])
> >>         }
> >>       }
> >>     }
> >>
> >> You should use the logical container to include the list elements.
> >>
> >> Also, please don't use hard coded xpath there, otherwise, your test is
> not
> >> robust to changes. Also, most 0.7.0 new
> >> features require the clocator.
> >>
> >> Interesting thing is I can get back the correct List size even with your
> >> UI module with new Tellurium API. I will
> >> post all my test code soon.
> >>
> >> Thanks,
> >>
> >> Jian
> >>
> >> On Mon, Feb 1, 2010 at 10:49 AM, Jian Fang <[email protected]>
> >> wrote:
> >>>
> >>> You are right, the new core added a WorkflowContext variable to all
> >>> Accessor methods
> >>> so that we can pass in meta data to the tiers under it. That is why it
> >>> cannot find the method with
> >>> the old snapshot.
> >>>
> >>> Thanks,
> >>>
> >>> Jian
> >>>
> >>> On Mon, Feb 1, 2010 at 10:35 AM, Jonathan Share <[email protected]>
> >>> wrote:
> >>>>
> >>>> Thanks, I'm also having problems with getXpathCount, but that may be
> >>>> because I'm using an old snapshot in order to work around the list
> >>>> problem.
> >>>>
> >>>> "groovy.lang.MissingMethodException: No signature of method:
> >>>> org.telluriumsource.access.Accessor.getXpathCount() is applicable for
> >>>> argument types: (java.lang.String) values:
> >>>>
> >>>>
> [//descendant-or-self::tab...@id="supplierEditor"]/tbody/tr[child::td]/td[1]]"
> >>>>
> >>>> 2010/2/1 Jian Fang <[email protected]>:
> >>>> > Thanks for reporting the problem. I will create a test case and see
> >>>> > what
> >>>> > happens.
> >>>> >
> >>>> > Thanks,
> >>>> >
> >>>> > Jian
> >>>> >
> >>>> > On Mon, Feb 1, 2010 at 7:20 AM, Jonathan Share <[email protected]
> >
> >>>> > wrote:
> >>>> >>
> >>>> >> Hi,
> >>>> >>
> >>>> >> I seem to be having a little problem with getListSize. When I call
> >>>> >> that method tellurium crashes on me with the following exception;
> >>>> >>
> >>>> >> com.thoughtworks.selenium.SeleniumException: ERROR: Element
> >>>> >>
> >>>> >>
> >>>> >>
> //descendant-or-self::fo...@name="selectedSailingsForm"]/div[1]/d...@class="option"][1]/descendant-or-self::ul/li[3]
> >>>> >> not found
> >>>> >>
> >>>> >> The interesting thing to note here is that there are only two li
> >>>> >> elements in the list. Is this a bug that has crept into tellurium
> or
> >>>> >> am I doing something really stupid in my test?
> >>>> >>
> >>>> >> Thanks in advance
> >>>> >>
> >>>> >> Jonathan
> >>>> >>
> >>>> >> // MODEL
> >>>> >> ui.Form(uid: "selectedSailings", clocator: [name:
> >>>> >> "selectedSailingsForm"])
> >>>> >> {
> >>>> >>            List(uid: "outgoingSailings", locator: "/div[1]") {
> >>>> >>                Container(uid: "all", clocator: [tag: "div",
> 'class':
> >>>> >> "option"]) {
> >>>> >>                    List(uid: "fares", clocator: [tag: "ul"]) {
> >>>> >>                        Container(uid: "all", clocator: [tag: "li"])
> {
> >>>> >>                            RadioButton(uid: "radio", clocator: [:],
> >>>> >> respond: ["click"])
> >>>> >>                            TextBox(uid: "label", clocator: [tag:
> >>>> >> "label"])
> >>>> >>                        }
> >>>> >>                    }
> >>>> >>                    TextBox(uid: "departureTime", locator:
> >>>> >> "/div/dl/dd/em[1]")
> >>>> >>                }
> >>>> >>            }
> >>>> >> }
> >>>> >>
> >>>> >> // TEST LINE THAT FAILS
> >>>> >> def numPricesForSailing =
> >>>> >> getListSize("selectedSailings.outgoingSailings[1].fares")
> >>>> >>
> >>>> >> // HTML (edited a little)
> >>>> >> <form action="..." id="airDetailsForm" method="POST"
> >>>> >> name="selectedSailingsForm">
> >>>> >>  <div class="segment clearfix">
> >>>> >>    <div class="option">
> >>>> >>      <ul class="fares">
> >>>> >>        <li>
> >>>> >>          <input id="..." name="..." type="radio" value="..."
> checked
> >>>> >> onclick="enableDisable(1,2)">&nbsp;<label for="..."><strong><span
> >>>> >> id="...">3,000</span>KR</strong>economy</label>
> >>>> >>        </li>
> >>>> >>        <li>
> >>>> >>          <input id="..." name="..." type="radio" value="..."
> >>>> >> onclick="enableDisable(1,1)">&nbsp;<label for="..."><strong><span
> >>>> >> id="...">4,000</span>KR</strong>&nbsp;Flexible</label>
> >>>> >>        </li>
> >>>> >>      </ul>
> >>>> >>    </div>
> >>>> >>  </div>
> >>>> >> </form>
> >>>> >>
> >>>> >> --
> >>>> >> 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.

Reply via email to