1 | package com.framsticks.gui; |
---|
2 | |
---|
3 | import static org.fest.assertions.Assertions.assertThat; |
---|
4 | import static org.fest.swing.edt.GuiActionRunner.execute; |
---|
5 | |
---|
6 | import java.awt.event.KeyEvent; |
---|
7 | |
---|
8 | |
---|
9 | import org.apache.logging.log4j.Logger; |
---|
10 | import org.apache.logging.log4j.LogManager; |
---|
11 | import org.fest.swing.edt.GuiTask; |
---|
12 | import org.testng.annotations.Test; |
---|
13 | |
---|
14 | import com.framsticks.model.ModelPackage; |
---|
15 | import com.framsticks.remote.RemoteTree; |
---|
16 | import com.framsticks.util.dispatching.Dispatching; |
---|
17 | |
---|
18 | public class BrowserTest extends BrowserBaseTest { |
---|
19 | |
---|
20 | private static final Logger log = LogManager.getLogger(BrowserTest.class); |
---|
21 | |
---|
22 | RemoteTree localhost; |
---|
23 | |
---|
24 | @Override |
---|
25 | protected void configureBrowser() { |
---|
26 | browser = new Browser(); |
---|
27 | |
---|
28 | localhost = new RemoteTree(); |
---|
29 | localhost.setName("localhost"); |
---|
30 | localhost.setAddress("localhost:9009"); |
---|
31 | localhost.usePackage(new ModelPackage()); |
---|
32 | |
---|
33 | browser.addTree(localhost); |
---|
34 | |
---|
35 | } |
---|
36 | |
---|
37 | @Test(timeOut = 60000) |
---|
38 | public void testShow() { |
---|
39 | Dispatching.synchronize(localhost, 1.0); |
---|
40 | Dispatching.sleep(2.0); |
---|
41 | log.info("testing"); |
---|
42 | clickAndExpandPath("localhost"); |
---|
43 | // tree.clickRow(0).expandRow(0); |
---|
44 | // robot.waitForIdle(); |
---|
45 | |
---|
46 | clickAndExpandPath("localhost/simulator"); |
---|
47 | // tree.clickRow(1).expandRow(1); |
---|
48 | // robot.waitForIdle(); |
---|
49 | assertThat(tree.valueAt(1)).isEqualTo("simulator"); |
---|
50 | robot.waitForIdle(); |
---|
51 | execute(new GuiTask() { |
---|
52 | @Override |
---|
53 | protected void executeInEDT() throws Throwable { |
---|
54 | assertThat(frame.panel("Simulator").component().isVisible()).isTrue(); |
---|
55 | } |
---|
56 | }); |
---|
57 | |
---|
58 | |
---|
59 | clickAndExpandPath("localhost/simulator/genepools"); |
---|
60 | clickAndExpandPath("localhost/simulator/genepools/groups"); |
---|
61 | clickAndExpandPath("localhost/simulator/genepools/groups/Genotypes"); |
---|
62 | clickAndExpandPath("localhost/simulator/genepools/groups/Genotypes/genotypes"); |
---|
63 | // Dispatching.sleep(2.0); |
---|
64 | // clickAndExpandPath("localhost/simulator/genepools/groups/Genotypes/genotypes"); |
---|
65 | robot.pressAndReleaseKey(KeyEvent.VK_J); |
---|
66 | waitForIdle(); |
---|
67 | Dispatching.sleep(2.0); |
---|
68 | |
---|
69 | frame.panel("Genotype").panel("name").textBox("value").enterText("-Żółw"); |
---|
70 | clickButton(frame.panel("Genotype").button("apply")); |
---|
71 | |
---|
72 | Dispatching.sleep(1.0); |
---|
73 | } |
---|
74 | |
---|
75 | |
---|
76 | |
---|
77 | } |
---|