
form={{form:SE}}

# Plus Button
{
  sql = SELECT 'p:{{pageSlug:T}}?form=e2e_test_form&r=0&reference=test|s|N|A:data-reference="new_record"' AS _link
  tail = <hr>
}

# Get form id for further changes
{
  sql = SELECT id AS _formId FROM Form WHERE name = 'e2e_test_form'
}

# Reset existing form and truncate table
{
  sql = SELECT '' FROM DUAL WHERE '{{action:CE:alnumx}}' = 'resetForm'

  # Delete existing form (clear parameters, etc.)
  {
    sql = DELETE FROM FormElement WHERE formId = '{{formId:R0}}'
  }
  {
    sql = DELETE FROM Form WHERE id = '{{formId:R0}}'
  }
  # Truncate the SQL table
  {
    sql = TRUNCATE TABLE E2eTestForm
  }

        {
            sql = INSERT INTO `Form` (`name`, `title`, `noteInternal`, `tableName`, `primaryKey`, `permitNew`, `permitEdit`, `restMethod`, `escapeTypeDefault`, `render`, `requiredParameterNew`, `requiredParameterEdit`, `dirtyMode`, `showButton`, `multiMode`, `multiSql`, `multiDetailForm`, `multiDetailFormParameter`, `forwardMode`, `forwardPage`, `labelAlign`, `bsLabelColumns`, `bsInputColumns`, `bsNoteColumns`, `parameter`, `parameterLanguageA`, `parameterLanguageB`, `parameterLanguageC`, `parameterLanguageD`, `recordLockTimeoutSeconds`, `deleted`)
            VALUES ('e2e_test_form', 'E2E Test Form', '', 'E2eTestForm', '', 'sip', 'sip', '', 'c', 'bootstrap', 'reference', '', 'exclusive', 'new,delete,close,save,note', 'none', '', '', '', 'auto', '', 'default', '', '', '', '', '', '', '', '', '900', 'no')
        }
        
                {
                    sql = SET @form_id = LAST_INSERT_ID();
                }
                {
                    sql = INSERT INTO `FormElement` (`formId`, `feIdContainer`, `dynamicUpdate`, `encryption`, `encryptionMethod`, `enabled`, `name`, `label`, `mode`, `modeSql`, `class`, `type`, `subrecordOption`, `encode`, `checkType`, `checkPattern`, `onChange`, `ord`, `tabindex`, `size`, `maxLength`, `labelAlign`, `bsLabelColumns`, `bsInputColumns`, `bsNoteColumns`, `rowLabelInputNote`, `note`, `adminNote`, `tooltip`, `placeholder`, `value`, `sql1`, `parameter`, `parameterLanguageA`, `parameterLanguageB`, `parameterLanguageC`, `parameterLanguageD`, `clientJs`, `deleted`)
                    VALUES (@form_id, 0, 'no', 'no', 'Default', 'yes', 'test_text', 'Name', 'show', '', 'native', 'text', '', 'specialchar', 'auto', '', '', '10', '0', '', '', 'default', '', '', '', 'row,label,/label,input,/input,note,/note,/row', '', '', '', '', '', '', '', '', '', '', '', '', 'no'),
(@form_id, 0, 'no', 'no', 'Default', 'yes', 'test_email', 'Email', 'show', '', 'native', 'text', '', 'specialchar', 'email', '', '', '20', '0', '', '', 'default', '', '', '', 'row,label,/label,input,/input,note,/note,/row', '', '', '', '', '', '', '', '', '', '', '', '', 'no'),
(@form_id, 0, 'no', 'no', 'Default', 'yes', 'test_pathFileName', 'Upload', 'show', '', 'native', 'upload', '', 'specialchar', 'auto', '', '', '30', '0', '', '', 'default', '', '', '', 'row,label,/label,input,/input,note,/note,/row', '', '', '', '', '', '', '', '', '', '', '', '', 'no')
                }
                }
        {
            sql = SELECT 'p:{{pageSlug:T}}?form=e2e_test_form&r=0&reference=test|s|b|t:Render|A:data-reference="render-button"' AS _link
        }
        render = single

# Record list with per-row edit links (used by the e2e test harness)
{
  sql = SELECT CONCAT('p:{{pageSlug:T}}?form=e2e_test_form&r=', id, '|s|t:Edit ', id, '|A:data-reference="edit_record_', id, '"') AS _link, ' ' FROM E2eTestForm ORDER BY id
  head = <div data-reference="record-list">
  tail = </div>
}

# Static fixtures for the report e2e tests (test_report.py) — keep minimal,
# report LOGIC is covered by phpunit; only browser-visible behaviour here:
# store TYPO3 variable, client-variable sanitizing, _link question dialog.
{
  sql = SELECT '<span data-reference="slug-out">{{pageSlug:T}}</span> <span data-reference="sanitize-out">{{qdemo:CE:alnumx}}</span>'
  head = <hr>
}
{
  sql = SELECT 'p:{{pageSlug:T}}?qdone=1|q:Are you sure?|t:QuestionLink|A:data-reference="question_link"' AS _link
}
        