My test code is uploaded and you can download it from here, http://tellurium-users.googlegroups.com/web/IssueSearch.tar.gz?gda=7PhC9EQAAAD5mhXrH3CK0rVx4StVj0LYF8Zi3RQ1nBFD4bY2dAvpCrZ9cfIw2ONmtvALMK56gmdV6u9SiETdg0Q2ffAyHU-dzc4BZkLnSFWX59nr5BxGqA&gsc=iRYkQhYAAADtlTNSv_m85N4J_S478VSDaKk2tFLs90LD5qOQGCC3Kw
On May 4, 3:38 pm, John <[email protected]> wrote: > I created an example project to define the Tellurium issue modules in > two module files, > > public class IssueSearchModule extends DslContext{ > > public void defineUi() { > > //define UI module of a form include issue type selector and > issue search > ui.Form(uid: "issueSearch", clocator: [action: "list", method: > "get"], group: "true") { > Selector(uid: "issueType", clocator: [name: "can", id: > "can"]) > TextBox(uid: "searchLabel", clocator: [tag: "span", text: > "*for"]) > InputBox(uid: "searchBox", clocator: [type: "text", name: > "q", id: "q"]) > SubmitButton(uid: "searchButton", clocator: [value: > "Search"]) > } > } > > public String[] getIsssueTypes(){ > return getSelectOptions("issueSearch.issueType") > } > > public void searchIssue(String issue){ > clearText "issueSearch.searchBox" > type "issueSearch.searchBox", issue > click "issueSearch.searchButton" > } > > } > > public class IssueSearchResultModule extends DslContext { > > public void defineUi() { > ui.Table(uid: "issueResult", clocator: [id: "resultstable", > class: "results"], group: "true") { > //define table header > //for the border column > TextBox(uid: "header: 1", clocator: [:]) > UrlLink(uid: "header: 2", clocator: [text: "*ID"]) > UrlLink(uid: "header: 3", clocator: [text: "*Type"]) > UrlLink(uid: "header: 4", clocator: [text: "*Status"]) > UrlLink(uid: "header: 5", clocator: [text: "*Priority"]) > UrlLink(uid: "header: 6", clocator: [text: "*Milestone"]) > UrlLink(uid: "header: 7", clocator: [text: "*Owner"]) > UrlLink(uid: "header: 9", clocator: [text: "*Summary + > Labels"]) > UrlLink(uid: "header: 10", clocator: [text: "*..."]) > > //define table elements > //for the border column > TextBox(uid: "row: *, column: 1", clocator: [:]) > TextBox(uid: "row: *, column: 8", clocator: [:]) > TextBox(uid: "row: *, column: 10", clocator: [:]) > //For the rest, just UrlLink > UrlLink(uid: "all", clocator: [:]) > } > } > > //simulate your method > public boolean waitForAjax() { > String element = "issueResult[1][1]"; > int timeout = 30000; > waitForElementPresent(element, timeout) > return isElementPresent(element) > } > > public void clickTable(int row, int column){ > click "issueResult[${row}][${column}]" > } > > public void clickOnTableHeader(int column){ > click "issueResult.header[${column}]" > } > > } > > Then, the Test class is as follows, > > public class IssueSearchTest extends TelluriumTestNGTestCase { > private static IssueSearchModule ism; > private static IssueSearchResultModule isrm; > > @BeforeClass > public static void initUi() { > ism = new IssueSearchModule(); > ism.defineUi(); > isrm = new IssueSearchResultModule(); > isrm.defineUi(); > } > > @BeforeMethod > public final void beforeMethod() { > connectUrl("http://code.google.com/p/aost/issues/list"); > } > > @Test > public void testSearchIssue(){ > String[] ists = ism.getIsssueTypes(); > ism.searchIssue("TrUMP"); > isrm.waitForAjax(); > isrm.clickTable(1, 2); > } > > } > > I run the test and it passed. I cannot reproduce your problem here. If > you > need, I can upload the code to our user group so that you can test it > in > your environment. > > Would it be possible it is your IDE problem? For example, in IntelliJ > IDEA, > sometimes, you need to run "build project" to regenerate the java > classes from groovy > classes to make the test running. > > Thanks, > > Jian > > On May 4, 5:56 am, Istvan_Pamer <[email protected]> wrote: > > > Hello! > > > I have a problem with using multiple page definitions in a single test > > group (class). I did like you mentioned above, but it throws an > > exception for me if the page definitions are splitted into multiple > > definition files. If I copy the definitions into one file without > > modifications, than it works fine. > > Let me copy the code here: > > > The two definition files: > > ======================= > > Homepage: > > import org.tellurium.dsl.DslContext > > public class Homepage extends DslContext { > > public void defineUi() { > > ui.Form(uid: "root", clocator: [tag: "form", id: > > "searchForm", name: > > "searchForm"]){ > > InputBox(uid: "input0", clocator: [tag: "input", type: > > "text", > > class: "width230", id: "Fcity1", name: "destination"], respond: > > ["keyDown", "click"]) > > SubmitButton(uid: "button1", clocator: [tag: "button", > > text: > > "Go", type: "submit", id: "btnHomeSubmit"]) > > } > > } > > > public void searchCity(String city){ > > type "root.input0", city > > pause 500 > > click "root.button1" > > waitForPageToLoad 30000 > > }} > > > --------------------------------------------------------- > > SearchResultPage: > > import org.tellurium.dsl.DslContext > > public class SearchResultPage extends DslContext { > > public void defineUi() { > > ui.Container(uid: "main_content", clocator: [tag: "div", id: > > "main_content"]){ > > List(uid: "twoColLeft", clocator: [tag: "div", id: > > "twoColLeftContainer"], separator: "d...@class='resultBox']"){ > > UrlLink(uid: "all", clocator: [tag: "a"]) > > } > > } > > } > > > public boolean waitForAjax() { > > String element = "main_content.twoColLeft[1]"; > > int timeout = 30000; > > waitForElementPresent(element, timeout) > > return isElementPresent(element) > > } > > > public void clickSearchResultLink() { > > click("main_content.twoColLeft[1]") > > waitForPageToLoad 30000 > > }} > > > ====================== > > The Test file: > > import ...Homepage; > > import ...SearchResultPage; > > public class TestBooking extends TelluriumTestNGTestCase { > > private static Homepage homepage; > > private static SearchResultPage srp; > > > @BeforeClass > > public static void initUi() { > > homepage = new Homepage(); > > homepage.defineUi(); > > srp = new SearchResultPage(); > > srp.defineUi(); > > } > > > @BeforeMethod > > public final void beforeMethod() { > > connectUrl("..."); > > } > > > @Test > > public final void testBooking() { > > homepage.searchCity("london"); > > srp.waitForAjax(); > > srp.clickSearchResultLink(); > > }} > > > ============================= > > > groovy.lang.MissingMethodException: No signature of > > method: .................module.Homepage.waitForElementPresent() is > > applicable for argument types: (java.lang.String, java.lang.Integer) > > values: [main_content.twoColLeft[1], 30000] > > at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap > > (ScriptBytecodeAdapter.java:54) > > at > > org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN > > (ScriptBytecodeAdapter.java:90) > > at ....................module.SearchResultPage.waitForAjax > > (SearchResultPage.groovy:37) > > at > > ....................test.TestBooking.testBooking(TestBooking.java: > > 86) > > > - It says that no method signature for waitForElementPresent() in the > > Homepage module - but there is no such method call in the Homepage > > module. The waitForElementPresent method call occurs on the > > SearchResultPage. > > - If I put the two definition files together in a separate one, import > > it to the test and call the methods, than it runs just fine. > > > Is it a bug? Or I'm the one who making some mistake? > > > Thank for the help in advance! > > Best regards, > > Istvan --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
