Plugin tests are failing on Apple Silicon Follow
I recently moved a plugin project (https://github.com/mdklatt/idea-netcdf-plugin) to a new Apple Silicon MacBook running macOS 12.6 (Monterrey) with IntelliJ CE 2022.2.3. Unit tests that pass on Intel Macs and Ubuntu are now failing. The problem is just with tests. The Gradle assemble and rundIde tasks work, and I can run the plugin using binaries built on a different machine.
The failing tests appear to all be related to a problem loading the JNA library, which causes errors when trying to use UI widgets. I can see the JNA library (net.java.dev.jna:jna:5.4.0) in the Project Structure window. These tests also all use com.intellij.testFramework.fixtures.BasePlatformTestCase. The plugin is built with IC-2022.1 sources using IntelliJ Gradle Plugin 1.9.0. The Java JDK I'm using is openjdk64-11.0.16.1, installed via Homebrew.
Is there special configuration required to run platform tests with Apple Silicon?
java.lang.AssertionError: JNA library is not available at com.intellij.ui.mac.foundation.Foundation.<clinit>(Foundation.java:31) at com.intellij.ui.mac.foundation.Foundation$NSAutoreleasePool.<init>(Foundation.java:481) at com.intellij.ui.components.MacScrollBarUI.callMac(MacScrollBarUI.java:200) at com.intellij.ui.components.MacScrollBarUI$Native.<init>(MacScrollBarUI.java:300) at com.intellij.ui.components.MacScrollBarUI$Style$1.<init>(MacScrollBarUI.java:251) at com.intellij.ui.components.MacScrollBarUI$Style.<clinit>(MacScrollBarUI.java:251) at com.intellij.ui.components.MacScrollBarUI.installUI(MacScrollBarUI.java:103) at java.desktop/javax.swing.JComponent.setUI(JComponent.java:685) at java.desktop/javax.swing.JScrollBar.setUI(JScrollBar.java:210) at com.intellij.ui.components.JBScrollBar.updateUI(JBScrollBar.java:87) at java.desktop/javax.swing.JScrollBar.<init>(JScrollBar.java:165) at com.intellij.ui.components.JBScrollBar.<init>(JBScrollBar.java:67) at com.intellij.ui.components.JBScrollBar.<init>(JBScrollBar.java:63) at com.intellij.ui.components.JBScrollPane.createVerticalScrollBar(JBScrollPane.java:279) at java.desktop/javax.swing.JScrollPane.<init>(JScrollPane.java:300) at com.intellij.ui.components.JBScrollPane.<init>(JBScrollPane.java:95) at com.intellij.openapi.ui.DialogWrapper$ErrorText.<init>(DialogWrapper.java:2042) at com.intellij.openapi.ui.DialogWrapper.init(DialogWrapper.java:1259) at dev.mdklatt.idea.netcdf.SaveFileDialog.<init>(FileDialog.kt:19) at dev.mdklatt.idea.netcdf.SaveFileDialog.<init>(FileDialog.kt:13) at dev.mdklatt.idea.netcdf.SaveFileDialogTest.setUp(FileDialogTest.kt:30) at com.intellij.testFramework.UsefulTestCase.invokeSetUp(UsefulTestCase.java:476) at com.intellij.testFramework.UsefulTestCase.defaultRunBare(UsefulTestCase.java:468) at com.intellij.testFramework.UsefulTestCase.lambda$runBare$12(UsefulTestCase.java:541) at com.intellij.testFramework.EdtTestUtil.lambda$runInEdtAndWait$1(EdtTestUtil.java:40) at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:303) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:393) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Please sign in to leave a comment.
I don't understand what exactly is going to happen with SaveFileDialog instance in this test, but you cannot test UI stuff from IDE platform in regular UsefulTestCase. See https://plugins.jetbrains.com/docs/intellij/testing-plugins.html#ui-tests if you want to build "real" UI tests.