Hi
I am pasting my Java class and Grovvy class both please let me know is
there any mistake:
Java Class:
package com.basware.sp.web;
import org.junit.BeforeClass;
import org.junit.Test;
import org.telluriumsource.test.java.TelluriumJavaTestCase;
import static org.junit.Assert.assertTrue;
public class SPCompanyProfileTest extends TelluriumJavaTestCase {
private static SPLoginModule app;
private static SPCompanyProfileModule obj;
private static final String WELCOME_TITLE = "SP - Basware
Supplier Portal";
private static final String Supplier_Update = "Supplier updated";
@BeforeClass
public static void initUi() {
app = new SPLoginModule();
obj = new SPCompanyProfileModule();
app.defineUi();
useCssSelector(true);
useTrace(true);
//Engine state offline update
useCache(false);
useTelluriumApi(true);
connectSeleniumServer();
}
@Test
public void saveComp() {
connectUrl("http://vmw080/SupplierPortal/login.aspx"); //
TODO no adr+port should be used, since they are in TelluriumConfig
app.loginAdmin();
assertTrue(app.getTitle().contains(WELCOME_TITLE));
obj.saveComp();
assertTrue(app.getTitle().contains(Supplier_Update));
}
}
GROVVY CLASS:
package com.basware.sp.web
import org.telluriumsource.dsl.DslContext
import com.sun.org.apache.bcel.internal.generic.Select
import org.telluriumsource.ui.object.UrlLink
/**
* Created by IntelliJ IDEA.
* User: shivaniang
* Date: 7/11/11
* Time: 4:08 PM
* To change this template use File | Settings | File Templates.
*/
public class SPCompanyProfileModule extends DslContext
{
public void defineUI()
{
ui.Container(uid: "Ctl00_NavigationPlaceholder_RadPanelbar1_p0")
{
//UrlLink(uid: "Administration", clocator: [tag:
"a", class: "link selected expanded", href: "http://vmw080/
SupplierPortal/SupplierPortal/Welcome.aspx"])
// ui.Container(uid: "ctl00_NavigationPlaceholder_RadPanelbar1_p0",
clocator: [tag: "a", class: "link selected expanded", href: "/
SupplierPortal/SupplierPortal/Welcome.aspx"])
// {
Div(uid: "Administration", clocator: [tag: "span",
text: "Administration", direct: "true", class: "text"])
}
ui.Container(uid:
"Ctl00_NavigationPlaceholder_RadPanelbar1_p0_p2", clocator: [tag: "a",
class: "link focused", id:
"ctl00_NavigationPlaceholder_RadPanelbar1_p0_p2"])
{
TextBox(uid: "CompanyProfile", clocator: [tag: "span",
text: "Company Profile", direct: "true", class: "text"])
}
ui.Container(uid: "Table", clocator: [tag: "table"])
{
InputBox(uid: "CompanyCode", clocator: [tag: "input",
type: "text", class: "TextBox", id:
"ctl00_Contentplaceholder_CompanyDetailCtrl_txtOrganizationID", value:
"Sup-01", name: "ctl00$Contentplaceholder$CompanyDetailCtrl
$txtOrganizationID"])
InputBox(uid: "CompanyName", clocator: [tag: "input",
type: "text", class: "TextBox", id:
"ctl00_Contentplaceholder_CompanyDetailCtrl_txtCompanyName", value:
"Supplier01", name: "ctl00$Contentplaceholder$CompanyDetailCtrl
$txtCompanyName"])
InputBox(uid: "Email", clocator: [tag: "input", type:
"text", class: "TextBox", id:
"ctl00_Contentplaceholder_CompanyDetailCtrl_txtEmail", value:
"[email protected]", name: "ctl00$Contentplaceholder
$CompanyDetailCtrl$txtEmail"])
Selector(uid: "Country", clocator: [tag: "select", class:
"dropDownList", id:
"ctl00_Contentplaceholder_CompanyDetailCtrl_ddlCountry", name:
"ctl00$Contentplaceholder$CompanyDetailCtrl$ddlCountry"])
}
ui.Container(uid: "Table1", clocator: [tag: "table"])
{
InputBox(uid: "SalesTaxNumber", clocator: [tag: "input",
type: "text", class: "TextBox", id:
"ctl00_Contentplaceholder_CompanyDetailCtrl_txtCompanyVATNumber",
value: "vat 12334", name: "ctl00$Contentplaceholder$CompanyDetailCtrl
$txtCompanyVATNumber"])
InputBox(uid: "TradeRegistryNumber", clocator: [tag:
"input", type: "text", class: "TextBox", id:
"ctl00_Contentplaceholder_CompanyDetailCtrl_txtCompanyRCSNumber",
value: "RD-02", name: "ctl00$Contentplaceholder$CompanyDetailCtrl
$txtCompanyRCSNumber"])
InputBox(uid: "PostalCode", clocator: [tag: "input", type:
"text", class: "TextBox", id:
"ctl00_Contentplaceholder_CompanyDetailCtrl_txtPostalCode", value:
"160047", name: "ctl00$Contentplaceholder$CompanyDetailCtrl
$txtPostalCode"])
InputBox(uid: "City", clocator: [tag: "input", type:
"text", class: "TextBox", id:
"ctl00_Contentplaceholder_CompanyDetailCtrl_txtCity", value:
"Chandigarh", name: "ctl00$Contentplaceholder$CompanyDetailCtrl
$txtCity"])
InputBox(uid: "State", clocator: [tag: "input", type:
"text", class: "TextBox", id:
"ctl00_Contentplaceholder_CompanyDetailCtrl_txtCompanyState", value:
"State in a province 12", name: "ctl00$Contentplaceholder
$CompanyDetailCtrl$txtCompanyState"])
InputBox(uid: "Phone", clocator: [tag: "input", type:
"text", class: "TextBox", id:
"ctl00_Contentplaceholder_CompanyDetailCtrl_txtCompanyPhone", value:
"9872716105", name: "ctl00$Contentplaceholder$CompanyDetailCtrl
$txtCompanyPhone"])
InputBox(uid: "Site", clocator: [tag: "input", type:
"text", class: "TextBox", id:
"ctl00_Contentplaceholder_CompanyDetailCtrl_txtCompanySite", value:
"www.companysite.com", name: "ctl00$Contentplaceholder
$CompanyDetailCtrl$txtCompanySite"])
InputBox(uid: "eInvoicingAddress", clocator: [tag:
"input", type: "text", class: "TextBox", id:
"ctl00_Contentplaceholder_CompanyDetailCtrl_txteInvoicingAddress",
value: "NSIDsup01", name: "ctl00$Contentplaceholder$CompanyDetailCtrl
$txteInvoicingAddress"])
Container(uid: "Section", clocator: [tag: "tr"])
{
Container(uid: "FirstTD", clocator: [tag: "td",
direct: "true", class: "firstTD"]){
Container(uid:
"Ctl00_Contentplaceholder_CompanyDetailCtrl_divOrganizationIDEdit",
clocator: [tag: "div", direct: "true", id:
"ctl00_Contentplaceholder_CompanyDetailCtrl_divOrganizationIDEdit"]){
InputBox(uid:
"Ctl00_Contentplaceholder_CompanyDetailCtrl_txtOrganizationID",
clocator: [tag: "input", direct: "true", type: "text", class:
"TextBox", id:
"ctl00_Contentplaceholder_CompanyDetailCtrl_txtOrganizationID", value:
"sup-01", name: "ctl00$Contentplaceholder$CompanyDetailCtrl
$txtOrganizationID"])
Image(uid: "Img", clocator: [tag: "img"])
}
}
Container(uid: "MiddleTD", clocator: [tag: "td",
direct: "true", class: "middleTD"]){
Container(uid:
"Ctl00_Contentplaceholder_CompanyDetailCtrl_divCompanyNameEdit",
clocator: [tag: "div", direct: "true", id:
"ctl00_Contentplaceholder_CompanyDetailCtrl_divCompanyNameEdit"]){
InputBox(uid:
"Ctl00_Contentplaceholder_CompanyDetailCtrl_txtCompanyName", clocator:
[tag: "input", direct: "true", type: "text", class: "TextBox", id:
"ctl00_Contentplaceholder_CompanyDetailCtrl_txtCompanyName", value:
"Basware", name: "ctl00$Contentplaceholder$CompanyDetailCtrl
$txtCompanyName"])
Image(uid: "Img", clocator: [tag: "img"])
}
}
}
Container(uid: "Section2", clocator: [tag: "tr"]){
Container(uid: "FirstTD", clocator: [tag: "td",
direct: "true", class: "firstTD"]){
Container(uid:
"Ctl00_Contentplaceholder_CompanyDetailCtrl_divEmailEdit", clocator:
[tag: "div", direct: "true", id:
"ctl00_Contentplaceholder_CompanyDetailCtrl_divEmailEdit"]){
InputBox(uid:
"Ctl00_Contentplaceholder_CompanyDetailCtrl_txtEmail", clocator: [tag:
"input", direct: "true", type: "text", class: "TextBox", id:
"ctl00_Contentplaceholder_CompanyDetailCtrl_txtEmail", value:
"[email protected]", name: "ctl00$Contentplaceholder
$CompanyDetailCtrl$txtEmail"])
Image(uid: "Img", clocator: [tag: "img"])
Image(uid:
"Ctl00_Contentplaceholder_CompanyDetailCtrl_emailInfoTip", clocator:
[tag: "img", direct: "true", id:
"ctl00_Contentplaceholder_CompanyDetailCtrl_emailInfoTip"], respond:
["mouseOver"])
Image(uid: "Img2", clocator: [tag: "img"])
}
}
}
}
ui.Container(uid: "Toolbarcontent", clocator: [tag: "div", class:
"toolbarcontent"])
{
SubmitButton(uid: "Save", clocator: [tag: "input", type:
"submit", class: "savebutton", title: "Save Company Information", id:
"ctl00_ToolbarPlaceHolder_btnSaveCompany_btnSaveCompany_button", name:
"ctl00$ToolbarPlaceHolder$btnSaveCompany$btnSaveCompany_button"])
}
}
public void loginAdmin()
{
login 'supplier01', 'supplier01*'
}
public void login(String userName, String password)
{
keyType "root.input0", userName
keyType "root.input1", password
click "root.input2"
waitForPageToLoad 20000 //TODO remove if possible
}
public void saveComp ( )
{
click
"*Ctl00_NavigationPlaceholder_RadPanelbar1_p0.Administration"
click
"Ctl00_NavigationPlaceholder_RadPanelbar1_p0_p2.CompanyProfile"
keyType "Table.CompanyCode", sup-01
keyType "Table.CompanyName", supplier01
//keyType "Table.Email", [email protected]
selectByValue "Table.Country", Finland
keyType "Table1.SalesTaxNumber", vat12334
keyType "Table1.TradeRegistryNumber", RD-02
keyType "Table1.PostalCode", 160047
keyType "Table1.City", Chandigarh
keyType "Table1.State", Chandigarh
keyType "Table1.Phone", +91-9872716105
//keyType "Table1.Site", www.basware.com
keyType "eInvoicingAddress", NSIDsup01
click "Toolbarcontent.Save"
waitForPageToLoad 20000 //TODO remove if possible
}
public void clickElement(String elementName)
{
click elementName
waitForPageToLoad 30000
}
// get required page text as per the argument passed
public boolean getPageText(String text)
{
return isTextPresent(text)
}
}
Regards
Shivani
--
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.