Skip to content

Commit f97a253

Browse files
authored
fix(UITest): fix for unstable tests & minor improvements
fix(UITest): fix for unstable tests & minor improvements
2 parents 9808e78 + c340e7a commit f97a253

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/FlatWelcomeFrame.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ private void removeTopProjectFromRecentProjects() {
265265
"robot.click(component, new Point(horizontal_offset, 22), MouseButton.LEFT_BUTTON, 1);");
266266

267267
if (ideaVersion >= 20231) {
268-
ComponentFixture removeDialog = remoteRobot.find(ComponentFixture.class, byXpath(XPathDefinitions.MY_DIALOG), Duration.ofSeconds(2));
268+
ComponentFixture removeDialog = remoteRobot.find(ComponentFixture.class, byXpath(XPathDefinitions.MY_DIALOG), Duration.ofSeconds(10));
269269
removeDialog.findText(ButtonLabels.REMOVE_FROM_LIST_LABEL)
270270
.click();
271271
} else if (ideaVersion >= 20203) { // Code for IntelliJ Idea 2020.3 or newer

src/test-project/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,15 @@ test {
3737

3838
tasks.register('integrationUITestUltimate', Test) {
3939
dependsOn copyKey
40+
group = 'verification'
4041
systemProperties['task.name'] = 'integrationUITestUltimate'
4142
systemProperties['intellij_debug'] = 'true'
4243
useJUnitPlatform()
4344
}
4445

4546
tasks.register('integrationUITest', Test) {
4647
systemProperties['intellij_debug'] = 'true'
48+
group = 'verification'
4749
useJUnitPlatform()
4850
}
4951

src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/mainidewindow/toolwindowspane/ProjectExplorerTest.java

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,26 +72,26 @@ public void hideAllPopups() {
7272

7373
@Test
7474
public void isItemPresentTest() {
75-
boolean isItemPresent = projectExplorer.isItemPresent(PROJECT_NAME, PROJECT_NAME + ".iml");
76-
assertTrue(isItemPresent, "The file '" + PROJECT_NAME + ".iml' should be present in the project on location '" + PROJECT_NAME + "/" + PROJECT_NAME + ".iml' but is not.");
75+
boolean isItemPresent = projectExplorer.isItemPresent(PROJECT_NAME, "src", "Main");
76+
assertTrue(isItemPresent, "The file 'Main' should be present in the project on location 'src/Main' but is not.");
7777
}
7878

7979
@Test
8080
public void openFileTest() {
81-
projectExplorer.openFile(PROJECT_NAME, PROJECT_NAME + ".iml");
81+
projectExplorer.openFile(PROJECT_NAME, ".gitignore");
8282
if (ideaVersionInt >= 20231) { // Code for IJ 2023.1+
83-
String projectLabelXpath = "//div[@accessiblename='" + PROJECT_NAME + ".iml' and @class='EditorTabLabel']//div[@class='ActionPanel']";
83+
String projectLabelXpath = "//div[@accessiblename='.gitignore' and @class='EditorTabLabel']//div[@class='ActionPanel']";
8484
try { // Verify file is opened by finding its tab in the editor
8585
remoteRobot.find(ComponentFixture.class, byXpath(projectLabelXpath));
8686
} catch (Exception e) {
87-
fail("The '" + PROJECT_NAME + ".iml' file should be opened but is not.");
87+
fail("The '.gitignore' file should be opened but is not.");
8888
}
8989
} else {
9090
List<ContainerFixture> cfs = remoteRobot.findAll(ContainerFixture.class, byXpath(XPathDefinitions.SINGLE_HEIGHT_LABEL));
9191
ContainerFixture cf = cfs.get(cfs.size() - 1);
9292
String allText = TextUtils.listOfRemoteTextToString(cf.findAllText());
93-
boolean isFileOpened = allText.contains(PROJECT_NAME + ".iml");
94-
assertTrue(isFileOpened, "The '" + PROJECT_NAME + ".iml' file should be opened but is not.");
93+
boolean isFileOpened = allText.contains(".gitignore");
94+
assertTrue(isFileOpened, "The '.gitignore' file should be opened but is not.");
9595
}
9696
}
9797

@@ -117,12 +117,16 @@ public void openViewsPopupTest() {
117117

118118
@Test
119119
public void selectOpenedFileTest() {
120-
projectExplorer.openFile(PROJECT_NAME, PROJECT_NAME + ".iml");
120+
projectExplorer.expandAll();
121+
projectExplorer.openFile(PROJECT_NAME, "src", "Main");
121122
projectExplorer.projectViewTree().clickRow(0);
122-
SharedSteps.waitForComponentByXpath(remoteRobot,3,1, byXpath(XPathDefinitions.MY_ICON_LOCATE_SVG));
123+
SharedSteps.waitForComponentByXpath(remoteRobot, 3, 1, byXpath(XPathDefinitions.MY_ICON_LOCATE_SVG));
123124
projectExplorer.selectOpenedFile();
124-
SharedSteps.waitForComponentByXpath(remoteRobot,3,1, byXpath(XPathDefinitions.MY_ICON_LOCATE_SVG));
125-
assertTrue(projectExplorer.projectViewTree().isPathSelected(projectExplorer.projectViewTree().getValueAtRow(0), PROJECT_NAME + ".iml"), "The file '" + PROJECT_NAME + ".xml' should be selected but is not.");
125+
SharedSteps.waitForComponentByXpath(remoteRobot, 3, 1, byXpath(XPathDefinitions.MY_ICON_LOCATE_SVG));
126+
assertTrue(projectExplorer.projectViewTree().isPathSelected(
127+
projectExplorer.projectViewTree().getValueAtRow(0), "src", "Main"),
128+
"The file 'Main' should be selected but is not."
129+
);
126130
}
127131

128132
@Test

0 commit comments

Comments
 (0)