0

我正在尝试为 JavaFx 编写测试,这将适用于无头 CI。当我以正常方式运行测试时,所有测试都可以正常运行,但如果我在 CI 上运行它们,它们就不会。似乎 FxRobot 没有以正确的方式单击某些元素,因为我收到如下错误:

Expected: Buttton is disabled
     but: was <Button[id=restart, styleClass=button_restart]'RESTART'>

正如我所说,所有这些测试都在本地通过。我用命令运行测试:

mvn test -Dtestfx.robot=glass -Dtestfx.headless=true -Dglass.platform=Monocle -Dmonocle.platform=Headless -Dprism.order=sw -Dprism.text=t2k -Dprism.verbose=true 

我正在使用 Java 11、TestFx 4

4

1 回答 1

0

If you run CI on a linux headless server, you need to run it with the xvfb tool, which simulates a graphical interface.

For specific instructions on how to set it up, search the docs of your CI provider for "xvfb", or provide your specific CI tool (Travis-CI, Circle-CI, etc).

于 2019-11-25T10:05:30.630 回答