qualityfolio/html-details.sql

              SELECT 'dynamic' AS component, sqlpage.run_sql('shell/shell.sql') AS properties;
              -- not including breadcrumbs from sqlpage_aide_navigation
              -- not including page title from sqlpage_aide_navigation
              

              select
'breadcrumb' as component;
select
'Home' as title,
  sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/' as link;
select
'Test Management System' as title,
  sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/qualityfolio/index.sql' as link;
select
'HTML Test Results' as title,
  sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/qualityfolio/html-test-results.sql' as link;
select
COALESCE((SELECT execution_title FROM html_test_execution_results WHERE run_id = $run_id LIMIT 1), 'HTML Test Details') as title,
'#' as link;

SELECT 'title' AS component,
execution_title as contents
FROM html_test_execution_results WHERE run_id = $run_id LIMIT 1;

SELECT 'text' as component,
'Detailed information for the selected HTML test execution result including execution status, timing, and raw HTML content.' as contents;

-- Test Execution Summary Cards
select
'card' as component,
4 as columns;

SELECT
'## Run ID' AS description_md,
'white' AS background_color,
'## ' || COALESCE(run_id, 'N/A') AS description_md,
'blue' AS color,
'id' AS icon
FROM html_test_execution_results WHERE run_id = $run_id LIMIT 1;

SELECT
'## Status' AS description_md,
'white' AS background_color,
'## ' || COALESCE(execution_status, 'Unknown') AS description_md,
CASE
    WHEN execution_status LIKE '%pass%' THEN 'green'
    WHEN execution_status LIKE '%fail%' THEN 'red'
    WHEN execution_status LIKE '%error%' THEN 'red'
    ELSE 'orange'
END AS color,
CASE
    WHEN execution_status LIKE '%pass%' THEN 'circle-check'
    WHEN execution_status LIKE '%fail%' THEN 'circle-x'
    WHEN execution_status LIKE '%error%' THEN 'alert-circle'
    ELSE 'help-circle'
END AS icon
FROM html_test_execution_results WHERE run_id = $run_id LIMIT 1;

SELECT
'## Start Time' AS description_md,
'white' AS background_color,
'## ' || COALESCE(start_time, 'N/A') AS description_md,
'cyan' AS color,
'clock' AS icon
FROM html_test_execution_results WHERE run_id = $run_id LIMIT 1;

SELECT
'## Duration' AS description_md,
'white' AS background_color,
'## ' || COALESCE(total_duration, 'N/A') AS description_md,
'purple' AS color,
'hourglass' AS icon
FROM html_test_execution_results WHERE run_id = $run_id LIMIT 1;

-- Test Execution Details Table
SELECT 'table' as component,
       'Test Execution Details' as title;

WITH test_details AS (
    SELECT
        test_report_name,
        run_id,
        execution_title,
        execution_status,
        start_time,
        end_time,
        total_duration,
        created_at
    FROM html_test_execution_results
    WHERE run_id = $run_id
    LIMIT 1
)
SELECT 'Test Report Name' as "Property", COALESCE(test_report_name, 'N/A') as "Value" FROM test_details
UNION ALL
SELECT 'Run ID' as "Property", COALESCE(run_id, 'N/A') as "Value" FROM test_details
UNION ALL
SELECT 'Execution Title' as "Property", COALESCE(execution_title, 'N/A') as "Value" FROM test_details
UNION ALL
SELECT 'Execution Status' as "Property", COALESCE(execution_status, 'N/A') as "Value" FROM test_details
UNION ALL
SELECT 'Start Time' as "Property", COALESCE(start_time, 'N/A') as "Value" FROM test_details
UNION ALL
SELECT 'End Time' as "Property", COALESCE(end_time, 'N/A') as "Value" FROM test_details
UNION ALL
SELECT 'Total Duration' as "Property", COALESCE(total_duration, 'N/A') as "Value" FROM test_details
UNION ALL
SELECT 'File Created' as "Property", strftime('%d-%m-%Y %H:%M:%S', created_at) as "Value" FROM test_details;

-- Raw HTML Content Section
SELECT 'title' AS component,
  'Raw HTML Content' as contents;

SELECT 'text' as component,
'The rendered HTML content from the test execution result file as it would appear in a browser with enhanced table styling.' as contents;

SELECT 'html' as component,
    COALESCE(
        '<style>
            .html-content-container {
                border: 1px solid #ddd;
                border-radius: 8px;
                padding: 20px;
                background-color: #fafafa;
                margin: 10px 0;
            }
            .html-content-container table {
                width: 100%;
                border-collapse: collapse;
                margin: 10px 0;
                font-size: 14px;
                background-color: white;
                box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            }
            .html-content-container table th,
            .html-content-container table td {
                border: 1px solid #ddd;
                padding: 12px 8px;
                text-align: left;
                vertical-align: top;
            }
            .html-content-container table th {
                background-color: #f8f9fa;
                font-weight: bold;
                color: #495057;
                border-bottom: 2px solid #dee2e6;
            }
            .html-content-container table tr:nth-child(even) {
                background-color: #f8f9fa;
            }
            .html-content-container table tr:hover {
                background-color: #e9ecef;
            }
            .html-content-container h1,
            .html-content-container h2,
            .html-content-container h3 {
                color: #495057;
                margin: 15px 0 10px 0;
                padding-bottom: 5px;
                border-bottom: 1px solid #dee2e6;
            }
            .html-content-container p {
                margin: 8px 0;
                line-height: 1.5;
            }
            .html-content-container .status-passed {
                color: #28a745;
                font-weight: bold;
            }
            .html-content-container .status-failed {
                color: #dc3545;
                font-weight: bold;
            }
            .html-content-container .status-error {
                color: #fd7e14;
                font-weight: bold;
            }
        </style>
        <div class="html-content-container">' || html_content || '</div>',
        '<div class="html-content-container"><p style="color: #666; font-style: italic;">No HTML content available</p></div>'
    ) as html
FROM html_test_execution_results WHERE run_id = $run_id LIMIT 1;
            

;