Skip to content

Commit 17bbd0e

Browse files
Test modified to capture LSP4MP quickfix intermittent failure logs as well
1 parent 7cd5384 commit 17bbd0e

File tree

3 files changed

+60
-7
lines changed

3 files changed

+60
-7
lines changed

.github/workflows/build.yaml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,19 @@ jobs:
9898
fail-fast: false
9999
matrix:
100100
runtime: [ linux, mac, windows ]
101-
test-group: [ Gradle-Jakarta-Language-Server ]
101+
test-group: [ Gradle-MP-Language-Server ]
102+
repeat: [ 1,2,3,4,5,6,7,8,9,10,
103+
11,12,13,14,15,16,17,18,19,20,
104+
21,22,23,24,25,26,27,28,29,30 ]
102105
include:
103106
- runtime: linux
104107
os: ubuntu-latest
105108
- runtime: mac
106109
os: macOS-14
107110
- runtime: windows
108111
os: windows-latest
109-
- test-group: Gradle-Jakarta-Language-Server
110-
test-class: io.openliberty.tools.intellij.it.GradleSingleModJakartaLSTest
112+
- test-group: Gradle-MP-Language-Server
113+
test-class: io.openliberty.tools.intellij.it.GradleSingleModMPLSTest
111114
env:
112115
USE_LOCAL_PLUGIN: ${{ inputs.useLocalPlugin || false }}
113116
REF_LSP4IJ: ${{ needs.fetch_merge_commit_sha_from_lsp4ij_PR.outputs.pr_details }}
@@ -168,9 +171,11 @@ jobs:
168171
working-directory: ./liberty-tools-intellij
169172
run: bash ./src/test/resources/ci/scripts/run.sh
170173
- name: 'Archive Test logs and reports'
171-
if: ${{ always() }}
174+
if: ${{ failure() && steps.run_tests.conclusion == 'failure' }}
172175
uses: actions/[email protected]
173176
with:
174-
name: ${{ matrix.runtime }}-${{ matrix.test-group }}-test-report-LTI-${{ env.REF_LTI_TAG || 'default' }}-LSP4IJ-${{ env.LSP4IJ_BRANCH || 'default' }}
175-
path: |
176-
liberty-tools-intellij/build/reports/
177+
name: ${{ matrix.runtime }}-${{ matrix.test-group }}-test-report-LTI-${{ env.REF_LTI_TAG || 'default' }}-LSP4IJ-${{ env.LSP4IJ_BRANCH || 'default' }}-${{ github.run_attempt }}
178+
path: liberty-tools-intellij/build/reports/
179+
if-no-files-found: warn
180+
compression-level: 6
181+
overwrite: true

src/test/java/io/openliberty/tools/intellij/it/SingleModMPLSTestCommon.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ public void testMPQuickFixInJavaFile() {
161161
String quickfixChooserString = "Insert " + livenessString;
162162
String mainQuickFixActionStr = "Generate OpenAPI Annotations for 'ServiceLiveHealthCheck'";
163163

164+
UIBotTestUtils.clickOnWindowPaneStripeButton(remoteRobot, "Language Servers");
165+
UIBotTestUtils.enableMPDebugTraceInLS(remoteRobot);
166+
164167
// get focus on file tab prior to copy
165168
UIBotTestUtils.clickOnFileTab(remoteRobot, "ServiceLiveHealthCheck.java");
166169

@@ -185,6 +188,7 @@ public void testMPQuickFixInJavaFile() {
185188
} finally {
186189
// Replace modified content with the original content
187190
UIBotTestUtils.pasteOnActiveWindow(remoteRobot);
191+
UIBotTestUtils.captureLSPConsoleLog(remoteRobot);
188192
}
189193
}
190194

@@ -296,6 +300,9 @@ public void testQuickFixInMicroProfileConfigProperties() {
296300

297301
Path pathToMpCfgProperties = Paths.get(projectsPath, projectName,"src", "main", "resources", "META-INF", "microprofile-config.properties");
298302

303+
UIBotTestUtils.clickOnWindowPaneStripeButton(remoteRobot, "Language Servers");
304+
UIBotTestUtils.enableMPDebugTraceInLS(remoteRobot);
305+
299306
// get focus on file tab prior to copy
300307
UIBotTestUtils.clickOnFileTab(remoteRobot, "microprofile-config.properties");
301308

@@ -314,6 +321,7 @@ public void testQuickFixInMicroProfileConfigProperties() {
314321
} finally {
315322
// Replace modified microprofile-config.properties with the original content
316323
UIBotTestUtils.pasteOnActiveWindow(remoteRobot, true);
324+
UIBotTestUtils.captureLSPConsoleLog(remoteRobot);
317325
}
318326

319327
}

src/test/java/io/openliberty/tools/intellij/it/UIBotTestUtils.java

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2985,6 +2985,46 @@ public static void enableDebugTraceInLS(RemoteRobot remoteRobot) {
29852985
}
29862986
}
29872987

2988+
/**
2989+
* Enable the trace level to verbose in LSP console
2990+
*
2991+
* @param remoteRobot Instance of the RemoteRobot to interact with the IntelliJ UI.
2992+
*/
2993+
public static void enableMPDebugTraceInLS(RemoteRobot remoteRobot) {
2994+
ComponentFixture node = remoteRobot.find(ComponentFixture.class, byXpath("//div[@class='LSPConsoleToolWindowPanel']"), Duration.ofSeconds(10));
2995+
2996+
List<RemoteText> rts = node.findAllText();
2997+
for (RemoteText rt : rts) {
2998+
if (rt.getText().contains("MicroProfile"))
2999+
rt.click();
3000+
}
3001+
3002+
ComponentFixture node1 = remoteRobot.find(ComponentFixture.class, byXpath("//div[@class='LSPConsoleToolWindowPanel']"), Duration.ofSeconds(10));
3003+
List<RemoteText> rts1 = node1.findAllText();
3004+
for (RemoteText rt : rts1) {
3005+
if (rt.getText().contains("Debug"))
3006+
rt.click();
3007+
}
3008+
3009+
ProjectFrameFixture projectFrame = remoteRobot.find(ProjectFrameFixture.class, Duration.ofMinutes(2));
3010+
List<ComboBoxFixture> comboBoxes = projectFrame.getComboBoxButton();
3011+
ComboBoxFixture comboBox = comboBoxes.get(1);
3012+
comboBox.selectItem("verbose");
3013+
3014+
String xPath = "//div[starts-with(@accessiblename, 'Apply') and @class='ActionButton']";
3015+
ComponentFixture actionButton = projectFrame.getActionButton(xPath, "10");
3016+
actionButton.click();
3017+
3018+
ComponentFixture node3 = remoteRobot.find(ComponentFixture.class, byXpath("//div[@class='LSPConsoleToolWindowPanel']"), Duration.ofSeconds(10));
3019+
List<RemoteText> rts3 = node3.findAllText();
3020+
for (RemoteText rt : rts3) {
3021+
if (rt.getText().contains("started pid")) {
3022+
rt.click();
3023+
break;
3024+
}
3025+
}
3026+
}
3027+
29883028
/**
29893029
* Access editor content in LSP console
29903030
*

0 commit comments

Comments
 (0)