Skip to content

Commit

Permalink
Improved navigation between execution and script page.
Browse files Browse the repository at this point in the history
  • Loading branch information
vertigo17 committed Mar 29, 2024
1 parent 3307641 commit 86d4c9a
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
*Bug fixes*
[square]
* Display small issue on testcase script page and execution when condition include value1 that contain quote or double quote.
* Fixed language local management on recent Chrome versions
* Homepage filters now also apply on all graphs on the page.

*Improvements / New features*
[square]
Expand All @@ -14,8 +16,14 @@
* new options on actions and controls in order to force screenshot before and after (that avoid the necessary takeScreenshot control)
* new options on actions and controls in order to add a wait in ms before and after (that avoid the necessary wait action). This is to be used with care as Cerberus already wait for an element before interacting with it.
* new parameter cerberus_pdfcampaignreportdisplayciresult_boolean in order to hide/display the cicd information on pdf report.
* PDF Files content can now be controled after being downloaded.

* PDF Files content can now be controlled after being downloaded (text content + page numbers + pdf certificates information).
* getRobotFile action now save the files on their initial format. Those files can be manually checked and saved.
* Improved navigation of testcase edition between Testcase script page and execution page (step focused is kept during execution and between the 2 screens).
* Screenshot preview is bigger.
* Screenshot order display on execution page correspond to the timing of its creation. #2522
* Allow multiple extraParameters on robot chrome (space seperator).
* Added %system.ROBOTSESSIONID% and %system.ROBOTPROVIDERSESSIONID% system variable.
* Allow to have optional subdata and feed cerberus_testdatalib_subdataDefaultValue parameter to defined its default value (Thanks to Promod team ;-)).

*Warning to be considered before applying the version (deprecated features)*
[square]
Expand Down
6 changes: 3 additions & 3 deletions source/src/main/webapp/TestCaseScript.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@
<div class="btn-group ">
<a><button class="btn btn-default pull-right" id="editTcInfo">Edit Test Case Header</button></a>
</div>
<div class="btn-group">
<a><button class="btn btn-default pull-left" id="seeLastExecUniq" style="margin-left: 5px; margin-right: 5px;"><span class="glyphicon glyphicon-saved"></span></button></a>
</div>
<div class="btn-group" id="runTestCasePopover">
<a><button class="btn btn-default pull-right" id="runTestCase" style="margin-left: 5px; margin-left: 5px;" data-toggle="tooltip" ><span class="glyphicon glyphicon-play"></span></button></a>
</div>
<div class="btn-group">
<a><button class="btn btn-default pull-right" id="rerunFromQueueandSee" style="margin-left: 5px; margin-left: 5px;"><span class="glyphicon glyphicon-forward"></span></button></a>
</div>
<div class="btn-group">
<a><button class="btn btn-default pull-left" id="seeLastExecUniq" style="margin-left: 5px; margin-right: 5px;"><span class="glyphicon glyphicon-saved"></span></button></a>
</div>
<div class="btn-group">
<a><button class="btn btn-default" id="saveScript" disabled style="margin-left: 1px;"><span class="glyphicon glyphicon-save"></span></button></a>
</div>
Expand Down
23 changes: 23 additions & 0 deletions source/src/main/webapp/js/global/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -2164,6 +2164,29 @@ function GetURLParameter(sParam, defaultValue) {
}
}

/**
* Get the parameter passed in the url Example : url?param=value
* @param {String} sParam parameter you want to get value from
* @param {String} defaultValue Default value in case the parameter is not defined in the URL.
* @returns {GetURLParameter.sParameterName} the value or defaultValue does not exist in URL or null if not found in URL and no default value specified.
*/
function GetURLAnchorValue(sParam, defaultValue) {
var sPageURL = window.location.hash.substring(1);
var sURLVariables = sPageURL.split('|');

for (var i = 0; i < sURLVariables.length; i++) {
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return decodeURIComponent(sParameterName[1]);
}
}
if (defaultValue === undefined) {
return null;
} else {
return defaultValue;
}
}

/**
* Get the parameter passed in the url Example : url?param=value
* @param {String} sParam parameter you want to get value from
Expand Down
49 changes: 36 additions & 13 deletions source/src/main/webapp/js/pages/TestCaseExecution.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var configNb = {};
var configSize = {};
var configGantt = {};
var sortCol = 1;
var stepFocus = -1;

$.when($.getScript("js/global/global.js")).then(function () {
$(document).ready(function () {
Expand Down Expand Up @@ -63,6 +64,7 @@ $.when($.getScript("js/global/global.js")).then(function () {

var executionId = GetURLParameter("executionId");
var executionQueueId = GetURLParameter("executionQueueId");
stepFocus = GetURLAnchorValue("stepId", 99999);
paramActivatewebsocketpush = getParameterString("cerberus_featureflipping_activatewebsocketpush", "", true);
paramWebsocketpushperiod = getParameterString("cerberus_featureflipping_websocketpushperiod", "", true);

Expand Down Expand Up @@ -412,7 +414,7 @@ function updatePage(data, steps) {
$("#editTcInfo").attr("disabled", false);
$("#editTcInfo").attr("href", "TestCaseScript.jsp?test=" + data.test + "&testcase=" + data.testcase);
$("#editTcStepInfo").attr("disabled", false);
$("#editTcStepInfo").parent().attr("href", "TestCaseScript.jsp?test=" + data.test + "&testcase=" + data.testcase);
$("#editTcStepInfo").parent().attr("href", "TestCaseScript.jsp?test=" + encodeURI(data.test) + "&testcase=" + encodeURI(data.testcase));
$("#btnGroupDrop4").click(function () {
setLinkOnEditTCStepInfoButton();
});
Expand Down Expand Up @@ -579,7 +581,7 @@ function isIndexSelected(index, selectedIndex) {
}

function loadIndexSelect() {
console.info("loadingSelect...")
// console.info("loadingSelect...")
$("#selectIndex").select2({
width: '100%' // need to override the default to secure to take the full size available.
});
Expand Down Expand Up @@ -1378,7 +1380,7 @@ function triggerTestCaseExecutionQueueandSee(queueId) {
if (getAlertType(data.messageType) === "success") {
showMessageMainPage(getAlertType(data.messageType), data.message, false, 60000);
var url = "./TestCaseExecution.jsp?executionQueueId=" + data.testCaseExecutionQueueList[0].id;
console.info("redir : " + url);
// console.info("redir : " + url);
window.location.replace(url);
} else {
showMessageMainPage(getAlertType(data.messageType), data.message, false, 60000);
Expand Down Expand Up @@ -1718,7 +1720,6 @@ function createProperties(propList) {
$('#secondaryPropTableHeader').css("display", "block");
// TO DO : link it to the docTable
secondaryPropCount++;
console.log(secondaryPropCount);
$('#secondaryPropCount').html(secondaryPropCount);
}
}
Expand Down Expand Up @@ -2088,7 +2089,20 @@ function createStepList(data, steps) {
steps.push(step);
}

if (steps.length > 0) {
if ((stepFocus !== undefined) && (stepFocus !== 99999)) {
var find = false;
for (var i = 0; i < steps.length; i++) {
let curStepIndex = steps[i].step + "-" + steps[i].index;
// Use == in stead of ===
if (curStepIndex == stepFocus) {
find = true;
$(steps[i].html[0]).click();
}
}
if ((!find) && (steps.length > 0)) {
$(steps[0].html[0]).click();
}
} else if (steps.length > 0) {
$("#steps a:last-child").trigger("click");
}
$("#steps").data("listOfStep", steps);
Expand Down Expand Up @@ -2234,12 +2248,21 @@ Step.prototype.update = function (idStep) {
};


Step.prototype.show = function () {
Step.prototype.show = function (a) {
var doc = new Doc();
var object = $(this).data("item");
var stepDesc = $("<div>").addClass("col-xs-10");
var stepButton = $("<div id='stepPlus'></a>").addClass("col-xs-1").addClass("paddingLeft0").addClass("paddingTop30").append($("<span class='glyphicon glyphicon-chevron-down'></span>").attr("style", "font-size:1.5em"));

if (a.cancelable) {
// the show action comes from a click so we save the step/index where focus was done and save it inside stepFocus for next refresh and inside the URL in case of F5.
const url = new URL(window.location);
url.hash = '#stepId=' + object.step + "-" + object.index;
stepFocus = object.step + "-" + object.index;
window.history.pushState({}, '', url);
$("#editTcStepInfo").parent().attr("href", "./TestCaseScript.jsp?test=" + encodeURI(object.test) + "&testcase=" + encodeURI(object.testcase) + '#stepId=' + object.step);
}

for (var i = 0; i < object.steps.length; i++) {
var step = object.steps[i];
step.stepActionContainer.hide();
Expand Down Expand Up @@ -3431,13 +3454,13 @@ function addFileLink(fileList, container, manual, idStep) {
;
var fileDesctxt = fileList[i].fileDesc;
var filetypetxt = fileList[i].fileType.toLowerCase();
var linkBoxtxt = $("<div name='mediaMiniature'>").addClass("col-sm-12").css("margin-bottom", "5px")
.prepend("<br>").prepend($("<img>").attr("src", "images/f-" + filetypetxt + ".svg")
.attr("data-toggle", "tooltip").attr("data-original-title", fileList[i].fileDesc)
.css("height", "30px").click(function (e) {
changeClickIfManual(isTheExecutionManual, container, idStep, fileList[index], e)
return false;
}));
var linkBoxtxt = $("<div name='mediaMiniature'>").addClass("col-sm-12").css("margin-bottom", "5px")
.prepend("<br>").prepend($("<img>").attr("src", "images/f-" + filetypetxt + ".svg")
.attr("data-toggle", "tooltip").attr("data-original-title", fileList[i].fileDesc)
.css("height", "30px").click(function (e) {
changeClickIfManual(isTheExecutionManual, container, idStep, fileList[index], e)
return false;
}));
container.append(linkBoxtxt);
} else if ((fileList[i].fileType === "BIN") || (fileList[i].fileType === "PDF")) {

Expand Down
26 changes: 19 additions & 7 deletions source/src/main/webapp/js/pages/TestCaseScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
var canUpdate = false;
var allDelete = false;
var Tags = [];
var exeId = 0;


$.when($.getScript("js/global/global.js")
Expand Down Expand Up @@ -81,10 +82,12 @@ $.when($.getScript("js/global/global.js")
bindToggleCollapse();
var test = GetURLParameter("test");
var testcase = GetURLParameter("testcase");
var step = GetURLParameter("step");
var property = GetURLParameter("property");
var tabactive = GetURLParameter("tabactive");
var oneclickcreation = GetURLParameter("oneclickcreation");

var tabactive = GetURLParameter("tabactive");
var step = GetURLAnchorValue("stepId");

displayHeaderLabel(doc);
displayGlobalLabel(doc);
displayFooter(doc);
Expand Down Expand Up @@ -229,6 +232,7 @@ $.when($.getScript("js/global/global.js")
$('[data-toggle="tooltip"]').tooltip();

$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
var target = $(e.target).attr("href")
initModification();
});
},
Expand Down Expand Up @@ -323,7 +327,8 @@ $.when($.getScript("js/global/global.js")
dataType: "json",
success: function (data) {
if (!jQuery.isEmptyObject(data.contentTable)) {
$("#seeLastExecUniq").parent().attr("href", "./TestCaseExecution.jsp?executionId=" + encodeURI(data.contentTable.id));
exeId = data.contentTable.id;
$("#seeLastExecUniq").parent().attr("href", "./TestCaseExecution.jsp?executionId=" + encodeURI(data.contentTable.id) + window.location.hash);
$("#seeLastExec").parent().attr("href", "./TestCaseExecutionList.jsp?Test=" + encodeURI(test) + "&TestCase=" + encodeURI(testcase));
$("#rerunTestCase").attr("title", "Last Execution was " + data.contentTable.controlStatus + " in " + data.contentTable.env + " in " + data.contentTable.country + " on " + data.contentTable.end);
$("#rerunTestCase").parent().attr("href", "./RunTests.jsp?test=" + encodeURI(test) + "&testcase=" + encodeURI(testcase) + "&country=" + encodeURI(data.contentTable.country) + "&environment=" + encodeURI(data.contentTable.env));
Expand Down Expand Up @@ -684,11 +689,13 @@ function saveScript(property) {
var new_uri = parser.pathname + "?test=" + encodeURI(GetURLParameter("test")) + "&testcase=" + encodeURI(GetURLParameter("testcase")) + url_sort + tutorialParameters + "&tabactive=" + tabActive;
// If the 1st 2 characters are // we remove 1 of them.
if ((new_uri[0] === '/') && (new_uri[1] === '/')) {
new_uri = new_uri[0] + new_uri.slice(2)
new_uri = new_uri[0] + new_uri.slice(2);
}
setModif(false);

window.location.href = new_uri;
location.replace(new_uri + window.location.hash);
window.location.reload();

},
error: showUnexpectedError
});
Expand Down Expand Up @@ -1443,7 +1450,7 @@ function createSteps(data, steps, stepIndex, canUpdate, hasPermissionsStepLibrar
var find = false;
for (var i = 0; i < steps.length; i++) {
// Use == in stead of ===
if (steps[i].sort == stepIndex) {
if (steps[i].stepId == stepIndex) {
find = true;
$(steps[i].html[0]).click();
}
Expand Down Expand Up @@ -1854,7 +1861,7 @@ Step.prototype.draw = function () {
var useStepContainer = $("<div class='col-sm-12 fieldRow row' class='useStepContainer' id='UseStepRow' style='display: none;'></div>");
if (this.isUsingLibraryStep) {
//useStepContainer.html("(" + doc.getDocLabel("page_testcasescript", "imported_from") + " <a href='./TestCaseScript.jsp?test=" + encodeURI(this.libraryStepTest) + "&testcase=" + encodeURI(this.libraryStepTestCase) + "&step=" + encodeURI(this.libraryStepSort) + "' >" + this.libraryStepTest + " - " + this.libraryStepTestCase + " - " + this.libraryStepSort + "</a>)").show();
var labelOptions = $("<span class='label label-primary optionLabel' style='background-color:rgba(114,124,245,.25);color:#727cf5'>" + doc.getDocLabel("page_testcasescript", "imported_from") + " <a href='./TestCaseScript.jsp?test=" + encodeURI(this.libraryStepTest) + "&testcase=" + encodeURI(this.libraryStepTestCase) + "&step=" + encodeURI(this.libraryStepSort) + "' >" + this.libraryStepTest + " - " + this.libraryStepTestCase + " - " + this.libraryStepSort + "</a></span>");
var labelOptions = $("<span class='label label-primary optionLabel' style='background-color:rgba(114,124,245,.25);color:#727cf5'>" + doc.getDocLabel("page_testcasescript", "imported_from") + " <a href='./TestCaseScript.jsp?test=" + encodeURI(this.libraryStepTest) + "&testcase=" + encodeURI(this.libraryStepTestCase) + "#stepId=" + this.libraryStepStepId + "' >" + this.libraryStepTest + " - " + this.libraryStepTestCase + " - " + this.libraryStepSort + "</a></span>");
stepLabelContainer.append(labelOptions[0]);

}
Expand Down Expand Up @@ -1883,6 +1890,11 @@ Step.prototype.show = function () {
var object = $(this).data("item");
$("#addActionBottomBtn").show();

const url = new URL(window.location);
url.hash = '#stepId=' + object.stepId;
window.history.pushState({}, '', url);
$("#seeLastExecUniq").parent().attr("href", "./TestCaseExecution.jsp?executionId=" + encodeURI(exeId) + window.location.hash + "-1");

for (var i = 0; i < object.steps.length; i++) {
var step = object.steps[i];

Expand Down

0 comments on commit 86d4c9a

Please sign in to comment.