Skip to content

Commit

Permalink
add test case for ZK-2152, ZK-2400, ZK-2414.
Browse files Browse the repository at this point in the history
  • Loading branch information
jerrywell committed Sep 1, 2014
1 parent 39085e0 commit ae2fd49
Show file tree
Hide file tree
Showing 6 changed files with 270 additions and 18 deletions.
11 changes: 11 additions & 0 deletions .classpath
@@ -1,5 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="zstl/test">
<attributes>
<attribute name="optional" value="true"/>
Expand All @@ -25,5 +30,11 @@
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.scala-ide.sdt.launching.SCALA_CONTAINER"/>
<classpathentry kind="src" output="target/classes" path="codegen">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
34 changes: 17 additions & 17 deletions config.properties
Expand Up @@ -48,11 +48,11 @@ systemproperties=webdriver.ie.driver:./lib/IEDriverServer.exe;webdriver.chrome.d

#selenium server setting
#client=http://localhost:4444
server=http://localhost:8081
server=http://10.1.3.181:8081
context-path=/zktest
delay=200
action=ztl.zul
timeout=60000
timeout=600000
browser=all
# for debuggable javascript in ZKElementFinder
debuggable=false
Expand All @@ -63,7 +63,7 @@ imgdest=c:/imgdest
comparable=true
granularity=5
leniency=1
#openonce=-1
openonce=1

### for parallel VM execution
connectionWaitPeriod=2000
Expand All @@ -73,22 +73,22 @@ restartSleep=90000
maxTimeoutCount=3

### for remote web driver
#ie6=http://10.1.3.247:4444/wd/hub;InternetExplorerDriver
#ie7=http://10.1.3.213:4444/wd/hub;InternetExplorerDriver
#ie8=http://10.1.3.214:4444/wd/hub,http://10.1.2.214:4444/wd/hub,http://10.1.2.218:4444/wd/hub;InternetExplorerDriver
#ie9=http://10.1.3.215:4444/wd/hub,http://10.1.2.215:4444/wd/hub,http://10.1.2.219:4444/wd/hub;InternetExplorerDriver
#ie10=http://10.1.3.216:4444/wd/hub,http://10.1.2.216:4444/wd/hub,http://10.1.2.220:4444/wd/hub;InternetExplorerDriver
#ie11=http://10.1.3.168:4444/wd/hub,http://10.1.2.217:4444/wd/hub,http://10.1.2.221:4444/wd/hub;InternetExplorerDriver
#chrome=http://10.1.3.223:4444/wd/hub,http://10.1.2.223:4444/wd/hub;ChromeDriver
#ff=http://10.1.3.222:4444/wd/hub,http://10.1.2.222:4444/wd/hub;FirefoxDriver
#opera=http://10.1.3.224:4444/wd/hub,http://10.1.2.224:4444/wd/hub;OperaDriver
#safari=http://10.1.3.232:4444/wd/hub;SafariDriver
ie6=http://10.1.3.247:4444/wd/hub;InternetExplorerDriver
ie7=http://10.1.3.213:4444/wd/hub;InternetExplorerDriver
ie8=http://10.1.3.214:4444/wd/hub,http://10.1.2.214:4444/wd/hub,http://10.1.2.218:4444/wd/hub;InternetExplorerDriver
ie9=http://10.1.3.215:4444/wd/hub,http://10.1.2.215:4444/wd/hub,http://10.1.2.219:4444/wd/hub;InternetExplorerDriver
ie10=http://10.1.3.216:4444/wd/hub,http://10.1.2.216:4444/wd/hub,http://10.1.2.220:4444/wd/hub;InternetExplorerDriver
ie11=http://10.1.3.168:4444/wd/hub,http://10.1.2.217:4444/wd/hub,http://10.1.2.221:4444/wd/hub;InternetExplorerDriver
chrome=http://10.1.3.223:4444/wd/hub,http://10.1.2.223:4444/wd/hub;ChromeDriver
ff=http://10.1.3.222:4444/wd/hub,http://10.1.2.222:4444/wd/hub;FirefoxDriver
opera=http://10.1.3.224:4444/wd/hub,http://10.1.2.224:4444/wd/hub;OperaDriver
safari=http://10.1.3.232:4444/wd/hub;SafariDriver
htmlunit=HtmlUnitDriver

ie=InternetExplorerDriver
#ie=InternetExplorerDriver
chrome=ChromeDriver
firefox=FirefoxDriver
opera=OperaDriver
#firefox=FirefoxDriver
#opera=OperaDriver
#android=AndroidDriver
#zktheme=atlantic|silvertail|sapphire
all=firefox,ie,chrome,opera
all=chrome
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -221,7 +221,7 @@
</includes>
<reportsDirectory>${report.dir}</reportsDirectory>
<forkCount>2</forkCount>
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
<argLine>-Xmx256m -XX:MaxPermSize=128m</argLine>
<reuseForks>true</reuseForks>
</configuration>
</plugin>
Expand Down
127 changes: 127 additions & 0 deletions zstl/test/org/zkoss/zktest/test2/B70/B70_ZK_2152Test.scala
@@ -0,0 +1,127 @@
package org.zkoss.zktest.test2.B70

import org.zkoss.ztl.Tags
import org.zkoss.zstl.ZTL4ScalaTestCase
import org.junit.Test
import java.awt.event.KeyEvent
import org.openqa.selenium.Keys
import org.zkoss.ztl.ZKSeleneseTestBase

@Tags(tags = "B70-ZK-2152.zul")
class B70_ZK_2152Test extends ZTL4ScalaTestCase {

@Test
def testClick() = {
val zscript = """<?xml version="1.0" encoding="UTF-8"?>
<!--
B70-ZK-2152.zul
Purpose:
Description:
History:
Mon, June 20, 2014 14:16:12 PM, Created by jerrychen
Copyright (C) Potix Corporation. All Rights Reserved.
-->
<zk>
<zscript>
String string = "10/10/2014 05:00:00";
Date date = null;
try{
date = new java.text.SimpleDateFormat("MM/dd/yyyy HH:mm:ss", Locale.ENGLISH).parse(string);
} catch(Exception ex){}
</zscript>
<div>
1. click datebox and input specified time into timebox.
<separator/>
2. if there's not the result as expected, it's a bug.
<separator/>
</div>
<div>
21:00:00 => 10/10/2014 21:00:00
<separator/>
<datebox cols="30" format="MM/dd/yyyy HH:mm:ss"
onCreate="self.value = date" width="230px" />
</div>
<div>
11:00:00 => 10/10/2014 11:00:00 AM
<separator/>
<datebox cols="30" format="MM/dd/yyyy hh:mm:ss a"
onCreate="self.value = date" width="230px" />
</div>
<div>
11:00:00 => 10/10/2014 11:00:00 AM
<separator/>
<datebox cols="30" format="MM/dd/yyyy KK:mm:ss a"
onCreate="self.value = date" width="230px" />
</div>
<div>
21:00:00 => 10/10/2014 21:00:00
<separator/>
<datebox cols="30" format="MM/dd/yyyy kk:mm:ss"
onCreate="self.value = date" width="230px" />
</div>
</zk>
"""
runZTL(zscript,
() => {
clickAt(jq(".z-datebox-button").eq(0), "1,1");
waitResponse();
var inp = jq(".z-timebox-input").eq(0);
zk(inp).eval("setSelectionRange(0);'test'");
waitResponse();
keyPress(inp, "210000");
waitResponse();
sendKeys(inp, Keys.ENTER);
waitResponse();
verifyTrue(jq("@datebox").eq(0).toWidget().get("text").equals("10/10/2014 21:00:00"));

clickAt(jq(".z-datebox-button").eq(1), "1,1");
waitResponse();
inp = jq(".z-timebox-input").eq(1);
zk(inp).eval("setSelectionRange(0);'test'");
waitResponse();
keyPress(inp, "110000");
waitResponse();
sendKeys(inp, Keys.ARROW_RIGHT);
waitResponse();
sendKeys(inp, Keys.ARROW_UP);
waitResponse();
sendKeys(inp, Keys.ENTER);
waitResponse();
verifyTrue(jq("@datebox").eq(1).toWidget().get("text").equals("10/10/2014 11:00:00 AM"));

clickAt(jq(".z-datebox-button").eq(2), "1,1");
waitResponse();
inp = jq(".z-timebox-input").eq(2);
zk(inp).eval("setSelectionRange(0);'test'");
waitResponse();
keyPress(inp, "110000");
waitResponse();
sendKeys(inp, Keys.ARROW_RIGHT);
waitResponse();
sendKeys(inp, Keys.ARROW_UP);
waitResponse();
sendKeys(inp, Keys.ENTER);
waitResponse();
verifyTrue(jq("@datebox").eq(2).toWidget().get("text").equals("10/10/2014 11:00:00 AM"));

clickAt(jq(".z-datebox-button").eq(3), "1,1");
waitResponse();
inp = jq(".z-timebox-input").eq(3);
zk(inp).eval("setSelectionRange(0);'test'");
waitResponse();
keyPress(inp, "210000");
waitResponse();
sendKeys(inp, Keys.ENTER);
waitResponse();
verifyTrue(jq("@datebox").eq(3).toWidget().get("text").equals("10/10/2014 21:00:00"));
})

}
}
52 changes: 52 additions & 0 deletions zstl/test/org/zkoss/zktest/test2/B70/B70_ZK_2400Test.scala
@@ -0,0 +1,52 @@
package org.zkoss.zktest.test2.B70

import org.zkoss.ztl.Tags
import org.zkoss.zstl.ZTL4ScalaTestCase
import org.junit.Test
import java.awt.event.KeyEvent
import org.openqa.selenium.Keys
import org.zkoss.ztl.ZKSeleneseTestBase

@Tags(tags = "B70-ZK-2400.zul")
class B70_ZK_2400Test extends ZTL4ScalaTestCase {

@Test
def testClick() = {
val zscript = """<?xml version="1.0" encoding="UTF-8"?>
<!--
B70-ZK-2400.zul
Purpose:
Description:
History:
Thur, Aug 14, 2014 11:35:00 AM, Created by jerrychen
Copyright (C) Potix Corporation. All Rights Reserved.
-->
<zk>
<div>
1. click up or down button. if you see the label changed as well without losing timebox's focus, it's a bug.
</div>
<timebox format="HH:mm" onChange="lbl.value = event.value"/>
<separator/>
value onChanged: <label id="lbl"/>
<separator/>
</zk>
"""
runZTL(zscript,
() => {
val btn = jq(".z-timebox-up");
clickAt(btn, "1,1");
waitResponse();
clickAt(btn, "1,1");
waitResponse();
verifyTrue("click up button shouldn't trigger onChange.", jq("$lbl").toWidget().get("value").equals(""));
})

}
}
62 changes: 62 additions & 0 deletions zstl/test/org/zkoss/zktest/test2/B70/B70_ZK_2414Test.scala
@@ -0,0 +1,62 @@
package org.zkoss.zktest.test2.B70

import org.zkoss.ztl.Tags
import org.zkoss.zstl.ZTL4ScalaTestCase
import org.junit.Test
import java.awt.event.KeyEvent
import org.openqa.selenium.Keys
import org.zkoss.ztl.ZKSeleneseTestBase

@Tags(tags = "B70-ZK-2414.zul")
class B70_ZK_2414Test extends ZTL4ScalaTestCase {

@Test
def testClick() = {
val zscript = """<?xml version="1.0" encoding="UTF-8"?>
<!--
B70-ZK-2414.zul
Purpose:
Description:
History:
Fri, Aug 22, 2014 2:30:33 PM, Created by jumperchen
Copyright (C) Potix Corporation. All Rights Reserved.
-->
<zk>
<window id="mainWin" width="100%" height="100%" sclass="page-bg" >
<div width="100%" vflex="80">
<hbox hflex="1" vflex="1">
<!-- empty div for alignment -->
<div hflex="15">You should be able to see the "right" word in IE9/IE10</div>
<div id="contentDiv" hflex="70" vflex="1">
<div id="financialDetailsWin" vflex="1" >
<panel id="contentPanel" height="100%" hflex="1">
<panelchildren style="overflow:auto;border:solid 1px black">
center
</panelchildren>
</panel>
<!-- SPACE element here causes the problem;
- - caused ZK 7 width-calculation on IE to explode the width to 1600+ pixels.
-->
<space/>
</div>
</div>
<div hflex="15" id="rLabel">right</div>
</hbox>
</div>
</window>
</zk>
"""
runZTL(zscript,
() => {
verifyTrue(jq("$rLabel").exists());
})

}
}

0 comments on commit ae2fd49

Please sign in to comment.