Skip to content

Commit

Permalink
ENG-1293: Add tests to verify that link to pattern_human_handoff is…
Browse files Browse the repository at this point in the history
… triggered in relevant conditions

On these conditions:
1. When `pattern_clarification` is triggered twice
2. Or when login fails during check-portfolio at least 3 times
  • Loading branch information
AsadHasan-Rasa committed Sep 17, 2024
1 parent 4ecfbcd commit abda9f2
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
fixtures:
- route_to_calm:
- route_session_to_calm: True

metadata:
- duplicate_message_1:
turn_idx: 1
- duplicate_message_2:
turn_idx: 2
- duplicate_message_3:
turn_idx: 3

test_cases:
- test_case: user_is_referred_to_human_after_2_clarifications
fixtures:
- route_to_calm
steps:
- user: cash
metadata: duplicate_message_1
assertions:
- pattern_clarification_contains:
- 'transfer money'
- 'check your balance'
- slot_was_set:
- name: clarification_count
value: 1
- bot_uttered:
utter_name: utter_clarification_options_rasa
- user: cash
metadata: duplicate_message_2
assertions:
- pattern_clarification_contains:
- 'transfer money'
- 'check your balance'
- slot_was_set:
- name: clarification_count
value: 2
- bot_uttered:
utter_name: utter_clarification_options_rasa
- user: cash
metadata: duplicate_message_3
assertions:
- slot_was_set:
- name: clarification_count
value: 3
- flow_started: pattern_human_handoff
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
fixtures:
- route_to_calm:
- route_session_to_calm: True

metadata:
- duplicate_message_1:
turn_idx: 1
- duplicate_message_2:
turn_idx: 2
- duplicate_message_3:
turn_idx: 3

test_cases:
- test_case: user_is_referred_to_human_after_3_portfolio_check_auth_fails
fixtures:
- route_to_calm
steps:
- user: I want to check my portfolio
assertions:
- bot_uttered:
utter_name: utter_ask_user_name
- user: John
metadata: duplicate_message_1
assertions:
- bot_uttered:
utter_name: utter_ask_user_password
- user: "1234"
metadata: duplicate_message_1
assertions:
- bot_uttered:
utter_name: utter_authentication_failed
- slot_was_set:
- name: login_failed_attempts
value: 1
- bot_uttered:
utter_name: utter_ask_user_name
- user: John
metadata: duplicate_message_2
assertions:
- bot_uttered:
utter_name: utter_ask_user_password
- user: "1234"
metadata: duplicate_message_2
assertions:
- bot_uttered:
utter_name: utter_authentication_failed
- slot_was_set:
- name: login_failed_attempts
value: 2
- bot_uttered:
utter_name: utter_ask_user_name
- user: John
metadata: duplicate_message_3
assertions:
- bot_uttered:
utter_name: utter_ask_user_password
- user: "1234"
metadata: duplicate_message_3
assertions:
- slot_was_set:
- name: login_failed_attempts
value: 3
- flow_started: pattern_human_handoff

0 comments on commit abda9f2

Please sign in to comment.