Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2023, 2024 IBM Corporation.
* Copyright (c) 2023, 2025 IBM Corporation.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand All @@ -18,6 +18,8 @@
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.Duration;
import java.util.HashSet;
import java.util.Set;

import static com.intellij.remoterobot.utils.RepeatUtilsKt.waitForIgnoringError;

Expand Down Expand Up @@ -230,11 +232,11 @@ public void testMicroProfileConfigHover() {
"considered required, however implementations may have other ways to define these URLs/URIs.Type: " +
"java.lang.StringValue: http://localhost:9081/data/client/service";

//mover cursor to hover point
// Move cursor to hover point
UIBotTestUtils.hoverInAppServerCfgFile(remoteRobot, testHoverTarget, "microprofile-config.properties", UIBotTestUtils.PopupType.DOCUMENTATION);
String hoverFoundOutcome = UIBotTestUtils.getHoverStringData(remoteRobot, UIBotTestUtils.PopupType.DOCUMENTATION);

// if the LS has not yet poulated the popup, re-get the popup data
// if the LS has not yet populated the popup, re-get the popup data
for (int i = 0; i<=5; i++){
if (hoverFoundOutcome.contains("Fetching Documentation...")) {
hoverFoundOutcome = UIBotTestUtils.getHoverStringData(remoteRobot, UIBotTestUtils.PopupType.DOCUMENTATION);
Expand All @@ -244,8 +246,38 @@ public void testMicroProfileConfigHover() {
}
}

// Validate that the hover action raised the expected hint text
TestUtils.validateHoverData(hoverExpectedOutcome, hoverFoundOutcome);
// Navigate through documentation pages
Set<String> visitedPages = new HashSet<>();
boolean encounteredBlankPage = false;
boolean expectedTextFound = false;

// Start iterating through the pages
while (visitedPages.add(hoverFoundOutcome)) {

// Check if this page is blank
if (hoverFoundOutcome.trim().isEmpty()) {
encounteredBlankPage = true;
}

// Check if the expected text is found
if (hoverFoundOutcome.contains(hoverExpectedOutcome)) {
expectedTextFound = true;
}

// Move to the next page
UIBotTestUtils.clickOnForwardButton(remoteRobot);
hoverFoundOutcome = UIBotTestUtils.getHoverStringData(remoteRobot, UIBotTestUtils.PopupType.DOCUMENTATION);
}

// If Expected text is not found throw error.
if (!expectedTextFound) {
throw new AssertionError("Error: Expected hover text not found on any documentation page.");
}

// If any blank page was encountered, throw an error
if (encounteredBlankPage) {
throw new AssertionError("Error: Encountered a blank hover documentation page during navigation.");
}
}

/**
Expand Down
18 changes: 18 additions & 0 deletions src/test/java/io/openliberty/tools/intellij/it/UIBotTestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -2975,4 +2975,22 @@ public static void clickOnLoad(RemoteRobot remoteRobot) {

TestUtils.sleepAndIgnoreException(5);
}

/**
* Clicks on the Forward arrow button in the UI if it is available.
*
* @param remoteRobot Instance of the RemoteRobot to interact with the IntelliJ UI.
*/
public static void clickOnForwardButton(RemoteRobot remoteRobot) {
ProjectFrameFixture projectFrame = remoteRobot.find(ProjectFrameFixture.class, Duration.ofSeconds(10));

try {
String xPath = "//div[@accessiblename='Forward' and @class='ActionButton']";
ComponentFixture forwardButton = projectFrame.getActionButton(xPath, "10");
forwardButton.click();

} catch (WaitForConditionTimeoutException e) {
// Forward button not found, nothing to do
}
}
}
Loading