Skip to content

Commit

Permalink
feat: scroll to top of project type list if item is missing
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Szuc <[email protected]>
  • Loading branch information
martinszuc committed Oct 7, 2024
1 parent 7ff78ac commit dc3d07e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.intellij.remoterobot.fixtures.JPopupMenuFixture;
import com.intellij.remoterobot.fixtures.JTextFieldFixture;
import com.intellij.remoterobot.fixtures.dataExtractor.RemoteText;
import com.intellij.remoterobot.utils.Keyboard;
import com.intellij.remoterobot.utils.WaitForConditionTimeoutException;
import com.redhat.devtools.intellij.commonuitest.UITestRunner;
import com.redhat.devtools.intellij.commonuitest.utils.constants.XPathDefinitions;
Expand All @@ -34,6 +35,7 @@
import static com.intellij.remoterobot.search.locators.Locators.byXpath;
import static com.intellij.remoterobot.stepsProcessing.StepWorkerKt.step;
import static com.intellij.remoterobot.utils.RepeatUtilsKt.waitFor;
import static java.awt.event.KeyEvent.VK_HOME;

/**
* New Project dialog first page fixture
Expand All @@ -59,7 +61,17 @@ public NewProjectFirstPage(@NotNull RemoteRobot remoteRobot, @NotNull RemoteComp
* @param projectType name of the project type to which will be changed the current settings
*/
public void selectNewProjectType(String projectType) {
jLists(JListFixture.Companion.byType()).get(0).findText(projectType).click();
step("Select the '" + projectType + "' as new project type", () -> {
JListFixture jListFixture = jLists(JListFixture.Companion.byType()).get(0);
try{
jListFixture.findText(projectType).click();
} catch (WaitForConditionTimeoutException e) {
Keyboard keyboard = new Keyboard(remoteRobot);
jListFixture.click();
keyboard.hotKey(VK_HOME);
jListFixture.findText(projectType).click();
}
});
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,13 +397,6 @@ public void createEmptyProjectTest() {

mainIdeWindow.closeProject();
mainIdeWindow = null;

// IntelliJ remembers the last chosen project language, for continuity with other tests select Java project
FlatWelcomeFrame flatWelcomeFrame = remoteRobot.find(FlatWelcomeFrame.class, Duration.ofSeconds(10));
flatWelcomeFrame.clearWorkspace();
flatWelcomeFrame.createNewProject();
selectJavaNewProjectType();
remoteRobot.find(NewProjectDialogWizard.class).cancel();
}

private void navigateToSetProjectNamePage(CreateCloseUtils.NewProjectType newProjectType) {
Expand Down

0 comments on commit dc3d07e

Please sign in to comment.