Skip to content

bump minimal version to 2022.3 #356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up JDK 11 # Java 11 is only used for test NewProjectDialogTest/setProjectSdkIfAvailableTest
uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'temurin'
cache: 'gradle'
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
Expand Down Expand Up @@ -104,12 +98,6 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11 # Java 11 is only used for test NewProjectDialogTest/setProjectSdkIfAvailableTest
uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'temurin'
cache: 'gradle'
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
Expand Down Expand Up @@ -144,12 +132,6 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11 # Java 11 is only used for test NewProjectDialogTest/setProjectSdkIfAvailableTest
uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'temurin'
cache: 'gradle'
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
Expand Down
17 changes: 1 addition & 16 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Validate against IJ versions

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

Expand All @@ -13,29 +11,16 @@ jobs:
strategy:
matrix:
IJ:
- 2020.2
- 2020.3
- 2021.1
- 2021.2
- 2021.3
- 2022.1
- 2022.2
- 2022.3
- 2023.1
- 2023.2
- 2023.3
- 2024.1
- 2024.2
- 2024.3
# - 2024.3 is the current one

steps:
- uses: actions/checkout@v4
- name: Set up JDK 11 # Java 11 is only used for test NewProjectDialogTest/setProjectSdkIfAvailableTest
uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'temurin'
cache: 'gradle'
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ build/
target/
pom.xml

/src/test-project/.intellijPlatform/self-update.lock
/src/test-project/.intellijPlatform/
/.intellijPlatform/
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,11 @@ public static RemoteRobot runIde(IntelliJVersion ideaVersionUnderTest, int port)
StepWorker.registerProcessor(new StepLogger());
ideaVersion = ideaVersionUnderTest;
if (ideaVersionUnderTest.equals(IntelliJVersion.UNSUPPORTED)) {
LOGGER.severe("Cannot run Idea. Version is unsupported");
LOGGER.severe("Cannot run Idea, version is unsupported. Please check supported versions in the documentation.");
return null;
}

return step("Start IntelliJ Idea ('" + ideaVersion + "') listening on port " + port, () -> {
System.setProperty("uitestlib.idea.version", Integer.toString(ideaVersion.toInt()));

acceptAllTermsAndConditions();

Expand Down Expand Up @@ -116,22 +115,13 @@ public static void closeIde() {
ideProcess.destroy();
}

/**
* Return the IdeaVersion representation of the currently running IntelliJ Idea version
*
* @return version of the currently running IntelliJ Idea
*/
public static IntelliJVersion getIdeaVersion() {
return ideaVersion;
}

/**
* Return the integer representation of the currently running IntelliJ Idea version
*
* @return version of the currently running IntelliJ Idea
*/
public static int getIdeaVersionInt() {
return getIdeaVersion().toInt();
return ideaVersion.toInt();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
import com.intellij.remoterobot.fixtures.ContainerFixture;
import com.intellij.remoterobot.fixtures.DefaultXpath;
import com.intellij.remoterobot.fixtures.FixtureName;
import com.intellij.remoterobot.fixtures.HeavyWeightWindowFixture;
import com.intellij.remoterobot.fixtures.JButtonFixture;
import com.intellij.remoterobot.fixtures.JListFixture;
import com.intellij.remoterobot.fixtures.JPopupMenuFixture;
import com.intellij.remoterobot.fixtures.JTreeFixture;
import com.intellij.remoterobot.utils.UtilsKt;
Expand Down Expand Up @@ -91,14 +89,7 @@ public void openProject(String projectName) {
* @param label label of the link to click on
*/
public void clickOnLink(String label) {
// Code for IntelliJ IDEA 2020.3 or newer
if (ideaVersionInt >= 20203) {
welcomeFrameLink(label).click();
}
// Code for IntelliJ IDEA 2020.2 or earlier
else {
actionLink(label).click();
}
welcomeFrameLink(label).click();
}

/**
Expand Down Expand Up @@ -134,11 +125,11 @@ public void clearWorkspace() {
public void clearExceptions() {
try {
ideErrorsIcon().click();
find(IdeFatalErrorsDialog.class, Duration.ofSeconds(10)).clearAll();
find(IdeFatalErrorsDialog.class, Duration.ofSeconds(5)).clearAll();
} catch (WaitForConditionTimeoutException e) {
LOGGER.log(Level.INFO, "No fatal errors dialog found to clear.");
try {
find(IdeFatalErrorsDialog.class, Duration.ofSeconds(10)).clearAll();
find(IdeFatalErrorsDialog.class, Duration.ofSeconds(5)).clearAll();
} catch (Exception e2) {
LOGGER.log(Level.INFO, "Second attempt to clear fatal errors dialog also failed.");
}
Expand All @@ -149,22 +140,18 @@ public void clearExceptions() {
* Open the 'Preferences' dialog
*/
public void openSettingsDialog() {
if (ideaVersionInt <= 20202) {
clickOnLink("Configure");
HeavyWeightWindowFixture heavyWeightWindowFixture = find(HeavyWeightWindowFixture.class, Duration.ofSeconds(5));
heavyWeightWindowFixture.findText("Preferences").click();
} else if (ideaVersionInt <= 20212) {
JListFixture jListFixture = remoteRobot.find(JListFixture.class, byXpath(XPathDefinitions.JBLIST));
jListFixture.clickItem("Customize", false);
remoteRobot.find(ContainerFixture.class, byXpath(XPathDefinitions.DIALOG_PANEL)).findText("All settings" + '\u2026').click();
} else {
JTreeFixture jTreeFixture = remoteRobot.find(JTreeFixture.class, byXpath(XPathDefinitions.TREE));
jTreeFixture.findText("Customize").click();
if (remoteRobot.isMac()) {
resizeWelcomeWindow();
}
remoteRobot.find(ContainerFixture.class, byXpath(XPathDefinitions.DIALOG_PANEL)).findText("All settings" + '\u2026').click();
JTreeFixture jTreeFixture;
try {
jTreeFixture = remoteRobot.find(JTreeFixture.class, byXpath(XPathDefinitions.TREE));
} catch (WaitForConditionTimeoutException e) {
// workaround for 2022.3
jTreeFixture = remoteRobot.find(JTreeFixture.class, byXpath("//div[@accessiblename='Welcome screen categories']"));
}
jTreeFixture.findText("Customize").click();
if (remoteRobot.isMac()) {
resizeWelcomeWindow();
}
remoteRobot.find(ContainerFixture.class, byXpath(XPathDefinitions.DIALOG_PANEL)).findText("All settings" + '\u2026').click();
}

/**
Expand Down Expand Up @@ -204,25 +191,10 @@ private void resizeWelcomeWindow() {
* @return fixture for the 'Tip Of the Day' dialog
*/
public TipDialog openTipDialog() {
if (ideaVersionInt >= 20211) {
FlatWelcomeFrame flatWelcomeFrame = remoteRobot.find(FlatWelcomeFrame.class, Duration.ofSeconds(2));
if (ideaVersionInt >= 20223) { // COMMUNITY_V_2022_3 and higher version have different labels for Learn button
flatWelcomeFrame.findText(ButtonLabels.LEARN_LABEL).click();
} else {
flatWelcomeFrame.findText(ButtonLabels.LEARN_INTELLIJ_IDEA_LABEL).click();
}
SharedSteps.waitForComponentByXpath(remoteRobot, 2, 200, byXpath(XPathDefinitions.TIP_DIALOG_2));
flatWelcomeFrame.findText(TIP_OF_THE_DAY).click();
} else if (ideaVersionInt <= 20202) {
clickOnLink("Get Help");
HeavyWeightWindowFixture heavyWeightWindowFixture = find(HeavyWeightWindowFixture.class, Duration.ofSeconds(5));
heavyWeightWindowFixture.findText(TIP_OF_THE_DAY).click();
} else if (ideaVersionInt == 20203) { // IJ 2020.3
actionLink("Help").click();
HeavyWeightWindowFixture heavyWeightWindowFixture = find(HeavyWeightWindowFixture.class, Duration.ofSeconds(5));
heavyWeightWindowFixture.findText(TIP_OF_THE_DAY).click();
}

FlatWelcomeFrame flatWelcomeFrame = remoteRobot.find(FlatWelcomeFrame.class, Duration.ofSeconds(2));
flatWelcomeFrame.findText(ButtonLabels.LEARN_LABEL).click();
SharedSteps.waitForComponentByXpath(remoteRobot, 2, 200, byXpath(XPathDefinitions.TIP_DIALOG_2));
flatWelcomeFrame.findText(TIP_OF_THE_DAY).click();
return remoteRobot.find(TipDialog.class, Duration.ofSeconds(10));
}

Expand All @@ -239,45 +211,26 @@ public void disableNotifications() {
switchToProjectsPage();
}

/**
* Prevent the 'Tip of the Day' dialog from opening after project import
*/
public void preventTipDialogFromOpening() {
TipDialog tipDialog = openTipDialog();
tipDialog.dontShowTipsCheckBox().setValue(true);
tipDialog.close();
switchToProjectsPage();
}

/**
* Switch to the 'Projects' page of flat welcome frame
*/
public void switchToProjectsPage() {
if (ideaVersionInt >= 20213) {
JTreeFixture jTreeFixture = remoteRobot.find(JTreeFixture.class, byXpath(XPathDefinitions.TREE));
jTreeFixture.findText(PROJECTS_BUTTON).click();
} else if (ideaVersionInt >= 20203) {
JListFixture jListFixture = remoteRobot.find(JListFixture.class, byXpath(XPathDefinitions.JBLIST));
jListFixture.clickItem(PROJECTS_BUTTON, false);
JTreeFixture jTreeFixture;
try {
jTreeFixture = remoteRobot.find(JTreeFixture.class, byXpath(XPathDefinitions.TREE));
} catch (WaitForConditionTimeoutException e) {
// workaround for 2022.3
jTreeFixture = remoteRobot.find(JTreeFixture.class, byXpath("//div[@accessiblename='Welcome screen categories']"));
}
jTreeFixture.findText(PROJECTS_BUTTON).click();
}

private int projectsCount() {
if (ideaVersionInt >= 20222) {
try {
JTreeFixture projects = remoteRobot.findAll(JTreeFixture.class, byXpath(XPathDefinitions.RECENT_PROJECT_PANEL_NEW_2)).get(0);
return projects.findAllText().size() / 2;
} catch (IndexOutOfBoundsException e) {
return 0;
}
} else {
try {
ContainerFixture projectWrapper = find(ContainerFixture.class, byXpath(XPathDefinitions.RECENT_PROJECT_PANEL_NEW));
JListFixture projectList = projectWrapper.find(JListFixture.class, byXpath(XPathDefinitions.MY_LIST));
return projectList.collectItems().size();
} catch (WaitForConditionTimeoutException e) {
return 0;
}
try {
JTreeFixture projects = remoteRobot.findAll(JTreeFixture.class, byXpath(XPathDefinitions.RECENT_PROJECT_PANEL_NEW_2)).get(0);
return projects.findAllText().size() / 2;
} catch (IndexOutOfBoundsException e) {
return 0;
}
}

Expand All @@ -293,16 +246,11 @@ private JButtonFixture welcomeFrameLink(String label) {
}

private ComponentFixture ideErrorsIcon() {
return find(ComponentFixture.class, byXpath(XPathDefinitions.IDE_ERROR_ICON), Duration.ofSeconds(10));
return find(ComponentFixture.class, byXpath(XPathDefinitions.IDE_ERROR_ICON), Duration.ofSeconds(5));
}

private void removeTopProjectFromRecentProjects() {
ComponentFixture recentProjects;
if (ideaVersionInt >= 20222) {
recentProjects = remoteRobot.findAll(JTreeFixture.class, byXpath(XPathDefinitions.RECENT_PROJECT_PANEL_NEW_2)).get(0);
} else {
recentProjects = jLists(byXpath(XPathDefinitions.RECENT_PROJECTS)).get(0);
}
ComponentFixture recentProjects = remoteRobot.findAll(JTreeFixture.class, byXpath(XPathDefinitions.RECENT_PROJECT_PANEL_NEW_2)).get(0);

// Clicks on X on first recent project to remove it from the recent projects list (visible only when hovered over with cursor)
recentProjects.runJs("const horizontal_offset = component.getWidth()-22;\n" +
Expand All @@ -311,16 +259,12 @@ private void removeTopProjectFromRecentProjects() {
if (ideaVersionInt >= 20231) {
ComponentFixture removeDialog = remoteRobot.find(ComponentFixture.class, byXpath(XPathDefinitions.MY_DIALOG), Duration.ofSeconds(10));
removeDialog.findText(ButtonLabels.REMOVE_FROM_LIST_LABEL).click();
} else if (ideaVersionInt >= 20203) { // Code for IntelliJ Idea 2020.3 or newer
} else {
List<JPopupMenuFixture> jPopupMenuFixtures = jPopupMenus(JPopupMenuFixture.Companion.byType());
if (!jPopupMenuFixtures.isEmpty()) {
JPopupMenuFixture contextMenu = jPopupMenuFixtures.get(0);
if (ideaVersionInt >= 20222) {
contextMenu.select("Remove from Recent Projects" + '\u2026');
button(byXpath(XPathDefinitions.REMOVE_PROJECT_BUTTON)).click();
} else {
contextMenu.select("Remove from Recent Projects");
}
contextMenu.select("Remove from Recent Projects" + '\u2026');
button(byXpath(XPathDefinitions.REMOVE_PROJECT_BUTTON)).click();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ public CodeWithMeDialog(@NotNull RemoteRobot remoteRobot, @NotNull RemoteCompone
*/
public static void closeCodeWithMePopupIfItAppears(RemoteRobot remoteRobot) {
CodeWithMeDialog codeWithMeDialog;
int ideaVersionInt = UITestRunner.getIdeaVersionInt();
try {
if (ideaVersionInt <= 20231) {
if (UITestRunner.getIdeaVersionInt() <= 20231) {
codeWithMeDialog = remoteRobot.find(CodeWithMeDialog.class, byXpath("//div[@class='Wrapper']//div[@class='JPanel']"), Duration.ofSeconds(10));
} else {
codeWithMeDialog = remoteRobot.find(CodeWithMeDialog.class, Duration.ofSeconds(10));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import com.intellij.remoterobot.fixtures.FixtureName;
import com.intellij.remoterobot.fixtures.JButtonFixture;
import com.intellij.remoterobot.utils.WaitForConditionTimeoutException;
import com.redhat.devtools.intellij.commonuitest.UITestRunner;
import com.redhat.devtools.intellij.commonuitest.exceptions.UITestException;
import com.redhat.devtools.intellij.commonuitest.utils.constants.ButtonLabels;
import com.redhat.devtools.intellij.commonuitest.utils.constants.XPathDefinitions;
Expand All @@ -35,29 +34,11 @@ public NewProjectDialogWizard(@NotNull RemoteRobot remoteRobot, @NotNull RemoteC
super(remoteRobot, remoteComponent);
}

/**
* Move to the previous page of the 'New Project' dialog by clicking on the 'Previous' button
*/
public void previous() {
clickOnButton(ButtonLabels.PREVIOUS_LABEL);
}

/**
* Move to the next page of the 'New Project' dialog by clicking on the 'Next' button
*/
public void next() {
clickOnButton(ButtonLabels.NEXT_LABEL);
}

/**
* Finish the 'New Project' dialog
*/
public void finish() {
if (UITestRunner.getIdeaVersionInt() >= 20221) {
clickOnButton(ButtonLabels.CREATE_LABEL);
} else {
clickOnButton(ButtonLabels.FINISH_LABEL);
}
clickOnButton(ButtonLabels.CREATE_LABEL);
}

/**
Expand Down
Loading
Loading