ianbrandt
05/25/2019, 11:06 PM@Start
method of my test, but I'm not sure what else needs to be done. Any help would be most appreciated.
https://github.com/ianbrandt/tornadofx-test/blob/master/src/test/kotlin/com/ianbrandt/test/MyViewTest.ktamanda.hinchman-dominguez
05/27/2019, 2:13 AMamanda.hinchman-dominguez
05/27/2019, 2:15 AM@Start
fun start(stage: Stage) {
interact {
stage.scene = Scene(MyView().root)
stage.show()
}
}
ianbrandt
05/27/2019, 3:29 AMApplicationTest
, so there is no interact()
in scope. I tried this, but no change...
@ExtendWith(ApplicationExtension::class)
class MyViewTest {
private lateinit var robot: FxRobotInterface
@Start
fun start(stage: Stage) {
robot.interact {
stage.scene = Scene(MyView().root)
stage.show()
}
}
...
I do think you're onto something regarding interaction, though. I'll keep experimenting.amanda.hinchman-dominguez
05/27/2019, 3:36 AMianbrandt
05/27/2019, 3:49 AMamanda.hinchman-dominguez
05/27/2019, 3:50 AMamanda.hinchman-dominguez
05/27/2019, 3:51 AMjava.lang.AssertionError: Expected: Labeled has text "Success"
but: was "Test"
Expected :Labeled has text "Success"
Actual :"Test"
amanda.hinchman-dominguez
05/27/2019, 3:51 AMamanda.hinchman-dominguez
05/27/2019, 3:51 AMamanda.hinchman-dominguez
05/27/2019, 3:51 AMamanda.hinchman-dominguez
05/27/2019, 3:52 AMianbrandt
05/27/2019, 5:21 AMianbrandt
05/27/2019, 3:16 PMamanda.hinchman-dominguez
05/27/2019, 3:24 PMianbrandt
05/29/2019, 3:23 AMoverride val root = vbox {
button(INITIAL_BUTTON_TEXT) {
id = BUTTON_ID
action {
text = CHANGED_BUTTON_TEXT
}
}
}
As I mentioned:
If I launch the app and click the button manually, I do get the expected result.So the code works fine run as an app, but not when invoked via the TestFX robot. The button text doesn't change. I set a breakpoint in the action lambda. It breaks when debugging the app, but not when debugging the test. Given that the example code on the TestFX page similarly fails, that leads me to conclude there is a bug in TestFX and not my code: https://github.com/TestFX/TestFX#junit-5-with-assertj-assertions In particular,
robot.clickOn(button)
does not result in the button action being invoked.amanda.hinchman-dominguez
05/29/2019, 3:52 AMianbrandt
05/29/2019, 3:55 AMianbrandt
05/29/2019, 3:57 AMamanda.hinchman-dominguez
05/29/2019, 4:13 AMianbrandt
05/29/2019, 4:15 AMamanda.hinchman-dominguez
05/29/2019, 4:17 AMactions
since that is a TornadoFX DSL?amanda.hinchman-dominguez
05/29/2019, 4:18 AMaction
?amanda.hinchman-dominguez
05/29/2019, 4:18 AMianbrandt
05/29/2019, 4:47 AMianbrandt
10/07/2019, 3:58 AM