-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue381 - Automated test case implementation - hover support for server.xml Liberty Server Feature #427
Open
SuparnaSuresh
wants to merge
27
commits into
OpenLiberty:main
Choose a base branch
from
SuparnaSuresh:issue381-ServerFeatureHoverSupport
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+183
−0
Open
Issue381 - Automated test case implementation - hover support for server.xml Liberty Server Feature #427
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
08aefcd
code to open server.xml and entry for logging
SuparnaSuresh c1a82a4
code added for hover and quicfix
SuparnaSuresh 121f17b
Code added to open server.xml
SuparnaSuresh 2771093
Code Added for write text in server.xml
SuparnaSuresh 80d8e87
Code for hover data
SuparnaSuresh 01d668f
Code for quick fix
SuparnaSuresh 3f5e62f
Code formatted
SuparnaSuresh dbba2a0
removed unwanted code
SuparnaSuresh 3e4affe
Copyright and docuementation
SuparnaSuresh 883f757
Merge branch 'OpenLiberty:main' into issue124-AutomatedTestcaseLCLS
SuparnaSuresh 150019c
Renamed file
SuparnaSuresh 7fdc278
Renamed file to GradleSingleModLCLSTest
SuparnaSuresh 108bfd5
added code to update the old content
SuparnaSuresh 23d1ce7
hover support for server.xml Liberty Server Attribute
SuparnaSuresh 6eba89d
updated code for quick fix element
SuparnaSuresh c35d6bf
Merge branch 'OpenLiberty:main' into issue378-HoversupportServerAttri…
SuparnaSuresh 13bb977
Added code for new config folder
SuparnaSuresh 008cb5c
updated variable and code format
SuparnaSuresh c452b38
Added test case for hover support for server.xml Liberty Server Feature
SuparnaSuresh 938ea5d
assert type changed
SuparnaSuresh 88a9b0b
Added test case to copy server.xm content
SuparnaSuresh 44525a6
Diagnostic test case added
SuparnaSuresh f60e566
changed server.xml path
SuparnaSuresh 4fd5218
Copy right header year updated
SuparnaSuresh 02ad791
Updated code
SuparnaSuresh f2809c2
updated testUtils to resolve conflict
SuparnaSuresh 3f16122
Merge branch 'OpenLiberty:main' into issue381-ServerFeatureHoverSupport
SuparnaSuresh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,183 @@ | ||
/** | ||
* Copyright (c) 2025 IBM Corporation. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
import { By, EditorView, SideBarView, TextEditor, VSBrowser } from "vscode-extension-tester"; | ||
import * as utils from './utils/testUtils'; | ||
import * as constants from './definitions/constants'; | ||
|
||
const path = require('path'); | ||
const assert = require('assert'); | ||
|
||
describe('LCLS tests for Gradle Project', function () { | ||
let editor: TextEditor; | ||
let actualSeverXMLContent: string; | ||
|
||
before(() => { | ||
utils.copyConfig(path.join(utils.getGradleProjectPath(), 'src', 'main', 'liberty', 'config'), path.join(utils.getGradleProjectPath(), 'src', 'main', 'liberty', 'config2')); | ||
}); | ||
|
||
it('Should copy content of server.xml', 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; | ||
actualSeverXMLContent = await editor.getText(); | ||
|
||
assert(actualSeverXMLContent.length !== 0, 'Content of server.xml is not in copied.'); | ||
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', 'config2', '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(); | ||
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 = "<logging appsWriteJson = \"wrong\" />"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move the duplicate code to testutils. |
||
const expectedHoverData = "<logging appsWriteJson = \"true\" />"; | ||
await editor.typeTextAt(17, 5, stanzaSnipet); | ||
await utils.delay(2000); | ||
const flagedString = await editor.findElement(By.xpath("//*[contains(text(), '\"wrong\"')]")); | ||
await utils.delay(7000); | ||
|
||
const actions = VSBrowser.instance.driver.actions(); | ||
await actions.move({ origin: flagedString }).perform(); | ||
await utils.delay(3000); | ||
|
||
const driver = VSBrowser.instance.driver; | ||
const hoverTxt = await editor.findElement(By.className('hover-row status-bar')); | ||
await utils.delay(2000); | ||
|
||
const qckFixPopupLink = await hoverTxt.findElement(By.xpath("//*[contains(text(), 'Quick Fix')]")); | ||
await qckFixPopupLink.click(); | ||
|
||
const hoverTaskBar = await editor.findElement(By.className('context-view monaco-component bottom left fixed')); | ||
await hoverTaskBar.findElement(By.className('actionList')); | ||
await utils.delay(2000); | ||
|
||
const pointerBlockedElement = await driver.findElement(By.css('.context-view-pointerBlock')); | ||
// Setting pointer block element display value as none to choose option from Quickfix menu | ||
if (pointerBlockedElement) { | ||
await driver.executeScript("arguments[0].style.display = 'none';", pointerBlockedElement); | ||
} else { | ||
console.log('pointerBlockElementt not found!'); | ||
} | ||
const qckfixOption = await editor.findElement(By.xpath("//*[contains(text(), \"Replace with 'true'\")]")); | ||
await qckfixOption.click(); | ||
|
||
const updatedSeverXMLContent = await editor.getText(); | ||
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"); | ||
|
||
}).timeout(38000); | ||
|
||
it('Should show hover support for server.xml Liberty Server Attribute', async () => { | ||
|
||
await VSBrowser.instance.openResources(path.join(utils.getGradleProjectPath(), 'src', 'main', 'liberty', 'config2', 'server.xml')); | ||
editor = await new EditorView().openEditor('server.xml') as TextEditor; | ||
|
||
const hovrExpctdOutcome = `Configuration properties for an HTTP endpoint.`; | ||
|
||
console.log(hovrExpctdOutcome); | ||
const focusTargtElemnt = editor.findElement(By.xpath("//*[contains(text(), 'httpEndpoint')]")); | ||
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 hoveredText = await hverContent.getText(); | ||
console.log("Hover text:" + hoveredText); | ||
|
||
assert(hoveredText.includes(hovrExpctdOutcome), 'Did not get expected hover data Liberty Server Attribute.'); | ||
|
||
editor.clearText(); | ||
editor.setText(actualSeverXMLContent); | ||
console.log("Content restored"); | ||
|
||
}).timeout(35000); | ||
|
||
it('Should show hover support for server.xml Liberty Server Feature', async () => { | ||
|
||
await VSBrowser.instance.openResources(path.join(utils.getGradleProjectPath(), 'src', 'main', 'liberty', 'config2', 'server.xml')); | ||
editor = await new EditorView().openEditor('server.xml') as TextEditor; | ||
|
||
const hverExpectdOutcome = `Description: This feature provides support for the MicroProfile Health specification.`; | ||
const testHverTarget = '<feature>mpHealth-4.0</feature>'; | ||
|
||
await editor.typeTextAt(15, 35, '\n'); | ||
await utils.delay(1000); | ||
await editor.typeTextAt(16, 9, testHverTarget); | ||
const focusTargtElemnt = editor.findElement(By.xpath("//*[contains(text(), 'mpHealth')]")); | ||
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 hover data Liberty Server Feature.'); | ||
|
||
editor.clearText(); | ||
editor.setText(actualSeverXMLContent); | ||
console.log("Content restored"); | ||
|
||
}).timeout(33000); | ||
|
||
after(() => { | ||
utils.removeConfigDir(path.join(utils.getGradleProjectPath(), 'src', 'main', 'liberty', 'config2')); | ||
console.log("Removed new config folder:"); | ||
}); | ||
|
||
}); |
Empty file.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move all the hardcoded strings to a constants file.