OpenLiberty / liberty-tools-vscode

Visual Studio Code extension for Liberty Tools
https://marketplace.visualstudio.com/items?itemName=Open-Liberty.liberty-dev-vscode-ext
Eclipse Public License 2.0
17 stars 31 forks source link

VS Code integration tests is failing. #324

Open aparnamichael opened 6 months ago

aparnamichael commented 6 months ago

Now the tests are failing by throwing the following error:

HTTPError: Response code 404 (Not Found) at Request._onResponseBase (/Users/runner/work/liberty-tools-vscode/liberty-tools-vscode/node_modules/got/dist/source/core/index.js:913:31) at Request._onResponse (/Users/runner/work/liberty-tools-vscode/liberty-tools-vscode/node_modules/got/dist/source/core/index.js:948:24) at ClientRequest. (/Users/runner/work/liberty-tools-vscode/liberty-tools-vscode/node_modules/got/dist/source/core/index.js:962:23) at Object.onceWrapper (node:events:633:26) at ClientRequest.emit (node:events:530:35)

aparnamichael commented 6 months ago

From the logs, we understood that it is failing while running "npm run test". "test" is defined as "test": "npm run test-compile && extest setup-and-run -o .vscode/settings.json 'out/test/*.js'". 'npm run test-compile' is working. As a next step, we have updated the extest framework with the latest, after that 404 error gone. Now error is coming for 'clipboardy' node module. Error [ERR_REQUIRE_ESM]: require() of ES Module node_modules/clipboardy/index.js from out/test/utils/testUtils.js not supported. Instead change the require of index.js in out/test/utils/testUtils.js to a dynamic import() which is available in all CommonJS modules.

vaisakhkannan commented 5 months ago

As part of my investigation, first, I updated the test framework to the latest version. Then, I found a component called 'clipboardy' causing issues. The reason behind the issue was that the clipboardy version defaulted to 4.0.0 after the test-framework update. This new version requires ES modules in the compiler options.As shown in the screenshot, we are using commonjs as default.

Screenshot 2024-03-21 at 5 54 09 PM

To resolve this, I downgraded the clipboardy component version from 4.0.0 to 2.3.0. After this change, the tests started running. However, a new issue was found in the UI test code during the Maven project testing.

The command palette in Visual Studio Code (VSCode) provides suggestions for recently used commands in a dropdown list. However, based on our UI testing code, it sometimes selects the incorrect command, such as choosing "Liberty: Start ..." instead of "Liberty: Start" from the recent suggestions. This discrepancy arises because we specifically require "Liberty: Start" at that moment.

I checked the possibility of selecting the exact same command from the list using the dev mode action, but unfortunately, I couldn't find a solution that way.

However, I did discover a solution involving clearing the command history in the command palette. To investigate this further, I reviewed the sample test code in vscode-extension-tester.

During this investigation, I identified a problem on their end. await dialog.pushButton('Clear'); Specifically, the method pushButton('Clear') is not functioning as expected due to their issue.

Consequently, I have raised an issue on GitHub. You can find the link : https://github.com/redhat-developer/vscode-extension-tester/issues/1195

They mentioned in the issue that the fix will be included in another release of ExTester scheduled for this week.