Skip to content
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

The Remote-Robot framework does not support native parts of the IntelliJ Idea #17

Open
zcervink opened this issue Jan 12, 2021 · 21 comments
Assignees

Comments

@zcervink
Copy link

  • some part of the IntelliJ Idea are on some platforms native and not accessible using the RR framework
  • see the top menu on OX X:

img

@nizienko
Copy link
Collaborator

Hello, thanks for the issue. We are working on separate library with basic fixtures and I believe we going to publish it soon. We expecting it will contains methods to work with native menu via osascript which we use in our internal test project

@nizienko
Copy link
Collaborator

Hello,
could you please try JMenuBarFixture which uses osascript to work with native mac menu

@zcervink
Copy link
Author

@nizienko I tried to use that fixture, but I am not able to create instance on OS X (probably I need to use another approach because of the native parts on OS X). When I use:

JMenuBarFixture jMenuBarFixture = remoteRobot.find(JMenuBarFixture.class, Duration.ofSeconds(10));

I get an error:

default locator is not defined for class com.intellij.remoterobot.fixtures.JMenuBarFixture

@mkfl3x
Copy link

mkfl3x commented Aug 31, 2021

@zcervink could you try following code, please:
remoteRobot.find(JMenuBarFixture.class, JMenuBarFixture.Companion.byType(), Duration.ofSeconds(10));

@zcervink
Copy link
Author

@mkfl3x I have tried it several times on OS X 11.5.2. When I run it from IntelliJ, it always uses the menu of IntelliJ I use to develop my tests, not the menu of IntelliJ that starts and is used to run the UI tests (I have focus on the IntelliJ that is used to run the UI tests, that does not help). When I run it from terminal, it fails (WaitForConditionTimeoutException), probably it is looking for the menu of IntelliJ, that is now closed.

After several unsuccessful attempts I have also tried the following code, it gave me the same results:

Locator locator = Locators.INSTANCE.byType(JMenuBar.class);
JMenuBarFixture menu = remoteRobot.find(JMenuBarFixture.class, locator);

@zcervink
Copy link
Author

@mkfl3x I have an important update. I have tried the JPopupMenuFixture (not native parts of IntelliJ on OS X) and it works without any issue. I have open context menu and after that the following code navigates and clicks as expected. Well, the JMenuBarFixture does not address the right process/IntelliJ instance.

JPopupMenuFixture menu = remoteRobot.find(JPopupMenuFixture.class, JPopupMenuFixture.Companion.byType(), Duration.ofSeconds(10));
menu.select("New", "File");

@zcervink
Copy link
Author

zcervink commented Sep 1, 2021

@mkfl3x @nizienko I have discussed this issue with my team - this issue is caused probably by wrong name of the IntelliJ used to run the UI tests (the name is generated in the JMenuBarFixture class). In my case (and I think it will be in all cases), the IntelliJ is name 'Main'. I think it will be really easy to fix.

Snímek obrazovky 2021-09-01 v 20 12 19

@nizienko
Copy link
Collaborator

nizienko commented Sep 2, 2021

@zcervink Thanks for the investigation, seems that processName='Main' when we run idea with gradle. We will think how to handle this.

@bric3
Copy link

bric3 commented Oct 20, 2021

I am not sure if this exactly related. But when I try to simply get access to the menu bar (even if the right instance) the call gets timed out.

val barFixture = remoteRobot.find<JMenuBarFixture>(JMenuBarFixture.byType(), Duration.ofSeconds(10))
Exceeded timeout (PT10S) for condition function (Failed to find 'JMenuBarFixture' by 'by type javax.swing.JMenuBar' in 10s) 
com.intellij.remoterobot.utils.WaitForConditionTimeoutException: Exceeded timeout (PT10S) for condition function (Failed to find 'JMenuBarFixture' by 'by type javax.swing.JMenuBar' in 10s) 

Even if I enter an actual xpath.

Exceeded timeout (PT10S) for condition function (Failed to find 'JMenuBarFixture' by '//div[@javaclass="javax.swing.JMenuBar" or contains(@classhierarchy, "javax.swing.JMenuBar ") or contains(@classhierarchy, " javax.swing.JMenuBar ")]' in 10s) 
com.intellij.remoterobot.utils.WaitForConditionTimeoutException: Exceeded timeout (PT10S) for condition function (Failed to find 'JMenuBarFixture' by '//div[@javaclass="javax.swing.JMenuBar" or contains(@classhierarchy, "javax.swing.JMenuBar ") or contains(@classhierarchy, " javax.swing.JMenuBar ")]' in 10s) 

@nizienko
Copy link
Collaborator

@bric3 Could you please check the xpath in the browser? You can stop at the breakpoint on remoteRobot.find() line, open in browser http://127.0.0.1:8580 and check xpath in the developer's console:
image
there should be one node found

@bric3
Copy link

bric3 commented Oct 21, 2021

Sorry I forgot versions in my earlier comment 🤦

Targeted IntelliJ :

IntelliJ IDEA 2021.1.3 (Ultimate Edition)
Build #IU-211.7628.21, built on June 30, 2021
Licensed to <edited>
You have a perpetual fallback license for this version.
Subscription is active until September 7, 2022.
Runtime version: 11.0.11+9-b1341.60 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 11.5
GC: G1 Young Generation, G1 Old Generation
Memory: 512M
Cores: 8
Registry: ide.mac.message.dialogs.as.sheets=false
Non-Bundled Plugins: com.jetbrains.test.robot-server-plugin (0.11.7), com.datadog.intellij (0.2)
Kotlin: 211-1.4.32-release-IJ7628.19

Robot : 0.11.7

So, actually I don't even have the WelcomeFrameMenuBar as it's a native component
image.

The trick to make the menu appear in the frame is to disable native UI in the Look-and-Feel.

systemProperty("apple.laf.useScreenMenuBar", "false")

image
image

Although I don't know how to do the same trick with native File Chooser Dialog window, eg when opening a project it opens a native window, and the robot does not show it.

@nizienko
Copy link
Collaborator

@bric3 for File Chooser Dialog you can use ide.mac.file.chooser.native=false

@bric3
Copy link

bric3 commented Oct 21, 2021

Ah cool thanks

@gsaslis
Copy link

gsaslis commented Jul 19, 2022

Hello @bric3,

I am facing the same issue as I also can't make the native menu bar and sheets show up, despite having set:

        systemProperty("ide.mac.message.dialogs.as.sheets", "false")
        systemProperty("apple.laf.useScreenMenuBar", "false")

Would you happen to know if this is still the recommended way to go about this ?

@nizienko
Copy link
Collaborator

Do you mean you want to disable the Mac native menu and file chooser? Then these properties are correct. Check how we defined it in our test project

@gsaslis
Copy link

gsaslis commented Jul 19, 2022

Thank you @nizienko !

Yes, that is exactly how they have been defined in Our project as well, but the native menu still shows up

@nizienko
Copy link
Collaborator

@gsaslis Indeed, just checked that apple.laf.useScreenMenuBar flag doesn't work.
I've found another one jbScreenMenuBar.enabled=false, seems it is more reliable.
I'm going to fix this info in the docs, thanks for pointing at this.

@gsaslis
Copy link

gsaslis commented Jul 19, 2022

@nizienko I'm trying with both but neither seems to be having any effect...

could I please ask you to send me a screenshot of how it looks like on your machine when it is enabled?

@nizienko
Copy link
Collaborator

@gsaslis That's really strange. It seems we have to set both properties to false. I'm not sure that this is ok and asked about this in the corresponding issue

@gsaslis
Copy link

gsaslis commented Jul 20, 2022

thanks @nizienko - setting both (!) to false did the trick... apologies I should have spotted that myself earlier!

@bric3
Copy link

bric3 commented Jul 28, 2022

Ah thanks for the update, this seem to have changed indeed.
This question might surface again with the new UI ?

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

No branches or pull requests

6 participants