Skip to content

Commit

Permalink
adapt tests for corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
ancalita committed Aug 6, 2024
1 parent a1c349d commit 8ca6151
Show file tree
Hide file tree
Showing 13 changed files with 703 additions and 1 deletion.
2 changes: 1 addition & 1 deletion actions/ask_for_slot_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def run(

if len(restaurant_names) > 0:
dispatcher.utter_message(
text="Do you know which restaurant you would like me to reverse a table at?",
text="Do you know which restaurant you would like me to reserve a table at?",
buttons=[
{"title": r, "payload": f'/inform{{"restaurant_name":"{r}"}}'}
for r in restaurant_names
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
metadata:
- duplicate_msg_correction_1:
turn_idx: 1
- duplicate_msg_correction_2:
turn_idx: 2
test_cases:
- test_case: user_corrects_a_branching_slot
steps:
- user: I want to verify my account
assertions:
- slot_was_set:
- name: route_session_to_calm
value: True
- bot_uttered:
utter_name: utter_ask_verify_account_email
- user: It's [email protected]
assertions:
- bot_uttered:
utter_name: utter_ask_based_in_california
- user: "yes"
metadata: duplicate_msg_correction_1
assertions:
- bot_uttered:
utter_name: utter_ask_verify_account_sufficient_california_income
- user: sorry, I need to correct the previous input
assertions:
- flow_started: pattern_correction
- bot_uttered:
utter_name: utter_ask_confirm_slot_correction
- user: /SetSlots(confirm_slot_correction=true)
assertions:
- bot_uttered:
utter_name: utter_corrected_previous_input
- slot_was_set:
- name: based_in_california
- bot_uttered:
utter_name: utter_ask_based_in_california
- user: "no"
assertions:
- bot_uttered:
utter_name: utter_ask_verify_account_confirmation
- user: "yes"
metadata: duplicate_msg_correction_2
assertions:
- bot_uttered:
utter_name: utter_verify_account_success
- bot_uttered:
utter_name: utter_can_do_something_else
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
test_cases:
- test_case: user_corrects_a_number_slot
steps:
- user: I want to book a table
assertions:
- slot_was_set:
- name: route_session_to_calm
value: False
- bot_uttered:
utter_name: utter_ask_restaurant_form_city
- user: /inform{"location":"amsterdam"}
assertions:
- action_executed: restaurant_form
- bot_uttered:
text_matches: "What cuisine are you looking for?"
- user: /inform{"cuisine":"Japanese"}
assertions:
- action_executed: restaurant_form
- bot_uttered:
text_matches: "Do you know which restaurant you would like me to reserve a table at?"
- user: /inform{"restaurant_name":"Yamazato Restaurant"}
assertions:
- bot_uttered:
utter_name: utter_ask_restaurant_form_num_people
- user: "4"
assertions:
- slot_was_set:
- name: num_people
value: 4
- bot_uttered:
utter_name: utter_ask_restaurant_form_restaurant_time
- user: sorry, we are 6 people
assertions:
- slot_was_set:
- name: num_people
value: 6
- bot_uttered:
utter_name: utter_ask_restaurant_form_restaurant_time
- user: tomorrow at 7pm
assertions:
- bot_uttered:
utter_name: utter_restaurant_form_submit
- bot_uttered:
utter_name: utter_restaurant_available
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
test_cases:
- test_case: user_corrects_amount_of_money_in_the_next_message
steps:
- user: I want to transfer money
assertions:
- slot_was_set:
- name: route_session_to_calm
value: True
- bot_uttered:
utter_name: utter_ask_transfer_money_recipient
- user: John
assertions:
- slot_was_set:
- name: transfer_money_recipient
value: John
- bot_uttered:
utter_name: utter_ask_transfer_money_amount_of_money
- user: 100 USD
assertions:
- slot_was_set:
- name: transfer_money_amount_of_money
value: "100"
- bot_uttered:
utter_name: utter_ask_transfer_money_final_confirmation
- user: Ah, scratch that, I meant 110$
assertions:
- flow_started: pattern_correction
- bot_uttered:
utter_name: utter_ask_confirm_slot_correction
- user: /SetSlots(confirm_slot_correction=true)
assertions:
- slot_was_set:
- name: transfer_money_amount_of_money
value: "110"
- bot_uttered:
utter_name: utter_corrected_previous_input
- bot_uttered:
utter_name: utter_ask_transfer_money_final_confirmation
- user: "yes"
assertions:
- bot_uttered:
utter_name: utter_transfer_complete
- flow_completed:
flow_id: transfer_money
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
test_cases:
- test_case: user_corrects_mentioning_old_value_first
steps:
- user: I want to transfer money
assertions:
- slot_was_set:
- name: route_session_to_calm
value: True
- bot_uttered:
utter_name: utter_ask_transfer_money_recipient
- user: John
assertions:
- slot_was_set:
- name: transfer_money_recipient
value: John
- bot_uttered:
utter_name: utter_ask_transfer_money_amount_of_money
- user: "50"
assertions:
- slot_was_set:
- name: transfer_money_amount_of_money
value: "50"
- bot_uttered:
utter_name: utter_ask_transfer_money_final_confirmation
- user: Ah, not 50, I meant 55
assertions:
- flow_started: pattern_correction
- bot_uttered:
utter_name: utter_ask_confirm_slot_correction
- user: /SetSlots(confirm_slot_correction=true)
assertions:
- slot_was_set:
- name: transfer_money_amount_of_money
value: "55"
- bot_uttered:
utter_name: utter_corrected_previous_input
- bot_uttered:
utter_name: utter_ask_transfer_money_final_confirmation
- user: "yes"
assertions:
- bot_uttered:
utter_name: utter_transfer_complete
- flow_completed:
flow_id: transfer_money
- utter: utter_transfer_complete
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
test_cases:
- test_case: user_corrects_mentioning_old_value_last
steps:
- user: I want to transfer money
assertions:
- slot_was_set:
- name: route_session_to_calm
value: True
- bot_uttered:
utter_name: utter_ask_transfer_money_recipient
- user: John
assertions:
- slot_was_set:
- name: transfer_money_recipient
value: John
- bot_uttered:
utter_name: utter_ask_transfer_money_amount_of_money
- user: Sorry, I meant to say Jimmy, not John
assertions:
- flow_started: pattern_correction
- bot_uttered:
utter_name: utter_ask_confirm_slot_correction
- user: /SetSlots(confirm_slot_correction=true)
assertions:
- slot_was_set:
- name: transfer_money_recipient
value: Jimmy
- bot_uttered:
utter_name: utter_corrected_previous_input
- bot_uttered:
utter_name: utter_ask_transfer_money_amount_of_money
- user: 50$
assertions:
- bot_uttered:
utter_name: utter_ask_transfer_money_final_confirmation
- user: "yes"
assertions:
- bot_uttered:
utter_name: utter_transfer_complete
- flow_completed:
flow_id: transfer_money
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
test_cases:
- test_case: user_corrects_recipient_in_the_next_message
steps:
- user: I want to transfer money
assertions:
- slot_was_set:
- name: route_session_to_calm
value: True
- bot_uttered:
utter_name: utter_ask_transfer_money_recipient
- user: John
assertions:
- slot_was_set:
- name: transfer_money_recipient
value: John
- bot_uttered:
utter_name: utter_ask_transfer_money_amount_of_money
- user: Sorry, I meant to say Joe
assertions:
- flow_started: pattern_correction
- bot_uttered:
utter_name: utter_ask_confirm_slot_correction
- user: /SetSlots(confirm_slot_correction=true)
assertions:
- slot_was_set:
- name: transfer_money_recipient
value: Joe
- bot_uttered:
utter_name: utter_corrected_previous_input
- bot_uttered:
utter_name: utter_ask_transfer_money_amount_of_money
- user: "50"
assertions:
- slot_was_set:
- name: transfer_money_amount_of_money
value: "50"
- bot_uttered:
utter_name: utter_ask_transfer_money_final_confirmation
- user: "yes"
assertions:
- bot_uttered:
utter_name: utter_transfer_complete
- flow_completed:
flow_id: transfer_money
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
test_cases:
- test_case: user_corrects_recipient_late
steps:
- user: I want to transfer money
assertions:
- slot_was_set:
- name: route_session_to_calm
value: True
- bot_uttered:
utter_name: utter_ask_transfer_money_recipient
- user: John
assertions:
- slot_was_set:
- name: transfer_money_recipient
value: John
- bot_uttered:
utter_name: utter_ask_transfer_money_amount_of_money
- user: 50 USD
assertions:
- slot_was_set:
- name: transfer_money_amount_of_money
value: "50"
- bot_uttered:
utter_name: utter_ask_transfer_money_final_confirmation
- user: Oh wait, I want to send it to James!
assertions:
- flow_started: pattern_correction
- bot_uttered:
utter_name: utter_ask_confirm_slot_correction
- user: /SetSlots(confirm_slot_correction=true)
assertions:
- slot_was_set:
- name: transfer_money_recipient
value: James
- bot_uttered:
utter_name: utter_corrected_previous_input
- bot_uttered:
utter_name: utter_ask_transfer_money_final_confirmation
- user: "yes"
assertions:
- bot_uttered:
utter_name: utter_transfer_complete
- flow_completed:
flow_id: transfer_money
Loading

0 comments on commit 8ca6151

Please sign in to comment.