1 | package com.framsticks.gui; |
---|
2 | |
---|
3 | import javax.swing.JFrame; |
---|
4 | |
---|
5 | import org.apache.logging.log4j.Logger; |
---|
6 | import org.apache.logging.log4j.LogManager; |
---|
7 | import org.fest.swing.edt.GuiQuery; |
---|
8 | import org.fest.swing.fixture.FrameFixture; |
---|
9 | import org.fest.swing.fixture.JTreeFixture; |
---|
10 | import org.testng.annotations.Test; |
---|
11 | |
---|
12 | |
---|
13 | import org.fest.swing.edt.GuiActionRunner; |
---|
14 | |
---|
15 | import com.framsticks.util.dispatching.Dispatching; |
---|
16 | import com.framsticks.util.dispatching.Joinable; |
---|
17 | |
---|
18 | @Test |
---|
19 | public abstract class BrowserBaseTest extends GuiTest { |
---|
20 | |
---|
21 | private static final Logger log = LogManager.getLogger(BrowserTest.class); |
---|
22 | |
---|
23 | protected Browser browser; |
---|
24 | protected FrameFixture frame; |
---|
25 | protected JTreeFixture tree; |
---|
26 | |
---|
27 | @Override |
---|
28 | protected Joinable createSubject() { |
---|
29 | configureBrowser(); |
---|
30 | // browser.getMainFrame().getStatusBar().setExceptionHandler(failOnException); |
---|
31 | return browser; |
---|
32 | } |
---|
33 | |
---|
34 | protected void setUpAfterUse() { |
---|
35 | frame = new FrameFixture(robot, |
---|
36 | GuiActionRunner.execute(new GuiQuery<JFrame>() { |
---|
37 | @Override |
---|
38 | protected JFrame executeInEDT() throws Throwable { |
---|
39 | return browser.getMainFrame().getSwing(); |
---|
40 | } |
---|
41 | })); |
---|
42 | |
---|
43 | tree = frame.tree("tree"); |
---|
44 | |
---|
45 | log.debug("frame fixture done"); |
---|
46 | } |
---|
47 | |
---|
48 | |
---|
49 | protected abstract void configureBrowser(); |
---|
50 | |
---|
51 | protected void clickAndExpandPath(String path) { |
---|
52 | tree.clickPath(path); |
---|
53 | Dispatching.sleep(2.0); |
---|
54 | tree.expandPath(path); |
---|
55 | Dispatching.sleep(2.0); |
---|
56 | robot.waitForIdle(); |
---|
57 | } |
---|
58 | |
---|
59 | |
---|
60 | } |
---|