banatie-service/tests/api/08-auto-enhance.rest

249 lines
6.6 KiB
ReStructuredText

@base = http://localhost:3000
@apiKey = bnt_727d2f4f72bd03ed96da5278bb971a00cb0a2454d4d70f9748b5c39f3f69d88d
###############################################################################
# AUTO-ENHANCE TESTS
# Tests: Prompt auto-enhancement feature
#
# Test Coverage:
# 1. Generate without autoEnhance param (defaults to true)
# 2. Generate with autoEnhance: false
# 3. Generate with autoEnhance: true
# 4. Verify enhancement quality
# 5. List generations with autoEnhance field
# 6. Verify response structure
###############################################################################
###############################################################################
# TEST 1: Generate Without autoEnhance Parameter
# Should default to true (enhancement enabled)
###############################################################################
### Step 1.1: Create generation without autoEnhance param
# @name genDefaultEnhance
POST {{base}}/api/v1/generations
Content-Type: application/json
X-API-Key: {{apiKey}}
{
"prompt": "a simple test image",
"aspectRatio": "1:1"
}
###
@genDefaultId = {{genDefaultEnhance.response.body.$.data.id}}
### Step 1.2: Poll generation
# @name checkGenDefault
GET {{base}}/api/v1/generations/{{genDefaultId}}
X-API-Key: {{apiKey}}
###
# Verify:
# - autoEnhance = true
# - originalPrompt = "a simple test image"
# - prompt != originalPrompt (was enhanced)
###############################################################################
# TEST 2: Generate with autoEnhance: false
# Should NOT enhance the prompt
###############################################################################
### Step 2.1: Create generation with autoEnhance: false
# @name genNoEnhance
POST {{base}}/api/v1/generations
Content-Type: application/json
X-API-Key: {{apiKey}}
{
"prompt": "another test image",
"aspectRatio": "1:1",
"autoEnhance": false
}
###
@genNoEnhanceId = {{genNoEnhance.response.body.$.data.id}}
### Step 2.2: Poll generation
# @name checkGenNoEnhance
GET {{base}}/api/v1/generations/{{genNoEnhanceId}}
X-API-Key: {{apiKey}}
###
# Verify:
# - autoEnhance = false
# - originalPrompt = "another test image"
# - prompt = "another test image" (same, NOT enhanced)
###############################################################################
# TEST 3: Generate with autoEnhance: true
# Should enhance the prompt
###############################################################################
### Step 3.1: Create generation with explicit autoEnhance: true
# @name genExplicitEnhance
POST {{base}}/api/v1/generations
Content-Type: application/json
X-API-Key: {{apiKey}}
{
"prompt": "third test image",
"aspectRatio": "1:1",
"autoEnhance": true
}
###
@genExplicitId = {{genExplicitEnhance.response.body.$.data.id}}
### Step 3.2: Poll generation
# @name checkGenExplicit
GET {{base}}/api/v1/generations/{{genExplicitId}}
X-API-Key: {{apiKey}}
###
# Verify:
# - autoEnhance = true
# - originalPrompt = "third test image"
# - prompt != originalPrompt (was enhanced)
# - prompt is longer and more descriptive
###############################################################################
# TEST 4: Verify Enhancement Quality
# Enhanced prompt should be longer and more descriptive
###############################################################################
### Step 4.1: Get enhanced generation
# @name getEnhancedGen
GET {{base}}/api/v1/generations/{{genDefaultId}}
X-API-Key: {{apiKey}}
###
# Verify:
# - Enhanced prompt is longer than original
# - Enhanced prompt may contain: "photorealistic", "detailed", "scene", etc.
# - Compare: prompt.length > originalPrompt.length
###############################################################################
# TEST 5: List Generations with autoEnhance Field
###############################################################################
### Step 5.1: List all generations
# @name listGens
GET {{base}}/api/v1/generations
X-API-Key: {{apiKey}}
###
# Verify:
# - Each generation has autoEnhance field (boolean)
# - Some generations have autoEnhance = true
# - Some generations have autoEnhance = false
### Step 5.2: Filter by status to see recent ones
# @name listSuccessGens
GET {{base}}/api/v1/generations?status=success&limit=10
X-API-Key: {{apiKey}}
###
###############################################################################
# TEST 6: Verify Response Structure
###############################################################################
### Step 6.1: Get generation and check fields
# @name verifyStructure
GET {{base}}/api/v1/generations/{{genDefaultId}}
X-API-Key: {{apiKey}}
###
# Expected fields:
# - prompt: string (final prompt, possibly enhanced)
# - originalPrompt: string (original input prompt)
# - autoEnhance: boolean (whether enhancement was applied)
# - status: string
# - outputImageId: string (on success)
# - processingTimeMs: number (on completion)
###############################################################################
# ADDITIONAL TEST CASES
###############################################################################
### Complex prompt that might be enhanced differently
# @name complexPrompt
POST {{base}}/api/v1/generations
Content-Type: application/json
X-API-Key: {{apiKey}}
{
"prompt": "a cat sitting on a windowsill",
"aspectRatio": "16:9"
}
###
@complexId = {{complexPrompt.response.body.$.data.id}}
### Check complex prompt enhancement
# @name checkComplexPrompt
GET {{base}}/api/v1/generations/{{complexId}}
X-API-Key: {{apiKey}}
###
# Verify: Enhanced prompt should add details like lighting, perspective, style, etc.
### Short prompt enhancement
# @name shortPrompt
POST {{base}}/api/v1/generations
Content-Type: application/json
X-API-Key: {{apiKey}}
{
"prompt": "sunset",
"aspectRatio": "21:9"
}
###
@shortId = {{shortPrompt.response.body.$.data.id}}
### Check short prompt enhancement
# @name checkShortPrompt
GET {{base}}/api/v1/generations/{{shortId}}
X-API-Key: {{apiKey}}
###
# Verify: Very short prompts should be significantly enhanced
###############################################################################
# NOTES
###############################################################################
#
# Auto-Enhance Feature:
# - Default: autoEnhance = true (prompts are enhanced by AI)
# - Set autoEnhance: false to disable enhancement
# - Enhanced prompts are more detailed and descriptive
#
# Response Fields:
# - prompt: The final prompt (enhanced if autoEnhance was true)
# - originalPrompt: The user's original input
# - autoEnhance: Boolean flag indicating if enhancement was applied
#
# Enhancement adds:
# - Descriptive adjectives
# - Lighting and atmosphere details
# - Perspective and composition hints
# - Style and rendering suggestions
#