assertj / assertj-swing

Fluent assertions for Swing apps
Other
108 stars 52 forks source link

Jbutton click is not working #244

Closed JavoEsteban closed 4 years ago

JavoEsteban commented 4 years ago

I'm doing functional testing in an application wich after login open a new window, but when i click de "ok" button, the login close the window without executing the next step (open the new window)

I think that there is something wrong with the launcher, because if i click the "ok" button manually the login window close without doing anything, if i click ok button without setting and user and password in the text fields, the login window should display and error like "user and password required", but the login close without display the error neither.

`public class LoginAssertJTest extends AssertJSwingJUnitTestCase { protected void onSetUp() {

    try {

application("package wit the main class").start(); FrameFixture frame = findFrame("frame0").using(robot()); JButtonMatcher buttonMatcherOK = JButtonMatcher.any().andText("OK").andShowing(); JButtonFixture okBtn = frame.button(buttonMatcherOK); okBtn.click();

} catch (Exception e) { System.out.println(e); }

}`

I don't know if the problem is the way i'm starting the app or the way i'm clicking the Jbutton

Yamuna-Rani commented 4 years ago

Hi JavoEsteban,

I need to create java swing application automation testing using assertj. I dont have more idea about assertj.

application("package wit the main class").start();

In this code, what I need to pass instead of package wit the main class?

Can you please help the same.

Thanks, Yamuna

JavoEsteban commented 4 years ago

Hi Yamuna-Rani, the line application("package wit the main class").start(); indicates the launcher application class, i mean the class that run the main window. you have to pass this class in thath line.

Literally there is a lot of information about how to use assertJ, you can look at this link https://joel-costigliola.github.io/assertj/assertj-swing-launch.html

croesch commented 4 years ago

@JavoEsteban thanks for answering the comment ;-)

Is your question still relevant? Sorry for not answering it for years .. I think it depends a lot on your application and the test, so for analyzing I would need a lot more information - like code snippets of the test (good) and either code snippets of the application under test or screenshots or mockups of the expected vs actual behaviour.

I'm closing because I assume that after all this time this has become irrelevant!? Reopen if not :-)