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 'title' AS component, (SELECT COALESCE(title, caption)
FROM sqlpage_aide_navigation
WHERE namespace = 'prime' AND path = 'qualityfolio/test-detail.sql/index.sql') as contents;
;
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 s.name as title,
sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/qualityfolio/suite-data.sql?id=' || s.id as link
FROM test_cases r
INNER JOIN groups g on g.id = r.group_id
INNER JOIN test_suites s on s.id = g.suite_id
where test_case_id = $id
group by title;
select g.name as title,
sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/qualityfolio/test-cases.sql?id=' || g.id as link
FROM test_cases r
INNER JOIN groups g on g.id = r.group_id
where test_case_id = $id
group by title;
SELECT title FROM test_cases where test_case_id = $id order by created_at desc limit 1;
SELECT 'title'AS component,
title as contents FROM test_cases where test_case_id = $id order by created_at desc limit 1;
-- Test Case Details Accordion Container
SELECT 'html' AS component,
'<details class="test-detail-outer-accordion" open>
<summary class="test-detail-outer-summary">Test Case Details</summary>
<div class="test-detail-outer-content">' AS html;
SELECT 'card' AS component,
1 as columns;
SELECT
'
**Title** : ' || bd.title AS description_md,
'
**Group** : ' || bd.group_name AS description_md,
'
**Created By** : ' || bd.created_by AS description_md,
'
**Created At** : ' || strftime('%d-%m-%Y', bd.created_at) AS description_md,
'
**Priority** : ' || bd.priority AS description_md,
'
' || bd.body AS description_md
FROM test_cases bd WHERE bd.test_case_id = $id group by bd.test_case_id;
-- Close Test Case Details Accordion
SELECT 'html' AS component,
'</div></details>' AS html;
SELECT 'html' as component,
'<style>
tr.actualClass-passed td.State {
color: green !important; /* Default to red */
}
tr.actualClass-failed td.State {
color: red !important; /* Default to red */
}
tr.actualClass-passed td.Statealign-middle {
color: green !important; /* Default to red */
}
tr.actualClass-failed td.Statealign-middle {
color: red !important; /* Default to red */
}
.btn-list {
display: flex;
justify-content: flex-end;
}
h2.accordion-header button {
font-weight: 700;
}
/* Test Detail Outer Accordion Styles */
.test-detail-outer-accordion {
border: 1px solid #ddd;
border-radius: 8px;
margin: 20px 0;
overflow: hidden;
}
.test-detail-outer-summary {
background-color: #f5f5f5;
padding: 15px 20px;
cursor: pointer;
font-weight: 600;
color: #333;
border: none;
outline: none;
user-select: none;
list-style: none;
position: relative;
transition: background-color 0.2s;
}
.test-detail-outer-summary::-webkit-details-marker {
display: none;
}
.test-detail-outer-summary::after {
content: "+";
position: absolute;
right: 20px;
top: 50%;
transform: translateY(-50%);
font-size: 18px;
font-weight: bold;
color: #666;
}
.test-detail-outer-accordion[open] .test-detail-outer-summary::after {
content: "−";
}
.test-detail-outer-summary:hover {
background-color: #ebebeb;
}
.test-detail-outer-content {
padding: 20px;
background-color: white;
border-top: 1px solid #ddd;
}
</style>
' as html FROM test_case_run_results where test_case_id = $id group by group_id;
-- Test Execution Data Accordion Container
SELECT 'html' AS component,
'<details class="test-detail-outer-accordion" open>
<summary class="test-detail-outer-summary">Test Execution Data</summary>
<div class="test-detail-outer-content">' AS html;
--Define tabs
SELECT
'tab' AS component,
TRUE AS center
FROM test_case_run_results where test_case_id = $id group by group_id;
--Tab 1: Actual Result
SELECT
'Actual Result' AS title,
sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/qualityfolio/test-detail.sql?tab=actual-result&id='|| $id || '#actual-result-content' AS link,
$tab = 'actual-result' AS active
FROM test_case_run_results where test_case_id = $id group by group_id;
--Tab 2: Test Run
SELECT
'Test Run' AS title,
sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/qualityfolio/test-detail.sql?tab=test-run&id='|| $id || '#test-run-content' AS link,
$tab = 'test-run' AS active
FROM test_case_run_results where test_case_id = $id group by group_id;
--Tab 3: Bug Report
SELECT
'Bug Report' AS title,
sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/qualityfolio/test-detail.sql?tab=bug-report&id='|| $id || '#bug-report-content' AS link,
$tab = 'bug-report' AS active
FROM bug_list where test_case_id = $id;
SELECT
CASE
WHEN $tab = 'actual-result' THEN 'title'
END AS component,
'Actual Result' as contents
FROM test_case_run_results WHERE test_case_id = $id group by group_id;
SELECT
CASE
WHEN $tab = 'actual-result' THEN 'table'
WHEN $tab = 'test-run' THEN 'list'
WHEN $tab = 'bug-report' THEN 'foldable'
END AS component,
'Column Count' as align_right,
TRUE as sort,
TRUE as search
FROM test_case_run_results where test_case_id = $id group by group_id;
--Tab - specific content for "actual-result"
SELECT
step_name as 'Activity',
step_status as 'State',
'actualClass-'||step_status as _sqlpage_css_class,
step_start_time as 'Start Time',
step_end_time as 'End Time'
FROM test_execution_log
WHERE $tab = 'actual-result' and test_case_id = $id order by step_start_time desc;
SELECT
CASE
WHEN $tab = 'actual-result' THEN 'html'
END AS component,
'<div id="actual-result-content"></div>' as html
FROM test_execution_log
WHERE $tab = 'actual-result' and test_case_id = $id;
--Tab - specific content for "test-run"
SELECT
'
**Run Date** : ' || strftime('%d-%m-%Y',run_date) AS description_md,
'
**Environment** : ' || environment AS description_md,
'
' || body AS description_md
FROM test_run WHERE $tab = 'test-run' and test_case_id = $id;
SELECT
CASE
WHEN $tab = 'test-run' THEN 'html'
END AS component,
'<div id="test-run-content"></div>' as html
FROM test_run WHERE $tab = 'test-run' and test_case_id = $id;
--Tab - specific content for "bug-report"
SELECT
b.id||' - '||b.title as title,
'head-title' as class,
'
**Created By** : ' || b.created_by AS description_md,
'
**Run Date** : ' || strftime('%d-%m-%Y', b.created_at) AS description_md,
'
**Type** : ' || b.type AS description_md,
'
**Priority** : ' || b.priority AS description_md,
'
**Assigned** : ' || b.assigned AS description_md,
'
**Status** : ' || b.status AS description_md,
'
' || b.body AS description_md
FROM bug_report b
WHERE $tab = 'bug-report' and b.test_case_id = $id;
SELECT
CASE
WHEN $tab = 'bug-report' THEN 'html'
END AS component,
'<div id="bug-report-content"></div>' as html
FROM bug_report b INNER JOIN test_case_run_results r on b.test_case_id=r.test_case_id where r.status='failed' and $tab = 'bug-report';
-- Close Test Execution Data Accordion
SELECT 'html' AS component,
'</div></details>' AS html;