Skip to content

Commit

Permalink
Started work on Testlink import feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
vertigo17 committed Dec 12, 2024
1 parent 1918829 commit 1468c10
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 6 deletions.
1 change: 1 addition & 0 deletions source/src/main/webapp/TestCaseList.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<%@ include file="include/pages/testcaselist/massActionTestCase.html"%>
<%@ include file="include/pages/testcaselist/importTestCase.html"%>
<%@ include file="include/pages/testcaselist/importTestCaseFromSIDE.html"%>
<%@ include file="include/pages/testcaselist/importTestCaseFromTestLink.html"%>

<h1 class="page-title-line" id="title">Test Case List</h1>

Expand Down
Binary file added source/src/main/webapp/images/TestLink.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ <h4 class="modal-title" id="importTestCaseFromSIDEModalLabel" name="importTestCa
</div>

<div class="row">
<div class="col-sm-2 text-center" style="height: 100%">
<div class="col-sm-3 text-center" style="height: 100%">
<img height='100' src='./images/SeleniumIDE.jpg'>
</div>
<div class="col-sm-10 marginLeft20">
<div class="col-sm-9 marginLeft20">
<br>
<label>Download the Selenium IDE plugin from <a href="https://addons.mozilla.org/fr/firefox/addon/selenium-ide/" target="_blank">Firefox</a> or <a href="https://chrome.google.com/webstore/detail/selenium-ide/mooikfkahbdckldjjndioackbalphokd" target="_blank">Chrome</a></label>
<br>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<!--Mass Action on a Test Case List -->
<div data-backdrop="static" class="modal fade center" id="importTestCaseFromTestLinkModal" role="dialog" aria-labelledby="importTestCaseFromTestLinkModalLabel" aria-hidden="true">
<div class="modal-dialog nomargintop nomarginbottom modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="importTestCaseFromTestLinkModalLabel" name="importTestCaseFromTestLinkField">Import test cases from Test Link</h4>
</div>
<div class="modal-body">
<!--edit form-->
<form id="importTestCaseFromTestLinkModalForm" name="importTestCaseFromTestLinkModalForm" title="Import TestCase" role="form" enctype="multipart/form-data">
<div class="container-fluid center">
<!-- messages area-->
<div id="DialogMessagesArea">
<div class="alert" id="DialogMessagesAlert" style="display:none;">
<strong><span class="alert-description" id="DialogAlertDescription"></span></strong>
<button type="button" class="close" data-hide="alert" aria-hidden="true">
<span class="glyphicon glyphicon-remove alert-right alert-close pull-right"></span>
</button>
</div>
</div>

<div class="row">
<div class="col-md-4 text-center" style="height: 100%">
<img height='100' src='./images/TestLink.png'>
</div>
<div class="col-md-8 marginLeft20">
<br>
<label>Use the Form below in order to integrate your Test Link Test cases into Cerberus.</label>
</div>
</div>

<div class="row marginTop20">
<div class="col-xs-6">
<div class="form-group">
<label for="test">Target Test Folder</label>
<select class="form-control" type="text" name="test" id="targetTest"></select>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label for="application">Application</label>
<select class="form-control" type="text" name="application" id="targetApplication"></select>
</div>
</div>
</div>

<div class="row marginTop15">
<div class="form-group col-xs-12">
<label for="filesTestLink">Select the Test Link files to import (.xml format)</label>
<input class="form-control-file" type="file" multiple="multiple" name="files[]" id="filesTestLink">
</div>
</div>

</div>
</form>
<div class="container-fluid center" id='filetestlink-list-display'></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal" name="buttonClose">Close</button>
<button type="button" id="importTestCaseFromTestLinkButton" class="btn btn-primary" name="buttonImport">Import</button>
</div>
</div>
</div>
</div>
37 changes: 33 additions & 4 deletions source/src/main/webapp/js/pages/TestCaseList.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ function renderOptionsForTestCaseList(data) {
// contentToAdd += "<button id='exportTestCaseMenuButtonSingleFile' type='button' class='btn btn-default' name='buttonExport'><span class='glyphicon glyphicon-export'></span> " + doc.getDocLabel("page_testcaselist", "btn_export1file") + "</button>";
contentToAdd += "<button id='importTestCaseButton' type='button' class='btn btn-default'><span class='glyphicon glyphicon-import'></span> " + doc.getDocLabel("page_testcaselist", "btn_import") + "</button>";
contentToAdd += "<button id='importFromSIDETestCaseMenuButton' type='button' class='btn btn-default'><img height='20 px' src='./images/SeleniumIDE.jpg'></span> " + doc.getDocLabel("page_testcaselist", "btn_import_ide") + "</button>";
contentToAdd += "<button id='importFromTestLinkTestCaseMenuButton' type='button' style='display: none;' class='btn btn-default'><img height='20 px' src='./images/TestLink.png'></span> " + doc.getDocLabel("page_testcaselist", "btn_import_testlink") + "</button>";
contentToAdd += "</div>";
contentToAdd += "</div>";
contentToAdd += "<button id='createBrpMassButton' type='button' class='btn btn-default'><span class='glyphicon glyphicon-th-list'></span> " + doc.getDocLabel("page_global", "button_massAction") + "</button>";
Expand All @@ -203,6 +204,7 @@ function renderOptionsForTestCaseList(data) {
$("#testCaseList #exportTestCaseMenuButtonSingleFile").click(exportTestCasesMenuClick);
$('#testCaseList #importTestCaseButton').click(importTestCasesMenuClick);
$('#testCaseList #importFromSIDETestCaseMenuButton').click(importTestCasesFromSIDEMenuClick);
$('#testCaseList #importFromTestLinkTestCaseMenuButton').click(importTestCasesFromTestLinkMenuClick);
$('#testCaseList #createBrpMassButton').click(massActionClick);
}
}
Expand Down Expand Up @@ -603,7 +605,7 @@ function importTestCasesFromSIDEMenuClick() {
for (var i = 0; i < fileInput.files.length; i++) {
fileList.push(fileInput.files[i]);
}
renderFileSIDEList(fileList, 'fileside-list-display');
renderFileList(fileList, 'fileside-list-display');
});

$("#importTestCaseFromSIDEButton").click(function () {
Expand All @@ -623,8 +625,36 @@ function importTestCasesFromSIDEMenuClick() {
$('#importTestCaseFromSIDEModal').modal('show');
}

function renderFileSIDEList(fileList, elementId) {
console.log("render");
function importTestCasesFromTestLinkMenuClick() {
$("#importTestCaseFromTestLinkButton").off("click");

var fileInput = document.getElementById('filesTestLink');
fileInput.addEventListener('change', function (evnt) {
fileList = [];
for (var i = 0; i < fileInput.files.length; i++) {
fileList.push(fileInput.files[i]);
}
renderFileList(fileList, 'filetestlink-list-display');
});

$("#importTestCaseFromTestLinkButton").click(function () {
confirmImportTestCaseFromTestLinkModalHandler();
});

var doc = new Doc();
var text = doc.getDocLabel("page_testcaselist", "import_testcase_msg");
$('#importTestCaseModalText').text(text);

$('#importTestCaseFromTestLinkModalForm #targetTest').empty();
$('#importTestCaseFromTestLinkModalForm #targetTest').select2(getComboConfigTest());

$('#importTestCaseFromTestLinkModalForm #targetApplication').empty();
$('#importTestCaseFromTestLinkModalForm #targetApplication').select2(getComboConfigApplication(false));

$('#importTestCaseFromTestLinkModal').modal('show');
}

function renderFileList(fileList, elementId) {
var fileListDisplay = document.getElementById(elementId);
fileListDisplay.innerHTML = '';
fileList.forEach(function (file, index) {
Expand All @@ -634,7 +664,6 @@ function renderFileSIDEList(fileList, elementId) {
});
}


function confirmImportTestCaseFromSIDEModalHandler() {
clearResponseMessage($('#importTestCaseModal'));

Expand Down

0 comments on commit 1468c10

Please sign in to comment.