@@ -17,9 +17,11 @@ def test_validate_chat_input_suggestion(page: Page, local_app: ShinyAppProc) ->
1717 expect (chat .loc_input_button ).to_be_disabled ()
1818
1919 # Locate input suggestions
20- first = chat .loc .locator (".suggestion" , has_text = "1st input suggestion" )
21- second = chat .loc .locator ("span[data-suggestion]" )
22- third = chat .loc .locator ("img[data-suggestion]" )
20+ first = chat .loc .locator ("#first" , has_text = "1st input suggestion" )
21+ second = chat .loc .locator ("#second" )
22+ third = chat .loc .locator ("#third" )
23+ fourth = chat .loc .locator ("#fourth" )
24+ fifth = chat .loc .locator ("#fifth" )
2325
2426 # Click on each suggestion and verify the input
2527 first .click ()
@@ -39,3 +41,17 @@ def test_validate_chat_input_suggestion(page: Page, local_app: ShinyAppProc) ->
3941 chat .expect_latest_message ("You said: A 3rd, image-based, suggestion" )
4042 chat .expect_user_input ("" )
4143 expect (chat .loc_input_button ).to_be_disabled ()
44+
45+ # Test auto-submitting suggestions
46+ fourth .click ()
47+ chat .expect_latest_message ("You said: this suggestion will auto-submit" )
48+ chat .expect_user_input ("" )
49+ expect (chat .loc_input_button ).to_be_disabled ()
50+ expect (chat .loc_input ).not_to_be_focused ()
51+
52+ fifth .focus ()
53+ page .keyboard .press ("Enter" )
54+ chat .expect_latest_message ("You said: another suggestion" )
55+ chat .expect_user_input ("" )
56+ expect (chat .loc_input_button ).to_be_disabled ()
57+ expect (chat .loc_input ).not_to_be_focused ()
0 commit comments