Skip to content

Commit 70e403c

Browse files
author
Wenjun Che
committed
ADAP-43: update JUnit example
1 parent 8f42a62 commit 70e403c

3 files changed

Lines changed: 16 additions & 4 deletions

File tree

1.76 KB
Binary file not shown.
1.07 KB
Binary file not shown.

src/main/java/com/openfin/desktop/demo/JUnitDemo.java

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,11 @@ public void onMessage(String message) {
8080
public void onOutgoingMessage(String message) {
8181
printf("openfin outgoing message: %s", message);
8282
}
83-
}, 60000);//this timeout (in 4.40.2.9) is ignored
83+
}, 60);//this timeout (in 4.40.2.9) is ignored
8484

8585
printf("waiting for desktop to connect");
86-
openFinConnectedLatch.await(20, TimeUnit.SECONDS);
86+
// wait for 60 seconds here in case it takes time to download newer version of Runtime
87+
openFinConnectedLatch.await(60, TimeUnit.SECONDS);
8788

8889
if (desktopConnection.isConnected()) {
8990
printf("desktop connected");
@@ -97,6 +98,17 @@ private static void teardownDesktopConnection() throws Exception {
9798
printf("desktop connection closed");
9899
}
99100

101+
private Application openHelloOpenFin(String uuid, String url) throws Exception {
102+
//default options for all test windows
103+
int top = 50;
104+
int left = 10;
105+
int width = 395;
106+
int height = 525;
107+
boolean withFrame = false;
108+
boolean resizable = false;
109+
return openWindow(uuid, url, left, top, width, height, withFrame, resizable);
110+
}
111+
100112
private Application openWindow(String uuid, String url) throws Exception {
101113
//default options for all test windows
102114
int top = 10;
@@ -430,7 +442,7 @@ public void onShow(Ack ack) {
430442

431443
@Test
432444
public void childWindow() throws Exception {
433-
Application application = openWindow(nextTestUuid(), "http://demoappdirectory.openf.in/desktop/config/apps/OpenFin/HelloOpenFin/index.html");
445+
Application application = openHelloOpenFin(nextTestUuid(), "http://demoappdirectory.openf.in/desktop/config/apps/OpenFin/HelloOpenFin/index.html");
434446
Window childWindow = this.createChildWindow(application, "ChildWindow1", "http://test.openf.in/bus/simple.html", 300, 300, 150, 150);
435447
Thread.sleep(SLEEP_FOR_HUMAN_OBSERVATION);
436448
WindowBounds bounds = getWindowBounds(childWindow);
@@ -442,7 +454,7 @@ public void childWindow() throws Exception {
442454
@Test
443455
public void windowsOfSameAppInSameGroupMoveTogether() throws Exception {
444456
//place two windows next to each other
445-
Application application = openWindow(nextTestUuid(), "http://demoappdirectory.openf.in/desktop/config/apps/OpenFin/HelloOpenFin/index.html");
457+
Application application = openHelloOpenFin(nextTestUuid(), "http://demoappdirectory.openf.in/desktop/config/apps/OpenFin/HelloOpenFin/index.html");
446458
Window childWindowA = this.createChildWindow(application, "ChildWindowA", "http://test.openf.in/bus/simple.html", 300, 300, 150, 150);
447459
Window childWindowB = this.createChildWindow(application, "ChildWindowB", "http://test.openf.in/bus/simple.html", 300, 300, 450, 150);
448460

0 commit comments

Comments
 (0)