openclaw/qa/scenarios/channels/whatsapp-access-control-group-disabled.yaml

71 lines
2.5 KiB
YAML

title: WhatsApp groupPolicy disabled stays quiet
scenario:
id: whatsapp-access-control-group-disabled
surface: channels
coverage:
primary:
- channels.access-policy
objective: Verify groupPolicy disabled rejects group messages.
successCriteria:
- The group message produces no outbound reply.
docsRefs:
- docs/channels/whatsapp.md
codeRefs:
- extensions/whatsapp/src/monitor.ts
execution:
kind: flow
channel: whatsapp
suiteIsolation: isolated
summary: Verify WhatsApp groupPolicy disabled behavior through the canonical adapter.
config:
requiredChannelDriver: live
policyKey: groupPolicy
policyValue: disabled
conversationKind: group
conversationId: 120363000000000000@g.us
senderId: 15550000002@s.whatsapp.net
mentionPrefix: "@openclaw "
expectReply: false
markerPrefix: WHATSAPP_QA_GROUP_DISABLED
timeoutMs: 8000
flow:
steps:
- name: enforces configured access policy
actions:
- call: waitForGatewayHealthy
args: [{ ref: env }, 60000]
- call: waitForTransportReady
args: [{ ref: env }, 60000]
- call: patchConfig
args:
- env: { ref: env }
patch:
expr: "({ channels: { whatsapp: { [config.policyKey]: config.policyValue, ...(env.transport.accountId === 'default' ? {} : { accounts: { [env.transport.accountId]: { [config.policyKey]: config.policyValue } } }) } } })"
- resetTransport: true
- set: marker
value:
expr: "`${config.markerPrefix}_${randomUUID().slice(0, 8).toUpperCase()}`"
- set: outboundCount
value:
expr: "getTransportSnapshot().messages.filter((message) => message.direction === 'outbound').length"
- sendInbound:
conversation:
id: { ref: config.conversationId }
kind: { ref: config.conversationKind }
senderId: { ref: config.senderId }
senderName: QA Driver
text:
expr: "`${config.mentionPrefix}Reply with only this exact marker: ${marker}`"
- if:
expr: config.expectReply
then:
- waitForOutbound:
textIncludes: { ref: marker }
timeoutMs: { ref: config.timeoutMs }
else:
- waitForNoOutbound:
quietMs: { ref: config.timeoutMs }
sinceIndex: { ref: outboundCount }
detailsExpr: "`${config.markerPrefix}: expectReply=${config.expectReply}`"