Skip to content

Commit

Permalink
Diagnostic test case added
Browse files Browse the repository at this point in the history
  • Loading branch information
SuparnaSuresh committed Dec 9, 2024
1 parent 88a9b0b commit 44525a6
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions src/test/GradleSingleModLCLSTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,41 @@ describe('LCLS tests for Gradle Project', function () {
editor = await new EditorView().openEditor('server.xml') as TextEditor;
actualSeverXMLContent = await editor.getText();

assert(actualSeverXMLContent.length!==0, 'Content of server.xml is not in coppied.');
console.log('Sever.xml content:',actualSeverXMLContent);
assert(actualSeverXMLContent.length !== 0, 'Content of server.xml is not in coppied.');
console.log('Sever.xml content:', actualSeverXMLContent);

}).timeout(10000);

it('Should show diagnostic for server.xml invalid value', async () => {

await VSBrowser.instance.openResources(path.join(utils.getGradleProjectPath(), 'src', 'main', 'liberty', 'config', 'server.xml'));
editor = await new EditorView().openEditor('server.xml') as TextEditor;

const hverExpectdOutcome = `'wrong' is not a valid value of union type 'booleanType'.`;
const testHverTarget = '<logging appsWriteJson = \"wrong\" />';

await editor.typeTextAt(17, 5, testHverTarget);
const focusTargtElemnt = editor.findElement(By.xpath("//*[contains(text(), 'wrong')]"));
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(hverExpectdOutcome), 'Did not get expected diagnostic in server.xml');

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

}).timeout(35000);

it('Should apply quick fix for invalid value in server.xml', async () => {
const section = await new SideBarView().getContent().getSection(constants.GRADLE_PROJECT);
section.expand();
Expand Down Expand Up @@ -77,7 +107,7 @@ describe('LCLS tests for Gradle Project', function () {
await utils.delay(3000);
console.log("Content after Quick fix : ", updatedSeverXMLContent);
assert(updatedSeverXMLContent.includes(expectedHoverData), 'Quick fix not applied correctly for the invalid value in server.xml.');

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

0 comments on commit 44525a6

Please sign in to comment.