Skip to content

Test fixes - #242

Closed
johnmay wants to merge 6 commits into
masterfrom
test-fixes-2
Closed

johnmay wants to merge 6 commits into
masterfrom
test-fixes-2

Conversation

@johnmay

@johnmay johnmay commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

This cleans up the test suite significantly to run more consistently and faster.

  • Make it so tests work on FlatLAF
  • Reorganise tests into fewer classes reusing the same frame/panel more - this required some tweaks as the tests have side effects but nothing too major.

@github-actions

Copy link
Copy Markdown
TestsPassed ✅SkippedFailed
JUnit Test Report88 ran88 passed0 skipped0 failed

@johnmay
johnmay requested a review from egonw October 12, 2026 17:06
@egonw egonw self-assigned this Oct 12, 2026
@egonw

egonw commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

I gets stuck on drawing a reaction:

image

It gets to this but then hangs...

update: @johnmay, I tried to fix it, but do not know how. The following did not work:

iff --git a/core/src/test/java/org/openscience/jchempaint/DrawingTest.java b/core/src/test/java/org/openscience/jchempaint/DrawingTest.java
index 8ca42a8e..0a9acac4 100644
--- a/core/src/test/java/org/openscience/jchempaint/DrawingTest.java
+++ b/core/src/test/java/org/openscience/jchempaint/DrawingTest.java
@@ -428,7 +428,7 @@ public class DrawingTest extends AbstractUITest {
 
                // we do target.doClick on the parent menu as otherwise FlatLAF gets stuck
                frame.menuItem("reaction").target.doClick();
-               frame.menuItem("addProductToExistingReaction").click();
+               frame.menuItem("addProductToExistingReaction").target.doClick();
 
                Assert.assertEquals(1, panel.getChemModel().getReactionSet().getReactionCount());
                Assert.assertEquals(1, panel.getChemModel().getReactionSet().getReaction(0).getReactantCount());

@johnmay

johnmay commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

I think this is just the nature of UI tests and slightly different interactions.
Note the tests are run as part of the build now and all passing there.

@johnmay

johnmay commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

Maybe try...

frame.menuItem("reaction").component().setVisible(true);
frame.menuItem("addProductToExistingReaction").click();

@johnmay

johnmay commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

The issue is the way submenu's work, they are not visible until mouse overed

@johnmay

johnmay commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor Author

Sorry... this.

frame.menuItem("reaction").component().menuSelectionChanged(true);
frame.menuItem("addProductToExistingReaction").target.doClick();

I am probably going to remove that functionality anyways. As soon as you have multiple arrows it's a bit wonky

@egonw

egonw commented Oct 17, 2026

Copy link
Copy Markdown
Member

frame.menuItem("reaction").component().menuSelectionChanged(true);
frame.menuItem("addProductToExistingReaction").target.doClick();

That solved it.

@egonw egonw closed this Oct 17, 2026
@johnmay

johnmay commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

Why did you close without merging? What is needed?

@johnmay johnmay reopened this Oct 17, 2026
@egonw

egonw commented Oct 17, 2026

Copy link
Copy Markdown
Member

Merged.

@egonw egonw closed this Oct 17, 2026
@johnmay
johnmay deleted the test-fixes-2 branch October 17, 2026 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants