# FieldOps Cloud Manual QA Script

Use this script when browser automation is unavailable or when doing a final human verification pass in XAMPP.

Local URL: `http://localhost/FieldOps-Cloud/public`

## Setup

1. Start XAMPP Apache and MySQL.
2. Open `http://localhost/FieldOps-Cloud/public`.
3. Confirm the page loads without PHP warnings/notices.
4. Keep DevTools console open during navigation.

## Navigation Smoke

Expected result for each page: page loads, sidebar/current navigation makes sense, no visible PHP warnings, no console errors, no obvious mobile overflow.

1. Open `/`.
2. Open `/pricing`.
3. Open `/dashboard`.
4. Open `/clients`.
5. Open `/clients/create`.
6. Open `/jobs`.
7. Open `/jobs/view?id=1`.
8. Open `/jobs/create`.
9. Open `/schedule`.
10. Open `/quotes`.
11. Open `/quotes/create`.
12. Open `/invoices`.
13. Open `/invoices/create`.
14. Open `/ai-assistant`.
15. Select a job, click Generate, and confirm a structured quote helper response appears.
16. Switch to Schedule mode, enter details containing a fake `api_key` and `password`, click Generate, and confirm the response redacts those values.
17. Open `/import-data`.
18. Open `/export-data`.
19. Open `/team`.
20. Open `/reports`.
21. Open `/settings`.
22. Open `/settings/accounting`.
23. Open `/settings/calendar`.
24. Open `/settings/llm`.
25. Switch demo role to Platform Admin, then open `/settings/pricing`.
26. Open `/workspace`.
27. Open `/subscription`.
28. Open `/platform-admin`.

## Core Workflow Checks

### Clients

1. Open `/clients/create`.
2. Submit the form empty.
3. Expected: validation error, status-like behavior visible to user.
4. Enter a valid name and email.
5. Submit.
6. Expected: redirect remains under `/FieldOps-Cloud/public/clients`.
7. Note: persistence is not complete yet; created client may not appear in list.

### Jobs

1. Open `/jobs`.
2. Search for `HVAC`.
3. Expected: HVAC job appears.
4. Open `/jobs/view?id=1`.
5. Expected: checklist, timeline, financials, and related actions are visible.
6. Open `/jobs/create`.
7. Submit invalid data.
8. Expected: validation errors.
9. Submit valid job data.
10. Expected: redirect remains under `/FieldOps-Cloud/public/jobs`.
11. Note: persistence is not complete yet; created job may not appear in list.

### Schedule

1. Open `/schedule?week=2026-06-14`.
2. Book an appointment for `2026-06-10`, `15:00`, `60 minutes`, `Demo User`.
3. Expected: appointment appears in the week.
4. Submit the same appointment again.
5. Expected: conflict validation message.

### Quotes

1. Open `/quotes/create`.
2. Submit invalid data.
3. Expected: validation errors.
4. Submit a valid quote with a unique quote number.
5. Expected: redirect to `/quotes`; quote appears in list.

### Invoices

1. Open `/invoices/create`.
2. Submit invalid data.
3. Expected: validation errors.
4. Submit a valid invoice with a unique invoice number.
5. Expected: redirect to `/invoices`; invoice appears in list.

### Import/Export

1. Open `/import-data`.
2. Select each import type: customers, jobs, quotes, invoices, team.
3. Expected: required fields and validation preview update.
4. Download sample CSV for each type.
5. Open `/export-data`.
6. Download each dataset: all, clients, jobs, quotes, invoices.
7. Expected: CSV downloads with headers and no browser errors.

### Pricing Admin

1. Switch demo role to Platform Admin.
2. Open `/settings/pricing`.
3. Submit invalid currency/trial/discount values.
4. Expected: validation errors.
5. Save valid settings with GBP enabled and a visible discount label.
6. Open `/pricing?currency=GBP`.
7. Expected: public pricing reflects GBP and discount label.
8. Return to `/settings/pricing`.
9. Reset pricing.
10. Expected: reset success state.

### Platform Admin Tenant Support

1. Switch demo role to Platform Admin.
2. Open `/platform-admin`.
3. Confirm the sidebar shows platform operations, not normal tenant jobs/clients navigation.
4. Select a tenant in Tenant support access.
5. Click `Log in as the Tenant`.
6. Expected: redirected to `/dashboard`, support-session banner appears, and normal tenant admin navigation is visible.
7. Click `Return to Platform Admin`.
8. Expected: returned to `/platform-admin`, platform sidebar restored, and success confirmation appears.
9. Switch demo role to Director/Owner.
10. Expected: platform admin and global pricing links are not visible in the tenant sidebar.

### Platform Admin Invoicing

1. Switch demo role to Platform Admin.
2. Open `/platform-admin#platform-billing`.
3. Confirm Platform invoicing shows each tenant name, package cycle, contract value, billed so far, yet to bill, next invoice, and status.
4. In Manual override, select `Demo Trade Co - Growth Monthly`.
5. Choose `Override next invoice amount`, enter `77.25`, and add a reason with at least 10 characters.
6. Submit.
7. Expected: success confirmation appears and Demo Trade Co shows `Manual override active` with next invoice amount changed.
8. Submit an override with missing amount or short reason.
9. Expected: validation errors display and no PHP warning is visible.
10. In Platform accounting connection, select `Xero`, sync mode `Invoices And Payments`, platform entity `FieldOps Cloud Ltd`, and external org `fieldops-xero-org`.
11. Submit.
12. Expected: success confirmation appears and the platform accounting connection card shows Xero and platform sandbox-ready status.

## Responsive Viewports

Run the navigation smoke at:

- Mobile: 390 x 844
- Tablet: 768 x 1024
- Desktop: 1366 x 768
- Wide desktop: 1920 x 1080

Check:

- No text overlap.
- No body-level horizontal scrolling.
- Buttons remain clickable.
- Forms remain readable.
- Calendar remains usable with intended internal scroll area.

## Security Spot Checks

1. Submit every POST form with the CSRF token removed.
2. Expected: 403 security check failed page.
3. Search with `<script>alert(1)</script>`.
4. Expected: text is escaped and no script executes.
5. Export a quote number beginning with `=`.
6. Expected: CSV prefixes the value with `'`.

## Manual QA Result Template

For each issue found, record:

- Page/route.
- Viewport.
- Steps.
- Expected result.
- Actual result.
- Severity.
- Screenshot path.
- Retest result.
