Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 10 additions & 16 deletions scripts/post_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,7 @@ async def check_admin_api_health(config: ResourceConfig) -> bool:
try:
response = await client.get(f"{config.app_url}/api/admin/health")
if response.status_code == 200:
data = response.json()
print_success(f"Admin API healthy (API key required: {data.get('api_key_required', False)})")
print_success("Admin API is healthy")
return True
else:
print_error(f"Admin API returned {response.status_code}")
Expand Down Expand Up @@ -391,28 +390,23 @@ async def run_application_tests(config: ResourceConfig, dry_run: bool = False) -
print_warning(f"Health check failed: {e}")
results["health"] = False

# Test 3: Brief Parsing (POST /api/brief/parse)
print_step("Testing Brief Parsing (POST /api/brief/parse)")
# Test 3: Chat API (POST /api/chat)
print_step("Testing Chat API (POST /api/chat)")
try:
response = await client.post(
f"{app_url}/api/brief/parse",
json={"brief_text": "Create an ad for calm interior paint for homeowners."},
f"{app_url}/api/chat",
json={"message": "Hello", "conversation_id": "test-post-deploy"},
headers={"Content-Type": "application/json"}
)
if response.status_code == 200:
data = response.json()
if "brief" in data:
print_success(f"Brief parsed: {data['brief'].get('overview', '')[:60]}...")
results["brief_parse"] = True
else:
print_error(f"Unexpected response: {data}")
results["brief_parse"] = False
print_success("Chat API responding")
results["chat_api"] = True
else:
print_error(f"Failed: {response.status_code} - {response.text[:200]}")
results["brief_parse"] = False
print_error(f"Failed: {response.status_code}")
results["chat_api"] = False
except Exception as e:
print_error(f"Failed: {e}")
results["brief_parse"] = False
results["chat_api"] = False

# Test 4: Product Search (GET /api/products)
print_step("Testing Product Search (GET /api/products?search=blue)")
Expand Down
14 changes: 5 additions & 9 deletions tests/e2e-test/pages/HomePage.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ class HomePage(BasePage):

# Response and status locators
TYPING_INDICATOR = "//div[@class='typing-indicator']"
AGENT = "//div[.='PlanningAgent']"
AGENT = "//*[contains(text(),'PlanningAgent')]"
CONFIRM_BRIEF_BUTTON = "//button[normalize-space()='Confirm brief']"
BRIEF_CONFIRMED_TEXT = "//div[contains(text(),'Brief Confirmed')]"
OLIVE_STONE_TEXT = "(//span[normalize-space()='Olive Stone'])[last()]"
OBSIDIAN_TEXT = "(//span[normalize-space()='Obsidian Pearl'])[last()]"
GENERATE_CONTENT_BUTTON = "//button[normalize-space()='Generate Content']"
ANALYZING_BRIEF_TEXT = "//span[contains(text(),'Analyzing creative brief..')]"
ANALYZING_BRIEF_TEXT = "//span[contains(text(),'Processing your request')]"
GENERATED_CONTENT_TEXT_OLIVE = "//span[contains(.,'✨ Discover the serene elegance of Olive Stone.')]"
GENERATED_CONTENT_TEXT_OBSIDIAN = "//span[contains(.,'✨ Discover the serene elegance of Obsidian Pearl.')]"
PAINT_LIST = "//span[.='Here is the list of available paints:']"
Expand Down Expand Up @@ -1039,8 +1039,8 @@ def assert_no_error_in_response(self, context=""):

def validate_planning_agent_response_quality(self, extra_keywords=None):
"""
Validate that the PlanningAgent response is present and contains meaningful
brief-related content (mentions objectives, key message, tone, etc.).
Validate that the response contains meaningful brief-related content
(mentions objectives, key message, tone, etc.).

Hard assertion: At least 2 baseline brief keywords must be present.
Soft assertion: If extra_keywords are provided, logs warnings for missing ones.
Expand All @@ -1050,15 +1050,11 @@ def validate_planning_agent_response_quality(self, extra_keywords=None):
(e.g., ["social media", "back to school"] for Obsidian Pearl).

Raises:
AssertionError: If PlanningAgent response is missing or lacks baseline content.
AssertionError: If response lacks baseline brief content.
"""
logger.info("🔍 Validating PlanningAgent response quality...")

try:
agent_label = self.page.locator(self.AGENT)
expect(agent_label).to_be_visible(timeout=15000)
logger.info("✓ PlanningAgent label is visible")

page_text = self.page.inner_text("body")
page_text_lower = page_text.lower()

Expand Down
Loading