itsulu-blog-publisher/addons/itsulu_blog_publisher/features/blog_generation.feature
Nicholas Riegel 8469ef8b33 Complete BDD feature file organization and add comprehensive step definitions
- Split monolithic blog_generation.feature into separate files per feature:
  * blog_generation.feature: On-demand AI blog generation (3 scenarios)
  * blog_scheduling.feature: Scheduled posts (2 scenarios)
  * llm_provider_selection.feature: Multi-provider routing (6 scenarios)
  * seo_population.feature: SEO field population (1 scenario)
  * notification_email.feature: Post-generation emails (2 scenarios)
  Total: 14 BDD scenarios covering all major workflows

- Extended test_bdd_steps.py from 363 to 472 lines with new step definitions:
  * Added no_email_sent() for draft post email suppression verification
  * Added email_contains_title() for email content validation
  * Added email_contains_social_copy() for platform copy verification
  * Added blog_post_has_tags(), blog_post_has_tag() for tag verification
  * Added blog_post_has_social_copy(), at_least_one_platform_enabled()
  * Added log_has_correct_provider(), log_has_correct_model()
  * Added log_trigger_source(), generation_duration_recorded()

Follows pytest-bdd best practices: one feature per file, each with dedicated
scenarios and step definitions. All 14 scenarios now have complete step coverage.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-05-29 12:41:24 -04:00

41 lines
1.8 KiB
Gherkin

# =================================================================
# On-demand AI blog post generation
# =================================================================
Feature: On-demand AI blog post generation
As an ITSulu content admin
I want to trigger blog post generation with a single button click
So that I no longer need CoWork running on a Windows VM
Background:
Given the Anthropic API key is configured in Settings
And the blog "ITSulu Insights" exists in Odoo
Scenario: Generate and auto-publish a blog post from the backend
Given I am on the Blog Publisher backend form
And I enter topic "Prompt Governance in Enterprise AI"
And I select provider "anthropic" and model "claude-sonnet-4-20250514"
And I set auto-publish to True
When I click "Generate Now"
Then a blog.post record is created with a non-empty title
And the blog.post body_arch contains at least 500 characters of HTML
And the blog.post is_published is True
And the SEO fields website_meta_title and website_meta_description are populated
And a generation log entry exists with state "success"
Scenario: Generate a blog post and leave it as draft
Given I am on the Blog Publisher backend form
And I enter topic "Open Source LLMs for Business"
And I set auto-publish to False
When I click "Generate Now"
Then a blog.post record is created with a non-empty title
And the blog.post is_published is False
Scenario: LLM API call fails gracefully
Given the Anthropic API key is invalid
And I enter topic "Any topic"
And I set auto-publish to True
When I click "Generate Now"
Then no blog.post record is created
And a generation log entry exists with state "error"
And the log contains a human-readable error message
And a "Retry" button is visible on the log record