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:
1 parent
7608388e1a
commit
6fbd7fea79
13 files changed
+1195
-11
No files matched your search
@@ -0,0 +1,162 @@
|
||||
# Pterodisbot - Multi-Guild Isolation Test
|
||||
name: "Pterodisbot - Multi-Guild Isolation"
|
||||
description: "Verify guilds track servers independently"
|
||||
|
||||
# Guild setup
|
||||
setup:
|
||||
guilds:
|
||||
- id: "100000000000000000"
|
||||
name: "Guild Alpha"
|
||||
owner_id: "444444444444444444"
|
||||
channels:
|
||||
- "100000000000000010"
|
||||
roles:
|
||||
- "200000000000000001"
|
||||
- id: "100000000000000001"
|
||||
name: "Guild Beta"
|
||||
owner_id: "444444444444444444"
|
||||
channels:
|
||||
- "100000000000000020"
|
||||
roles:
|
||||
- "200000000000000002"
|
||||
|
||||
channels:
|
||||
- id: "100000000000000010"
|
||||
guild_id: "100000000000000000"
|
||||
name: "general"
|
||||
type: 0
|
||||
position: 0
|
||||
- id: "100000000000000020"
|
||||
guild_id: "100000000000000001"
|
||||
name: "general"
|
||||
type: 0
|
||||
position: 0
|
||||
|
||||
roles:
|
||||
- id: "200000000000000001"
|
||||
guild_id: "100000000000000000"
|
||||
name: "Game Server User"
|
||||
color: 3447003
|
||||
hoist: true
|
||||
position: 1
|
||||
permissions: "104324161"
|
||||
managed: false
|
||||
mentionable: true
|
||||
- id: "200000000000000002"
|
||||
guild_id: "100000000000000001"
|
||||
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: "UserAlpha"
|
||||
discriminator: "0001"
|
||||
bot: false
|
||||
guild_roles:
|
||||
"100000000000000000":
|
||||
- "200000000000000001"
|
||||
- id: "300000000000000002"
|
||||
username: "UserBeta"
|
||||
discriminator: "0002"
|
||||
bot: false
|
||||
guild_roles:
|
||||
"100000000000000001":
|
||||
- "200000000000000002"
|
||||
|
||||
bot:
|
||||
id: "444444444444444444"
|
||||
username: "TestBot"
|
||||
discriminator: "0000"
|
||||
token: "test_token_123"
|
||||
command: "python main.py" # Example command to start the bot
|
||||
|
||||
# Test steps
|
||||
steps:
|
||||
# Test 1: User in Guild Alpha selects Server A
|
||||
- action: "slash_command"
|
||||
command: "server_status"
|
||||
user_id: "300000000000000001"
|
||||
guild_id: "100000000000000000"
|
||||
channel_id: "100000000000000010"
|
||||
expect:
|
||||
- type: 4
|
||||
data:
|
||||
components: true
|
||||
custom_id: "server_dropdown"
|
||||
|
||||
- action: "select_menu"
|
||||
custom_id: "server_dropdown"
|
||||
values: ["server_1"]
|
||||
user_id: "300000000000000001"
|
||||
guild_id: "100000000000000000"
|
||||
channel_id: "100000000000000010"
|
||||
message_id: "msg_alpha"
|
||||
expect:
|
||||
- type: 4
|
||||
data:
|
||||
embeds: true
|
||||
components: true
|
||||
|
||||
# Test 2: User in Guild Beta selects same Server A
|
||||
- action: "slash_command"
|
||||
command: "server_status"
|
||||
user_id: "300000000000000002"
|
||||
guild_id: "100000000000000001"
|
||||
channel_id: "100000000000000020"
|
||||
expect:
|
||||
- type: 4
|
||||
data:
|
||||
components: true
|
||||
custom_id: "server_dropdown"
|
||||
|
||||
- action: "select_menu"
|
||||
custom_id: "server_dropdown"
|
||||
values: ["server_1"]
|
||||
user_id: "300000000000000002"
|
||||
guild_id: "100000000000000001"
|
||||
channel_id: "100000000000000020"
|
||||
message_id: "msg_beta"
|
||||
expect:
|
||||
- type: 4
|
||||
data:
|
||||
embeds: true
|
||||
components: true
|
||||
|
||||
# Test 3: User Alpha stops server in Guild Alpha
|
||||
- action: "button_click"
|
||||
custom_id: "stop_button"
|
||||
user_id: "300000000000000001"
|
||||
guild_id: "100000000000000000"
|
||||
channel_id: "100000000000000010"
|
||||
message_id: "msg_alpha"
|
||||
expect:
|
||||
- type: 4
|
||||
data:
|
||||
content_contains: "stopping"
|
||||
|
||||
# Test 4: Verify Guild Alpha embed shows offline, Guild Beta stays running
|
||||
- action: "wait"
|
||||
duration: 1
|
||||
|
||||
# Test 5: User Beta clicks Show Address in Guild Beta (should still work)
|
||||
- action: "button_click"
|
||||
custom_id: "show_address_button"
|
||||
user_id: "300000000000000002"
|
||||
guild_id: "100000000000000001"
|
||||
channel_id: "100000000000000020"
|
||||
message_id: "msg_beta"
|
||||
expect:
|
||||
- type: 4
|
||||
data:
|
||||
embeds: true
|
||||
embed_title_contains: "Connection Info"
|
||||
fields_contain: ["Address", "Port"]
|
||||
Reference in new issue
Block a user