289 lines
8.1 KiB
ReStructuredText
289 lines
8.1 KiB
ReStructuredText
@base = http://localhost:3000
|
||
@apiKey = bnt_727d2f4f72bd03ed96da5278bb971a00cb0a2454d4d70f9748b5c39f3f69d88d
|
||
|
||
###############################################################################
|
||
# BASIC GENERATION TESTS
|
||
# Run these tests FIRST to verify core generation functionality
|
||
#
|
||
# Test Coverage:
|
||
# 1. Simple generation with different aspect ratios
|
||
# 2. Generation retrieval and listing
|
||
# 3. Pagination and filtering
|
||
# 4. Processing time tracking
|
||
###############################################################################
|
||
|
||
###############################################################################
|
||
# TEST 1: Simple Generation (16:9)
|
||
# Creates a basic generation without references or flows
|
||
###############################################################################
|
||
|
||
### Step 1.1: Create Generation
|
||
# @name createBasicGen
|
||
POST {{base}}/api/v1/generations
|
||
Content-Type: application/json
|
||
X-API-Key: {{apiKey}}
|
||
|
||
{
|
||
"prompt": "шикарная моторная яхта движется по живописному озеру, люди сидят в спасательных жилетах и держат в руках бутылки с пивом, густой хвойный лес на берегу. фотореалистичная фотография",
|
||
"aspectRatio": "16:9"
|
||
}
|
||
|
||
###
|
||
|
||
@generationId = {{createBasicGen.response.body.$.data.id}}
|
||
@generationStatus = {{createBasicGen.response.body.$.data.status}}
|
||
|
||
|
||
### Step 1.2: Check Generation Status (Poll until success)
|
||
# @name checkBasicGen
|
||
# Keep running this until status = "success"
|
||
GET {{base}}/api/v1/generations/{{generationId}}
|
||
X-API-Key: {{apiKey}}
|
||
|
||
###
|
||
|
||
@outputImageId = {{checkBasicGen.response.body.$.data.outputImageId}}
|
||
@processingTimeMs = {{checkBasicGen.response.body.$.data.processingTimeMs}}
|
||
|
||
|
||
### Step 1.3: Get Output Image Metadata
|
||
# @name getBasicImage
|
||
GET {{base}}/api/v1/images/{{outputImageId}}
|
||
X-API-Key: {{apiKey}}
|
||
|
||
###
|
||
# Verify:
|
||
# - storageUrl is present
|
||
# - Image is accessible at storageUrl
|
||
# - processingTimeMs is recorded
|
||
|
||
|
||
###############################################################################
|
||
# TEST 2: Square Generation (1:1)
|
||
# Tests aspect ratio 1:1
|
||
###############################################################################
|
||
|
||
### Step 2.1: Create Square Generation
|
||
# @name createSquareGen
|
||
POST {{base}}/api/v1/generations
|
||
Content-Type: application/json
|
||
X-API-Key: {{apiKey}}
|
||
|
||
{
|
||
"prompt": "A minimalist logo design",
|
||
"aspectRatio": "1:1"
|
||
}
|
||
|
||
###
|
||
|
||
@squareGenId = {{createSquareGen.response.body.$.data.id}}
|
||
|
||
|
||
### Step 2.2: Check Status (Poll until success)
|
||
# @name checkSquareGen
|
||
GET {{base}}/api/v1/generations/{{squareGenId}}
|
||
X-API-Key: {{apiKey}}
|
||
|
||
###
|
||
|
||
@squareImageId = {{checkSquareGen.response.body.$.data.outputImageId}}
|
||
|
||
###
|
||
# Verify:
|
||
# - aspectRatio = "1:1"
|
||
# - status = "success"
|
||
# - outputImageId is present
|
||
|
||
|
||
###############################################################################
|
||
# TEST 3: Portrait Generation (9:16)
|
||
# Tests aspect ratio 9:16
|
||
###############################################################################
|
||
|
||
### Step 3.1: Create Portrait Generation
|
||
# @name createPortraitGen
|
||
POST {{base}}/api/v1/generations
|
||
Content-Type: application/json
|
||
X-API-Key: {{apiKey}}
|
||
|
||
{
|
||
"prompt": "A tall building at night",
|
||
"aspectRatio": "9:16"
|
||
}
|
||
|
||
###
|
||
|
||
@portraitGenId = {{createPortraitGen.response.body.$.data.id}}
|
||
|
||
|
||
### Step 3.2: Check Status (Poll until success)
|
||
# @name checkPortraitGen
|
||
GET {{base}}/api/v1/generations/{{portraitGenId}}
|
||
X-API-Key: {{apiKey}}
|
||
|
||
###
|
||
|
||
@portraitImageId = {{checkPortraitGen.response.body.$.data.outputImageId}}
|
||
|
||
###
|
||
# Verify:
|
||
# - aspectRatio = "9:16"
|
||
# - status = "success"
|
||
# - outputImageId is present
|
||
|
||
|
||
###############################################################################
|
||
# TEST 4: Get Generation by ID
|
||
# Verifies all expected fields are present in response
|
||
###############################################################################
|
||
|
||
### Step 4.1: Get Generation Details
|
||
# @name getGenDetails
|
||
GET {{base}}/api/v1/generations/{{generationId}}
|
||
X-API-Key: {{apiKey}}
|
||
|
||
###
|
||
# Verify response contains:
|
||
# - id: {{generationId}}
|
||
# - prompt: "A beautiful sunset over mountains"
|
||
# - status: "success"
|
||
# - outputImageId: {{outputImageId}}
|
||
# - outputImage (nested object)
|
||
# - createdAt
|
||
# - updatedAt
|
||
# - processingTimeMs
|
||
|
||
|
||
###############################################################################
|
||
# TEST 5: List All Generations
|
||
# Verifies generation listing without filters
|
||
###############################################################################
|
||
|
||
### Step 5.1: List All Generations (Default pagination)
|
||
# @name listAllGens
|
||
GET {{base}}/api/v1/generations
|
||
X-API-Key: {{apiKey}}
|
||
|
||
###
|
||
# Verify:
|
||
# - Response has data array
|
||
# - Response has pagination object
|
||
# - At least 3 generations present (from previous tests)
|
||
# - Our generation {{generationId}} is in the list
|
||
|
||
|
||
###############################################################################
|
||
# TEST 6: List Generations with Pagination
|
||
# Tests pagination parameters (limit, offset)
|
||
###############################################################################
|
||
|
||
### Step 6.1: Get First Page (limit=2)
|
||
# @name listPageOne
|
||
GET {{base}}/api/v1/generations?limit=2&offset=0
|
||
X-API-Key: {{apiKey}}
|
||
|
||
###
|
||
# Verify:
|
||
# - data.length <= 2
|
||
# - pagination.limit = 2
|
||
# - pagination.offset = 0
|
||
# - pagination.hasMore = true (if total > 2)
|
||
|
||
|
||
### Step 6.2: Get Second Page (offset=2)
|
||
# @name listPageTwo
|
||
GET {{base}}/api/v1/generations?limit=2&offset=2
|
||
X-API-Key: {{apiKey}}
|
||
|
||
###
|
||
# Verify:
|
||
# - Different results than first page
|
||
# - pagination.offset = 2
|
||
|
||
|
||
###############################################################################
|
||
# TEST 7: Filter Generations by Status
|
||
# Tests status filter parameter
|
||
###############################################################################
|
||
|
||
### Step 7.1: Filter by Success Status
|
||
# @name filterSuccess
|
||
GET {{base}}/api/v1/generations?status=success
|
||
X-API-Key: {{apiKey}}
|
||
|
||
###
|
||
# Verify:
|
||
# - All items in data[] have status = "success"
|
||
# - No pending/processing/failed generations
|
||
|
||
|
||
### Step 7.2: Filter by Failed Status
|
||
# @name filterFailed
|
||
GET {{base}}/api/v1/generations?status=failed
|
||
X-API-Key: {{apiKey}}
|
||
|
||
###
|
||
# Verify:
|
||
# - All items (if any) have status = "failed"
|
||
|
||
|
||
###############################################################################
|
||
# TEST 8: Verify Processing Time Recorded
|
||
# Ensures generation performance metrics are tracked
|
||
###############################################################################
|
||
|
||
### Step 8.1: Check Processing Time
|
||
# @name checkProcessingTime
|
||
GET {{base}}/api/v1/generations/{{generationId}}
|
||
X-API-Key: {{apiKey}}
|
||
|
||
###
|
||
# Verify:
|
||
# - processingTimeMs is a number: {{processingTimeMs}}
|
||
# - processingTimeMs > 0
|
||
# - Typical range: 3000-15000ms (3-15 seconds)
|
||
# - Processing time reflects actual generation duration
|
||
|
||
|
||
###############################################################################
|
||
# CLEANUP (Optional)
|
||
# Uncomment to delete test generations
|
||
###############################################################################
|
||
|
||
# ### Delete Test Generation 1
|
||
# DELETE {{base}}/api/v1/generations/{{generationId}}
|
||
# X-API-Key: {{apiKey}}
|
||
|
||
# ### Delete Test Generation 2
|
||
# DELETE {{base}}/api/v1/generations/{{squareGenId}}
|
||
# X-API-Key: {{apiKey}}
|
||
|
||
# ### Delete Test Generation 3
|
||
# DELETE {{base}}/api/v1/generations/{{portraitGenId}}
|
||
# X-API-Key: {{apiKey}}
|
||
|
||
|
||
###############################################################################
|
||
# NOTES
|
||
###############################################################################
|
||
#
|
||
# Expected Results:
|
||
# ✓ All generations complete successfully (status = "success")
|
||
# ✓ Each generation has unique ID and output image
|
||
# ✓ Aspect ratios are correctly applied
|
||
# ✓ Processing times are recorded (typically 3-15 seconds)
|
||
# ✓ Pagination works correctly
|
||
# ✓ Status filtering works correctly
|
||
#
|
||
# Common Issues:
|
||
# ⚠ Generation may fail with Gemini API errors (transient)
|
||
# ⚠ Processing time varies based on prompt complexity
|
||
# ⚠ First generation may be slower (cold start)
|
||
#
|
||
# Tips:
|
||
# - Use "Poll until success" for Step X.2 requests
|
||
# - Variables are automatically extracted from responses
|
||
# - Check response body to see extracted values
|
||
# - Most generations complete in 5-10 seconds
|
||
#
|