@@ -61,12 +61,11 @@ public class FlatWelcomeFrame extends CommonContainerFixture {
6161 private static final String PROJECTS_BUTTON = "Projects" ;
6262 private static final String TIP_OF_THE_DAY = "Tip of the Day" ;
6363 private final RemoteRobot remoteRobot ;
64- private final int ideaVersion ;
64+ private final int ideaVersionInt = UITestRunner . getIdeaVersionInt () ;
6565
6666 public FlatWelcomeFrame (@ NotNull RemoteRobot remoteRobot , @ NotNull RemoteComponent remoteComponent ) {
6767 super (remoteRobot , remoteComponent );
6868 this .remoteRobot = remoteRobot ;
69- this .ideaVersion = UITestRunner .getIdeaVersion ().toInt ();
7069 }
7170
7271 /**
@@ -93,7 +92,7 @@ public void openProject(String projectName) {
9392 */
9493 public void clickOnLink (String label ) {
9594 // Code for IntelliJ IDEA 2020.3 or newer
96- if (ideaVersion >= 20203 ) {
95+ if (ideaVersionInt >= 20203 ) {
9796 welcomeFrameLink (label ).click ();
9897 }
9998 // Code for IntelliJ IDEA 2020.2 or earlier
@@ -150,11 +149,11 @@ public void clearExceptions() {
150149 * Open the 'Preferences' dialog
151150 */
152151 public void openSettingsDialog () {
153- if (ideaVersion <= 20202 ) {
152+ if (ideaVersionInt <= 20202 ) {
154153 clickOnLink ("Configure" );
155154 HeavyWeightWindowFixture heavyWeightWindowFixture = find (HeavyWeightWindowFixture .class , Duration .ofSeconds (5 ));
156155 heavyWeightWindowFixture .findText ("Preferences" ).click ();
157- } else if (ideaVersion <= 20212 ) {
156+ } else if (ideaVersionInt <= 20212 ) {
158157 JListFixture jListFixture = remoteRobot .find (JListFixture .class , byXpath (XPathDefinitions .JBLIST ));
159158 jListFixture .clickItem ("Customize" , false );
160159 remoteRobot .find (ContainerFixture .class , byXpath (XPathDefinitions .DIALOG_PANEL )).findText ("All settings" + '\u2026' ).click ();
@@ -205,20 +204,20 @@ private void resizeWelcomeWindow() {
205204 * @return fixture for the 'Tip Of the Day' dialog
206205 */
207206 public TipDialog openTipDialog () {
208- if (ideaVersion >= 20211 ) {
207+ if (ideaVersionInt >= 20211 ) {
209208 FlatWelcomeFrame flatWelcomeFrame = remoteRobot .find (FlatWelcomeFrame .class , Duration .ofSeconds (2 ));
210- if (ideaVersion >= 20223 ) { // COMMUNITY_V_2022_3 and higher version have different labels for Learn button
209+ if (ideaVersionInt >= 20223 ) { // COMMUNITY_V_2022_3 and higher version have different labels for Learn button
211210 flatWelcomeFrame .findText (ButtonLabels .LEARN_LABEL ).click ();
212211 } else {
213212 flatWelcomeFrame .findText (ButtonLabels .LEARN_INTELLIJ_IDEA_LABEL ).click ();
214213 }
215- SharedSteps .waitForComponentByXpath (remoteRobot , 2 , 1 , byXpath (XPathDefinitions .TIP_DIALOG_2 ));
214+ SharedSteps .waitForComponentByXpath (remoteRobot , 2 , 200 , byXpath (XPathDefinitions .TIP_DIALOG_2 ));
216215 flatWelcomeFrame .findText (TIP_OF_THE_DAY ).click ();
217- } else if (ideaVersion <= 20202 ) {
216+ } else if (ideaVersionInt <= 20202 ) {
218217 clickOnLink ("Get Help" );
219218 HeavyWeightWindowFixture heavyWeightWindowFixture = find (HeavyWeightWindowFixture .class , Duration .ofSeconds (5 ));
220219 heavyWeightWindowFixture .findText (TIP_OF_THE_DAY ).click ();
221- } else if (ideaVersion == 20203 ) { // IJ 2020.3
220+ } else if (ideaVersionInt == 20203 ) { // IJ 2020.3
222221 actionLink ("Help" ).click ();
223222 HeavyWeightWindowFixture heavyWeightWindowFixture = find (HeavyWeightWindowFixture .class , Duration .ofSeconds (5 ));
224223 heavyWeightWindowFixture .findText (TIP_OF_THE_DAY ).click ();
@@ -254,17 +253,17 @@ public void preventTipDialogFromOpening() {
254253 * Switch to the 'Projects' page of flat welcome frame
255254 */
256255 public void switchToProjectsPage () {
257- if (ideaVersion >= 20213 ) {
256+ if (ideaVersionInt >= 20213 ) {
258257 JTreeFixture jTreeFixture = remoteRobot .find (JTreeFixture .class , byXpath (XPathDefinitions .TREE ));
259258 jTreeFixture .findText (PROJECTS_BUTTON ).click ();
260- } else if (ideaVersion >= 20203 ) {
259+ } else if (ideaVersionInt >= 20203 ) {
261260 JListFixture jListFixture = remoteRobot .find (JListFixture .class , byXpath (XPathDefinitions .JBLIST ));
262261 jListFixture .clickItem (PROJECTS_BUTTON , false );
263262 }
264263 }
265264
266265 private int projectsCount () {
267- if (ideaVersion >= 20222 ) {
266+ if (ideaVersionInt >= 20222 ) {
268267 try {
269268 JTreeFixture projects = remoteRobot .findAll (JTreeFixture .class , byXpath (XPathDefinitions .RECENT_PROJECT_PANEL_NEW_2 )).get (0 );
270269 return projects .findAllText ().size () / 2 ;
@@ -287,7 +286,7 @@ private JButtonFixture welcomeFrameLink(String label) {
287286 if (UtilsKt .hasAnyComponent (this , byXpath (XPathDefinitions .RECENT_PROJECT_PANEL_NEW ))) {
288287 return button (byXpath (XPathDefinitions .jBOptionButton (label )), Duration .ofSeconds (2 ));
289288 }
290- if (ideaVersion >= 20241 && label .equals ("New Project" )) {
289+ if (ideaVersionInt >= 20241 && label .equals ("New Project" )) {
291290 return button (byXpath (XPathDefinitions .CREATE_NEW_PROJECT ), Duration .ofSeconds (2 ));
292291 }
293292 return button (byXpath (XPathDefinitions .nonOpaquePanel (label )), Duration .ofSeconds (2 ));
@@ -299,7 +298,7 @@ private ComponentFixture ideErrorsIcon() {
299298
300299 private void removeTopProjectFromRecentProjects () {
301300 ComponentFixture recentProjects ;
302- if (ideaVersion >= 20222 ) {
301+ if (ideaVersionInt >= 20222 ) {
303302 recentProjects = remoteRobot .findAll (JTreeFixture .class , byXpath (XPathDefinitions .RECENT_PROJECT_PANEL_NEW_2 )).get (0 );
304303 } else {
305304 recentProjects = jLists (byXpath (XPathDefinitions .RECENT_PROJECTS )).get (0 );
@@ -309,14 +308,14 @@ private void removeTopProjectFromRecentProjects() {
309308 recentProjects .runJs ("const horizontal_offset = component.getWidth()-22;\n " +
310309 "robot.click(component, new Point(horizontal_offset, 22), MouseButton.LEFT_BUTTON, 1);" );
311310
312- if (ideaVersion >= 20231 ) {
311+ if (ideaVersionInt >= 20231 ) {
313312 ComponentFixture removeDialog = remoteRobot .find (ComponentFixture .class , byXpath (XPathDefinitions .MY_DIALOG ), Duration .ofSeconds (10 ));
314313 removeDialog .findText (ButtonLabels .REMOVE_FROM_LIST_LABEL ).click ();
315- } else if (ideaVersion >= 20203 ) { // Code for IntelliJ Idea 2020.3 or newer
314+ } else if (ideaVersionInt >= 20203 ) { // Code for IntelliJ Idea 2020.3 or newer
316315 List <JPopupMenuFixture > jPopupMenuFixtures = jPopupMenus (JPopupMenuFixture .Companion .byType ());
317316 if (!jPopupMenuFixtures .isEmpty ()) {
318317 JPopupMenuFixture contextMenu = jPopupMenuFixtures .get (0 );
319- if (ideaVersion >= 20222 ) {
318+ if (ideaVersionInt >= 20222 ) {
320319 contextMenu .select ("Remove from Recent Projects" + '\u2026' );
321320 button (byXpath (XPathDefinitions .REMOVE_PROJECT_BUTTON )).click ();
322321 } else {
0 commit comments