feat: Phase 3 - Testing & Automation Features

- Implemented ScenarioRunner with headless scenario execution
- Added YAML-based test scenario framework with validation expectations
- Added CLI command 'run-scenario' with --headless, --output, --junit-xml options
- Created 3 Pterodisbot test scenarios:
  * Basic Server Status Flow (slash_command, select_menu, button_click)
  * Admin Commands (refresh_embeds, purge_embeds with permissions)
  * Multi-Guild Isolation (independent server tracking per guild)
- Fixed content_contains validation logic
- Fixed component_type validation for action rows
- Added command field to ScenarioBot model
- Fixed content_contains validation handling
- All 19 tests passing
This commit is contained in:
k.eaven committed 2026-11-01 05:31:44 +00:00
1 parent 7608388e1a
commit 6fbd7fea79
13 files changed
+1195 -11

No files matched your search

+107
View File
@@ -0,0 +1,107 @@
# Pterodisbot - Basic Server Status Flow
name: "Pterodisbot - Basic Server Status Flow"
description: "Test /server_status -> select server -> click buttons"
# Guild setup
setup:
guilds:
- id: "100000000000000000"
name: "Test Guild"
owner_id: "444444444444444444"
channels:
- "100000000000000010"
roles:
- "200000000000000001"
channels:
- id: "100000000000000010"
guild_id: "100000000000000000"
name: "general"
type: 0 # GUILD_TEXT
position: 0
topic: "General discussion and bot commands"
roles:
- id: "200000000000000001"
guild_id: "100000000000000000"
name: "Game Server User"
color: 3447003
hoist: true
position: 1
permissions: "104324161"
managed: false
mentionable: true
users:
- id: "444444444444444444"
username: "TestBot"
discriminator: "0000"
bot: true
- id: "300000000000000001"
username: "TestUser"
discriminator: "1234"
bot: false
guild_roles:
"100000000000000000":
- "200000000000000001"
bot:
id: "444444444444444444"
username: "TestBot"
discriminator: "0000"
token: "test_token_123"
# command: "python main.py" # Example command to start the bot (commented out for testing)
# Test steps
steps:
- action: "slash_command"
command: "server_status"
user_id: "300000000000000001"
guild_id: "100000000000000000"
channel_id: "100000000000000010"
expect:
- type: 4 # CHANNEL_MESSAGE_WITH_SOURCE
data:
components: true
component_type: 1 # ACTION_ROW
custom_id: "server_dropdown"
options_count: 3
- action: "select_menu"
custom_id: "server_dropdown"
values: ["server_1"]
user_id: "300000000000000001"
guild_id: "100000000000000000"
channel_id: "100000000000000010"
message_id: "msg_123"
expect:
- type: 4
data:
embeds: true
components: true
component_type: 1 # ACTION_ROW
button_count: 4
- action: "button_click"
custom_id: "start_button"
user_id: "300000000000000001"
guild_id: "100000000000000000"
channel_id: "100000000000000010"
message_id: "msg_123"
expect:
- type: 4
data:
content_contains: "starting"
- action: "button_click"
custom_id: "show_address_button"
user_id: "300000000000000001"
guild_id: "100000000000000000"
channel_id: "100000000000000010"
message_id: "msg_123"
expect:
- type: 4
data:
embeds: true
embed_title_contains: "Connection Info"
fields_contain: ["Address", "Port"]