Advertisement
Afaeld

DuplicateTestRuns

Sep 25th, 2018
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. name: Duplicate test runs
  2. description: Allow users to duplicate a run inside a plan
  3. author:
  4. version: 1.0
  5. includes:
  6. excludes:
  7.  
  8. js:
  9. $(document).ready(
  10. function() {
  11. $(".plan-entry").each(function()
  12. {
  13.     var entry = $(this).attr("id");
  14.     entry = entry.split("entry-")[1];
  15.     if($(this).find(".includeAllLink.hidden").length)
  16.     {
  17.         $(this).find(".summary-description-compact").append(" | <a href='#' class='link copyTestRun' value='"+entry+"'>Duplicate this test Run</a>");
  18.     }
  19.     else
  20.     {
  21.         console.log("All cases included");
  22.     }
  23.  
  24.     //console.log(window.location.href);
  25.     //console.log(uiscripts.env.page_base);
  26.  
  27. });
  28.  
  29.  
  30. $(".copyTestRun").click(function(){
  31.     var r = confirm("Please save the plan before using this functionnality, all unsaved modifications will be lost. Click ok to continue the copy.")
  32.     if (r == true)
  33.     {
  34.     currentEntry = $(this).attr("value");
  35.     testPlan = window.location.href.split('/')[6];
  36.     console.log(testPlan);
  37.     // alert(currentEntry);
  38.     $.ajax(
  39.     {
  40.         url: "duplicateTestRuns.php?entry_id="+currentEntry+"&plan_id="+testPlan,
  41.         // dataType: "json",
  42.         // data: {entry: currentEntry},
  43.         type: "GET",
  44.         async: false,
  45.         success : function(html,status){
  46.             console.log(html);
  47.             location.reload();
  48.  
  49.         },
  50.         error : function(result,status,error){
  51.             console.log(result);
  52.             alert("error");
  53.         }
  54.     });
  55.     }
  56.  
  57. });
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement