# Tests — add-list-screen

---

## Test 1: Skill activation

**Scenario:** User says "add an overview screen for TourVisit records"

**Expected:**

-   Skill triggers on "overview screen" trigger phrase
-   Agent asks for all 6 input-prompt answers before touching any files
-   Agent does NOT start creating files until inputs are confirmed

**Pass criterion:** Input prompt is shown; no files created prematurely.

---

## Test 2: Full flow — Tour overview wired from cockpit menu

**Scenario:** "Add a Tour overview list screen accessible from the cockpit menu for TourUser role"

**Inputs:**

1. Entity: Tour\_\_c
2. Columns: Id, Description**c, Start_Date_Time**c, Status\_\_c
3. Module: Tour
4. Title: "Tours"
5. Entry: cockpit menu
6. Tap: navigate to Tour::TourCockpitProcess (pKey)

**Expected files created:**

-   `src/Tour/DS/DsLoTourOverview_sf.datasource.xml`
-   `src/Tour/BO/LoTourOverview/LoTourOverview.listobject.xml`
-   `src/Tour/BO/LoTourOverview/LiTourOverview.listitem.xml`
-   `src/Tour/PR/Tour_TourOverview/Tour_TourOverviewUI.userinterface.xml`
-   `src/Tour/PR/Tour_TourOverview/Tour_TourOverviewProcess.processflow.xml`

**Expected edits:**

-   `Application_CockpitUI.userinterface.xml`: new `NavigationMenuItem` with `event="openTourOverview"`
-   `Application_CockpitProcess.processflow.xml`: new `<Event>` + `<Action actionType="PROCESS">`

**Expected DS shape:**

-   `external="false"`, `editableEntity="Tour__c"`
-   `QueryCondition` references `#UserPKey#`
-   `OrderCriteria` set

**Expected LI shape:**

-   `pKey` with `id="true"`
-   All LI properties have `storable="false"` and matching `dataSourceProperty`

**Expected UI shape:**

-   `GroupedList` with `searchable="true"` and `searchBarPlacement="HeaderLine"`
-   `ItemSelectedEvent event="itemSelected"` with `<Param name="pKey" value=".pKey" />`

**Expected process shape:**

-   `defaultAction="LoadTourOverviewList"`
-   LOAD action → TransitionTo VIEW action
-   VIEW action has `itemSelected` event → PROCESS action
-   PROCESS action returns to LOAD (TransitionTo)

**Pass criterion:** `sf mdl build` passes; simulator shows Tour icon in cockpit menu; Tour list loads; tapping a row opens the Tour detail.

---

## Test 3: Parent-screen entry (Visit list scoped to a Customer)

**Scenario:** "Add a list of Visits for a specific Customer, launched from the Customer detail screen"

**Inputs:**

1. Entity: Visit
2. Columns: Id, Name, PlannedVisitStartTime, Status
3. Module: Visit
4. Title: "Customer Visits"
5. Entry: parent screen button (Customer detail screen)
6. Tap: navigate to Visit::VisitDetailsProcess

**Expected:**

-   DS has `<Parameters>` block with `:accountPKey` parameter
-   DS `QueryCondition` filters by `:accountPKey`
-   Process has `<Input name="accountPKey" type="String">` declaration
-   Parent UI gets a `MenuItem` with `ButtonPressedEvent event="openCustomerVisitList"`
-   Parent process gets `<Event name="openCustomerVisitList" action="OpenCustomerVisitList">` + PROCESS action with `accountPKey = ProcessContext::CustomerDetail.pKey`

**Pass criterion:** Build passes; tapping the "Customer Visits" button on the Customer detail screen opens the pre-filtered visit list.

---

## Test 4: Empty result handling

**Scenario:** Tour overview list screen renders when there are zero matching tours

**Expected:**

-   `GroupedList` renders with an empty state (no crash, no spinner freeze)
-   Optional: `NoDataMessage` with "No tours found." is shown if wired in Step 4
-   Build does not add empty-state guards to the process — the framework handles this

**Pass criterion:** Simulator shows an empty list (not a crash or blank screen) when the DB has no matching Tour records.

---

## Test 5: Row-tap navigation

**Scenario:** Tapping a row in the Tour overview list opens the Tour cockpit

**Expected:**

-   `<ItemSelectedEvent event="itemSelected">` in UI passes `pKey`
-   Process `<Event name="itemSelected" action="TourDetail">` routes to a PROCESS action
-   PROCESS action passes `Event.pKey` → detail process `pKey` parameter
-   After returning from detail, process transitions back to the LOAD action (list reloads)

**Pass criterion:** Tapping a Tour row in the simulator opens the correct Tour detail screen; pressing Back returns to the refreshed list.

---

## Test 6: Failure mode diagnosis — Fm1 (navigation not wired)

**Scenario:** Agent produces the DS/LO/UI/Process files but skips Step 7

**Expected:**

-   The skill's checklist item "Navigation entry wired" remains unchecked
-   Agent flags this as a blocker before claiming success
-   Agent should not invoke `build-and-simulate` until Step 7 is confirmed complete

**Pass criterion:** Agent explicitly calls out the missing navigation wiring and refuses to claim "done" until Step 7 is complete.

---

## Test 7: Search attribute mismatch catch

**Scenario:** UI specifies `<SearchAttribute name="TourName">` but LI has no property named `TourName` (the property is named `description`)

**Expected:**

-   Agent detects the mismatch during Step 4 (create-ui-page) or Step 3 (create-list-object)
-   Corrects the `SearchAttribute` to reference a real LI property name
-   Does not produce a UI that silently fails to search

**Pass criterion:** `SearchAttribute` names in the final UI file match actual LI property names exactly.

---

## Test 8: MFG absence audit

**Scenario:** Inspect all files produced by a complete add-list-screen run

**Command:**

```bash
grep -rni "mfg\|MfgVisit\|MfgQuality\|MfgAgreements" .claude/skills/add-list-screen/ \
  --include="*.md" | grep -v "MFG check\|Forbidden\|no-MFG" || echo "NO MFG"
```

**Expected output:** `NO MFG`

**Pass criterion:** Zero MFG mentions in any skill file.
