# HUB-615 / HUB-611: list cell editing and list-page flows

Test cases for PR #98 (Contacts, Companies and Leads lists, 28 Oct design). Each case says how it
is covered:

- **Unit:** an automated test (`npm test`). The file is named in the case.
- **App:** checked by hand in the running app. A screenshot is attached to the PR.
- **Not clicked yet / Not checked:** written, but not yet run by hand.

Sheet rows refer to the HUB-611 QA sheet.

## Cell editing rules (HUB-615)

| #   | Case                                    | Steps                                                                     | Expected                                                                                           | Covered                                                   |
| --- | --------------------------------------- | ------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | --------------------------------------------------------- |
| E1  | Email cleared (sheet #148)              | Contacts › Email cell › delete the text › Enter                           | "Email is required"; nothing saved                                                                 | Unit `contactCellEdit.test.ts`                            |
| E2  | Invalid email                           | Type `not-an-email` › Enter                                               | Validation message; nothing saved                                                                  | Unit                                                      |
| E3  | Duplicate email (sheet #147)            | Type an email another contact uses › Enter                                | "Another contact already uses this email: <name>"; nothing saved                                   | Unit                                                      |
| E4  | Duplicate check unavailable             | Same as E3 with the network down                                          | "Couldn't check whether this email is already used. Try again."; nothing saved                     | Unit                                                      |
| E5  | Unchanged email                         | Enter without changing                                                    | No request                                                                                         | Unit                                                      |
| E6  | Row not editable                        | Sign in with a permission set that can't edit the record                  | Every cell shows "Your permissions don't allow you to edit this record"                            | Unit (contacts, companies, leads)                         |
| E7  | View-only field                         | Field set to view-only in the permission set                              | That cell is locked with the view-only reason; others edit                                         | Unit                                                      |
| E8  | Calculated field read-only (sheet #150) | Last activity date cell                                                   | Locked with the calculated-field reason                                                            | Unit (contacts, companies)                                |
| E9  | Required custom field cleared           | Clear a required custom field                                             | "<Label> is required"; nothing saved                                                               | Unit                                                      |
| E10 | Number field                            | Type `ten`, then `12.5`                                                   | "<Label> must be a number"; then saved as 12.5                                                     | Unit                                                      |
| E11 | Archived options                        | Open a dropdown whose field has archived options                          | Active options only, plus the archived value the record holds                                      | Unit                                                      |
| E12 | Owner                                   | Owner cell › pick "No owner"                                              | Owner cleared; inactive owners only listed when current                                            | Unit                                                      |
| E13 | Not editable columns                    | Name, Create date, association columns                                    | Cells don't open an editor                                                                         | Unit                                                      |
| E14 | Record deleted elsewhere (sheet #160)   | Open the list › delete the contact in another tab › edit one of its cells | "This contact was deleted, so it can't be edited. It's off the list now."; the row leaves the list | Unit `cellSaveError.test.ts` + App (`pr-deleted-row.png`) |
| E15 | Company domain                          | Type `https://www.acme.io/about`                                          | Saved as `www.acme.io`; spaces refused                                                             | Unit `companyCellEdit.test.ts`                            |
| E16 | Lead stage                              | Lead stage cell                                                           | Open stages of the lead's pipeline only (qualify / disqualify stay on the board and record page)   | Unit `objectCellEdit.test.ts`                             |
| E17 | Lead pipeline                           | Pick another pipeline                                                     | The lead moves to that pipeline's first open stage                                                 | Unit                                                      |

## Dropdown cells

| #   | Case                       | Steps                                                          | Expected                                                        | Covered                                                |
| --- | -------------------------- | -------------------------------------------------------------- | --------------------------------------------------------------- | ------------------------------------------------------ |
| D1  | Enter with an empty search | Primary company cell (has a search box) › Enter without typing | Nothing happens; the value stays (it used to save "(No value)") | Unit `cellChoice.test.ts` + App (`pr-enter-empty.png`) |
| D2  | Enter while searching      | Type part of a name › Enter                                    | The first real match is saved                                   | Unit                                                   |
| D3  | Enter with no match        | Type text that matches nothing › Enter                         | Nothing happens                                                 | Unit                                                   |

## Phone numbers

| #   | Case                     | Steps                                                            | Expected                                                                          | Covered                                            |
| --- | ------------------------ | ---------------------------------------------------------------- | --------------------------------------------------------------------------------- | -------------------------------------------------- |
| P1  | Canadian number          | Open a contact whose phone is `+1 416 555 0199`                  | The editor shows Canada (area code), not the US                                   | Unit `phone.test.ts` + App (`pr-phone-canada.png`) |
| P2  | Long or odd number       | Open a number with more digits than the format holds, or letters | The editor opens "as typed" with the stored text unchanged; no digits are dropped | Unit                                               |
| P3  | Extension                | `+1 415 555 0451 ext. 12`, `x7`, `extension 3`                   | Extension read; an "x" inside a word ("box 12") is not an extension               | Unit                                               |
| P4  | Remove number formatting | Open a number › Remove number formatting                         | Starts from the stored text, not a re-formatted copy                              | Not clicked yet (code: `CellPhonePopover`)         |
| P5  | Unchanged Save           | Open and close without changes                                   | Save stays disabled; nothing is re-saved                                          | Not clicked yet (code: `canSave`)                  |
| P6  | Too long                 | More than 50 characters                                          | "Phone number is too long"                                                        | Unit                                               |

## Bulk actions

| #   | Case                           | Steps                                                                                                | Expected                                                                                         | Covered                                                     |
| --- | ------------------------------ | ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ----------------------------------------------------------- |
| B1  | Create leads                   | Contacts › select a contact › More › Create leads › Create                                           | "1 lead created"; the lead is linked to the contact                                              | App (`pr-leads-done.png`)                                   |
| B2  | Create leads, open lead exists | Repeat B1 for the same contact                                                                       | "0 leads created, 1 record already has an open lead" (not counted as failed)                     | Unit `leadsResult.test.ts` + App (`pr-leads-existing.png`)  |
| B3  | Create leads, real failure     | A create that fails for another reason                                                               | "… N failed: <reason>"                                                                           | Unit                                                        |
| B4  | Dissociate asks first          | Review Associations › tick a group › Dissociate                                                      | Confirmation "Remove N associations? The records stay; only the links between them are removed." | App (`pr-dissociate-confirm.png`)                           |
| B5  | Dissociate                     | Confirm B4                                                                                           | "1 association removed"; the link is gone (checked through the API)                              | App (`pr-dissociate-done.png`)                              |
| B6  | "Select all" cap shown         | Select all N records (N over 500, or over 200 for tasks / leads, 50 for associations) › open a panel | "Only the first X of N … are included." before anything runs                                     | Not checked: the test business has no list over 500 records |
| B7  | Concurrency                    | Any one-by-one panel                                                                                 | At most 4 requests at a time                                                                     | Code (`eachRecord`)                                         |

## Metrics

| #   | Case                      | Steps                                       | Expected                                                  | Covered                        |
| --- | ------------------------- | ------------------------------------------- | --------------------------------------------------------- | ------------------------------ |
| M1  | Apply                     | Manage metrics › Add metric › Apply         | "Metrics updated"; the new tile shows its value           | App (`pr-metrics-applied.png`) |
| M2  | Count with share          | A count metric with the secondary line      | "N contacts", "X% of total"                               | Unit `metrics.test.ts`         |
| M3  | Sum / average / min / max | Number property                             | Right values; empty average shows "No value", empty sum 0 | Unit                           |
| M4  | Over 2,000 records        | Sum on a view with more than 2,000 matches  | Tile says "Based on the first 2,000 …"                    | Unit                           |
| M5  | Shared reads              | Two metrics on the same property and filter | The records are read once                                 | Unit                           |
| M6  | One metric fails          | API error for one metric                    | That tile shows "Could not load"; the others load         | Unit                           |

## View types

| #   | Case          | Steps                                                                                      | Expected                                                                  | Covered                       |
| --- | ------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------- | ----------------------------- |
| V1  | Save report   | Report view › Report settings › Vertical bar, Dimension, Break down by Owner › Save report | Panel closes, "Report saved", legend shows the owners                     | App (`pr-report-saved.png`)   |
| V2  | Calendar drag | Calendar view on a custom date › drag a record to Oct 20                                   | "<name>: <date property> set to Oct 20, 2026"; the API holds the new date | App (`pr-calendar-after.png`) |

## Not covered here (backend needed)

- **Email uniqueness on edit:** the API only warns about a duplicate on edit, so two people saving the same email at the same moment can still create a duplicate. Needs a 409 on `PATCH /contacts/:id`; see the backend dependencies doc.
- **Metrics over 2,000 records:** needs the aggregate endpoint.
- **Bulk actions over 500 records:** need bulk endpoints.
