-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ZK-5546: Websocket endpoint doesn't trigger timeout-uri redirect afte…
…r desktop timeout
- Loading branch information
1 parent
83fc72b
commit aa99a6d
Showing
5 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<zk> | ||
<listener> | ||
<listener-class>org.zkoss.zkmax.au.websocket.WebSocketWebAppInit</listener-class> | ||
</listener> | ||
|
||
<session-config> | ||
<max-desktops-per-session>1</max-desktops-per-session> | ||
<automatic-timeout/> | ||
<timeout-uri>/timeout.zul</timeout-uri> | ||
</session-config> | ||
</zk> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!-- | ||
B101-ZK-5546.zul | ||
Purpose: | ||
Description: | ||
History: | ||
2024/10/7, Created by jumperchen | ||
Copyright (C) 2024 Potix Corporation. All Rights Reserved. | ||
--> | ||
<zk> | ||
<label multiline="true"><![CDATA[ | ||
1. Add the following configuration to zk.xml | ||
<listener> | ||
<listener-class&amp;gt;org.zkoss.zkmax.au.websocket.WebSocketWebAppInit</listener-class&amp;gt; | ||
</listener> | ||
<session-config> | ||
<max-desktops-per-session>1</max-desktops-per-session> | ||
<automatic-timeout/> | ||
<timeout-uri>/timeout.zul</timeout-uri> | ||
</session-config> | ||
2. Open a browser tab to visit this page. | ||
3. Open another browser tab to visit this page. | ||
4. Make an action in the first tab (click a button, etc) with an event listener | ||
]]></label> | ||
<button label="Click me to test" onClick='Clients.log("Test")'/> | ||
</zk> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
zktest/src/test/java/org/zkoss/zktest/zats/test2/B101_ZK_5546Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* B101_ZK_5546Test.java | ||
Purpose: | ||
Description: | ||
History: | ||
2:15 PM 2024/10/7, Created by jumperchen | ||
Copyright (C) 2024 Potix Corporation. All Rights Reserved. | ||
*/ | ||
package org.zkoss.zktest.zats.test2; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.endsWith; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
import org.openqa.selenium.WindowType; | ||
|
||
import org.zkoss.test.webdriver.ExternalZkXml; | ||
import org.zkoss.test.webdriver.ForkJVMTestOnly; | ||
import org.zkoss.test.webdriver.WebDriverTestCase; | ||
|
||
/** | ||
* @author jumperchen | ||
*/ | ||
@ForkJVMTestOnly | ||
public class B101_ZK_5546Test extends WebDriverTestCase { | ||
@RegisterExtension | ||
public static final ExternalZkXml CONFIG = new ExternalZkXml(B101_ZK_5546Test.class); | ||
|
||
@Test | ||
public void test() { | ||
connect(); | ||
waitResponse(); | ||
driver.switchTo().newWindow(WindowType.TAB); | ||
driver.get(getAddress() + "/test2/B101-ZK-5546.zul"); | ||
Object[] windowHandles = driver.getWindowHandles().toArray(); | ||
driver.switchTo().window((String) windowHandles[0]); | ||
click(jq("@button")); | ||
waitResponse(); | ||
assertThat(driver.getCurrentUrl(), endsWith("timeout.zul")); | ||
} | ||
} |