Compare commits
No commits in common. "b00a930e8d62511a02d9af91dc7db921b495cebf" and "2f7dcf352051d1bc6e052db86d2b6017ed2fbc43" have entirely different histories.
b00a930e8d
...
2f7dcf3520
|
|
@ -2,28 +2,16 @@
|
|||
|
||||
Quick reference for deploying the Salesforce Composite Envelope Builder to your org and running tests.
|
||||
|
||||
> **Shell Note:** Commands below show both **Bash/WSL** and **PowerShell** variants for Windows Terminal. Choose the one that matches your environment. The `sf` CLI commands are identical across both shells.
|
||||
|
||||
---
|
||||
|
||||
## Quick Start (Recommended)
|
||||
|
||||
### Deploy + Test in One Script
|
||||
|
||||
**Bash/WSL:**
|
||||
```bash
|
||||
cd /home/paulh/.openclaw/workspace/projects/salesforce-composite-envelope-builder/composite-envelope-builder
|
||||
bash deploy-to-dev-org.sh
|
||||
```
|
||||
|
||||
**PowerShell (Windows Terminal):**
|
||||
```powershell
|
||||
cd "$env:USERPROFILE\.openclaw\workspace\projects\salesforce-composite-envelope-builder\composite-envelope-builder"
|
||||
bash deploy-to-dev-org.sh
|
||||
# Or if you prefer native PowerShell (not WSL):
|
||||
# .\deploy-to-dev-org.sh (requires WSL bash available)
|
||||
```
|
||||
|
||||
This script handles:
|
||||
- ✅ Org authorization (opens browser login)
|
||||
- ✅ Code deployment
|
||||
|
|
@ -35,8 +23,6 @@ This script handles:
|
|||
## Manual Commands
|
||||
|
||||
### 1. Authorize Your Org (First Time Only)
|
||||
|
||||
**Bash/WSL:**
|
||||
```bash
|
||||
# For Developer Edition
|
||||
sf org login web --alias dev-org --instance-url https://login.salesforce.com
|
||||
|
|
@ -45,33 +31,18 @@ sf org login web --alias dev-org --instance-url https://login.salesforce.com
|
|||
sf org login web --alias sandbox-org --instance-url https://test.salesforce.com
|
||||
```
|
||||
|
||||
**PowerShell (Windows Terminal):**
|
||||
```powershell
|
||||
# For Developer Edition
|
||||
sf org login web --alias dev-org --instance-url https://login.salesforce.com
|
||||
|
||||
# For Sandbox
|
||||
sf org login web --alias sandbox-org --instance-url https://test.salesforce.com
|
||||
```
|
||||
|
||||
You'll be redirected to Salesforce login. Once authorized, the org alias is saved for future deploys.
|
||||
|
||||
---
|
||||
|
||||
### 2. Deploy Code
|
||||
|
||||
**Bash/WSL:**
|
||||
**Deploy all code to your org:**
|
||||
```bash
|
||||
cd /home/paulh/.openclaw/workspace/projects/salesforce-composite-envelope-builder/composite-envelope-builder
|
||||
sf project deploy start --target-org dev-org
|
||||
```
|
||||
|
||||
**PowerShell (Windows Terminal):**
|
||||
```powershell
|
||||
cd "$env:USERPROFILE\.openclaw\workspace\projects\salesforce-composite-envelope-builder\composite-envelope-builder"
|
||||
sf project deploy start --target-org dev-org
|
||||
```
|
||||
|
||||
**Options:**
|
||||
- `--target-org dev-org` — Use the authorized org alias (replace with your alias if different)
|
||||
- `--wait 10` — Wait up to 10 minutes for deployment to complete
|
||||
|
|
@ -81,82 +52,35 @@ sf project deploy start --target-org dev-org
|
|||
### 3. Run Tests
|
||||
|
||||
**Run ALL unit tests with code coverage:**
|
||||
|
||||
Bash/WSL:
|
||||
```bash
|
||||
sf apex run test --wait 10 --result-format human --code-coverage --target-org dev-org
|
||||
```
|
||||
|
||||
PowerShell:
|
||||
```powershell
|
||||
sf apex run test --wait 10 --result-format human --code-coverage --target-org dev-org
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Run ONLY the new handler tests:**
|
||||
|
||||
Bash/WSL:
|
||||
```bash
|
||||
sf apex run test --class-names DocusignEnvelopeRequestHandlerTest --wait 10 --result-format human --target-org dev-org
|
||||
```
|
||||
|
||||
PowerShell:
|
||||
```powershell
|
||||
sf apex run test --class-names DocusignEnvelopeRequestHandlerTest --wait 10 --result-format human --target-org dev-org
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Run specific test methods:**
|
||||
|
||||
Bash/WSL:
|
||||
```bash
|
||||
sf apex run test --class-names DocusignEnvelopeRequestHandlerTest --method-names testValidateRequest_Success --wait 10 --result-format human --target-org dev-org
|
||||
```
|
||||
|
||||
PowerShell:
|
||||
```powershell
|
||||
sf apex run test --class-names DocusignEnvelopeRequestHandlerTest --method-names testValidateRequest_Success --wait 10 --result-format human --target-org dev-org
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Run ALL tests with JSON output (for parsing):**
|
||||
|
||||
Bash/WSL:
|
||||
```bash
|
||||
sf apex run test --wait 10 --result-format json --code-coverage --target-org dev-org > test-results.json
|
||||
```
|
||||
|
||||
PowerShell:
|
||||
```powershell
|
||||
sf apex run test --wait 10 --result-format json --code-coverage --target-org dev-org | Out-File -FilePath test-results.json
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Complete Deploy + Test in One Command
|
||||
|
||||
**Bash/WSL:**
|
||||
```bash
|
||||
cd /home/paulh/.openclaw/workspace/projects/salesforce-composite-envelope-builder/composite-envelope-builder && \
|
||||
sf project deploy start --target-org dev-org && \
|
||||
sf apex run test --wait 10 --result-format human --code-coverage --target-org dev-org
|
||||
```
|
||||
|
||||
**PowerShell (Windows Terminal):**
|
||||
```powershell
|
||||
cd "$env:USERPROFILE\.openclaw\workspace\projects\salesforce-composite-envelope-builder\composite-envelope-builder"; `
|
||||
sf project deploy start --target-org dev-org; `
|
||||
sf apex run test --wait 10 --result-format human --code-coverage --target-org dev-org
|
||||
```
|
||||
|
||||
**Alternative PowerShell (using semicolons):**
|
||||
```powershell
|
||||
cd "$env:USERPROFILE\.openclaw\workspace\projects\salesforce-composite-envelope-builder\composite-envelope-builder"; sf project deploy start --target-org dev-org; sf apex run test --wait 10 --result-format human --code-coverage --target-org dev-org
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Understanding Test Results
|
||||
|
|
@ -234,8 +158,6 @@ After successful deployment, configure your Salesforce org:
|
|||
## Troubleshooting
|
||||
|
||||
### Authorization Issues
|
||||
|
||||
**Bash/WSL:**
|
||||
```bash
|
||||
# If auth fails, try manual URL method:
|
||||
sf org login web --alias dev-org --instance-url https://login.salesforce.com --json
|
||||
|
|
@ -243,19 +165,7 @@ sf org login web --alias dev-org --instance-url https://login.salesforce.com --j
|
|||
# Copy the 'url' value and paste into your browser
|
||||
```
|
||||
|
||||
**PowerShell:**
|
||||
```powershell
|
||||
# If auth fails, try manual URL method:
|
||||
sf org login web --alias dev-org --instance-url https://login.salesforce.com --json
|
||||
|
||||
# Copy the 'url' value from the output and paste into your browser
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Deployment Errors
|
||||
|
||||
**Bash/WSL:**
|
||||
```bash
|
||||
# Check what's in your org
|
||||
sf project list metadata --target-org dev-org
|
||||
|
|
@ -264,31 +174,12 @@ sf project list metadata --target-org dev-org
|
|||
sf project validate deploy --target-org dev-org
|
||||
```
|
||||
|
||||
**PowerShell:**
|
||||
```powershell
|
||||
# Check what's in your org
|
||||
sf project list metadata --target-org dev-org
|
||||
|
||||
# Validate without deploying
|
||||
sf project validate deploy --target-org dev-org
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Test Failures
|
||||
|
||||
**Bash/WSL:**
|
||||
```bash
|
||||
# Run tests with verbose output
|
||||
sf apex run test --target-org dev-org --result-format human --code-coverage -v
|
||||
```
|
||||
|
||||
**PowerShell:**
|
||||
```powershell
|
||||
# Run tests with verbose output
|
||||
sf apex run test --target-org dev-org --result-format human --code-coverage -v
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Reference: Classes Deployed
|
||||
|
|
|
|||
|
|
@ -278,4 +278,35 @@ private class DocusignCompositeEnvelopeBuilderTest {
|
|||
System.assertNotEquals(null, results[0].errorMessage, 'Should have error message');
|
||||
System.assert(String.isNotBlank(results[0].errorMessage), 'Error message should not be blank');
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Test JSON builder with all parameters
|
||||
*/
|
||||
@isTest
|
||||
static void testJSONBuilder() {
|
||||
// Arrange
|
||||
List<String> templateIds = new List<String>{'template-A', 'template-B'};
|
||||
String recordId = '001000000ABC123';
|
||||
String language = 'es';
|
||||
String emailSubject = 'Custom Subject';
|
||||
|
||||
// Act
|
||||
Test.startTest();
|
||||
String json = DocusignCompositeEnvelopeBuilder.buildCompositeEnvelopeJSON(
|
||||
templateIds,
|
||||
recordId,
|
||||
language,
|
||||
emailSubject,
|
||||
null // customFields - not supported in Phase 1
|
||||
);
|
||||
Test.stopTest();
|
||||
|
||||
// Assert
|
||||
System.assertNotEquals(null, json, 'JSON should be generated');
|
||||
System.assert(json.contains('template-A'), 'Should contain first template');
|
||||
System.assert(json.contains('template-B'), 'Should contain second template');
|
||||
System.assert(json.contains(emailSubject), 'Should contain email subject');
|
||||
System.assert(json.contains('SalesforceRecordId'), 'Should contain record ID field');
|
||||
System.assert(json.contains(language), 'Should contain language');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue