10
10
******************************************************************************/
11
11
package com .redhat .devtools .intellij .commonuitest ;
12
12
13
- import com .intellij .openapi .util .SystemInfo ;
14
13
import com .intellij .remoterobot .RemoteRobot ;
15
14
import com .intellij .remoterobot .stepsProcessing .StepLogger ;
16
15
import com .intellij .remoterobot .stepsProcessing .StepWorker ;
@@ -48,6 +47,7 @@ public class UITestRunner {
48
47
private static final String ACCEPTED_SOURCE_LOCATION = "accepted" ;
49
48
private static final String COPY_ACCEPTED_FILE_STEP_DESCRIPTION = "Copy the 'accepted' file to the appropriate location" ;
50
49
private static final Logger LOGGER = Logger .getLogger (UITestRunner .class .getName ());
50
+ private static final String OS_NAME = System .getProperty ("os.name" ).toLowerCase ();
51
51
private static final String USER_HOME = System .getProperty ("user.home" );
52
52
private static final String NEW_ITEM_PROPERTY = "New-ItemProperty" ;
53
53
private static final String NAME_PARAM = "-Name" ;
@@ -69,15 +69,15 @@ public static RemoteRobot runIde(IntelliJVersion ideaVersionUnderTest, int port)
69
69
StepWorker .registerProcessor (new StepLogger ());
70
70
ideaVersion = ideaVersionUnderTest ;
71
71
if (ideaVersionUnderTest .equals (IntelliJVersion .UNSUPPORTED )) {
72
- LOGGER .severe ("Cannot run Idea. Version is unsupported" );
72
+ LOGGER .severe ("Cannot run Idea, version is unsupported. Please check supported versions in the documentation. " );
73
73
return null ;
74
74
}
75
75
76
76
return step ("Start IntelliJ Idea ('" + ideaVersion + "') listening on port " + port , () -> {
77
77
78
78
acceptAllTermsAndConditions ();
79
79
80
- String fileExtension = SystemInfo . isWindows ? ".bat" : "" ;
80
+ String fileExtension = OS_NAME . contains ( "windows" ) ? ".bat" : "" ;
81
81
String platformVersion = generatePlatformVersion ();
82
82
83
83
ProcessBuilder pb = new ProcessBuilder ("." + File .separator + "gradlew" + fileExtension , "runIdeForUiTests" , "-PideaVersion=" + platformVersion , "-Drobot-server.port=" + port );
@@ -162,7 +162,7 @@ private static void acceptAllTermsAndConditions() {
162
162
linuxPrefsXmlSourceLocation = "prefs_xml/2022_1/prefs.xml" ;
163
163
}
164
164
165
- if (SystemInfo . isLinux ) {
165
+ if (OS_NAME . contains ( "linux" ) ) {
166
166
step ("Copy the 'prefs.xml' file to the appropriate location" , () -> {
167
167
String prefsXmlDir = USER_HOME + "/.java/.userPrefs/jetbrains/_!(!!cg\" p!(}!}@\" j!(k!|w\" w!'8!b!\" p!':!e@==" ;
168
168
createDirectoryHierarchy (prefsXmlDir );
@@ -174,7 +174,7 @@ private static void acceptAllTermsAndConditions() {
174
174
createDirectoryHierarchy (acceptedDir );
175
175
copyFileFromJarResourceDir (ACCEPTED_SOURCE_LOCATION , acceptedDir + "/accepted" );
176
176
});
177
- } else if (SystemInfo . isMac ) {
177
+ } else if (OS_NAME . contains ( "os x" ) ) {
178
178
step ("Copy the 'com.apple.java.util.prefs.plist' file to the appropriate location" , () -> {
179
179
String plistDir = USER_HOME + "/Library/Preferences" ;
180
180
copyFileFromJarResourceDir (osxPlistSourceLocation , plistDir + "/com.apple.java.util.prefs.plist" );
@@ -195,7 +195,7 @@ private static void acceptAllTermsAndConditions() {
195
195
Thread .currentThread ().interrupt ();
196
196
}
197
197
});
198
- } else if (SystemInfo . isWindows ) {
198
+ } else if (OS_NAME . contains ( "windows" ) ) {
199
199
step (COPY_ACCEPTED_FILE_STEP_DESCRIPTION , () -> {
200
200
String acceptedDir = USER_HOME + "\\ AppData\\ Roaming\\ JetBrains\\ consentOptions" ;
201
201
createDirectoryHierarchy (acceptedDir );
0 commit comments