qualityfolio/suite-group.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
              

              

    --Define tabs
    SELECT
    'tab' AS component,
      TRUE AS center;

    --Tab 1: Test Suite list
    SELECT
    'Test Plan List' AS title,
      sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/qualityfolio/suite-group?tab=test_suites' AS link,
        $tab = 'test_suites' AS active;
      SELECT 'html' AS component,
        (SELECT COALESCE('<section class="requirement-hero" style="background:linear-gradient(90deg,#ffffff,#f7f9fc);padding:22px;border-radius:10px;margin-bottom:18px;border:1px solid #eceff3;">' ||
          '<div style="display:flex;gap:20px;align-items:flex-start">' ||
          '<div style="flex:1">' ||
          '<h1 style="margin:0 0 8px 0;font-size:24px;font-weight:700;color:#1f2937">' || COALESCE(req.title, req.requirement_id) || '</h1>' ||
          '<p style="margin:0 0 12px 0;color:#374151;line-height:1.5">' || COALESCE(req.description, 'No description') || '</p>' ||
          '<div style="color:#6b7280;font-size:13px">' ||
          COALESCE(req.created_by, '') ||
          CASE WHEN req.created_by IS NOT NULL AND req.created_at IS NOT NULL THEN ' • ' ELSE '' END ||
          CASE WHEN req.created_at IS NOT NULL THEN strftime('%d-%m-%Y', req.created_at) ELSE '' END ||
          CASE WHEN req.version IS NOT NULL THEN ' • v' || req.version ELSE '' END ||
          CASE WHEN req.type IS NOT NULL THEN ' • ' || req.type ELSE '' END ||
          '</div>' ||
          '</div>' ||
          '<div style="min-width:160px;text-align:right">' ||
          '<a href="' || sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/qualityfolio/test_case_related_requirements.sql?requirement=' || REPLACE(REPLACE(req.requirement_id, ' ', '%20'), '&', '%26') || '" style="display:inline-block;background:#eef2ff;color:#3730a3;padding:8px 12px;border-radius:6px;text-decoration:none;font-weight:600">View related test cases</a>' ||
          '</div>' ||
          '</div>' ||
          '</section>', '<div class="requirement-detail"><p>No requirement found</p></div>') AS html
        '
 **Created By**  :  ' || rn.created_by_user AS description_md,
          '
 **Created At**  :  ' || strftime('%d-%m-%Y', rn.created_at) AS description_md,
            '
 **Priority**  :  ' || rn.linked_requirements AS description_md,
              '
' || rn.body AS description_md
FROM test_suites rn WHERE id = $id;


    --Define component type based on active tab
    SELECT
    CASE
        WHEN $tab = 'test_cases' THEN 'table'
        WHEN $tab = 'test_suites' THEN 'table'
        WHEN $tab = 'test_run' THEN 'table'
      END AS component,
      TRUE AS sort,
        --TRUE AS search,
          'URL' AS align_left,
            'title' AS align_left,
              'group' as markdown,
              'id' as markdown,
              'count' as markdown;

    --Conditional content based on active tab

    --Tab - specific content for "test_suites"
    SELECT
      '[' || test_case_id || '](' || sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/qualityfolio/test-detail.sql?tab=actual-result&id='|| test_case_id || ')' as id,
      test_case_title AS "title",
        group_name AS "group",
          created_by as "Created By",
          formatted_test_case_created_at as "Created On",
          priority as "Priority"
    FROM test_cases
    WHERE $tab = 'test_cases' and group_id = $id 
    order by test_case_id;




    --Tab - specific content for "test_run"
   SELECT
      name AS "Property Name"
    FROM groups
    WHERE $tab = 'test_run';
            

;