se-edu / addressbook-level4

:ab::four: Address Book sample application (Level 4)
https://se-edu.github.io/addressbook-level4
MIT License
42 stars 1.72k forks source link

Pressing "Enter" is not happening in GUI tests #380

Open okkhoy opened 7 years ago

okkhoy commented 7 years ago

A few students have reported this issue. Description from one of the students this time:

The GUI tests run as usual, but when command text is auto-input in the text box, the automation doesn't press enter (even though the code is coded correctly to instruct so).
The GUI tests fail because the command is not executed because 'Enter' button is not pressed automatically. I tried to press enter manually during the tests and the tests were able to pass... I have already tried the fix announced on IVLE, but it didn't work.

Is this a known issue? What could fix the problem?

yamgent commented 7 years ago

I am unable to reproduce this problem. May I know which team is having this problem?

eugenepeh commented 7 years ago

Not sure if its the same problem face by the CS2103 students of this semester, but I have faced similar issue in the past during my CS2103.

The problem that I had back then, which I believe, was due to guiRobot.clickOn( ) -> FxRobot( ) function not clicking on the ui component that it was given, which leads to the commandbox not having the focus, hence the 'enter' command does not work. The problem seems to occur only on certain devices, as the testApp works perfectly on my team mate's laptop but does not work on mine.

The solution I relied on during that time was to run gradle test instead of testApp.

damithc commented 7 years ago

@okkhoy can you tag one or more of the affected students here so that we can rope them into the troubleshooting discussion? Or ask them to reply here.

okkhoy commented 7 years ago

@lproperty can you please carry forward the discussion

lproperty commented 7 years ago

The problem that I had back then, which I believe, was due to guiRobot.clickOn( ) -> FxRobot( ) function not clicking on the ui component that it was given, which leads to the commandbox not having the focus, hence the 'enter' command does not work. The problem seems to occur only on certain devices, as the testApp works perfectly on my team mate's laptop but does not work on mine.

I face this issue and I believe this is the correct explanation to the problem. I have tried to run the test cases using Gradle and the problem did not appear. Thank you!

yamgent commented 7 years ago

Ah OK, thanks for your inputs @eugenepeh and @lproperty!

May I also know whether both of you ran the GUI tests in headless mode to pass the tests?

eugenepeh commented 7 years ago

@yamgent

Ah yes, I ran the tests in headless mode in order to check my program and pass the test cases. Additionally, the problem only occurred to me after I modified the original addressbook GUI layout, shifting the command box from top to bottom etc.

lproperty commented 7 years ago

@yamgent same for me as well

yamgent commented 7 years ago

Thanks for confirming.

Actually, I have experienced a different issue before during my CS2103T time, whereby I cannot pass a HelpWindow GuiTest because TestFx wasn't able to press 'F1' on my laptop. However, my other teammates did not faced this problem.

I also solved the problem by running Gradle on headless mode.

The GuiTest architecture probably needs further examination to see whether we can solve the issue when it runs on vastly different testing environments.