You way is fine. Each nested UI component after "ui." is a separate
UI module.

If you really need to reuse some of the UI modules in multiple UIs,
for example,
the login module, you can define a separate UI module class for it,
i.e.,

LoginModule extends DslContext{
        public void defineUi() {
                //               Citrix home page Top Menus
                ui.Container(uid: "CitrixHomePage", clocator: [tag:
"div", id:
"supnav"])
                {
                        UrlLink(uid: "LoginLink", clocator: [tag: "a",
text: "Log in",
header: "/default:sp...@id='unav_login']", href: "/English/mycitrix/
index.asp"])
                        Container(uid: "TopMenu", clocator: [tag:
"div", class: "qmmc",
id: "qm1"]){
                                UrlLink(uid: "MyCitrixLink", clocator:
[tag: "a", text: "My
Citrix", position: "7", direct: "true", href: "/English/mycitrix/
index.asp?ntref=hp_util_US"])
                                UrlLink(uid: "GlobalSitesLink",
clocator: [tag: "a", text:
"Global Sites", position: "6", direct: "true", href: "/global"])
                        }
                        UrlLink(uid: "LogOutLink", clocator: [tag:
"a", text: "Log Out",
href: "/English/mycitrix/logout.asp"])
                }
       }

        public void doMyCitrixLogin(String UserName,String Password){
                clickLogin()
                type "LoginForm.LoginSection.UserName",UserName
                type "LoginForm.LoginSection.Password",Password
                click "LoginForm.LoginSection.LoginBtn"
                waitForPageToLoad()

        }
}

Then in your test code, you have

LoginModule um = new LoginModule();
um.defineUI();

You can use multiple UI module classes in one test class, for example,

LoginModule um = new LoginModule();
um.defineUI();
NavigatorModule nm = new NavigatorModule();
nm.defineUI();

Then, just call methods in um and nm to run tests.

Thanks,

Jian

On Aug 18, 9:32 am, satyadev <[email protected]> wrote:
> and my dummy test script
>
>         @BeforeClass
>     public static void initUi() {
>         app = new CitrixHomePageUI();
>         app.defineUi();
>       //  app.useJQuerySelector();
>        // app.enableSelectorCache();
>     }
>         @Test
>         public void test1()
>         {
>                 // go to WebSite index page
>                 //selenium.open("/lang/English/home.asp");
>                 connectUrl("http://www.citrix.com/lang/English/home.asp";);
>                 // Verify webSite content
>                 app.waitForPageToLoad(30000);
>                 assertEquals("Citrix Systems - Virtualization, Networking and 
> Cloud.
> Simplified.", app.getTitle());
>
>                 assertTrue(app.isTextPresent("Products & Solutions"));
>                 app.clickProductsAndSolutions();
>                 assertEquals("Citrix Systems » The Best Application Delivery
> Solution", app.getTitle());
>
>                 // Login to MyCitrix
>                 app.doMyCitrixLogin("mkr836","mk836!");
>                 assertTrue(app.isTextPresent("Welcome to My Citrix!"));
>                 assertTrue(app.isTextPresent("CITRIX TEST ACCOUNT1 >> ID:"));
>
>                 // Logout from Mycitrix
>                 app.clickLogout();
>         }
>
> On Aug 18, 6:30 pm, satyadev <[email protected]> wrote:
>
> > Hi Vivek,
>
> > How exactly we can integrate each module. I did in following way.
>
> > public class CitrixHomePageUI extends DslContext{
>
> >         public void defineUi() {
> >                 //               Citrix home page Top Menus
> >                 ui.Container(uid: "CitrixHomePage", clocator: [tag: "div", 
> > id:
> > "supnav"])
> >                 {
> >                         UrlLink(uid: "LoginLink", clocator: [tag: "a", 
> > text: "Log in",
> > header: "/default:sp...@id='unav_login']", href: "/English/mycitrix/
> > index.asp"])
> >                         Container(uid: "TopMenu", clocator: [tag: "div", 
> > class: "qmmc",
> > id: "qm1"]){
> >                                 UrlLink(uid: "MyCitrixLink", clocator: 
> > [tag: "a", text: "My
> > Citrix", position: "7", direct: "true", href: "/English/mycitrix/
> > index.asp?ntref=hp_util_US"])
> >                                 UrlLink(uid: "GlobalSitesLink", clocator: 
> > [tag: "a", text:
> > "Global Sites", position: "6", direct: "true", href: "/global"])
> >                         }
> >                         UrlLink(uid: "LogOutLink", clocator: [tag: "a", 
> > text: "Log Out",
> > href: "/English/mycitrix/logout.asp"])
> >                 }
> >                 // Citrix home Page Section
> >                 ui.Container(uid: "CitrixSection", clocator: [tag: "div", 
> > id:
> > "container"])
> >                 {
> >                         Container(uid: "TopMenu", clocator: [tag: "div", 
> > class: "qmmc",
> > id: "qm0"])
> >                         {
> >                                 UrlLink(uid: "ProductsandSolutionsLink", 
> > clocator: [tag: "a",
> > text: "Products & Solutions", position: "1", href: "/English/ps2/
> > products/product.asp?contentID=683711&ntref=hp_nav_US"])
> >                         }
> >                         TextBox(uid: "FlashPromotion", clocator: [tag: 
> > "embed", type:
> > "application/x-shockwave-flash", name: "flashpromo", id: "flashpromo",
> > src: "/site/resources/dynamic/homelowpromos/
> > 316x120_Center_TopPicks2.swf"])
> >            }
>
> >                 // Login Form
> >                 ui.Form(uid: "LoginForm", clocator: [tag: "form", id: 
> > "MiniLogin",
> > name: "LOGIN"], group: "true")
> >                 {
> >                         Container(uid: "LoginSection", clocator: [tag: 
> > "div", class:
> > "primary"])
> >                         {
> >                                 InputBox(uid: "UserName", clocator: [tag: 
> > "input", direct:
> > "true", type: "text", id: "userid", name: "userid"])
> >                                 InputBox(uid: "Password", clocator: [tag: 
> > "input", direct:
> > "true", type: "password", id: "password", name: "password"])
> >                                 InputBox(uid: "LoginBtn", clocator: [tag: 
> > "input", direct:
> > "true", type: "image", name: "loginbtn", src: "/site/resources/
> > v4_includes/login_btn.gif"])
> >                         }
> >                         UrlLink(uid: "NewUsers", clocator: [tag: "a", text: 
> > "New Users",
> > href: "/English/myCitrix/loginNewUser.asp"])
> >                 }
> >         }
>
> >         //Add your methods here
> >         public void doMyCitrixLogin(String UserName,String Password){
> >                 clickLogin()
> >                 type "LoginForm.LoginSection.UserName",UserName
> >                 type "LoginForm.LoginSection.Password",Password
> >                 click "LoginForm.LoginSection.LoginBtn"
> >                 waitForPageToLoad()
>
> >         }
> >         //Add your methods here
> >         public void clickProductsAndSolutions(){
> >                 click "CitrixSection.TopMenu.ProductsandSolutionsLink";
> >                 waitForPageToLoad()
> >         }
> >         public void clickMyCitrix(){
> >                 click "CitrixHomePage.TopMenu.MyCitrixLink"
> >                 waitForPageToLoad()
> >         }
> >         public void clickLogin(){
> >                 click "CitrixHomePage.LoginLink"
> >                 waitForPageToLoad()
> >         }
> >         public void clickLogout(){
> >                 click "CitrixHomePage.LogOutLink"
> >                 waitForPageToLoad()
> >         }
>
> > On Aug 18, 5:45 pm, satyadev <[email protected]> wrote:
>
> > > Hi,
>
> > > can Any one provide best practices for UI modules maintenance?
> > > site Demo show's only part of one frame example. things will be
> > > difficult once real website with lot frames and containers.
>
> > > regards,
> > > Satyadev
>
> > > On Aug 14, 7:32 pm, Vivek <[email protected]> wrote:
>
> > > > I dont need to put everything in one module. Try splitting them into
> > > > separates UI modules like
> > > > module1
> > > >      My Citrix/Log in
> > > > module 2
> > > >     Products & Solutions
> > > > module 3
> > > >    Username, Password, Log in
>
> > > > Record for the first module then click Generate and Customize. Clear
> > > > the recorded elements and then record for the second module...
> > > > Generate and Customize
>
> > > > You can put three modules in the defineUI method... see if this will
> > > > solve the problem...
>
> > > > Thanks,
> > > > Vivek
>
> > > > On Aug 14, 3:19 am, satyadev <[email protected]> wrote:
>
> > > > > Hi All,
>
> > > > > I am facing lot of trouble with TrUmp for defining object map. I am
> > > > > not able to customize properties. UI operations are not consistly
> > > > > updating  UI element in customizer pane.
>
> > > > > Eample URL :http://www.citrix.com/English/ss/downloads/index.asp
>
> > > > > Start Recording using trump IDE.
> > > > > learn UI elements like Login/MyCtirix/downlaods/Product&solutions/
> > > > > username/Password/login
>
> > > > > we got follwing UI object code.
>
> > > > > Container(uid: "root", clocator: [tag: "div", id: "container"]){
> > > > >         Container(uid: "T4d", clocator: [tag: "div", id: "header"]){
> > > > >                 Container(uid: "TopLeftmenu", clocator: [tag: "div", 
> > > > > direct: "true",
> > > > > id: "supnav"]){
> > > > >                         UrlLink(uid: "a0", clocator: [tag: "a", text: 
> > > > > "My Citrix", href: "/
> > > > > English/mycitrix/index.asp?ntref=util"])
> > > > >                         UrlLink(uid: "a1", clocator: [tag: "a", text: 
> > > > > "Log in", href: "/
> > > > > English/mycitrix/index.asp"])
> > > > >                 }
> > > > >                 Container(uid: "T4dd", clocator: [tag: "div", direct: 
> > > > > "true", class:
> > > > > "qmmc", id: "qm0"]){
> > > > >                         UrlLink(uid: "a2", clocator: [tag: "a", text: 
> > > > > "Products &
> > > > > Solutions", href: "/English/ps2/products/product.asp?
> > > > > contentID=683711", class: "qmparent qmactive"])
> > > > >                         UrlLink(uid: "a3", clocator: [tag: "a", text: 
> > > > > "Downloads", href: "/
> > > > > English/ss/downloads/index.asp"])
> > > > >                 }
> > > > >         }
> > > > >         Form(uid: "T4dddddd", clocator: [tag: "form", id: 
> > > > > "MiniLogin", name:
> > > > > "LOGIN", action: "https://www.citrix.com/English/myCitrix/
> > > > > doLogin.asp", method: "post"]){
> > > > >                 InputBox(uid: "input4", clocator: [tag: "input", 
> > > > > type: "text",
> > > > > class: "formelement", id: "userid", name: "userid"])
> > > > >                 InputBox(uid: "input5", clocator: [tag: "input", 
> > > > > type: "password",
> > > > > class: "formelement", id: "password", name: "password"])
> > > > >                 InputBox(uid: "input6", clocator: [tag: "input", 
> > > > > type: "image",
> > > > > value: "1", name: "loginbtn", src: "/site/resources/v4_includes/
> > > > > login_btn.gif"])
> > > > >         }
>
> > > > > }
>
> > > > > Now Click on Genrate and Customize
>
> > > > > Select Login url Link item observe that add one extra attribute like
> > > > > header it won't reflect in UI element.
>
> > > > > I am trapped here all my UI elements stop respond customization.
>
> > > > > Can Anybody help me to over come above situation.
>
> > > > > regards,
> > > > > Satyadev
--~--~---------~--~----~------------~-------~--~----~
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