-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to find component using matcher | Fail on Ubuntu #254
Comments
I am having similar issues on Linux! On both matching standard components (e. g. JButton) and private component (e. g. extending JPanel) I am encountering flickering tests, meaning sometimes the error occurs and sometimes it doesn't. I am still investigating, but I would also be interested what others have to say. |
Hi @JKollien, in the initial state of my unit testing i have the same issue on macos, i solved it using this.setVisible(true) On my class that extends jframe, but seems "not working" on ubuntu. |
Hi @JKollien, It`s My first Post. In my App src public class WFrame extends JFrame {
protected JLabel label = null;
protected JButton btn = null;
protected JPanel panel = new JPanel();
public WFrame(String title) {
this.setTitle(title);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setSize(300,400);
this.setPane(getContentPane());
this.setVisible(true);
}
private void setPane(Container c) {
c.add(panel.add(getLabel()),BorderLayout.NORTH);
c.add(panel.add(getButton()),BorderLayout.CENTER);
}
protected JLabel getLabel() {
if(this.label == null) {
this.label = new JLabel("Test");
this.label.setText("Test");
}
return this.label
} my suite tests package test;
import org.fest.swing.edt.FailOnThreadViolationRepaintManager;
import org.fest.swing.edt.GuiActionRunner;
import org.fest.swing.edt.GuiQuery;
import org.fest.swing.fixture.FrameFixture;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
public class WFrameTest {
private FrameFixture mockWindow;
@BeforeClass
public static void beforeClass() {
FailOnThreadViolationRepaintManager.install();
}
@Before
public void before() {
WFrame frame = GuiActionRunner.execute(new GuiQuery<WFrame>() {
@Override
protected WFrame executeInEDT() throws Throwable {
return new WFrame("test app");
}
});
mockWindow = new FrameFixture(frame);
mockWindow.show();
}
@After
public void after() {
mockWindow.cleanUp();
}
// healthy
@Test
public void LabelBindDataCheckWithNoTarget() {
mockWindow.label().text().equals("Test");
}
// UnHealthy
@Test
public void LabelBindDataCheckWithTarget() {
mockWindow.label("Test").text().equals("Test");
}
} Is that any Plan ? |
Hi, i have to test my java swing ui with assertj swing, on my mac i have no error but on latest and previous ubuntu version, i have this issue Unable to find component using matcher (the stacktrace is at the end of this post)
Running on Java 8 or 11 same issue, assertj swing version 3.17.0
I have to set timeout before testing ui?
Here a snippet code of my tests
The text was updated successfully, but these errors were encountered: