Skip to content

Commit dc3d07e

Browse files
committed
feat: scroll to top of project type list if item is missing
Signed-off-by: Martin Szuc <[email protected]>
1 parent 7ff78ac commit dc3d07e

File tree

2 files changed

+13
-8
lines changed
  • src

2 files changed

+13
-8
lines changed

src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/project/pages/NewProjectFirstPage.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.intellij.remoterobot.fixtures.JPopupMenuFixture;
2323
import com.intellij.remoterobot.fixtures.JTextFieldFixture;
2424
import com.intellij.remoterobot.fixtures.dataExtractor.RemoteText;
25+
import com.intellij.remoterobot.utils.Keyboard;
2526
import com.intellij.remoterobot.utils.WaitForConditionTimeoutException;
2627
import com.redhat.devtools.intellij.commonuitest.UITestRunner;
2728
import com.redhat.devtools.intellij.commonuitest.utils.constants.XPathDefinitions;
@@ -34,6 +35,7 @@
3435
import static com.intellij.remoterobot.search.locators.Locators.byXpath;
3536
import static com.intellij.remoterobot.stepsProcessing.StepWorkerKt.step;
3637
import static com.intellij.remoterobot.utils.RepeatUtilsKt.waitFor;
38+
import static java.awt.event.KeyEvent.VK_HOME;
3739

3840
/**
3941
* New Project dialog first page fixture
@@ -59,7 +61,17 @@ public NewProjectFirstPage(@NotNull RemoteRobot remoteRobot, @NotNull RemoteComp
5961
* @param projectType name of the project type to which will be changed the current settings
6062
*/
6163
public void selectNewProjectType(String projectType) {
62-
jLists(JListFixture.Companion.byType()).get(0).findText(projectType).click();
64+
step("Select the '" + projectType + "' as new project type", () -> {
65+
JListFixture jListFixture = jLists(JListFixture.Companion.byType()).get(0);
66+
try{
67+
jListFixture.findText(projectType).click();
68+
} catch (WaitForConditionTimeoutException e) {
69+
Keyboard keyboard = new Keyboard(remoteRobot);
70+
jListFixture.click();
71+
keyboard.hotKey(VK_HOME);
72+
jListFixture.findText(projectType).click();
73+
}
74+
});
6375
}
6476

6577
/**

src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/dialogs/project_manipulation/NewProjectDialogTest.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -397,13 +397,6 @@ public void createEmptyProjectTest() {
397397

398398
mainIdeWindow.closeProject();
399399
mainIdeWindow = null;
400-
401-
// IntelliJ remembers the last chosen project language, for continuity with other tests select Java project
402-
FlatWelcomeFrame flatWelcomeFrame = remoteRobot.find(FlatWelcomeFrame.class, Duration.ofSeconds(10));
403-
flatWelcomeFrame.clearWorkspace();
404-
flatWelcomeFrame.createNewProject();
405-
selectJavaNewProjectType();
406-
remoteRobot.find(NewProjectDialogWizard.class).cancel();
407400
}
408401

409402
private void navigateToSetProjectNamePage(CreateCloseUtils.NewProjectType newProjectType) {

0 commit comments

Comments
 (0)