$('#custom_test_execution_modal').html('<%= raw @modal_content %>');
// $("#prepare_custom_test_execution_form").attr("action", "/test_files/execute_test_custom/<%= @test_case.id %>.js");
$("#custom_test_execution_modal").modal("show");

$("select.select2").select2({ width: '100%' });      

$("#prepare_custom_test_execution_form").submit (function() {
  
  var form = $(this);
  var url = form.attr('action');

  $("#execution-in-progress").show();
  $("#custom-execution-progress-animation").show();

  $("#test-stdout").html("");
  $("#execution-timing").html("");

  var start_time = new Date();
  
     $.ajax({
            type: "POST",
            url: url,
            data: form.serialize(),
            success: function(data)
            {
              var time_cost = new Date().getTime() - start_time.getTime();
              $("#execution-in-progress").hide();              
              $("#custom-execution-progress-animation").hide();
              $("#execution-timing").html(time_cost/ 1000 + " s");              
              $("#execution-timing").show();
              // alert(data);
            }
          });
          
  return false; 
});