Skip to content

Commit 4df6303

Browse files
committed
chore: fix integration tests
Signed-off-by: Stephane Bouchet <[email protected]>
1 parent 8ef30bd commit 4df6303

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

.github/workflows/sonar.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ jobs:
3838
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
3939
run: |
4040
if [ '${{github.event.workflow_run.event}}' == 'pull_request' ]; then
41-
PR_NUMBER=$(<build/PR)
42-
BASE_REF=$(<build/base_ref)
43-
HEAD_REF=$(<build/head_ref)
41+
PR_NUMBER=$(<prInfo/PR)
42+
BASE_REF=$(<prInfo/base_ref)
43+
HEAD_REF=$(<prInfo/head_ref)
4444
./gradlew sonarqube -Dsonar.pullrequest.base=$BASE_REF -Dsonar.pullrequest.branch=$HEAD_REF -Dsonar.pullrequest.key=$PR_NUMBER -Dsonar.pullrequest.provider=GitHub -Dsonar.pullrequest.github.repository=${{github.repository}}
4545
else
4646
./gradlew sonarqube

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@
2929
import org.jetbrains.annotations.NotNull;
3030

3131
import java.time.Duration;
32+
import java.util.Arrays;
33+
import java.util.HashMap;
3234
import java.util.List;
33-
import java.util.Optional;
35+
import java.util.Map;
3436

3537
import static com.intellij.remoterobot.search.locators.Locators.byXpath;
3638
import static com.intellij.remoterobot.stepsProcessing.StepWorkerKt.step;
@@ -154,8 +156,15 @@ public void setProjectSdkIfAvailable(String targetSdkName) {
154156
CommonContainerFixture parentFixture = waitFor(Duration.ofSeconds(20), Duration.ofSeconds(2), "Wait for the 'Project SDK' list to finish loading all items.", "The project JDK list did not load all items in 20 seconds.", this::didProjectSdkListLoadAllItems);
155157
JPopupMenuFixture projectSdkList = parentFixture.jPopupMenus(byXpath(XPathDefinitions.HEAVY_WEIGHT_WINDOW)).get(0); // issue https://github.com/JetBrains/intellij-ui-test-robot/issues/104
156158
List<String> sdkItems = projectSdkList.jList().collectItems();
157-
Optional<String> item = sdkItems.stream().filter(s -> s.startsWith(targetSdkName)).findFirst();
158-
item.ifPresent(s -> projectSdkList.jList().clickItem(s, true));
159+
Map<String, String> foundItems = new HashMap<>();
160+
sdkItems.forEach(item ->
161+
Arrays.stream(item.split(" ")).filter(s ->
162+
s.startsWith(targetSdkName)).findFirst().ifPresent(s -> foundItems.put(s, item))
163+
);
164+
if (!foundItems.isEmpty()) {
165+
String label = foundItems.values().stream().findFirst().get();
166+
projectSdkList.jList().clickItem(label, true);
167+
}
159168
});
160169
}
161170

0 commit comments

Comments
 (0)