Skip to content

Commit

Permalink
test case added for diagnostic server feature
Browse files Browse the repository at this point in the history
  • Loading branch information
SuparnaSuresh committed Dec 13, 2024
1 parent 1314e8a commit 04da615
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/test/GradleSingleModLCLSTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,38 @@ describe('LCLS tests for Gradle Project', function () {

}).timeout(25000);

it('Should show diagnostic for invalid value in server.xml for server feature', async () => {
const section = await new SideBarView().getContent().getSection(constants.GRADLE_PROJECT);
section.expand();
await VSBrowser.instance.openResources(path.join(utils.getGradleProjectPath(), 'src', 'main', 'liberty', 'config2', 'server.xml'));

editor = await new EditorView().openEditor('server.xml') as TextEditor;
const stanzaSnipet = "<feature>servlet</feature>";
const expectedDiagnosticData = `ERROR: The "servlet" versionless feature cannot be resolved since there are more than one common platform. Specify a platform or a feature with a version to enable resolution`;
await editor.typeTextAt(15, 35, '\n');
await editor.typeTextAt(16, 9, stanzaSnipet);
await utils.delay(2000);
const focusTargtElemnt = await editor.findElement(By.xpath("//*[contains(text(), '\servlet\')]"));
await utils.delay(3000);
focusTargtElemnt.click();
await editor.click();

const actns = VSBrowser.instance.driver.actions();
await actns.move({ origin: focusTargtElemnt }).perform();
await utils.delay(5000);

const hverContent = editor.findElement(By.className('hover-contents'));
const hverValue = await hverContent.getText();
console.log("Hover text:" + hverValue);

assert(hverValue.includes(expectedDiagnosticData), 'Did not get expected diagnostic in server.xml server feature');

editor.clearText();
editor.setText(actualSeverXMLContent);
console.log("Content restored");

}).timeout(38000);

it('Should apply quick fix for invalid value in server.xml for server feature', async () => {
const section = await new SideBarView().getContent().getSection(constants.GRADLE_PROJECT);
section.expand();
Expand Down

0 comments on commit 04da615

Please sign in to comment.