qltyfolio/test-cases.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') || '/qltyfolio/index.sql' as link;

  SELECT name as title,
  sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/qltyfolio/suite-data.sql?id='|| id as link
  FROM test_suites where id=(select suite_id from test_cases where group_id = $id) ;

  SELECT group_name as title,
  sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/qltyfolio/suite-data.sql?id='|| suite_id as link
  FROM test_cases WHERE  group_id = $id group by group_name;
  
  SELECT 'list'  AS component,
    group_name as title FROM test_cases
  WHERE  group_id = $id group by group_name;
  SELECT
  'A structured summary of a specific test scenario, detailing its purpose, preconditions, test data, steps, and expected results. The description ensures clarity on the tests objective, enabling accurate validation of functionality or compliance. It aligns with defined requirements, identifies edge cases, and facilitates efficient defect detection during execution.
  ' as description;

 SELECT 'html' as component,
  '<style>
      tr.rowClass-passed td.test_status {
          color: green !important; /* Default to red */
      }
       tr.rowClass-failed td.test_status {
          color: red !important; /* Default to red */
      }
      .btn-list {
      display: flex;
      justify-content: flex-end;
  }
  </style>
  
  ' as html;
  select 
  'button' as component;
select 
  'Generate Report'           as title,
  'download-test-case.sql?group_id='||$id as link;

 SET total_rows = (SELECT COUNT(*) FROM test_cases WHERE group_id=$id);
SET limit = COALESCE($limit, 50);
SET offset = COALESCE($offset, 0);
SET total_pages = ($total_rows + $limit - 1) / $limit;
SET current_page = ($offset / $limit) + 1;

  SELECT 'table' as component,
    TRUE AS sort,
      --TRUE AS search,
        'URL' AS align_left,
          'title' AS align_left,
            'group' as markdown,
            'id' as markdown,
            "status_new" as markdown,
            'count' as markdown;
  SELECT
  '[' || test_case_id || '](' || sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/qltyfolio/test-detail.sql?tab=actual-result&id='|| test_case_id || ')' as id,
    test_case_title AS "title",
      group_name AS "group",
        test_status,
    'rowClass-'||test_status as _sqlpage_css_class,
    created_by as "Created By",
    formatted_test_case_created_at as "Created On",
    priority as "Priority"
  FROM test_cases t
  WHERE  group_id = $id
  LIMIT $limit
    OFFSET $offset;
    SELECT 'text' AS component,
    (SELECT CASE WHEN $current_page > 1 THEN '[Previous](?limit=' || $limit || '&offset=' || ($offset - $limit) ||  '&id=' || $id ||   ')' ELSE '' END) || ' ' ||
    '(Page ' || $current_page || ' of ' || $total_pages || ") " ||
    (SELECT CASE WHEN $current_page < $total_pages THEN '[Next](?limit=' || $limit || '&offset=' || ($offset + $limit) ||   '&id=' || $id ||  ')' ELSE '' END)
    AS contents_md;