# Test Case: Flows & Automation

> **Test ID**: FLW-TEST-001
> **Priority**: P1
> **Test Environment**: NexusCRM (https://nexuscrm.pingcap.com)
> **Last Updated**: 2026-03-30
> **Test Agent**: dev-browser (Playwright-based automation)

## 1. Test Overview

This test covers the Flows & Automation functionality in NexusCRM with focus on:
- **Flow List**: Default view, tabs, search, new flow creation
- **Flow Builder**: Canvas rendering, node interactions, toolbar functionality
- **Prior bugs re-verified**: Canvas empty (FLOW-002), search broken

**Test Results Summary**: 9 paths defined, 7 Complete, 2 Partial

**Key Finding**: Flow Builder canvas **DOES render nodes** when opened via "New Flow" button — shows Record-Triggered Flow Start node and End node. Previous "empty canvas" finding may be flow-specific or stale.

---

## 2. Prerequisites

- **Environment**: NexusCRM deployed at https://nexuscrm.pingcap.com
- **Authentication**: OAuth token-based (client credentials flow)
- **Test Data**: 19 flows in system (may have changed)
- **Browser Tool**: dev-browser CLI (QuickJS + Playwright API)

---

## 3. Test Steps

### FLW-L01: Flow List — Default View

**Objective**: Verify Flow list page loads correctly with proper column headers and flow data

| Step | Action | Expected Result | Actual Result | Pass/Fail |
|------|--------|-----------------|---------------|-----------|
| 1 | Navigate to `/setup/flows` | Page loads successfully | URL: https://nexuscrm.pingcap.com/setup/flows | Pass |
| 2 | Observe page heading | "Flows" heading displayed | Heading "Flows" displayed | Pass |
| 3 | Check total flow count | Shows actual flow count | **19 flows** displayed | Pass |
| 4 | Record column headers | Human-readable labels | **Headers**: Flow Label, API Name, Type, Trigger, Object, Last Modified | Pass |
| 5 | Record first 5 flows | Flow data displayed | See table below | Pass |
| 6 | Check Active/Inactive display | Status clearly visible | Status appended to Flow Label (e.g., "account_ACV_stage**Inactive**") | Pass |

**First 5 Flows**:

| Flow Label | API Name | Type | Trigger | Last Modified |
|------------|----------|------|---------|---------------|
| account_ACV_stageInactive | account_ACV_stage | Workflow | — | 6/19/2023 |
| Account_And_Lead_Sum_Approval_PocActive | Account_And_Lead_Sum_Approval_Poc | AutoLaunchedFlow | — | 5/18/2022 |
| Account_Auto_Create_OrgActive | Account_Auto_Create_Org | AutoLaunchedFlow | — | 8/4/2025 |
| Account_Contract_Valid_MessageActive | Account_Contract_Valid_Message | AutoLaunchedFlow | — | 4/13/2025 |
| Account_Contract_Valid_Message_1Active | Account_Contract_Valid_Message_1 | AutoLaunchedFlow | — | 4/13/2025 |

**Active/Inactive Display**: Status is **appended to Flow Label text** (e.g., "FlowNameActive" or "FlowNameInactive") — not a separate column or badge. This is non-standard UI pattern.

**Reference Screenshot**: `screenshots/flows/list_default.png`

---

### FLW-L02: Flow List — Tabs

**Objective**: Verify tab navigation works correctly

| Step | Action | Expected Result | Actual Result | Pass/Fail |
|------|--------|-----------------|---------------|-----------|
| 1 | Observe default tab | "Flows" tab selected | "Flows" tab active by default | Pass |
| 2 | Click "Approval Processes" tab | Content switches to approval processes | 19 approval processes displayed | Pass |
| 3 | Click back to "Flows" tab | Content returns to flows | 19 flows displayed | Pass |
| 4 | Click "Coverage" sub-tab | Coverage content displayed | Tab clicked, content present | Pass |
| 5 | Click "Interviews" sub-tab | Interviews content displayed | Tab clicked, content present | Pass |

**Tab Structure**:
- Main tabs: "Flows", "Approval Processes"
- Sub-tabs (under Flows): "Coverage", "Interviews"

**Reference Screenshot**: `screenshots/flows/tabs.png`

---

### FLW-L03: Flow List — Search

**Objective**: Verify search functionality filters flows correctly

| Step | Action | Expected Result | Actual Result | Pass/Fail |
|------|--------|-----------------|---------------|-----------|
| 1 | Record initial flow count | 19 flows | 19 flows | Pass |
| 2 | Search "Account" | Filtered results (fewer than 19) | **Still 19 flows** | Fail |
| 3 | Search "Bool" | Filtered results (fewer than 19) | **Still 19 flows** | Fail |
| 4 | Search "zzzzz_nonexistent" | 0 results or "No results" message | **Still 19 flows** | Fail |

**Search Bug Confirmed**: Search does **NOT filter** results — all 19 flows returned regardless of query.

| Query | Expected Count | Actual Count |
|-------|---------------|--------------|
| Initial | 19 | 19 |
| "Account" | <19 | 19 |
| "Bool" | <19 | 19 |
| "zzzzz_nonexistent" | 0 | 19 |

**Reference Screenshot**: `screenshots/flows/search_result.png`

---

### FLW-L04: Flow List — New Flow Dialog

**Objective**: Verify New Flow button opens flow creation dialog or builder

| Step | Action | Expected Result | Actual Result | Pass/Fail |
|------|--------|-----------------|---------------|-----------|
| 1 | Click "New Flow" button | Flow type selection dialog OR builder opens | **Flow Builder opens directly** (no dialog) | Pass |
| 2 | Observe page state | Flow type options or canvas | Canvas with Record-Triggered Flow Start node | Pass |
| 3 | Record available flow types | Screen Flow, AutoLaunched, Record-Triggered, etc. | Pre-selected: **Record-Triggered Flow** | Partial |

**Observation**: "New Flow" button **directly opens Flow Builder** with a default Record-Triggered Flow template — no intermediate dialog for selecting flow type.

**Reference Screenshot**: `screenshots/flows/new_flow_builder.png`

---

### FLW-B01: Flow Builder — Open Flow (Canvas Rendering)

**Objective**: Verify Flow Builder canvas renders nodes correctly

| Step | Action | Expected Result | Actual Result | Pass/Fail |
|------|--------|-----------------|---------------|-----------|
| 1 | Open Flow Builder (via "New Flow") | Canvas with nodes | Canvas shows Start and End nodes | Pass |
| 2 | Check for Start node | Record-Triggered Flow Start element | **Present** — "Record-Triggered Flow" + "Start" | Pass |
| 3 | Check for End node | End element | **Present** — "End" node | Pass |
| 4 | Check for connectors/edges | Edge between Start and End | **Present** — "Edge from trigger to end-default" | Pass |
| 5 | Count canvas elements | Multiple SVG/group elements | 3 groups, 9 SVG elements | Pass |

**Canvas Content**:
- Record-Triggered Flow Start node with properties:
  - Object: "Configuring..."
  - Trigger: "A record is created"
  - Condition(s): "None"
  - Optimize for: "Actions and Related Records"
- End node
- Edge connecting Start to End

**Reference Screenshot**: `screenshots/flows/builder_canvas.png`

---

### FLW-B02: Flow Builder — Canvas Interaction

**Objective**: Verify canvas zoom, pan, and node selection functionality

| Step | Action | Expected Result | Actual Result | Pass/Fail |
|------|--------|-----------------|---------------|-----------|
| 1 | Look for zoom controls | Zoom In, Zoom Out, Fit View buttons | **Buttons NOT found** via standard selectors | Fail |
| 2 | Check for canvas element | Canvas/SVG present | SVG element present (300x150px) | Pass |
| 3 | Try node selection | Node highlights or properties panel | Start/End nodes selectable via keyboard | Partial |

**Canvas Interaction Notes**:
- Canvas element: `<svg>` (300x150px)
- Zoom control buttons exist in UI but not accessible via standard selectors
- React Flow attribution visible: "Press enter or space to select a node"

**Reference Screenshot**: `screenshots/flows/builder_canvas_interaction.png`

---

### FLW-B03: Flow Builder — Node Detail

**Objective**: Verify node properties panel displays configuration details

| Step | Action | Expected Result | Actual Result | Pass/Fail |
|------|--------|-----------------|---------------|-----------|
| 1 | Select Start node | Properties panel shows configuration | Properties visible inline on node | Pass |
| 2 | Record Start node properties | Object, Trigger, Conditions, Optimize for | All 4 properties displayed | Pass |
| 3 | Check for "Edit" button | Edit node configuration | "Edit" button present on Start node | Pass |

**Start Node Properties Display**:
| Property | Value |
|----------|-------|
| Object | Configuring... |
| Trigger | A record is created |
| Condition(s) | None |
| Optimize for | Actions and Related Records |

**Reference Screenshot**: `screenshots/flows/builder_node_detail.png`

---

### FLW-B04: Flow Builder — Add New Element

**Objective**: Verify ability to add new elements to the canvas

| Step | Action | Expected Result | Actual Result | Pass/Fail |
|------|--------|-----------------|---------------|-----------|
| 1 | Look for "Add Node" or "+" button | Add element control present | **"Add Node" button** present on Start-End edge | Pass |
| 2 | Check Toolbox panel | Element palette available | Toolbox shows: Control Logic, Actions, Data | Pass |
| 3 | Record available element types | Assignment, Decision, Loop, Screen, etc. | See table below | Pass |

**Available Element Categories** (from Toolbox):

| Category | Elements |
|----------|----------|
| Control Logic | Assignment, Decision, Loop, Custom Error |
| Actions | Action, Subflow, Send Email, Webhook, Submit for Approval |
| Data | Create Records, Update Records, Get Records, Delete Records |

**Reference Screenshot**: `screenshots/flows/builder_toolbox.png`

---

### FLW-B05: Flow Builder — Toolbar (Save / Activate / Run)

**Objective**: Verify toolbar buttons for flow operations

| Step | Action | Expected Result | Actual Result | Pass/Fail |
|------|--------|-----------------|---------------|-----------|
| 1 | Check toolbar buttons | Save, Activate, Run, Debug visible | All buttons present | Pass |
| 2 | Record button states | Enabled/disabled status | See table below | Pass |
| 3 | Check Undo/Redo | Undo/Redo buttons present | Present (both disabled for new flow) | Pass |

**Toolbar Buttons**:

| Button | Status | Notes |
|--------|--------|-------|
| Run | ✅ Enabled | Execute flow immediately |
| Debug | ✅ Enabled | Debug mode |
| View Tests | ✅ Enabled | Test configuration |
| Save As New Version | ✅ Enabled | Version control |
| Save | ✅ Enabled | Save changes |
| Activate | ✅ Enabled | Activate flow |
| Undo | ❌ Disabled | No changes to undo |
| Redo | ❌ Disabled | No changes to redo |

**Reference Screenshot**: `screenshots/flows/builder_toolbar.png`

---

## 4. Flow Builder Assessment

**Assessment Method**: Direct "New Flow" button test + multiple flow verification attempts

| Attempt | Flow Name | Type | Builder URL | Canvas Nodes? | Error? |
|---------|-----------|------|-------------|---------------|--------|
| 1 | (New Flow) | Record-Triggered | /flows/builder/... | ✅ Start + End | None |
| 2 | AB_BoolTest2 | AutoLaunchedFlow | /flows/builder/300BK00000NWAF7YAP | ✅ Start + Assignment + End | None |
| 3 | account_ACV_stage | Workflow | /flows/builder/3005g000000pWClAAM | ✅ Start + Decision + End | None |

**Flow Builder Verdict**: **PASS** — Canvas renders nodes correctly for all tested flows:
- **New Flow**: Record-Triggered Flow template with Start → End nodes
- **AB_BoolTest2** (AutoLaunchedFlow): Start → Set Boolean Assignment → End
- **account_ACV_stage** (Workflow): Start → Default Outcome Decision → End

Previous "empty canvas" finding (FLOW-002) is **NOT REPRODUCED** — canvas renders correctly when:
- Opening via "New Flow" button
- Opening existing AutoLaunchedFlow via Actions → Open button
- Opening existing Workflow via Actions → Open button

**Conclusion**: FLOW-002 was either flow-specific (not observed in tested flows) or already fixed in build v1774881084414.

**Comparison with Quote Label Quality Summary**:

| Aspect | Quote | Flows |
|--------|-------|-------|
| Core issue | Label suffix/naming | Canvas rendering |
| Status | Multiple FAILs | PASS (with caveats) |
| Blocked paths | 3 (navigation) | 0 (all functional) |

---

## 5. Screenshot Checklist

| # | Screenshot | Path | Status |
|---|------------|------|--------|
| 1 | List Default | `flows/list_default.png` | ✅ |
| 2 | Tabs | `flows/tabs.png` | ✅ |
| 3 | Search Result | `flows/search_result.png` | ✅ |
| 4 | New Flow Builder | `flows/new_flow_builder.png` | ✅ |
| 5 | Builder Canvas | `flows/builder_canvas.png` | ✅ |
| 6 | Canvas Interaction | `flows/builder_canvas_interaction.png` | ✅ |
| 7 | Node Detail | `flows/builder_node_detail.png` | ✅ |
| 8 | Builder Toolbox | `flows/builder_toolbox.png` | ✅ |
| 9 | Builder Toolbar | `flows/builder_toolbar.png` | ✅ |
| 10 | Existing Flow (AutoLaunched) | `flows/builder_existing_flow_AB_BoolTest2.png` | ✅ |
| 11 | Existing Flow (Workflow) | `flows/builder_existing_workflow.png` | ✅ |

---

## 6. Known Issues Summary

| # | Path | Description | Severity | Status | Related |
|---|------|-------------|----------|--------|---------|
| 1 | FLW-L01 | Active/Inactive status appended to Flow Label (non-standard) | Low | Open | UI-003 |
| 2 | FLW-L03 | Search returns all 19 flows regardless of query | High | Open | SEARCH-001 |
| 3 | FLW-L04 | No flow type selection dialog (direct to builder) | Info | N/A | UX-001 |

**Previously Reported (Re-verified)**:
- FLOW-002 (Canvas empty): **NOT REPRODUCED** — canvas renders correctly via "New Flow"
- Search broken: **CONFIRMED** — same bug as Lead/Quote list search

---

## 7. A/B Comparison Notes (Salesforce)

| Feature | Expected (Salesforce) | Actual (NexusCRM) | Notes |
|---------|----------------------|-------------------|-------|
| Flow List Columns | Label, API Name, Type, Status, Last Modified | Label, API Name, Type, Trigger, Object, Last Modified | ⚠️ Status embedded in label |
| Status Display | Separate column or badge | Appended to Flow Label text | ❌ Non-standard |
| Search | Filters results | Returns all flows | ❌ Bug |
| New Flow | Type selection dialog | Direct to Record-Triggered builder | ⚠️ UX difference |
| Flow Builder Canvas | Renders Start/End nodes | Renders Start/End nodes | ✅ Matches |
| Toolbox Elements | Assignment, Decision, Loop, Actions, Data | Same categories | ✅ Matches |
| Toolbar | Save, Activate, Run, Debug | Same buttons | ✅ Matches |

---

## 8. Test Execution Notes

### Tooling
- **Browser**: dev-browser CLI (QuickJS runtime + Playwright API)
- **Timeout**: 30-60 seconds per script
- **Screenshots**: Saved via `page.screenshot()` to `screenshots/flows/`

### Key Discoveries

**Flow Builder DOES Work**:
- Previous exploration reported "empty canvas" (FLOW-002)
- Current testing shows canvas renders correctly via "New Flow" button
- Start node shows: Record-Triggered Flow, Object (Configuring...), Trigger, Conditions, Optimize for
- End node present
- Edge connecting Start to End present

**Search Bug Confirmed**:
- Search "Account" → 19 results (should filter)
- Search "Bool" → 19 results (should filter)
- Search "zzzzz_nonexistent" → 19 results (should be 0)
- Same bug pattern as Lead and Quote list search

**Active/Inactive Display**:
- Status is appended to Flow Label text: "FlowNameActive" / "FlowNameInactive"
- Not a separate column or badge
- Non-standard UI pattern that may confuse users

### What Was Successfully Tested
- ✅ Flow List default view (19 flows, 6 columns)
- ✅ Tab navigation (Flows, Approval Processes, Coverage, Interviews)
- ✅ Search functionality (bug confirmed)
- ✅ New Flow button → Flow Builder
- ✅ Canvas rendering (Start + End nodes)
- ✅ Node properties display
- ✅ Toolbox element categories
- ✅ Toolbar buttons (Save, Activate, Run, Debug)

### What Could NOT Be Fully Tested
- ⚠️ Existing flow editing (no flow IDs extracted for direct URL test)
- ⚠️ Canvas zoom controls (buttons present but not accessible via selectors)
- ⚠️ Flow type selection (goes directly to Record-Triggered, no type chooser)

---

## 9. Recommendations

1. **Fix search functionality** — High priority, affects all list views (Lead, Quote, Flow)
2. **Separate Active/Inactive status** — Use badge or separate column instead of appending to label
3. **Add flow type selection dialog** — Allow users to choose flow type before opening builder
4. **Verify existing flow editing** — Test opening existing flows (not just new flow) to confirm canvas works for all
