<%= link_to 'Back to Build', @test_case_result.smoca_build %>

<h1><%= @test_case_result.smoca_build.name %></h1>
<hr>
<h3><%= @test_case_result.test_case.name %></h3>

Result: <%= @test_case_result.result %>

<% if @test_case_result.has_exception_data? %>
  <hr>
  <%= render 'screenshot_modal', screenshot_url: @test_case_result.parsed_screenshot_url %>

  <div class="exception-data">
    <div class="exception-detail col-md-7">
      <h4>Exception Data</h4>
      <% if @test_case_result.failing_line %>
        <%= @test_case_result.failing_line %>
        <br>
      <% end %>

      <% if @test_case_result.exception_message %>
        <%= @test_case_result.exception_message %>
        <br>
      <% end %>

      <% if @test_case_result.backtrace_to_array.length > 0 %>
        <p></p>
        <div id="backtrace">
          <b>Backtrace:</b>
          <div id="backtrace-data">
            <% @test_case_result.backtrace_to_array.each do |trace| %>
              <text class="backtrace-line"><%= trace %></text>
              <br>
            <% end %>
          </div>
        </div>
      <% end %>
    </div>

    <% if @test_case_result.parsed_screenshot_url %>
      <div class="screenshot-data col-md-3">
        <h4>Screenshot</h4>
        <!--Link to the Image, open a new tab when clicked-->
        <%= link_to(
                image_tag(@test_case_result.parsed_screenshot_url, class: 'screenshot-image img-responsive', id: 'screenshot-thumbnail'),
                @test_case_result.parsed_screenshot_url, :target => '_blank') %>
      </div>
    <% end %>
  </div>
<% end %>
