IDEMPIERE-92 - Integrate Selenium. Make more class test ready.

This commit is contained in:
Heng Sin Low 2012-12-14 16:48:09 +08:00
parent fa2b6fa861
commit a43e609451
23 changed files with 130 additions and 23 deletions

View File

@ -90,6 +90,8 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
public static final String APP_NAME = "iDempiere"; public static final String APP_NAME = "iDempiere";
public static final String UID = "1.0.0"; public static final String UID = "1.0.0";
public static final String WIDGET_INSTANCE_NAME = "instanceName";
private WLogin loginDesktop; private WLogin loginDesktop;

View File

@ -25,6 +25,7 @@ import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Borderlayout; import org.adempiere.webui.component.Borderlayout;
import org.adempiere.webui.component.Column; import org.adempiere.webui.component.Column;
@ -199,6 +200,7 @@ DataStatusListener, IADTabpanel, IdSpace
form.setHeight(null); form.setHeight(null);
form.setVflex(false); form.setVflex(false);
form.setSclass("grid-layout adwindow-form"); form.setSclass("grid-layout adwindow-form");
form.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "form");
listPanel = new GridView(); listPanel = new GridView();
listPanel.getListbox().addEventListener(Events.ON_DOUBLE_CLICK, this); listPanel.getListbox().addEventListener(Events.ON_DOUBLE_CLICK, this);
@ -406,6 +408,7 @@ DataStatusListener, IADTabpanel, IdSpace
editor.setADTabpanel(this); editor.setADTabpanel(this);
field.addPropertyChangeListener(editor); field.addPropertyChangeListener(editor);
editors.add(editor); editors.add(editor);
editor.getComponent().setId(field.getColumnName());
toolbarButtonEditors.add(editor); toolbarButtonEditors.add(editor);
continue; continue;
@ -519,6 +522,8 @@ DataStatusListener, IADTabpanel, IdSpace
//stretch component to fill grid cell //stretch component to fill grid cell
editor.fillHorizontal(); editor.fillHorizontal();
editor.getComponent().setId(field.getColumnName());
//setup editor context menu //setup editor context menu
WEditorPopupMenu popupMenu = editor.getPopupMenu(); WEditorPopupMenu popupMenu = editor.getPopupMenu();
@ -540,6 +545,8 @@ DataStatusListener, IADTabpanel, IdSpace
popupMenu.addContextElement((XulElement) editor.getComponent()); popupMenu.addContextElement((XulElement) editor.getComponent());
} }
} }
popupMenu.setId(field.getColumnName()+"-popup");
} }
} }
} }

View File

@ -14,6 +14,7 @@
package org.adempiere.webui.adwindow; package org.adempiere.webui.adwindow;
import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.component.SimpleTreeModel; import org.adempiere.webui.component.SimpleTreeModel;
import org.adempiere.webui.component.ToolBarButton; import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.panel.TreeSearchPanel; import org.adempiere.webui.panel.TreeSearchPanel;
@ -73,6 +74,7 @@ public class ADTreePanel extends Panel implements EventListener<Event>
private void init() private void init()
{ {
setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "treepanel");
this.setWidth("100%"); this.setWidth("100%");
this.setHeight("100%"); this.setHeight("100%");

View File

@ -34,6 +34,7 @@ import java.util.Vector;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.util.Callback; import org.adempiere.util.Callback;
import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.WArchive; import org.adempiere.webui.WArchive;
import org.adempiere.webui.WRequest; import org.adempiere.webui.WRequest;
@ -2742,6 +2743,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
@Override @Override
public void onProcess() { public void onProcess() {
ProcessButtonPopup popup = new ProcessButtonPopup(); ProcessButtonPopup popup = new ProcessButtonPopup();
popup.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "processButtonPopup");
ADTabpanel adtab = (ADTabpanel) adTabbox.getSelectedTabpanel(); ADTabpanel adtab = (ADTabpanel) adTabbox.getSelectedTabpanel();
popup.render(adtab.getToolbarButtons()); popup.render(adtab.getToolbarButtons());

View File

@ -19,6 +19,7 @@ import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.Menupopup; import org.adempiere.webui.component.Menupopup;
@ -151,6 +152,7 @@ public class BreadCrumb extends Div implements EventListener<Event> {
createPopup(); createPopup();
toolbar.setStyle("background-image: none; background-color: transparent; border: none;"); toolbar.setStyle("background-image: none; background-color: transparent; border: none;");
setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "breadcrumb");
} }
public void setToolbarListener(ToolbarListener listener) { public void setToolbarListener(ToolbarListener listener) {

View File

@ -42,6 +42,7 @@ import org.zkoss.zk.au.out.AuFocus;
import org.zkoss.zk.au.out.AuScript; import org.zkoss.zk.au.out.AuScript;
import org.zkoss.zk.ui.AbstractComponent; import org.zkoss.zk.ui.AbstractComponent;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.IdSpace;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
@ -62,7 +63,7 @@ import org.zkoss.zul.event.ZulEvents;
* @author Low Heng Sin * @author Low Heng Sin
* *
*/ */
public class GridView extends Vbox implements EventListener<Event> public class GridView extends Vbox implements EventListener<Event>, IdSpace
{ {
private static final int DEFAULT_DETAIL_PAGE_SIZE = 10; private static final int DEFAULT_DETAIL_PAGE_SIZE = 10;
@ -131,6 +132,7 @@ public class GridView extends Vbox implements EventListener<Event>
public GridView(int windowNo) public GridView(int windowNo)
{ {
this.windowNo = windowNo; this.windowNo = windowNo;
setId("gridView");
createListbox(); createListbox();
this.setHflex("1"); this.setHflex("1");
@ -519,6 +521,7 @@ public class GridView extends Vbox implements EventListener<Event>
} else { } else {
gridFooter.setVisible(true); gridFooter.setVisible(true);
} }
paging.setId("paging");
} }
else else
{ {

View File

@ -150,6 +150,7 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
message = new Html(); message = new Html();
messageDiv.appendChild(message); messageDiv.appendChild(message);
messageDiv.setStyle(MESSAGE_DIV_STYLE); messageDiv.setStyle(MESSAGE_DIV_STYLE);
messageDiv.setId("message");
north = new North(); north = new North();
north.appendChild(messageDiv); north.appendChild(messageDiv);

View File

@ -165,6 +165,7 @@ public class ProcessModalDialog extends Window implements EventListener<Event>,
dialogBody = new VerticalBox(); dialogBody = new VerticalBox();
dialogBody.setHflex("1"); dialogBody.setHflex("1");
Div div = new Div(); Div div = new Div();
div.setId("message");
message = new Html(); message = new Html();
div.appendChild(message); div.appendChild(message);
div.setStyle("max-height: 150pt; overflow: auto;"); div.setStyle("max-height: 150pt; overflow: auto;");

View File

@ -305,6 +305,8 @@ public class ProcessParameterPanel extends Panel implements
m_mFields2.add(mField2); m_mFields2.add(mField2);
// The Editor // The Editor
WEditor editor2 = WebEditorFactory.getEditor(mField2, false); WEditor editor2 = WebEditorFactory.getEditor(mField2, false);
//override attribute
editor2.getComponent().setWidgetAttribute("columnName", mField2.getColumnName()+"_To");
// New Field value to be updated to editor // New Field value to be updated to editor
mField2.addPropertyChangeListener(editor2); mField2.addPropertyChangeListener(editor2);
editor2.dynamicDisplay(); editor2.dynamicDisplay();

View File

@ -244,6 +244,7 @@ public final class ConfirmPanel extends Hbox
this.appendChild(hboxBtnLeft); this.appendChild(hboxBtnLeft);
this.appendChild(hboxBtnRight); this.appendChild(hboxBtnRight);
this.setSclass("confirm-panel"); this.setSclass("confirm-panel");
setId("confirmPanel");
} }
/** /**

View File

@ -31,6 +31,7 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.event.TableValueChangeEvent; import org.adempiere.webui.event.TableValueChangeEvent;
import org.adempiere.webui.event.TableValueChangeListener; import org.adempiere.webui.event.TableValueChangeListener;
@ -194,6 +195,10 @@ public class WListItemRenderer implements ListitemRenderer<Object>, EventListene
int rowIndex, int columnIndex) int rowIndex, int columnIndex)
{ {
ListCell listcell = new ListCell(); ListCell listcell = new ListCell();
WTableColumn column = getColumn(columnIndex);
if (column != null && column.getHeaderValue() != null) {
listcell.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, column.getHeaderValue().toString());
}
boolean isCellEditable = table != null ? table.isCellEditable(rowIndex, columnIndex) : false; boolean isCellEditable = table != null ? table.isCellEditable(rowIndex, columnIndex) : false;
// TODO put this in factory method for generating cell renderers, which // TODO put this in factory method for generating cell renderers, which

View File

@ -22,6 +22,7 @@ import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Checkbox; import org.adempiere.webui.component.Checkbox;
import org.adempiere.webui.component.Grid; import org.adempiere.webui.component.Grid;
@ -175,16 +176,22 @@ public class InfoBPartnerPanel extends InfoPanel implements EventListener<Event>
fieldValue = new Textbox(); fieldValue = new Textbox();
fieldValue.setMaxlength(40); fieldValue.setMaxlength(40);
fieldValue.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "value");
fieldName = new Textbox(); fieldName = new Textbox();
fieldName.setMaxlength(40); fieldName.setMaxlength(40);
fieldName.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "name");
fieldContact = new Textbox(); fieldContact = new Textbox();
fieldContact.setMaxlength(40); fieldContact.setMaxlength(40);
fieldContact.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "contact");
fieldEMail = new Textbox(); fieldEMail = new Textbox();
fieldEMail.setMaxlength(40); fieldEMail.setMaxlength(40);
fieldEMail.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "email");
fieldPostal = new Textbox(); fieldPostal = new Textbox();
fieldPostal.setMaxlength(40); fieldPostal.setMaxlength(40);
fieldPhone = new Textbox(); fieldPostal.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "postal");
fieldPhone = new Textbox();
fieldPhone.setMaxlength(40); fieldPhone.setMaxlength(40);
fieldPhone.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "phone");
checkAND = new Checkbox(); checkAND = new Checkbox();
checkAND.setLabel(Msg.getMsg(Env.getCtx(), "SearchAND")); checkAND.setLabel(Msg.getMsg(Env.getCtx(), "SearchAND"));
@ -210,6 +217,7 @@ public class InfoBPartnerPanel extends InfoPanel implements EventListener<Event>
fieldPostal.setHflex("1"); fieldPostal.setHflex("1");
Grid grid = GridFactory.newGridLayout(); Grid grid = GridFactory.newGridLayout();
grid.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "infoParameterPanel");
Rows rows = new Rows(); Rows rows = new Rows();
grid.appendChild(rows); grid.appendChild(rows);

View File

@ -25,6 +25,7 @@ import java.sql.Timestamp;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.component.Grid; import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.GridFactory; import org.adempiere.webui.component.GridFactory;
import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Label;
@ -189,6 +190,11 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener<Event>
txt2 = new Textbox(); txt2 = new Textbox();
txt3 = new Textbox(); txt3 = new Textbox();
txt4 = new Textbox(); txt4 = new Textbox();
txt1.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "textbox1");
txt2.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "textbox2");
txt3.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "textbox3");
txt4.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "textbox4");
lbl1 = new Label(); lbl1 = new Label();
lbl2 = new Label(); lbl2 = new Label();

View File

@ -22,6 +22,7 @@ import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.Date; import java.util.Date;
import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Checkbox; import org.adempiere.webui.component.Checkbox;
import org.adempiere.webui.component.Datebox; import org.adempiere.webui.component.Datebox;
@ -174,6 +175,12 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
fDocumentNo.addEventListener(Events.ON_CHANGE, this); fDocumentNo.addEventListener(Events.ON_CHANGE, this);
fDescription.addEventListener(Events.ON_CHANGE, this); fDescription.addEventListener(Events.ON_CHANGE, this);
fPOReference.addEventListener(Events.ON_CHANGE, this); fPOReference.addEventListener(Events.ON_CHANGE, this);
fDocumentNo.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "documentNo");
fDescription.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "description");
fPOReference.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "poreference");
fDateFrom.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "dateFrom");
fDateTo.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "dateTo");
fIsSOTrx.setLabel(Msg.translate(Env.getCtx(), "IsSOTrx")); fIsSOTrx.setLabel(Msg.translate(Env.getCtx(), "IsSOTrx"));
fIsSOTrx.setChecked(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx"))); fIsSOTrx.setChecked(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx")));

View File

@ -23,6 +23,7 @@ import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.Date; import java.util.Date;
import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Checkbox; import org.adempiere.webui.component.Checkbox;
import org.adempiere.webui.component.Datebox; import org.adempiere.webui.component.Datebox;
@ -170,12 +171,21 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
txtDocumentNo = new Textbox(); txtDocumentNo = new Textbox();
txtDescription = new Textbox(); txtDescription = new Textbox();
txtDocumentNo.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "documentNo");
txtDescription.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "description");
dateFrom = new Datebox(); dateFrom = new Datebox();
dateTo= new Datebox(); dateTo= new Datebox();
dateFrom.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "dateFrom");
dateTo.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "dateTo");
amountFrom = new NumberBox(false); amountFrom = new NumberBox(false);
amountTo = new NumberBox(false); amountTo = new NumberBox(false);
amountFrom.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "amountFrom");
amountTo.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "amountTo");
isPaid = new Checkbox(); isPaid = new Checkbox();
isPaid.setLabel(Msg.translate(Env.getCtx(), "IsPaid")); isPaid.setLabel(Msg.translate(Env.getCtx(), "IsPaid"));
@ -189,6 +199,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
Env.getCtx(), "C_BPartner_ID"), "", false, false, true); Env.getCtx(), "C_BPartner_ID"), "", false, false, true);
editorBPartner.addValueChangeListener(this); editorBPartner.addValueChangeListener(this);
editorBPartner.getComponent().setHflex("1"); editorBPartner.getComponent().setHflex("1");
editorBPartner.getComponent().setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "bpartnerLookup");
MLookup lookupOrder = MLookupFactory.get(Env.getCtx(), p_WindowNo, MLookup lookupOrder = MLookupFactory.get(Env.getCtx(), p_WindowNo,
0, 4247, DisplayType.Search); 0, 4247, DisplayType.Search);
@ -196,6 +207,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
Env.getCtx(), "C_Order_ID"), "", false, false, true); Env.getCtx(), "C_Order_ID"), "", false, false, true);
editorOrder.addValueChangeListener(this); editorOrder.addValueChangeListener(this);
editorOrder.getComponent().setHflex("1"); editorOrder.getComponent().setHflex("1");
editorOrder.getComponent().setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "orderLookup");
} }
private void init() private void init()

View File

@ -23,6 +23,7 @@ import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.Date; import java.util.Date;
import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Checkbox; import org.adempiere.webui.component.Checkbox;
import org.adempiere.webui.component.Datebox; import org.adempiere.webui.component.Datebox;
@ -158,11 +159,21 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
txtDescription = new Textbox(); txtDescription = new Textbox();
txtOrderRef = new Textbox(); txtOrderRef = new Textbox();
txtDocumentNo.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "documentNo");
txtDescription.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "description");
txtOrderRef.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "orderReference");
dateFrom = new Datebox(); dateFrom = new Datebox();
dateTo= new Datebox(); dateTo= new Datebox();
dateFrom.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "dateFrom");
dateTo.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "dateTo");
amountFrom = new NumberBox(false); amountFrom = new NumberBox(false);
amountTo = new NumberBox(false); amountTo = new NumberBox(false);
amountFrom.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "amountFrom");
amountTo.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "amountTo");
isSoTrx = new Checkbox(); isSoTrx = new Checkbox();
isSoTrx.setLabel(Msg.translate(Env.getCtx(), "IsSOTrx")); isSoTrx.setLabel(Msg.translate(Env.getCtx(), "IsSOTrx"));
@ -172,6 +183,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
editorBPartner = new WSearchEditor(lookupBP, Msg.translate( editorBPartner = new WSearchEditor(lookupBP, Msg.translate(
Env.getCtx(), "C_BPartner_ID"), "", true, false, true); Env.getCtx(), "C_BPartner_ID"), "", true, false, true);
editorBPartner.addValueChangeListener(this); editorBPartner.addValueChangeListener(this);
editorBPartner.getComponent().setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "bpartnerLookup");
} }

View File

@ -30,6 +30,7 @@ import java.util.List;
import java.util.Vector; import java.util.Vector;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.apps.BusyDialog; import org.adempiere.webui.apps.BusyDialog;
import org.adempiere.webui.component.ConfirmPanel; import org.adempiere.webui.component.ConfirmPanel;
@ -266,6 +267,8 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
scrollToSelectedRow(); scrollToSelectedRow();
} }
}); });
setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "infopanel");
} // InfoPanel } // InfoPanel
private void init() private void init()
@ -311,6 +314,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
contentPanel.setOddRowSclass(null); contentPanel.setOddRowSclass(null);
contentPanel.setSizedByContent(true); contentPanel.setSizedByContent(true);
contentPanel.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "infoListbox");
this.setSclass("info-panel"); this.setSclass("info-panel");
} // init } // init

View File

@ -42,6 +42,7 @@ import java.util.ArrayList;
import java.util.Vector; import java.util.Vector;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Button; import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.ConfirmPanel; import org.adempiere.webui.component.ConfirmPanel;
@ -266,15 +267,20 @@ public class InfoProductPanel extends InfoPanel implements EventListener<Event>
m_InfoPAttributeButton.addEventListener(Events.ON_CLICK,this); m_InfoPAttributeButton.addEventListener(Events.ON_CLICK,this);
fieldValue = new Textbox(); fieldValue = new Textbox();
fieldValue.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "value");
fieldName = new Textbox(); fieldName = new Textbox();
fieldName.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "name");
fieldUPC = new Textbox(); fieldUPC = new Textbox();
fieldUPC.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "upc");
fieldSKU = new Textbox(); fieldSKU = new Textbox();
fieldSKU.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "sku");
pickPriceList = new Listbox(); pickPriceList = new Listbox();
pickPriceList.setRows(0); pickPriceList.setRows(0);
pickPriceList.setMultiple(false); pickPriceList.setMultiple(false);
pickPriceList.setMold("select"); pickPriceList.setMold("select");
pickPriceList.setHflex("1"); pickPriceList.setHflex("1");
pickPriceList.addEventListener(Events.ON_SELECT, this); pickPriceList.addEventListener(Events.ON_SELECT, this);
pickPriceList.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "priceList");
// Elaine 2008/11/21 // Elaine 2008/11/21
pickProductCategory = new Listbox(); pickProductCategory = new Listbox();
@ -283,6 +289,7 @@ public class InfoProductPanel extends InfoPanel implements EventListener<Event>
pickProductCategory.setMold("select"); pickProductCategory.setMold("select");
pickProductCategory.setHflex("1"); pickProductCategory.setHflex("1");
pickProductCategory.addEventListener(Events.ON_SELECT, this); pickProductCategory.addEventListener(Events.ON_SELECT, this);
pickProductCategory.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "productCategory");
// //
pickAS = new Listbox(); pickAS = new Listbox();
pickAS.setRows(0); pickAS.setRows(0);
@ -290,6 +297,7 @@ public class InfoProductPanel extends InfoPanel implements EventListener<Event>
pickAS.setMold("select"); pickAS.setMold("select");
pickAS.setHflex("1"); pickAS.setHflex("1");
pickAS.addEventListener(Events.ON_SELECT, this); pickAS.addEventListener(Events.ON_SELECT, this);
pickAS.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "attributeSet");
pickWarehouse = new Listbox(); pickWarehouse = new Listbox();
pickWarehouse.setRows(0); pickWarehouse.setRows(0);
@ -297,6 +305,7 @@ public class InfoProductPanel extends InfoPanel implements EventListener<Event>
pickWarehouse.setMold("select"); pickWarehouse.setMold("select");
pickWarehouse.setHflex("1"); pickWarehouse.setHflex("1");
pickWarehouse.addEventListener(Events.ON_SELECT, this); pickWarehouse.addEventListener(Events.ON_SELECT, this);
pickWarehouse.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "warehouse");
fieldVendor = new Textbox(); fieldVendor = new Textbox();

View File

@ -17,6 +17,7 @@
package org.adempiere.webui.panel; package org.adempiere.webui.panel;
import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Label;
@ -88,6 +89,7 @@ public class StatusBarPanel extends Panel implements EventListener<Event>, IStat
private void init() private void init()
{ {
setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "statusBar");
statusDB = new Label(" "); statusDB = new Label(" ");
statusLine = new Label(); statusLine = new Label();

View File

@ -20,6 +20,7 @@ package org.adempiere.webui.panel;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.component.ConfirmPanel; import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.Grid; import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.GridFactory; import org.adempiere.webui.component.GridFactory;
@ -224,11 +225,9 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
private void initComponents() private void initComponents()
{ {
lblDocAction = new Label(); lblDocAction = new Label();
lblDocAction.setId("lblDocAction");
lblDocAction.setValue(Msg.translate(Env.getCtx(), "DocAction")); lblDocAction.setValue(Msg.translate(Env.getCtx(), "DocAction"));
label = new Label(); label = new Label();
label.setId("label");
lstDocAction = new Listbox(); lstDocAction = new Listbox();
lstDocAction.setId("lstDocAction"); lstDocAction.setId("lstDocAction");
@ -245,8 +244,8 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
private void init() private void init()
{ {
setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "documentAction");
Grid grid = GridFactory.newGridLayout(); Grid grid = GridFactory.newGridLayout();
grid.setId("grd");
grid.setStyle("width: 390px; margin: auto;"); grid.setStyle("width: 390px; margin: auto;");
Rows rows = new Rows(); Rows rows = new Rows();

View File

@ -18,6 +18,11 @@ public class Widget extends By {
this.locator = locator; this.locator = locator;
} }
public Widget(WebElement element) {
String id = element.getAttribute("id");
locator = "#"+id;
}
@Override @Override
public List<WebElement> findElements(SearchContext context) { public List<WebElement> findElements(SearchContext context) {
List<WebElement> list = new ArrayList<WebElement>(); List<WebElement> list = new ArrayList<WebElement>();

View File

@ -11,7 +11,6 @@ import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.openqa.selenium.By; import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Keys;
import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement; import org.openqa.selenium.WebElement;
@ -38,22 +37,33 @@ public class AbstractTestCase {
element.sendKeys(value); element.sendKeys(value);
} }
protected void select(String locator, String label) { protected void comboboxSelectItem(String locator, String label) {
WebElement select = driver.findElement(Zk.jq(locator)); Widget widget = new Widget(locator);
select(select, label); widget.execute(driver, "setValue('"+label+"')");
widget.execute(driver, "fireOnChange()");
WebElement element = widget.$n(driver, "real");
element.click();
} }
protected void select(WebElement select, String label) { protected void comboboxSelectItem(WebElement select, String label) {
WebElement element = select.findElement(By.tagName("input")); Widget widget = new Widget(select);
element.clear(); widget.execute(driver, "setValue('"+label+"')");
element.sendKeys(label); widget.execute(driver, "fireOnChange()");
waitResponse(); WebElement element = widget.$n(driver, "real");
element.click(); element.click();
element.sendKeys(Keys.TAB);
} }
protected void clickCheckbox(String locator) { protected void selectCheckbox(String locator, boolean select) {
driver.findElement(Zk.jq("$"+locator+" ~ input")).click(); final WebElement element = driver.findElement(Zk.jq("$"+locator+" ~ input"));
if (element.isSelected()) {
if (!select) {
element.click();
}
} else {
if (select) {
element.click();
}
}
} }
protected void clickButton(String locator) { protected void clickButton(String locator) {
@ -136,10 +146,10 @@ public class AbstractTestCase {
type("$loginPanel $txtPassword", "GardenAdmin"); type("$loginPanel $txtPassword", "GardenAdmin");
//select language //select language
select("$loginPanel $lstLanguage", "English"); comboboxSelectItem("$loginPanel $lstLanguage", "English");
// check select role // check select role
clickCheckbox("$loginPanel $chkSelectRole"); selectCheckbox("$loginPanel $chkSelectRole", true);
// click ok button // click ok button
clickButton("$loginPanel $Ok"); clickButton("$loginPanel $Ok");
@ -173,14 +183,14 @@ public class AbstractTestCase {
// select client // select client
if (lstClient != null && lstClient.isDisplayed()) { if (lstClient != null && lstClient.isDisplayed()) {
select(lstClient, client); comboboxSelectItem(lstClient, client);
} }
// select role // select role
select("$rolePanel $lstRole", role); comboboxSelectItem("$rolePanel $lstRole", role);
// select organization // select organization
select("$rolePanel $lstOrganisation", org); comboboxSelectItem("$rolePanel $lstOrganisation", org);
// click ok button // click ok button
clickButton("$rolePanel $Ok"); clickButton("$rolePanel $Ok");

View File

@ -2,7 +2,9 @@ package test;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import org.idempiere.ui.zk.selenium.Zk;
import org.junit.*; import org.junit.*;
import org.openqa.selenium.WebElement;
/** /**
* Web Driver + zk jq selector, doesn't required AdempiereIdGenerator * Web Driver + zk jq selector, doesn't required AdempiereIdGenerator
@ -14,7 +16,7 @@ public class SelectTabTest extends AbstractTestCase {
public void testSelectTab() throws Exception { public void testSelectTab() throws Exception {
login(); login();
waitResponse(); waitResponse();
select("$treeSearchCombo", "Product"); comboboxSelectItem("$treeSearchCombo", "Product");
waitResponse(); waitResponse();
clickButton("$findWindow_1 $simpleSearch $btnOk"); clickButton("$findWindow_1 $simpleSearch $btnOk");
waitResponse(); waitResponse();
@ -23,5 +25,8 @@ public class SelectTabTest extends AbstractTestCase {
waitResponse(); waitResponse();
selectTab("$Product_1 $detailPane @tabbox", "Business Partner"); selectTab("$Product_1 $detailPane @tabbox", "Business Partner");
assertEquals("Business Partner", selectedTab("$Product_1 $detailPane @tabbox")); assertEquals("Business Partner", selectedTab("$Product_1 $detailPane @tabbox"));
WebElement element = driver.findElement(Zk.jq("$Product_1 $Product @textbox[columnName=\"Name\"]"));
assertNotNull(element);
} }
} }