|
31 | 31 | import javafxlibrary.keywords.AdditionalKeywords.RunOnFailure;
|
32 | 32 | import javafxlibrary.utils.HelperFunctions;
|
33 | 33 | import javafxlibrary.utils.RobotLog;
|
| 34 | +import javafxlibrary.utils.TestFxAdapter; |
34 | 35 | import javafxlibrary.utils.TestListener;
|
35 | 36 | import org.apache.commons.io.FileUtils;
|
36 | 37 | import org.python.google.common.base.Throwables;
|
@@ -58,12 +59,24 @@ public class JavaFXLibrary extends AnnotationLibrary {
|
58 | 59 | }};
|
59 | 60 |
|
60 | 61 | public JavaFXLibrary() {
|
| 62 | + this(false); |
| 63 | + } |
| 64 | + |
| 65 | + public JavaFXLibrary(boolean headless) { |
61 | 66 | super(includePatterns);
|
62 | 67 | deleteScreenshotsFrom("report-images/imagecomparison");
|
63 |
| - //v4.0.15-alpha sets default robot as glass, which breaks rolling |
64 |
| - //Forcing usage of awt robot as previous versions |
65 |
| - System.setProperty("testfx.robot", "awt"); |
66 |
| - } |
| 68 | + if (headless) { |
| 69 | + System.setProperty("testfx.robot", "glass"); |
| 70 | + System.setProperty("testfx.headless", "true"); |
| 71 | + System.setProperty("prism.order", "sw"); |
| 72 | + System.setProperty("prism.text", "t2k"); |
| 73 | + TestFxAdapter.isHeadless = true; |
| 74 | + } else { |
| 75 | + //v4.0.15-alpha sets default robot as glass, which breaks rolling |
| 76 | + //Forcing usage of awt robot as previous versions |
| 77 | + System.setProperty("testfx.robot", "awt"); |
| 78 | + } |
| 79 | + } |
67 | 80 |
|
68 | 81 | @Autowired
|
69 | 82 | protected RunOnFailure runOnFailure;
|
@@ -136,8 +149,21 @@ public String getKeywordDocumentation(String keywordName) {
|
136 | 149 | e.printStackTrace();
|
137 | 150 | return "IOException occured while reading the documentation file!";
|
138 | 151 | }
|
| 152 | + } else if (keywordName.equals("__init__")) { |
| 153 | + try { |
| 154 | + return FileUtils.readFileToString(new File("./src/main/java/libdoc-init-documentation.txt"), "utf-8"); |
| 155 | + } catch (IOException e) { |
| 156 | + e.printStackTrace(); |
| 157 | + return "IOException occured while reading the init documentation file!"; |
| 158 | + } |
| 159 | + } else { |
| 160 | + try { |
| 161 | + return super.getKeywordDocumentation(keywordName); |
| 162 | + } |
| 163 | + catch (Exception e) { |
| 164 | + return keywordName; |
| 165 | + } |
139 | 166 | }
|
140 |
| - return super.getKeywordDocumentation(keywordName); |
141 | 167 | }
|
142 | 168 |
|
143 | 169 | /**
|
|
0 commit comments