IDEMPIERE-92 - Integrate Selenium. Make more class test ready. Added test case for IDEMPIERE-520.
This commit is contained in:
parent
16773b295b
commit
d442f2c04d
|
@ -0,0 +1,32 @@
|
||||||
|
'''IDEMPIERE-520 Master/Detail bugs found using Production window'''
|
||||||
|
|
||||||
|
!include -c ZkGardenAdminLogin
|
||||||
|
|
||||||
|
!define windowId {$Production__Single_Product__1}
|
||||||
|
|
||||||
|
|''open window''|!-Production (Single Product)-!|
|
||||||
|
|''wait response''|
|
||||||
|
|''window''|${windowId}|''click toolbar''|!-BtnNew-!|
|
||||||
|
|''wait response''|
|
||||||
|
|''element exists''|${windowId} $detailPane @tabbox|
|
||||||
|
|''lookup''|${windowId} $Production $M_Product_ID|''search''|!-PatioSet-!|
|
||||||
|
|''wait response''|
|
||||||
|
|''with''|${windowId} $Production $ProductionQty @decimalbox|''set text''|!-1-!|
|
||||||
|
|''window''|${windowId}|''click toolbar''|!-BtnSave-!|
|
||||||
|
|''wait response''|
|
||||||
|
|''window message''|${windowId}|is|!-Record saved-!|
|
||||||
|
|''window''|${windowId}|''click detail toolbar''|!-BtnNew-!|
|
||||||
|
|''wait response''|
|
||||||
|
|''text of''|${windowId} $recordInfo|is|!-+*1/1-!|
|
||||||
|
|''window''|${windowId}|''click toolbar''|!-BtnParentRecord-!|
|
||||||
|
|''wait response''|
|
||||||
|
|''window''|${windowId}|''click process button''|!-CreateFrom-!|
|
||||||
|
|''wait response''|
|
||||||
|
|''click''|${windowId} @window[title="Create Production"] $Ok|
|
||||||
|
|''wait response''|
|
||||||
|
|''window''|${windowId}|''click detail toolbar''|!-BtnEdit-!|
|
||||||
|
|''wait response''|
|
||||||
|
|''element visible''|${windowId} $detailPane @tab|
|
||||||
|
|''window''|${windowId}|''next record''|
|
||||||
|
|''wait response''|
|
||||||
|
|''element invisible''|${windowId} $detailPane @tab|
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<properties>
|
||||||
|
<Edit>true</Edit>
|
||||||
|
<Files>true</Files>
|
||||||
|
<Properties>true</Properties>
|
||||||
|
<RecentChanges>true</RecentChanges>
|
||||||
|
<Refactor>true</Refactor>
|
||||||
|
<Search>true</Search>
|
||||||
|
<Test/>
|
||||||
|
<Versions>true</Versions>
|
||||||
|
<WhereUsed>true</WhereUsed>
|
||||||
|
</properties>
|
|
@ -0,0 +1,31 @@
|
||||||
|
'''IDEMPIERE-520 Master/Detail bugs found using Production window'''
|
||||||
|
|
||||||
|
!include -c ZkGardenAdminLogin
|
||||||
|
|
||||||
|
!define windowId {$Production__Single_Product__1}
|
||||||
|
|
||||||
|
|''open window''|!-Production (Single Product)-!|
|
||||||
|
|''wait response''|
|
||||||
|
|''element exists''|${windowId} $detailPane @tabbox|
|
||||||
|
|''lookup''|${windowId} $Production $M_Product_ID|''search''|!-PatioSet-!|
|
||||||
|
|''wait response''|
|
||||||
|
|''with''|${windowId} $Production $ProductionQty @decimalbox|''set text''|!-1-!|
|
||||||
|
|''window''|${windowId}|''click toolbar''|!-BtnSave-!|
|
||||||
|
|''wait response''|
|
||||||
|
|''window message''|${windowId}|is|!-Record saved-!|
|
||||||
|
|''window''|${windowId}|''click detail toolbar''|!-BtnNew-!|
|
||||||
|
|''wait response''|
|
||||||
|
|''text of''|${windowId} $recordInfo|is|!-+*1/1-!|
|
||||||
|
|''window''|${windowId}|''click toolbar''|!-BtnParentRecord-!|
|
||||||
|
|''wait response''|
|
||||||
|
|''window''|${windowId}|''click process button''|!-CreateFrom-!|
|
||||||
|
|''wait response''|
|
||||||
|
|''click''|${windowId} @window[title="Create Production"] $Ok|
|
||||||
|
|''wait response''|
|
||||||
|
|''window''|${windowId}|''click detail toolbar''|!-BtnEdit-!|
|
||||||
|
|''wait response''|
|
||||||
|
|''element visible''|${windowId} $detailPane @tab|
|
||||||
|
|''window''|${windowId}|''next record''|
|
||||||
|
|''wait response''|
|
||||||
|
|''element invisible''|${windowId} $detailPane @tab|
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<properties>
|
||||||
|
<Edit>true</Edit>
|
||||||
|
<Files>true</Files>
|
||||||
|
<Properties>true</Properties>
|
||||||
|
<RecentChanges>true</RecentChanges>
|
||||||
|
<Refactor>true</Refactor>
|
||||||
|
<Search>true</Search>
|
||||||
|
<Test/>
|
||||||
|
<Versions>true</Versions>
|
||||||
|
<WhereUsed>true</WhereUsed>
|
||||||
|
</properties>
|
|
@ -92,6 +92,7 @@ public class ADWindowContent extends AbstractADWindowContent
|
||||||
toolbar.setWindowNo(getWindowNo());
|
toolbar.setWindowNo(getWindowNo());
|
||||||
breadCrumb = new BreadCrumb(getWindowNo());
|
breadCrumb = new BreadCrumb(getWindowNo());
|
||||||
breadCrumb.setToolbarListener(this);
|
breadCrumb.setToolbarListener(this);
|
||||||
|
breadCrumb.setId("breadCrumb");
|
||||||
div.appendChild(breadCrumb);
|
div.appendChild(breadCrumb);
|
||||||
|
|
||||||
//status bar
|
//status bar
|
||||||
|
|
|
@ -33,6 +33,7 @@ import java.util.TreeMap;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.adempiere.util.Callback;
|
import org.adempiere.util.Callback;
|
||||||
|
import org.adempiere.webui.AdempiereIdGenerator;
|
||||||
import org.adempiere.webui.AdempiereWebUI;
|
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;
|
||||||
|
@ -232,6 +233,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
||||||
{
|
{
|
||||||
/** Initalise toolbar */
|
/** Initalise toolbar */
|
||||||
toolbar = new ADWindowToolbar(getWindowNo());
|
toolbar = new ADWindowToolbar(getWindowNo());
|
||||||
|
toolbar.setId("windowToolbar");
|
||||||
toolbar.addListener(this);
|
toolbar.addListener(this);
|
||||||
|
|
||||||
statusBar = new StatusBar();
|
statusBar = new StatusBar();
|
||||||
|
@ -2374,6 +2376,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
||||||
{
|
{
|
||||||
Clients.showBusy(getComponent(), " ");
|
Clients.showBusy(getComponent(), " ");
|
||||||
final WCreateFromWindow window = (WCreateFromWindow) cf.getWindow();
|
final WCreateFromWindow window = (WCreateFromWindow) cf.getWindow();
|
||||||
|
window.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, AdempiereIdGenerator.escapeId(window.getTitle()));
|
||||||
window.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
window.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
|
|
|
@ -132,6 +132,7 @@ public class BreadCrumb extends Div implements EventListener<Event> {
|
||||||
btnRecordInfo.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Who")));
|
btnRecordInfo.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Who")));
|
||||||
btnRecordInfo.addEventListener(Events.ON_CLICK, this);
|
btnRecordInfo.addEventListener(Events.ON_CLICK, this);
|
||||||
btnRecordInfo.setSclass("breadcrumb-record-info link");
|
btnRecordInfo.setSclass("breadcrumb-record-info link");
|
||||||
|
btnRecordInfo.setId("recordInfo");
|
||||||
toolbar.appendChild(btnRecordInfo);
|
toolbar.appendChild(btnRecordInfo);
|
||||||
btnNext = createButton("Next", "Next", "Next");
|
btnNext = createButton("Next", "Next", "Next");
|
||||||
toolbar.appendChild(btnNext);
|
toolbar.appendChild(btnNext);
|
||||||
|
|
|
@ -98,6 +98,54 @@ public class ZkFixture extends SpiderFixture {
|
||||||
return (String) widget.eval(webDriver, "getSelectedTab().getLabel()");
|
return (String) widget.eval(webDriver, "getSelectedTab().getLabel()");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--- Search (lookup) --
|
||||||
|
@SimpleAction(wiki = "|''<i>lookup</i>''|xpath, id or other locator|''<i>search</i>''|value|", tooltip = "Search lookup with value.")
|
||||||
|
public void lookupSearch(String locator, String value) {
|
||||||
|
Widget widget = new Widget(locator + " @textbox");
|
||||||
|
WebElement element = widget.findElement(webDriver);
|
||||||
|
element.click();
|
||||||
|
widget.execute(webDriver, "setValue('"+value+"')");
|
||||||
|
widget.execute(webDriver, "fireOnChange()");
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- window ( tab ) ---
|
||||||
|
@SimpleAction(wiki = "|''<i>open window</i>''|menu label|", tooltip = "Open window with label.")
|
||||||
|
public void openWindow(String label) {
|
||||||
|
comboboxSelectItem("$treeSearchCombo", label);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SimpleAction(wiki = "|''<i>window</i>''|xpath, id or other locator|''<i>click process button</i>''|button id|", tooltip = "Click a window's process button.")
|
||||||
|
public void windowClickProcessButton(String windowLocator, String btnId) {
|
||||||
|
click(windowLocator + " $windowToolbar $BtnProcess");
|
||||||
|
waitResponse();
|
||||||
|
click("@window[instanceName=\"processButtonPopup\"] $" + btnId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SimpleAction(wiki = "|''<i>window</i>''|xpath, id or other locator|''<i>click toolbar</i>''|value|", tooltip = "Click a window's toolbar button")
|
||||||
|
public void windowClickToolbar(String windowLocator, String toolbarButtonId) {
|
||||||
|
click(windowLocator + " $windowToolbar $" + toolbarButtonId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SimpleAction(wiki = "|''<i>window</i>''|xpath, id or other locator|''<i>click detail toolbar</i>''|value|", tooltip = "Click the detailpane's toolbar button")
|
||||||
|
public void windowClickDetailToolbar(String windowLocator, String toolbarButtonId) {
|
||||||
|
click(windowLocator + " $detailPane $" + toolbarButtonId + ":visible");
|
||||||
|
}
|
||||||
|
|
||||||
|
@SimpleAction(wiki = "|''<i>window message</i>''|xpath, id or other locator|", tooltip = "Current status message display for a window")
|
||||||
|
public String windowMessage(String windowLocator) {
|
||||||
|
return webDriver.findElement(Zk.jq(windowLocator +" $messages @label")).getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SimpleAction(wiki = "|''<i>window</i>''|xpath, id or other locator|''<i>next record</i>''|value|", tooltip = "Navigate to next record.")
|
||||||
|
public void windowNextRecord(String windowLocator) {
|
||||||
|
click(windowLocator+" $breadCrumb $Next");
|
||||||
|
}
|
||||||
|
|
||||||
|
@SimpleAction(wiki = "|''<i>window</i>''|xpath, id or other locator|''<i>previous record</i>''|value|", tooltip = "Navigate to previous record.")
|
||||||
|
public void windowPreviousRecord(String windowLocator) {
|
||||||
|
click(windowLocator+" $breadCrumb $Previous");
|
||||||
|
}
|
||||||
|
|
||||||
// -------- Wait Ajax Response -----
|
// -------- Wait Ajax Response -----
|
||||||
@SimpleAction(wiki = "|''<i>wait response</i>''|", tooltip = "Wait for ajax response with default timeout value.")
|
@SimpleAction(wiki = "|''<i>wait response</i>''|", tooltip = "Wait for ajax response with default timeout value.")
|
||||||
public void waitResponse() {
|
public void waitResponse() {
|
||||||
|
|
|
@ -53,6 +53,14 @@ public class AbstractTestCase {
|
||||||
element.click();
|
element.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void search(String locator, String label) {
|
||||||
|
Widget widget = new Widget(locator + " @textbox");
|
||||||
|
WebElement element = widget.findElement(driver);
|
||||||
|
element.click();
|
||||||
|
widget.execute(driver, "setValue('"+label+"')");
|
||||||
|
widget.execute(driver, "fireOnChange()");
|
||||||
|
}
|
||||||
|
|
||||||
protected void selectCheckbox(String locator, boolean select) {
|
protected void selectCheckbox(String locator, boolean select) {
|
||||||
final WebElement element = driver.findElement(Zk.jq("$"+locator+" ~ input"));
|
final WebElement element = driver.findElement(Zk.jq("$"+locator+" ~ input"));
|
||||||
if (element.isSelected()) {
|
if (element.isSelected()) {
|
||||||
|
@ -205,6 +213,36 @@ public class AbstractTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void openWindow(String label) {
|
||||||
|
comboboxSelectItem("$treeSearchCombo", label);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void clickProcessButton(String windowId, String btnId) {
|
||||||
|
clickButton("$"+windowId + " $windowToolbar $BtnProcess");
|
||||||
|
waitResponse();
|
||||||
|
clickButton("@window[instanceName=\"processButtonPopup\"] $" + btnId);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void clickToolbarButton(String windowId, String toolBarButtonId) {
|
||||||
|
clickButton("$" + windowId + " $windowToolbar $" + toolBarButtonId);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void clickDetailToolbarButton(String windowId, String toolBarButtonId) {
|
||||||
|
clickButton("$" + windowId + " $detailPane $" + toolBarButtonId + ":visible");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected WebElement getWindowMessageLabel(String windowId) {
|
||||||
|
return driver.findElement(Zk.jq("$"+windowId +" $messages @label"));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void nextRecord(String windowId) {
|
||||||
|
clickButton("$"+windowId+" $breadCrumb $Next");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void previousRecord(String windowId) {
|
||||||
|
clickButton("$"+windowId+" $breadCrumb $Previous");
|
||||||
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
//driver.quit();
|
//driver.quit();
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
package test;
|
||||||
|
|
||||||
|
import org.idempiere.ui.zk.selenium.Zk;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
import org.openqa.selenium.WebElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test case for http://jira.idempiere.com/browse/IDEMPIERE-520
|
||||||
|
* @author hengsin
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ProductionTest extends AbstractTestCase {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIDempiere520() throws Exception {
|
||||||
|
login();
|
||||||
|
|
||||||
|
String windowId = "Production__Single_Product__1";
|
||||||
|
|
||||||
|
openWindow("Production (Single Product)");
|
||||||
|
|
||||||
|
waitResponse();
|
||||||
|
|
||||||
|
//check detail is shown for new record
|
||||||
|
WebElement element = driver.findElement(Zk.jq("$"+windowId+" $detailPane @tabbox"));
|
||||||
|
|
||||||
|
assertTrue(element != null && element.isDisplayed());
|
||||||
|
|
||||||
|
search("$"+windowId+" $Production $M_Product_ID", "PatioSet");
|
||||||
|
waitResponse();
|
||||||
|
|
||||||
|
type("$"+windowId+" $Production $ProductionQty @decimalbox", "1");
|
||||||
|
|
||||||
|
|
||||||
|
clickToolbarButton(windowId, "BtnSave");
|
||||||
|
waitResponse();
|
||||||
|
|
||||||
|
//verify save successfull
|
||||||
|
element = getWindowMessageLabel(windowId);
|
||||||
|
assertTrue("Record saved".equals(element.getText()));
|
||||||
|
|
||||||
|
clickDetailToolbarButton(windowId, "BtnNew");
|
||||||
|
|
||||||
|
//verify +*1/1 for is shown for new record
|
||||||
|
waitResponse();
|
||||||
|
element = driver.findElement(Zk.jq("$"+windowId+" $recordInfo"));
|
||||||
|
assertEquals("+*1/1", element.getText());
|
||||||
|
|
||||||
|
//test for npe
|
||||||
|
clickToolbarButton(windowId, "BtnParentRecord");
|
||||||
|
waitResponse();
|
||||||
|
|
||||||
|
//create production lines
|
||||||
|
clickProcessButton(windowId, "CreateFrom");
|
||||||
|
waitResponse();
|
||||||
|
clickButton("$"+windowId+" @window[title=\"Create Production\"] $Ok");
|
||||||
|
waitResponse();
|
||||||
|
|
||||||
|
clickDetailToolbarButton(windowId, "BtnEdit");
|
||||||
|
waitResponse();
|
||||||
|
|
||||||
|
//verify qc tab visible for first record
|
||||||
|
element = driver.findElement(Zk.jq("$"+windowId+" $detailPane @tab"));
|
||||||
|
assertTrue(element != null && element.isDisplayed());
|
||||||
|
|
||||||
|
nextRecord(windowId);
|
||||||
|
waitResponse();
|
||||||
|
|
||||||
|
//verify qc tab is invisible for first record
|
||||||
|
element = driver.findElement(Zk.jq("$"+windowId+" $detailPane @tab"));
|
||||||
|
assertTrue(element == null || !element.isDisplayed());
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,7 +16,7 @@ public class SelectTabTest extends AbstractTestCase {
|
||||||
public void testSelectTab() throws Exception {
|
public void testSelectTab() throws Exception {
|
||||||
login();
|
login();
|
||||||
waitResponse();
|
waitResponse();
|
||||||
comboboxSelectItem("$treeSearchCombo", "Product");
|
openWindow("Product");
|
||||||
waitResponse();
|
waitResponse();
|
||||||
clickButton("$findWindow_1 $simpleSearch $btnOk");
|
clickButton("$findWindow_1 $simpleSearch $btnOk");
|
||||||
waitResponse();
|
waitResponse();
|
||||||
|
|
Loading…
Reference in New Issue