diff --git a/src/test/GradleSingleModLCLSTest.ts b/src/test/GradleSingleModLCLSTest.ts index 76e8dfe4..d4ae0212 100755 --- a/src/test/GradleSingleModLCLSTest.ts +++ b/src/test/GradleSingleModLCLSTest.ts @@ -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 = ''; + + 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(); @@ -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");