Open LeStegii opened 8 months ago
When using a real headless enviroment everything seems to work fine. On Windows the node cannot be found and an error is thrown. On MAC, it doesn't throw an error but the node isn't clicked.
Please use this code for testing:
public class BadControllerTest extends ControllerTest {
@Test
void bad() {
try {
FxAssert.verifyThat("some button that does not exist", Node::isVisible, collectInfos());
} catch (Exception ex) {
printInfos();
}
}
public void printInfos() {
System.err.println(collectInfos().apply(new StringBuilder()));
}
public Function<StringBuilder, StringBuilder> collectInfos() {
final Path dir = Paths.get("build", "failed-test-screenshots");
try {
Files.createDirectories(dir);
} catch (IOException e) {
throw new RuntimeException(e);
}
return DebugUtils.compose(
DebugUtils.insertHeader("Context:"),
DebugUtils.showKeysPressedAtTestFailure(this),
DebugUtils.showMouseButtonsPressedAtTestFailure(this),
DebugUtils.showFiredEvents(),
DebugUtils.saveWindow(
stage,
() -> dir.resolve(getClass().getSimpleName() + " " + LocalTime.now() + ".png"),
null));
}
}
Describe the bug When testing the Ludo game in headless mode, the tests fail because the bot cannot click on nodes (not visible).
To Reproduce Steps to reproduce the behavior:
Expected behavior The tests shouldn't fail becaues the nodes are visible.
Desktop (please complete the following information):
Additional context The nodes exist and can be used (e.g. using tabs and enter), but they cannot be found when clicked as they are apparently not visible on screen (see #67)