Skip to content
This repository was archived by the owner on Sep 30, 2025. It is now read-only.

Commit f76583e

Browse files
authored
Merge pull request #243 from MicroFocus/octane-dev-latest
octane 5.8.3 fixes
2 parents 1dd34ac + 63bd7ca commit f76583e

File tree

2 files changed

+68
-44
lines changed
  • src/main

2 files changed

+68
-44
lines changed

src/main/java/com/microfocus/application/automation/tools/octane/testrunner/TestsToRunConverterBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ public String getFormat() {
161161
return framework.getFramework().getFormat();
162162
}
163163

164-
public boolean getIsCustom(){
165-
return TestsToRunFramework.Custom.value().equals(framework.getFramework().getName());
164+
public boolean getIsCustom() {
165+
return framework != null && TestsToRunFramework.Custom.value().equals(framework.getFramework().getName());
166166
}
167167

168168
private void printToConsole(TaskListener listener, String msg) {

src/main/resources/com/microfocus/application/automation/tools/octane/testrunner/TestsToRunConverterBuilder/config.jelly

Lines changed: 66 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,35 @@
2323
<?jelly escape-by-default='true'?>
2424
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
2525
<f:entry title="Testing framework" field="framework">
26-
<select name="teststorunconverter.framework" onchange="selectionChanged(this)">
26+
<select name="teststorunconverter.framework" onchange="frameworkChanged(this)">
2727
<j:forEach var="myFramework" items="${descriptor.Frameworks}">
2828
<f:option selected="${myFramework.name == instance.testsToRunConverterModel.framework.name}" value="${myFramework.name}">
2929
${myFramework.description}
3030
</f:option>
3131
</j:forEach>
3232
</select>
3333
</f:entry>
34-
35-
<j:forEach var="myFramework" items="${descriptor.Frameworks}">
36-
<f:textbox id="format+${myFramework.name}" value="${myFramework.format}" hidden="hidden"/>
37-
</j:forEach>
3834
<f:entry title="Custom configuration" field="format">
39-
<textarea id="format" name="teststorunconverter.format" type="text" disabled="disabled" class="setting-input" style="resize: vertical; min-height:90px;">
40-
${instance.testsToRunConverterModel.framework.format}
41-
</textarea>
42-
<select id="fillFormat" onchange="insertFormat(this)" style="visibility: hidden; float: right;position: relative;font-size: smaller;">
43-
<f:option value="title">Fill configuration ...</f:option>
44-
<f:option value="basic">Minimal configuration</f:option>
45-
<f:option value="extended">Extended configuration</f:option>
46-
</select>
35+
<j:if test="${instance.isCustom}">
36+
<textarea name="teststorunconverter.format" type="text" class="custom-configuration-text setting-input">
37+
${instance.testsToRunConverterModel.framework.format}
38+
</textarea>
39+
<select class="custom-configuration-fill" onchange="insertFormat(this)">
40+
<f:option value="title">Fill configuration ...</f:option>
41+
<f:option value="basic">Minimal configuration</f:option>
42+
<f:option value="extended">Extended configuration</f:option>
43+
</select>
44+
</j:if>
45+
<j:if test="${!instance.isCustom}">
46+
<textarea name="teststorunconverter.format" type="text" disabled="true" class="custom-configuration-text setting-input">
47+
${instance.testsToRunConverterModel.framework.format}
48+
</textarea>
49+
<select class="custom-configuration-fill hidden" onchange="insertFormat(this)">
50+
<f:option value="title">Fill configuration ...</f:option>
51+
<f:option value="basic">Minimal configuration</f:option>
52+
<f:option value="extended">Extended configuration</f:option>
53+
</select>
54+
</j:if>
4755
</f:entry>
4856

4957
<f:advanced>
@@ -55,21 +63,29 @@
5563
method="testConvert" with="teststorunconverter.framework,teststorunconverter.format,testsToRun"/>
5664
</f:advanced>
5765

58-
<script>
59-
function init(){
60-
var isCustom=false;
61-
var txtFormat = document.getElementById('format');
62-
63-
if(txtFormat){
64-
var index = txtFormat.selectedIndex;
65-
isCustom=true;//${instance.isCustom};
66-
}
67-
enableElements(isCustom);
66+
<style>
67+
.custom-configuration-fill{
68+
top=-1px;
69+
position: relative;
70+
font-size: smaller;
71+
float:right;
72+
}
73+
.custom-configuration-text{
74+
resize: vertical;
75+
min-height:90px;
76+
height:120px;
6877
}
78+
.hidden{
79+
visibility: hidden
80+
}
81+
</style>
82+
<script>
6983
function insertFormat(sender){
7084
var index = sender.selectedIndex;
7185
var options = sender.options;
72-
var txtFormat = document.getElementById('format');
86+
87+
var parent = getTableParent(sender);
88+
var txtFormat = parent.querySelector(".custom-configuration-text");
7389

7490
if(options[index].value === 'basic'){
7591
txtFormat.value = "{\n\t\"testPattern\": \"$$package.$$class#$$testName\",\n\t\"testDelimiter\": \",\"\n}";
@@ -110,34 +126,42 @@
110126
sender.selectedIndex = 0;
111127
}
112128

113-
function selectionChanged(sender) {
114-
var x = sender.selectedIndex;
115-
var y = sender.options;
116-
var bCustom = y[x].value === 'custom' ? true : false;
117-
enableElements(bCustom);
118-
var optionFormat = document.getElementById('format+' + y[x].value);
119-
var txtFormat = document.getElementById('format');
120-
txtFormat.value = optionFormat ? optionFormat.value : "";
129+
function frameworkChanged(sender) {
130+
var parent = getTableParent(sender);
131+
var bCustom = sender.options[sender.selectedIndex].value === 'custom' ? true : false;
132+
var parent = getTableParent(sender)
133+
enableElements(bCustom,parent);
121134
}
122135

123-
function enableElements(isCustom, secondTry){
124-
var txtFormat = document.getElementById('format');
136+
function enableElements(isCustom, parent){
137+
138+
var txtFormat = parent.querySelector(".custom-configuration-text");
125139
if(txtFormat){
126140
txtFormat.disabled = !isCustom;
127-
}else{
128-
if(!secondTry){
129-
setTimeout(function(){ enableElements(isCustom,true); }, 500);
130-
return;
131-
}
132141
}
133142

134-
var fillFormat = document.getElementById('fillFormat');
143+
var fillFormat = parent.querySelector(".custom-configuration-fill");
135144
if(fillFormat){
136-
fillFormat.style.visibility = isCustom ? "visible" : "hidden";
145+
if(isCustom){
146+
fillFormat.classList.remove("hidden");
147+
} else {
148+
fillFormat.classList.add("hidden");
149+
}
137150
}
138151
}
139-
init();
140152

153+
function getTableParent(element){
154+
var myElement = element;
155+
var counter = 0;
156+
while(myElement.nodeName.toLowerCase()!=="table"){
157+
myElement = myElement.parentElement;
158+
counter++;
159+
if(counter>=4){
160+
break;
161+
}
162+
}
163+
return myElement;
164+
}
141165
</script>
142166

143167
</j:jelly>

0 commit comments

Comments
 (0)