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
-~----------~----~----~----~------~----~------~--~---