8381443: SystemMenuBarHelpMenuTest fails on macOS#2147
8381443: SystemMenuBarHelpMenuTest fails on macOS#2147dmarkov20 wants to merge 2 commits intoopenjdk:masterfrom
Conversation
|
👋 Welcome back dmarkov! A progress list of the required criteria for merging this PR into |
|
@dmarkov20 This change is no longer ready for integration - check the PR body for details. |
|
/reviewers 2 |
|
@andy-goryachev-oracle |
|
sorry, it's a test fix. one reviewer is enough |
|
@andy-goryachev-oracle |
andy-goryachev-oracle
left a comment
There was a problem hiding this comment.
tested on macOS 26.3.1 with two monitors.
| robot.mouseMove(MENU_BAR_X, MENU_ABOUT_Y); | ||
| robot.mouseClick(MouseButton.PRIMARY); | ||
| robot.keyType(KeyCode.DOWN); | ||
| robot.keyType(KeyCode.ENTER); |
There was a problem hiding this comment.
This is reasonable.
I suppose the only scenario when the system menu is not focused is when the test must fail, which is exactly what we need.
|
There was a reason for the mouse approach: the Spotlight search menu is not a node, it is a pure decoration that macOS adds to the Help menu. By adding a key event, we are always sure that the first JavaFX menuItem is going to be selected (key events won't be affected by decorations, whether they are there or not), and the test will never fail. However, the initial intention of this test was precisely to assert that there was a spotlight search decoration added precisely to the "Help" menu. I agree that using a hardcoded Y offset was probably a bad idea (as it didn't take into account multiple resolutions). Could we find a better way? |
|
/reviewers 2 |
|
@andy-goryachev-oracle |
|
I wonder if taking the screen size into account would help? Either way, the test is likely to be fragile unless we can find a reliable way to calculate the Y value of the About menu. |
|
maybe we can populate the menu with █ symbols and then detect these blocks in screen capture... |
|
It looks like there is no reliable way to calculate the Y position of the About menu item. I would therefore suggest keeping the proposed change since it improves the stability of the test even though it does not cover one of the original scenarios the test was meant to verify. We could cover the Spotlight case in the macOS system menu with a separate manual test instead. |
|
Technically, we could use an osascript like in the manual test MacOSSystemenuTestBase (see So this test should probably be indeed moved to a manual test, with the sole purpose of visually confirming that the Spotlight is added under a "Help" menu, and optionally, use the osascript to verify it. Keeping it as a system test with the changes from this PR will always pass, so I don't see that much value for the test. |
Well, the test file contains two tests that verify different aspects of the system menu bar behavior on macOS. Overall it still looks useful and I would prefer to keep it with the proposed changes unless there are objections. As for verifying that the Spotlight field is added under the "Help" menu, I will file a new bug to introduce a separate manual test for that purpose. |
The root cause of the test failure is that the robot does not successfully click on the "About" menu item. The test relies on hardcoded cursor coordinates and the Y coordinate value (80) is insufficient on some macOS systems with higher resolutions.
Replace the mouse click on the "About" menu item with keyboard interactions. This removes the dependency on hardcoded cursor positions and makes the test more robust across systems with different resolutions and font sizes.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/2147/head:pull/2147$ git checkout pull/2147Update a local copy of the PR:
$ git checkout pull/2147$ git pull https://git.openjdk.org/jfx.git pull/2147/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 2147View PR using the GUI difftool:
$ git pr show -t 2147Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/2147.diff
Using Webrev
Link to Webrev Comment