Add comprehensive .gitignore
This commit is contained in:
258
maternal-app/maternal-app-backend/artillery.yml
Normal file
258
maternal-app/maternal-app-backend/artillery.yml
Normal file
@@ -0,0 +1,258 @@
|
||||
config:
|
||||
target: "http://localhost:3000"
|
||||
phases:
|
||||
# Warm-up phase
|
||||
- duration: 60
|
||||
arrivalRate: 5
|
||||
name: "Warm up"
|
||||
|
||||
# Ramp up phase
|
||||
- duration: 120
|
||||
arrivalRate: 5
|
||||
rampTo: 50
|
||||
name: "Ramp up load"
|
||||
|
||||
# Sustained load phase
|
||||
- duration: 300
|
||||
arrivalRate: 50
|
||||
name: "Sustained load"
|
||||
|
||||
# Spike test
|
||||
- duration: 60
|
||||
arrivalRate: 100
|
||||
name: "Spike test"
|
||||
|
||||
# Performance thresholds
|
||||
ensure:
|
||||
maxErrorRate: 1 # Max 1% error rate
|
||||
p95: 2000 # 95th percentile response time < 2s
|
||||
p99: 3000 # 99th percentile response time < 3s
|
||||
|
||||
# HTTP defaults
|
||||
http:
|
||||
timeout: 10
|
||||
|
||||
# Define variables
|
||||
variables:
|
||||
testEmail: "perf-test-{{ $randomString() }}@example.com"
|
||||
testPassword: "TestPassword123!"
|
||||
|
||||
# Processor for custom logic
|
||||
processor: "./test-helpers/artillery-processor.js"
|
||||
|
||||
scenarios:
|
||||
# Authentication flow
|
||||
- name: "User Registration and Login"
|
||||
weight: 10
|
||||
flow:
|
||||
- post:
|
||||
url: "/api/v1/auth/register"
|
||||
json:
|
||||
email: "{{ testEmail }}"
|
||||
password: "{{ testPassword }}"
|
||||
name: "Test User"
|
||||
phone: "+1234567890"
|
||||
deviceInfo:
|
||||
deviceId: "test-device-{{ $randomString() }}"
|
||||
deviceName: "Artillery Test Device"
|
||||
platform: "web"
|
||||
capture:
|
||||
- json: "$.data.tokens.accessToken"
|
||||
as: "accessToken"
|
||||
- json: "$.data.user.id"
|
||||
as: "userId"
|
||||
- json: "$.data.family.id"
|
||||
as: "familyId"
|
||||
expect:
|
||||
- statusCode: 201
|
||||
|
||||
- post:
|
||||
url: "/api/v1/auth/login"
|
||||
json:
|
||||
email: "{{ testEmail }}"
|
||||
password: "{{ testPassword }}"
|
||||
deviceInfo:
|
||||
deviceId: "test-device-{{ $randomString() }}"
|
||||
deviceName: "Artillery Test Device"
|
||||
platform: "web"
|
||||
expect:
|
||||
- statusCode: 200
|
||||
|
||||
# Activity tracking flow (most common operation)
|
||||
- name: "Track Baby Activities"
|
||||
weight: 50
|
||||
flow:
|
||||
# Login first
|
||||
- post:
|
||||
url: "/api/v1/auth/login"
|
||||
json:
|
||||
email: "perf-test@example.com" # Use pre-seeded account
|
||||
password: "TestPassword123!"
|
||||
deviceInfo:
|
||||
deviceId: "test-device-{{ $randomString() }}"
|
||||
deviceName: "Artillery Test Device"
|
||||
platform: "web"
|
||||
capture:
|
||||
- json: "$.data.tokens.accessToken"
|
||||
as: "accessToken"
|
||||
- json: "$.data.user.id"
|
||||
as: "userId"
|
||||
|
||||
# Create child if needed
|
||||
- post:
|
||||
url: "/api/v1/children"
|
||||
headers:
|
||||
Authorization: "Bearer {{ accessToken }}"
|
||||
json:
|
||||
name: "Test Baby {{ $randomNumber(1, 1000) }}"
|
||||
dateOfBirth: "2024-01-01"
|
||||
gender: "other"
|
||||
capture:
|
||||
- json: "$.data.id"
|
||||
as: "childId"
|
||||
|
||||
# Log feeding activity
|
||||
- post:
|
||||
url: "/api/v1/activities?childId={{ childId }}"
|
||||
headers:
|
||||
Authorization: "Bearer {{ accessToken }}"
|
||||
json:
|
||||
type: "feeding"
|
||||
startedAt: "{{ $now }}"
|
||||
endedAt: "{{ $now }}"
|
||||
details:
|
||||
feedingType: "bottle"
|
||||
amountMl: 120
|
||||
notes: "Performance test feeding"
|
||||
expect:
|
||||
- statusCode: 201
|
||||
- contentType: json
|
||||
|
||||
# Log sleep activity
|
||||
- post:
|
||||
url: "/api/v1/activities?childId={{ childId }}"
|
||||
headers:
|
||||
Authorization: "Bearer {{ accessToken }}"
|
||||
json:
|
||||
type: "sleep"
|
||||
startedAt: "{{ $now }}"
|
||||
details:
|
||||
quality: "good"
|
||||
location: "crib"
|
||||
expect:
|
||||
- statusCode: 201
|
||||
|
||||
# Get daily summary
|
||||
- get:
|
||||
url: "/api/v1/activities/summary?childId={{ childId }}&date={{ $now }}"
|
||||
headers:
|
||||
Authorization: "Bearer {{ accessToken }}"
|
||||
expect:
|
||||
- statusCode: 200
|
||||
|
||||
# Analytics and insights (read-heavy)
|
||||
- name: "View Analytics Dashboard"
|
||||
weight: 20
|
||||
flow:
|
||||
- post:
|
||||
url: "/api/v1/auth/login"
|
||||
json:
|
||||
email: "perf-test@example.com"
|
||||
password: "TestPassword123!"
|
||||
deviceInfo:
|
||||
deviceId: "test-device-{{ $randomString() }}"
|
||||
deviceName: "Artillery Test Device"
|
||||
platform: "web"
|
||||
capture:
|
||||
- json: "$.data.tokens.accessToken"
|
||||
as: "accessToken"
|
||||
|
||||
- get:
|
||||
url: "/api/v1/analytics/insights/sleep-patterns?childId={{ childId }}&days=7"
|
||||
headers:
|
||||
Authorization: "Bearer {{ accessToken }}"
|
||||
expect:
|
||||
- statusCode: 200
|
||||
|
||||
- get:
|
||||
url: "/api/v1/analytics/insights/feeding-patterns?childId={{ childId }}&days=7"
|
||||
headers:
|
||||
Authorization: "Bearer {{ accessToken }}"
|
||||
expect:
|
||||
- statusCode: 200
|
||||
|
||||
- get:
|
||||
url: "/api/v1/analytics/reports/weekly?childId={{ childId }}"
|
||||
headers:
|
||||
Authorization: "Bearer {{ accessToken }}"
|
||||
expect:
|
||||
- statusCode: 200
|
||||
|
||||
# AI assistant interaction
|
||||
- name: "AI Chat Interaction"
|
||||
weight: 15
|
||||
flow:
|
||||
- post:
|
||||
url: "/api/v1/auth/login"
|
||||
json:
|
||||
email: "perf-test@example.com"
|
||||
password: "TestPassword123!"
|
||||
deviceInfo:
|
||||
deviceId: "test-device-{{ $randomString() }}"
|
||||
deviceName: "Artillery Test Device"
|
||||
platform: "web"
|
||||
capture:
|
||||
- json: "$.data.tokens.accessToken"
|
||||
as: "accessToken"
|
||||
|
||||
- post:
|
||||
url: "/api/v1/ai/chat"
|
||||
headers:
|
||||
Authorization: "Bearer {{ accessToken }}"
|
||||
json:
|
||||
message: "How much should my 3-month-old eat?"
|
||||
capture:
|
||||
- json: "$.data.conversationId"
|
||||
as: "conversationId"
|
||||
expect:
|
||||
- statusCode: 201
|
||||
|
||||
- get:
|
||||
url: "/api/v1/ai/conversations"
|
||||
headers:
|
||||
Authorization: "Bearer {{ accessToken }}"
|
||||
expect:
|
||||
- statusCode: 200
|
||||
|
||||
# Family management
|
||||
- name: "Family Collaboration"
|
||||
weight: 5
|
||||
flow:
|
||||
- post:
|
||||
url: "/api/v1/auth/login"
|
||||
json:
|
||||
email: "perf-test@example.com"
|
||||
password: "TestPassword123!"
|
||||
deviceInfo:
|
||||
deviceId: "test-device-{{ $randomString() }}"
|
||||
deviceName: "Artillery Test Device"
|
||||
platform: "web"
|
||||
capture:
|
||||
- json: "$.data.tokens.accessToken"
|
||||
as: "accessToken"
|
||||
- json: "$.data.family.id"
|
||||
as: "familyId"
|
||||
|
||||
- get:
|
||||
url: "/api/v1/families/{{ familyId }}"
|
||||
headers:
|
||||
Authorization: "Bearer {{ accessToken }}"
|
||||
expect:
|
||||
- statusCode: 200
|
||||
|
||||
- get:
|
||||
url: "/api/v1/families/{{ familyId }}/members"
|
||||
headers:
|
||||
Authorization: "Bearer {{ accessToken }}"
|
||||
expect:
|
||||
- statusCode: 200
|
||||
Reference in New Issue
Block a user