diff --git a/zktest/src/main/webapp/test2/B65-ZK-1588.zul b/zktest/src/main/webapp/test2/B65-ZK-1588.zul index 1bb3d5b395..f5cf994a0b 100644 --- a/zktest/src/main/webapp/test2/B65-ZK-1588.zul +++ b/zktest/src/main/webapp/test2/B65-ZK-1588.zul @@ -1,10 +1,9 @@ - -
+
+
when click the button of bandbox, the popup should be above bandbox.
- - +
@@ -58,6 +57,6 @@ - - +
+
\ No newline at end of file diff --git a/zktest/src/test/java/org/zkoss/zktest/zats/test2/B30_1898094Test.java b/zktest/src/test/java/org/zkoss/zktest/zats/test2/B30_1898094Test.java new file mode 100644 index 0000000000..5e350b7470 --- /dev/null +++ b/zktest/src/test/java/org/zkoss/zktest/zats/test2/B30_1898094Test.java @@ -0,0 +1,62 @@ +/* B30_1898094Test.java + + Purpose: + + Description: + + History: + Wed Dec 04 15:08:13 CST 2024, Created by jamson + +Copyright (C) 2024 Potix Corporation. All Rights Reserved. +*/ +package org.zkoss.zktest.zats.test2; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.Collections; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; +import org.openqa.selenium.chrome.ChromeOptions; + +import org.zkoss.test.webdriver.ExternalZkXml; +import org.zkoss.test.webdriver.ForkJVMTestOnly; +import org.zkoss.test.webdriver.WebDriverTestCase; +import org.zkoss.test.webdriver.ztl.JQuery; + +@ForkJVMTestOnly +public class B30_1898094Test extends WebDriverTestCase { + + @RegisterExtension + public static final ExternalZkXml CONFIG = new ExternalZkXml("/test2/enable-tablet-ui-zk.xml"); + + @Override + protected ChromeOptions getWebDriverOptions() { + return super.getWebDriverOptions() + .setExperimentalOption("mobileEmulation", Collections.singletonMap("deviceName", "iPad")); + } + + @Test + public void test() { + connect(); + + sleep(1000); + + //Look for a textbox focused + JQuery b = jq("@textbox:focus"); + + //Look for a button focused + JQuery r = jq("@button:focus"); + + //Textbox focused Exists? + boolean bb = b.exists(); + + //Button focused Exists? + boolean br = r.exists(); + + //Assert + assertTrue(bb); + assertFalse(br); + } +} \ No newline at end of file diff --git a/zktest/src/test/java/org/zkoss/zktest/zats/test2/B36_2807475Test.java b/zktest/src/test/java/org/zkoss/zktest/zats/test2/B36_2807475Test.java new file mode 100644 index 0000000000..58902ca342 --- /dev/null +++ b/zktest/src/test/java/org/zkoss/zktest/zats/test2/B36_2807475Test.java @@ -0,0 +1,57 @@ +/* B36_2807475Test.java + + Purpose: + + Description: + + History: + Wed Dec 04 15:14:53 CST 2024, Created by jamson + +Copyright (C) 2024 Potix Corporation. All Rights Reserved. +*/ +package org.zkoss.zktest.zats.test2; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.Collections; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; +import org.openqa.selenium.chrome.ChromeOptions; + +import org.zkoss.test.webdriver.ExternalZkXml; +import org.zkoss.test.webdriver.ForkJVMTestOnly; +import org.zkoss.test.webdriver.WebDriverTestCase; + +@ForkJVMTestOnly +public class B36_2807475Test extends WebDriverTestCase { + + @RegisterExtension + public static final ExternalZkXml CONFIG = new ExternalZkXml("/test2/enable-tablet-ui-zk.xml"); + + @Override + protected ChromeOptions getWebDriverOptions() { + return super.getWebDriverOptions() + .setExperimentalOption("mobileEmulation", Collections.singletonMap("deviceName", "iPad")); + } + + @Test + public void test() { + connect(); + + // Click on menu popup + click(jq("$menubar")); + waitResponse(); + + // Click textbox + click(jq("$demo1")); + waitResponse(); + + // Verify that the popup textbox has focus + assertTrue(jq("$demo1:focus").exists(), "The textbox should have focus"); + + // Verify that the value is updated + assertEquals("2", jq("$demo2").val(), "The text should be selected"); + } +} \ No newline at end of file diff --git a/zktest/src/test/java/org/zkoss/zktest/zats/test2/B36_2973306Test.java b/zktest/src/test/java/org/zkoss/zktest/zats/test2/B36_2973306Test.java new file mode 100644 index 0000000000..dd3ea508cf --- /dev/null +++ b/zktest/src/test/java/org/zkoss/zktest/zats/test2/B36_2973306Test.java @@ -0,0 +1,47 @@ +/* B36_2973306Test.java + + Purpose: + + Description: + + History: + Fri Nov 29 19:19:41 CST 2024, Created by jamson + +Copyright (C) 2024 Potix Corporation. All Rights Reserved. +*/ +package org.zkoss.zktest.zats.test2; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.util.Collections; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; +import org.openqa.selenium.chrome.ChromeOptions; + +import org.zkoss.test.webdriver.ExternalZkXml; +import org.zkoss.test.webdriver.ForkJVMTestOnly; +import org.zkoss.test.webdriver.WebDriverTestCase; +import org.zkoss.test.webdriver.ztl.Widget; + +@ForkJVMTestOnly +public class B36_2973306Test extends WebDriverTestCase { + + @RegisterExtension + public static final ExternalZkXml CONFIG = new ExternalZkXml("/test2/enable-tablet-ui-zk.xml"); + + @Override + protected ChromeOptions getWebDriverOptions() { + return super.getWebDriverOptions() + .setExperimentalOption("mobileEmulation", Collections.singletonMap("deviceName", "Nexus 7")); + } + + @Test + public void test() { + connect(); + Widget detail = jq("$detail").toWidget(); + click(detail.$n("icon")); + waitResponse(); + assertEquals(1, jq(detail.$n("fake")).find(">td").length()); + } +} diff --git a/zktest/src/test/java/org/zkoss/zktest/zats/test2/B50_2928109Test.java b/zktest/src/test/java/org/zkoss/zktest/zats/test2/B50_2928109Test.java new file mode 100644 index 0000000000..2a29827f24 --- /dev/null +++ b/zktest/src/test/java/org/zkoss/zktest/zats/test2/B50_2928109Test.java @@ -0,0 +1,43 @@ +/* B50_2928109Test.java + + Purpose: + + Description: + + History: + Wed Dec 04 15:22:47 CST 2024, Created by jamson + +Copyright (C) 2024 Potix Corporation. All Rights Reserved. +*/ +package org.zkoss.zktest.zats.test2; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.Collections; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; +import org.openqa.selenium.chrome.ChromeOptions; + +import org.zkoss.test.webdriver.ExternalZkXml; +import org.zkoss.test.webdriver.ForkJVMTestOnly; +import org.zkoss.test.webdriver.WebDriverTestCase; + +@ForkJVMTestOnly +public class B50_2928109Test extends WebDriverTestCase { + + @RegisterExtension + public static final ExternalZkXml CONFIG = new ExternalZkXml("/test2/enable-tablet-ui-zk.xml"); + + @Override + protected ChromeOptions getWebDriverOptions() { + return super.getWebDriverOptions() + .setExperimentalOption("mobileEmulation", Collections.singletonMap("deviceName", "iPad")); + } + + @Test + public void test() { + connect(); + assertTrue(jq(jq(".z-window-embedded").toWidget().$n("cave")).height() < 24); + } +} \ No newline at end of file diff --git a/zktest/src/test/java/org/zkoss/zktest/zats/test2/B50_ZK_580Test.java b/zktest/src/test/java/org/zkoss/zktest/zats/test2/B50_ZK_580Test.java new file mode 100644 index 0000000000..73654a2f41 --- /dev/null +++ b/zktest/src/test/java/org/zkoss/zktest/zats/test2/B50_ZK_580Test.java @@ -0,0 +1,38 @@ +/* B50_ZK_580Test.java + + Purpose: + + Description: + + History: + Fri Nov 29 16:29:59 CST 2024, Created by jamson + +Copyright (C) 2024 Potix Corporation. All Rights Reserved. +*/ +package org.zkoss.zktest.zats.test2; + +import static org.junit.jupiter.api.Assertions.assertNotEquals; + +import org.junit.jupiter.api.Test; + +import org.zkoss.test.webdriver.FirefoxWebDriverTestCase; +import org.zkoss.test.webdriver.ztl.JQuery; + +public class B50_ZK_580Test extends FirefoxWebDriverTestCase { + + @Test + public void test() { + connect(); + JQuery textbox = jq(".z-textbox"); + clickAt(textbox, -40, 5); + waitResponse(); + String originCursorPosition = zk(textbox).eval("getSelectionRange()[0]"); + + mouseOver(jq(".z-label")); + waitResponse(); + + clickAt(textbox, -10, 5); + waitResponse(); + assertNotEquals(originCursorPosition, zk(textbox).eval("getSelectionRange()[0]")); + } +} diff --git a/zktest/src/test/java/org/zkoss/zktest/zats/test2/B60_ZK_765Test.java b/zktest/src/test/java/org/zkoss/zktest/zats/test2/B60_ZK_765Test.java new file mode 100644 index 0000000000..eec1ea6360 --- /dev/null +++ b/zktest/src/test/java/org/zkoss/zktest/zats/test2/B60_ZK_765Test.java @@ -0,0 +1,81 @@ +/* B60_ZK_765Test.java + + Purpose: + + Description: + + History: + Wed Dec 04 14:55:30 CST 2024, Created by jamson + +Copyright (C) 2024 Potix Corporation. All Rights Reserved. +*/ +package org.zkoss.zktest.zats.test2; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.Collections; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; +import org.openqa.selenium.chrome.ChromeOptions; + +import org.zkoss.test.webdriver.ExternalZkXml; +import org.zkoss.test.webdriver.ForkJVMTestOnly; +import org.zkoss.test.webdriver.WebDriverTestCase; +import org.zkoss.test.webdriver.ztl.JQuery; +import org.zkoss.test.webdriver.ztl.Widget; + +@ForkJVMTestOnly +public class B60_ZK_765Test extends WebDriverTestCase { + + @RegisterExtension + public static final ExternalZkXml CONFIG = new ExternalZkXml("/test2/enable-tablet-ui-zk.xml"); + + @Override + protected ChromeOptions getWebDriverOptions() { + return super.getWebDriverOptions() + .setExperimentalOption("mobileEmulation", Collections.singletonMap("deviceName", "iPad")); + } + + @Test + public void test() { + connect(); + + Widget btnOne = jq("@button:eq(0)").toWidget(), + btnTwo = jq("@button:eq(1)").toWidget(), + btnThree = jq("@button:eq(2)").toWidget(); + + clickAndWait(btnTwo); + assertTrue(jq("$msg:contains(selected index is undefined, no selection)").exists() + || jq("$msg:contains(selected index is -1)").exists(), + "message should be 'selected index is undefined, no selection or ... index is -1 ...'"); + clickAndWait(jq(".z-listitem:contains(Item 1)")); + clickAndWait(btnTwo); + assertTrue(jq("$msg:contains(selected index is 1, widget selected is true)").exists(), "message should be 'selected index is 1, widget selected is true'"); + clickAndWait(btnOne); + clickAndWait(btnTwo); + assertTrue(jq("$msg:contains(selected index is 1, widget selected is true)").exists(), "message should be 'selected index is 1, widget selected is true'"); + + waitResponse(); + driver.navigate().refresh(); + waitResponse(); + + clickAndWait(btnThree); + assertTrue(jq("$msg:contains(selected no selection)").exists(), "message should be 'selected no selection'"); + clickAndWait(jq(".z-listitem:contains(Item 1)")); + clickAndWait(btnThree); + assertTrue(jq("$msg:contains(selected index is 1)").exists(), "message should be 'selected index is 1'"); + clickAndWait(btnOne); + clickAndWait(btnThree); + assertTrue(jq("$msg:contains(selected index is 1)").exists(), "message should be 'selected index is 1'"); + } + + private void clickAndWait(Widget wgt) { + click(wgt); + waitResponse(); + } + + private void clickAndWait(JQuery jq) { + clickAndWait(jq.toWidget()); + } +} diff --git a/zktest/src/test/java/org/zkoss/zktest/zats/test2/B65_ZK_1552Test.java b/zktest/src/test/java/org/zkoss/zktest/zats/test2/B65_ZK_1552Test.java new file mode 100644 index 0000000000..885b788dad --- /dev/null +++ b/zktest/src/test/java/org/zkoss/zktest/zats/test2/B65_ZK_1552Test.java @@ -0,0 +1,48 @@ +/* B65_ZK_1552Test.java + + Purpose: + + Description: + + History: + Thu Dec 05 11:59:26 CST 2024, Created by jamson + +Copyright (C) 2024 Potix Corporation. All Rights Reserved. +*/ +package org.zkoss.zktest.zats.test2; + +import static org.junit.jupiter.api.Assertions.assertFalse; + +import java.util.Collections; + +import org.junit.jupiter.api.Test; +import org.openqa.selenium.chrome.ChromeOptions; + +import org.zkoss.test.webdriver.WebDriverTestCase; +import org.zkoss.test.webdriver.ztl.JQuery; +import org.zkoss.test.webdriver.ztl.Widget; + +public class B65_ZK_1552Test extends WebDriverTestCase { + + @Override + protected ChromeOptions getWebDriverOptions() { + return super.getWebDriverOptions() + .setExperimentalOption("mobileEmulation", Collections.singletonMap("deviceName", "iPad")); + } + + @Test + public void test() { + connect(); + + JQuery center = jq(".z-center-body"); + String[] compList = new String[] {"combobox", "datebox", "bandbox"}; + for (String comp : compList) { + Widget wgt = jq(".z-" + comp).toWidget(); + click(wgt.$n("btn")); + waitResponse(); + center.scrollTop(center.scrollHeight()); + center.scrollTop(0); + assertFalse(jq(wgt.$n("pp")).isVisible(), "should not show the " + comp + " popup"); + } + } +} diff --git a/zktest/src/test/java/org/zkoss/zktest/zats/test2/B70_ZK_2331Test.java b/zktest/src/test/java/org/zkoss/zktest/zats/test2/B70_ZK_2331Test.java new file mode 100644 index 0000000000..eb18031788 --- /dev/null +++ b/zktest/src/test/java/org/zkoss/zktest/zats/test2/B70_ZK_2331Test.java @@ -0,0 +1,40 @@ +/* B70_ZK_2331Test.java + + Purpose: + + Description: + + History: + Thu Dec 05 12:16:26 CST 2024, Created by jamson + +Copyright (C) 2024 Potix Corporation. All Rights Reserved. +*/ +package org.zkoss.zktest.zats.test2; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.Collections; + +import org.junit.jupiter.api.Test; +import org.openqa.selenium.chrome.ChromeOptions; + +import org.zkoss.test.webdriver.WebDriverTestCase; +import org.zkoss.test.webdriver.ztl.JQuery; + +public class B70_ZK_2331Test extends WebDriverTestCase { + + @Override + protected ChromeOptions getWebDriverOptions() { + return super.getWebDriverOptions() + .setExperimentalOption("mobileEmulation", Collections.singletonMap("deviceName", "iPad")); + } + + @Test + public void test() { + connect(); + click(jq(".z-combobox-button")); + waitResponse(); + JQuery popup = jq(".z-combobox-popup"); + assertTrue(popup.offsetTop() + popup.height() < jq("@combobox").offsetTop(), "popup shouldn't overlap the input."); + } +} \ No newline at end of file diff --git a/zktest/src/test/java/org/zkoss/zktest/zats/test2/B90_ZK_4407Test.java b/zktest/src/test/java/org/zkoss/zktest/zats/test2/B90_ZK_4407Test.java new file mode 100644 index 0000000000..e7df9bf813 --- /dev/null +++ b/zktest/src/test/java/org/zkoss/zktest/zats/test2/B90_ZK_4407Test.java @@ -0,0 +1,52 @@ +/* B90_ZK_4407Test.java + + Purpose: + + Description: + + History: + Wed Dec 04 14:27:56 CST 2024, Created by jamson + +Copyright (C) 2024 Potix Corporation. All Rights Reserved. +*/ +package org.zkoss.zktest.zats.test2; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; + +import java.util.Collections; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; +import org.openqa.selenium.chrome.ChromeOptions; + +import org.zkoss.test.webdriver.ExternalZkXml; +import org.zkoss.test.webdriver.ForkJVMTestOnly; +import org.zkoss.test.webdriver.WebDriverTestCase; + +@ForkJVMTestOnly +public class B90_ZK_4407Test extends WebDriverTestCase { + + @RegisterExtension + public static final ExternalZkXml CONFIG = new ExternalZkXml("/test2/enable-tablet-ui-zk.xml"); + + @Override + protected ChromeOptions getWebDriverOptions() { + return super.getWebDriverOptions() + .setExperimentalOption("mobileEmulation", Collections.singletonMap("deviceName", "iPad")); + } + + @Test + public void test() { + connect(); + + eval("window.scroll(0, 0)"); + driver.navigate().refresh(); + waitResponse(); + assertNotEquals(0, jq("html").scrollTop()); + sleep(1000); + click(jq("@button")); + waitResponse(); + assertEquals("history.scrollRestoration: auto", getZKLog()); + } +} diff --git a/zktest/src/test/java/org/zkoss/zktest/zats/test2/F70_ZK_2410Test.java b/zktest/src/test/java/org/zkoss/zktest/zats/test2/F70_ZK_2410Test.java new file mode 100644 index 0000000000..149f0ef0d2 --- /dev/null +++ b/zktest/src/test/java/org/zkoss/zktest/zats/test2/F70_ZK_2410Test.java @@ -0,0 +1,34 @@ +/* F70_ZK_2410Test.java + + Purpose: + + Description: + + History: + Fri Nov 29 17:06:39 CST 2024, Created by jamson + +Copyright (C) 2024 Potix Corporation. All Rights Reserved. +*/ +package org.zkoss.zktest.zats.test2; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Test; +import org.openqa.selenium.Keys; + +import org.zkoss.test.webdriver.FirefoxWebDriverTestCase; +import org.zkoss.test.webdriver.ztl.JQuery; + +public class F70_ZK_2410Test extends FirefoxWebDriverTestCase { + + @Test + public void test() { + connect(); + JQuery input = jq(".z-paging-input"); + click(input); + waitResponse(); + sendKeys(jq("body"), Keys.TAB, Keys.ENTER); + waitResponse(); + assertEquals(jq(".z-paging-input").eval("val()"), "2"); + } +}