|
10 | 10 | ******************************************************************************/ |
11 | 11 | package com.redhat.devtools.intellij.commonuitest.fixtures.test.dialogs.project_manipulation; |
12 | 12 |
|
13 | | -import com.intellij.remoterobot.fixtures.ComboBoxFixture; |
14 | | -import com.intellij.remoterobot.fixtures.ComponentFixture; |
15 | | -import com.intellij.remoterobot.fixtures.ContainerFixture; |
16 | | -import com.intellij.remoterobot.fixtures.JLabelFixture; |
17 | | -import com.intellij.remoterobot.fixtures.JListFixture; |
| 13 | +import com.intellij.remoterobot.fixtures.*; |
18 | 14 | import com.intellij.remoterobot.utils.WaitForConditionTimeoutException; |
19 | 15 | import com.redhat.devtools.intellij.commonuitest.LibraryTestBase; |
20 | 16 | import com.redhat.devtools.intellij.commonuitest.UITestRunner; |
|
28 | 24 | import com.redhat.devtools.intellij.commonuitest.fixtures.dialogs.project.pages.NewProjectFirstPage; |
29 | 25 | import com.redhat.devtools.intellij.commonuitest.fixtures.mainidewindow.MainIdeWindow; |
30 | 26 | import com.redhat.devtools.intellij.commonuitest.fixtures.mainidewindow.idestatusbar.IdeStatusBar; |
| 27 | +import com.redhat.devtools.intellij.commonuitest.utils.constants.ButtonLabels; |
31 | 28 | import com.redhat.devtools.intellij.commonuitest.utils.constants.XPathDefinitions; |
32 | 29 | import com.redhat.devtools.intellij.commonuitest.utils.project.CreateCloseUtils; |
| 30 | +import com.redhat.devtools.intellij.commonuitest.utils.screenshot.ScreenshotUtils; |
33 | 31 | import org.junit.jupiter.api.AfterEach; |
34 | 32 | import org.junit.jupiter.api.BeforeEach; |
35 | 33 | import org.junit.jupiter.api.Test; |
@@ -333,13 +331,23 @@ public void cancelButtonTest() { |
333 | 331 |
|
334 | 332 | @Test |
335 | 333 | public void setProjectSdkIfAvailableTest() { |
336 | | - newProjectFirstPage.setProjectSdkIfAvailable("11"); |
337 | | - ComboBoxFixture projectJdkComboBox = newProjectFirstPage.getProjectJdkComboBox(); |
338 | | - String currentlySelectedProjectSdk = listOfRemoteTextToString(projectJdkComboBox.findAllText()); |
339 | | - assertTrue(currentlySelectedProjectSdk.contains("11"), "Selected project SDK should be Java 11 but is '" + currentlySelectedProjectSdk + "'"); |
340 | | - newProjectFirstPage.setProjectSdkIfAvailable("17"); |
341 | | - currentlySelectedProjectSdk = listOfRemoteTextToString(projectJdkComboBox.findAllText()); |
342 | | - assertTrue(currentlySelectedProjectSdk.contains("17"), "Selected project SDK should be Java 17 but is '" + currentlySelectedProjectSdk + "'"); |
| 334 | + if (ideaVersionInt >= 20242 && remoteRobot.isWin()) { |
| 335 | + newProjectFirstPage.setProjectSdkIfAvailable("Download JDK"); |
| 336 | + try { |
| 337 | + ContainerFixture downloadJdkDialog = remoteRobot.find(ContainerFixture.class, byXpath("//div[@title='Download JDK']"), Duration.ofSeconds(10)); |
| 338 | + downloadJdkDialog.find(ActionButtonFixture.class, byXpath(XPathDefinitions.label(ButtonLabels.CANCEL_LABEL)), Duration.ofSeconds(5)).click(); |
| 339 | + } catch (WaitForConditionTimeoutException e) { |
| 340 | + fail("Download JDK button was not pressed and Download JDK dialog was not found"); |
| 341 | + } |
| 342 | + } else { |
| 343 | + newProjectFirstPage.setProjectSdkIfAvailable("11"); |
| 344 | + ComboBoxFixture projectJdkComboBox = newProjectFirstPage.getProjectJdkComboBox(); |
| 345 | + String currentlySelectedProjectSdk = listOfRemoteTextToString(projectJdkComboBox.findAllText()); |
| 346 | + assertTrue(currentlySelectedProjectSdk.contains("11"), "Selected project SDK should be Java 11 but is '" + currentlySelectedProjectSdk + "'"); |
| 347 | + newProjectFirstPage.setProjectSdkIfAvailable("17"); |
| 348 | + currentlySelectedProjectSdk = listOfRemoteTextToString(projectJdkComboBox.findAllText()); |
| 349 | + assertTrue(currentlySelectedProjectSdk.contains("17"), "Selected project SDK should be Java 17 but is '" + currentlySelectedProjectSdk + "'"); |
| 350 | + } |
343 | 351 | } |
344 | 352 |
|
345 | 353 | @Test |
|
0 commit comments