Skip to content

Commit 83f0d9f

Browse files
authored
Merge branch 'OpenLiberty:main' into add-remove-project
2 parents d0416eb + 7233e87 commit 83f0d9f

File tree

5 files changed

+123
-85
lines changed

5 files changed

+123
-85
lines changed

.github/workflows/run-regression-tests.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
# Archive artifacts
4646
- name: Archive artifacts
4747
if: runner.os == 'linux' && matrix.targetVSCode == 'latest'
48-
uses: actions/upload-artifact@v3
48+
uses: actions/upload-artifact@v4.3.4
4949
with:
5050
name: liberty-tools-vscode-${{ github.sha }}
5151
path: ./**/*.vsix
@@ -55,3 +55,13 @@ jobs:
5555
# Build the plugin.
5656
- name: 'Test: RunTests'
5757
run: bash ./src/test/resources/ci/scripts/exec.sh TEST ${{ matrix.targetVSCode }}
58+
59+
# Archive screenshots
60+
- name: Archive screenshots
61+
if: always()
62+
uses: actions/upload-artifact@v4.3.4
63+
with:
64+
name: liberty-run-tests-screenshots-${{ runner.os }}-${{ matrix.targetVSCode }}
65+
path: ./screenshots/*.png
66+
if-no-files-found: warn
67+
retention-days: 7

src/locales/en.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"jakarta.ls": "LSP4Jakarta",
1010
"jakarta.ls.output.dropdown": "Language Support for Jakarta EE",
1111
"jakarta.ls.thumbs.up": "LSP4Jakarta $(thumbsup)",
12-
"jakarta.ls.started": "Language Server for Jakarta started.",
13-
"no.liberty.projects.found": "No liberty projects found.",
12+
"jakarta.ls.started": "Language Server for Jakarta EE started.",
13+
"no.liberty.projects.found": "No Liberty projects found.",
1414
"starting.liberty.dev.on": "Starting Liberty dev mode on {0}.",
1515
"cannot.start.liberty.dev": "Cannot start Liberty dev mode on an undefined project.",
1616
"stopping.liverty.dev.on": "Stopping Liberty dev mode on {0}.",
@@ -45,19 +45,19 @@
4545
"remove.custom.project.not.in.list": "The selected project does not exist in the Liberty Dashboard, or it was not manually added to the Liberty Dashboard. Nothing to remove.",
4646
"attach.debugger.liverty.dev.in": "Attaching debugger to Liberty server in {0}.",
4747
"cannot.attach.debugger.to.undefined": "Cannot attach debugger to an undefined project.",
48-
"liberty.dev.attach.debugger.failed": "The Liberty server might not be started. Start the Liberty server by using the 'Start' or 'Start...' command in the Liberty dashboard. If you already started the Liberty server, wait until you see the Liberty dev mode startup message and try to attach the debugger again.",
48+
"liberty.dev.attach.debugger.failed": "The Liberty server might not be started. Start the Liberty server by using the 'Start' or 'Start...' command in the Liberty Dashboard. If you already started the Liberty server, wait until you see the Liberty dev mode startup message and try to attach the debugger again.",
4949
"liberty.dev.attach.debugger.failed.with.error": "Failed to attach debugger to selected project. The error is: {0}.",
5050
"liberty.dev.debug.label": "Debug {0}",
5151
"liberty.dev.attach.debugger.failed.no.port.in.server.env": "Failed to detect remote debug port in {0}.",
52-
"check.java.runtime.version.outdated": "Java 17 or later is required to run 'Liberty Tools for VS Code'. Download and install a recent JDK.",
52+
"check.java.runtime.version.outdated": "Java 17 or later is required to run 'Liberty Tools for VS Code'. Download and install a recent Java SDK.",
5353
"check.java.runtime.vscode.java.home": "The java.home variable defined in VS Code settings",
5454
"check.java.runtime.env.jdk.home": "The JDK_HOME environment variable",
5555
"check.java.runtime.env.java.home": "The JAVA_HOME environment variable",
56-
"define.xml.java.home.message": "The Liberty Config Language Server requires Java 17 or later. Please set 'xml.java.home' to point to Java 17 or later in the VS Code settings or set the system JAVA_HOME environment variable to point to Java 17 or later.",
56+
"define.xml.java.home.message": "The Liberty Config Language Server requires Java 17 or later. Set 'xml.java.home' in the VS Code settings or set the system JAVA_HOME environment variable to point to a Java 17 or later SDK.",
5757
"check.java.runtime.dismiss.label": "Dismiss",
5858
"open.jdk.download.part.missing.folder": " points to a missing folder.",
5959
"open.jdk.download.part.no.runtime": " does not point to a Java runtime.",
60-
"open.jdk.download.label": "Get the Java Development Kit.",
60+
"open.jdk.download.label": "Get the Java SDK.",
6161
"check.java.runtime.failed.locate": "Java runtime could not be located.",
6262
"hotkey.commands.title.refresh": "Liberty: Refresh projects",
6363
"hotkey.commands.title.start": "Liberty: Start",
@@ -72,5 +72,5 @@
7272
"hotkey.commands.title.add.project": "Liberty: Add Project to Liberty Dashboard",
7373
"hotkey.commands.title.remove.project": "Liberty: Remove Project from Liberty Dashboard",
7474
"hotkey.commands.title.show.commands": "Liberty: Show Liberty commands",
75-
"workspace.not.saved.projects.may.not.persist": "Please save the workspace first. Projects that are manually added to the Liberty dashboard may not persist in the next VS Code session if the workspace is not saved before adding the project."
75+
"workspace.not.saved.projects.may.not.persist": "Save the workspace first. Projects that you manually add to the Liberty Dashboard might not persist in the next VS Code session if you don't save the workspace before you add the project."
7676
}

src/test/GradleTestDevModeActions.ts

Lines changed: 35 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,37 @@ it('Start gradle project from liberty dashboard', async () => {
6464
expect (serverStartStatus).to.be.true;
6565

6666

67+
}).timeout(350000);
68+
69+
it('start gradle with docker from liberty dashboard', async () => {
70+
71+
if((process.platform === 'darwin' ) || (process.platform === 'win32'))
72+
{
73+
//skip running for platforms , enable them for linux after resolving docker setup in GHA
74+
return true;
75+
}
76+
77+
78+
await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITHDOCKER, constants.START_DASHBOARD_MAC_ACTION_WITHDOCKER);
79+
await utils.delay(60000);
80+
const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING);
81+
if(!serverStartStatus)
82+
console.log("Server started message not found in the terminal");
83+
else
84+
{
85+
console.log("Server succuessfully started");
86+
await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION);
87+
const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING);
88+
if(!serverStopStatus){
89+
console.error("Server stopped message not found in the terminal");
90+
}
91+
else
92+
console.log("Server stopped successfully");
93+
expect (serverStopStatus).to.be.true;
94+
}
95+
expect (serverStartStatus).to.be.true;
96+
97+
6798
}).timeout(350000);
6899

69100
it('Run tests for gradle project', async () => {
@@ -153,21 +184,10 @@ it('start gradle with history from liberty dashboard', async () => {
153184

154185
}).timeout(350000);
155186

156-
157-
158-
159-
160-
161-
162-
163-
164-
165-
166-
167-
168-
169-
170-
187+
/**
188+
* All future test cases should be written before the test that attaches the debugger, as this will switch the UI to the debugger view.
189+
* If, for any reason, a test case needs to be written after the debugger test, ensure that the UI is switched back to the explorer view before executing the subsequent tests.
190+
*/
171191
it('attach debugger for gradle with custom parameter event', async () => {
172192
console.log("start attach debugger");
173193
let isServerRunning: Boolean = true;
@@ -217,37 +237,6 @@ it('attach debugger for gradle with custom parameter event', async () => {
217237
expect(attachStatus).to.be.true;
218238
}).timeout(550000);
219239

220-
it('start gradle with docker from liberty dashboard', async () => {
221-
222-
if((process.platform === 'darwin' ) || (process.platform === 'win32') || (process.platform == 'linux'))
223-
{
224-
//skip running for platforms , enable them for linux after resolving docker setup in GHA
225-
return true;
226-
}
227-
228-
229-
await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITHDOCKER, constants.START_DASHBOARD_MAC_ACTION_WITHDOCKER);
230-
await utils.delay(60000);
231-
const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING);
232-
if(!serverStartStatus)
233-
console.log("Server started message not found in the terminal");
234-
else
235-
{
236-
console.log("Server succuessfully started");
237-
await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION);
238-
const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING);
239-
if(!serverStopStatus){
240-
console.error("Server stopped message not found in the terminal");
241-
}
242-
else
243-
console.log("Server stopped successfully");
244-
expect (serverStopStatus).to.be.true;
245-
}
246-
expect (serverStartStatus).to.be.true;
247-
248-
249-
}).timeout(350000);
250-
251240
it('View test report for gradle project', async () => {
252241

253242
if((process.platform === 'darwin' ) || (process.platform === 'win32') || (process.platform == 'linux'))

src/test/MavenTestDevModeActions.ts

Lines changed: 66 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { expect } from 'chai';
2-
import { InputBox, Workbench,SideBarView, ViewItem, ViewSection,EditorView, DefaultTreeItem , DebugView } from 'vscode-extension-tester';
2+
import { InputBox, Workbench,SideBarView, ViewItem, ViewSection,EditorView, DefaultTreeItem , DebugView, VSBrowser } from 'vscode-extension-tester';
33
import * as utils from './utils/testUtils';
44
import * as constants from './definitions/constants';
55
import path = require('path');
6+
import * as fs from 'fs';
67

78
describe('Devmode action tests for Maven Project', () => {
89
let sidebar: SideBarView;
@@ -67,6 +68,37 @@ it('Start maven project from liberty dashboard', async () => {
6768

6869
}).timeout(550000);
6970

71+
it('start maven with docker from liberty dashboard', async () => {
72+
73+
if((process.platform === 'darwin' ) || (process.platform === 'win32'))
74+
{
75+
//skip running for platforms , enable them for linux after resolving docker setup in GHA
76+
return true;
77+
}
78+
79+
80+
await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITHDOCKER, constants.START_DASHBOARD_MAC_ACTION_WITHDOCKER);
81+
await utils.delay(60000);
82+
const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING);
83+
if(!serverStartStatus)
84+
console.log("Server started message not found in the terminal");
85+
else
86+
{
87+
console.log("Server succuessfully started");
88+
await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION);
89+
const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING);
90+
if(!serverStopStatus){
91+
console.error("Server stopped message not found in the terminal");
92+
}
93+
else
94+
console.log("Server stopped successfully");
95+
expect (serverStopStatus).to.be.true;
96+
}
97+
expect (serverStartStatus).to.be.true;
98+
99+
100+
}).timeout(350000);
101+
70102
it('Run tests for sample maven project', async () => {
71103

72104
await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION, constants.START_DASHBOARD_MAC_ACTION);
@@ -188,6 +220,10 @@ it('View Integration test report for maven project', async () => {
188220

189221
}).timeout(10000);
190222

223+
/**
224+
* All future test cases should be written before the test that attaches the debugger, as this will switch the UI to the debugger view.
225+
* If, for any reason, a test case needs to be written after the debugger test, ensure that the UI is switched back to the explorer view before executing the subsequent tests.
226+
*/
191227
it('attach debugger for start with custom parameter event', async () => {
192228
console.log("start attach debugger");
193229
let isServerRunning: Boolean = true;
@@ -238,37 +274,38 @@ it('attach debugger for start with custom parameter event', async () => {
238274
expect(attachStatus).to.be.true;
239275
}).timeout(350000);
240276

241-
it('start maven with docker from liberty dashboard', async () => {
277+
/**
278+
* The following after hook copies the screenshot from the temporary folder in which it is saved to a known permanent location in the project folder.
279+
* The MavenTestDevModeAction is the last test file that will be executed. Hence the after hook placed here
280+
* ensures that all the screenshots will be copied to a known permanent location in the project folder.
281+
*/
282+
after(() => {
283+
const sourcePath = VSBrowser.instance.getScreenshotsDir();
284+
const destinationPath = './screenshots';
242285

243-
if((process.platform === 'darwin' ) || (process.platform === 'win32') || (process.platform == 'linux'))
244-
{
245-
//skip running for platforms , enable them for linux after resolving docker setup in GHA
246-
return true;
247-
}
248-
249-
250-
await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITHDOCKER, constants.START_DASHBOARD_MAC_ACTION_WITHDOCKER);
251-
await utils.delay(60000);
252-
const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING);
253-
if(!serverStartStatus)
254-
console.log("Server started message not found in the terminal");
255-
else
256-
{
257-
console.log("Server succuessfully started");
258-
await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION);
259-
const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING);
260-
if(!serverStopStatus){
261-
console.error("Server stopped message not found in the terminal");
286+
copyFolderContents(sourcePath, destinationPath);
287+
});
288+
289+
function copyFolderContents(sourceFolder: string, destinationFolder: string): void {
290+
if (!fs.existsSync(sourceFolder)) {
291+
return;
292+
}
293+
294+
if (!fs.existsSync(destinationFolder)) {
295+
fs.mkdirSync(destinationFolder);
262296
}
263-
else
264-
console.log("Server stopped successfully");
265-
expect (serverStopStatus).to.be.true;
266-
}
267-
expect (serverStartStatus).to.be.true;
268-
269-
270-
}).timeout(350000);
271297

298+
const files = fs.readdirSync(sourceFolder);
299+
for (const file of files) {
300+
const sourcePath = path.join(sourceFolder, file);
301+
const destinationPath = path.join(destinationFolder, file);
272302

303+
if (fs.statSync(sourcePath).isDirectory()) {
304+
copyFolderContents(sourcePath, destinationPath);
305+
} else {
306+
fs.copyFileSync(sourcePath, destinationPath);
307+
}
308+
}
309+
}
273310
});
274311

src/test/resources/ci/scripts/exec.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@ main() {
6565
if [ $OS = "Darwin" ]; then
6666
chown -R runner src/test/resources/maven
6767
chown -R runner src/test/resources/gradle
68-
npm run test-mac-maven -- -u
68+
# Gradle tests should be run before Maven tests because the after hook for copying the screeshots from temporary to a permananet location is written in the Maven tests so that the copying will be done at the end of every test cases.
6969
npm run test-mac-gradle -- -u
70+
npm run test-mac-maven -- -u
7071
else
7172
npm run test -- -u
7273
fi
@@ -75,8 +76,9 @@ main() {
7576
if [ $OS = "Darwin" ]; then
7677
chown -R runner src/test/resources/maven
7778
chown -R runner src/test/resources/gradle
78-
npm run test-mac-maven -- -u -c $VSCODE_VERSION_TO_RUN
79+
# Gradle tests should be run before Maven tests because the after hook for copying the screeshots from temporary to a permananet location is written in the Maven tests so that the copying will be done at the end of every test cases.
7980
npm run test-mac-gradle -- -u -c $VSCODE_VERSION_TO_RUN
81+
npm run test-mac-maven -- -u -c $VSCODE_VERSION_TO_RUN
8082

8183
else
8284
npm run test -- -u -c $VSCODE_VERSION_TO_RUN

0 commit comments

Comments
 (0)