# Integration Module — UI Automation Status

Date: 2026-09-17. Goal: SQL execution via the i21 Integration module on customer servers.

## What works

1. **Login** via JS form submit (bypass reCAPTCHA) — Playwright headless
2. **Integration module** loads (JS bundles: Shared, Controls, Web — 500KB total)
3. **Menu navigation** — Integration → Processes / Connections / New Process
4. **Process list** — `/integration/api/process/search` returns 7 processes
5. **API endpoints** (lowercase): `/integration/api/process/search`, `/integration/api/step/get`, `/integration/api/connection/get`, `/integration/api/ftserver/get`

## API endpoints confirmed

| Endpoint | Method | Returns | POST? |
|---|---|---|---|
| `/integration/api/process/search` | GET | 7 processes | 405 |
| `/integration/api/step/get` | GET | 9 steps (including SQL step) | 405 |
| `/integration/api/connection/get` | GET | 1 connection (SQL Server) | 405 |
| `/integration/api/ftserver/get` | GET | 2 FTP servers (with creds) | 405 |

## Step types (from API data)

Step 9 (AP DPR Diagnostics):
- `intStepTypeId: 9` → "Send Mail" (executes SQL + sends result)
- `strSQL: uspAPCompareBalance` → stored procedure
- `intSQLTypeId: 2` → stored procedure type
- `intConnectionId: 1` → connection to local SQL Server

## UI structure

New Process page:
- Process Name: `textfield-1076-inputEl`
- Description: `textarea-1077-inputEl`
- Start Date: `datetimefield-1079-inputEl`
- Auto Execution: `checkbox-1080-inputEl`
- Interval: `textfield-1116-inputEl` / `numericfield-1229-inputEl`
- **Save**: `button-1209`
- **Delete**: `button-1210`
- **Run Selected Step**: `button-1212` ← KEY
- **Run All**: `button-1213`
- Step grid with: Edit, Move Up/Down, Remove, Export, View buttons

## What does NOT work

1. **POST/PUT/PATCH** on Integration API = 405 (GET only)
2. **Double-click** on a process row doesn't open the editor
3. **API route case**: uppercase `/Integration/api/` works for GET, but lowercase `/integration/api/` also works

## Next steps

1. Open New Process → find the step type dropdown → select "Execute SQL Query"
2. Fill in the SQL (`SELECT @@version`)
3. Click "Run Selected Step"
4. Intercept the AJAX execution endpoint
5. Use the endpoint directly via curl

## FTP creds (found via API)

| Server | URL | Username | Password |
|---|---|---|---|
| RT Rogers 003 Data | ftp.dtnenergy.com (SFTP) | 0075345.003 | [REDACTED] |
| RT Rogers 004 Prices | ftp.dtnenergy.com (SFTP) | 0075345.004 | [REDACTED] |
