@@ -24,13 +24,7 @@ export const basic = {
24
24
25
25
const modal = within ( dialog ) ;
26
26
expect ( modal . getByText ( / W e l c o m e t o B o x A I / i) ) . toBeInTheDocument ( ) ;
27
- expect ( modal . getByText ( 'Ask Box AI' ) ) . toBeInTheDocument ( ) ;
28
- expect ( modal . getByText ( 'This chat will be cleared when you close this pdf' ) ) . toBeInTheDocument ( ) ;
29
-
30
- expect ( modal . getByText ( 'Summarize this document' ) ) . toBeInTheDocument ( ) ;
31
- expect ( modal . getByText ( 'What are the key takeaways?' ) ) . toBeInTheDocument ( ) ;
32
- expect ( modal . getByText ( 'How can this document be improved?' ) ) . toBeInTheDocument ( ) ;
33
- expect ( modal . getByText ( 'Are there any next steps defined?' ) ) . toBeInTheDocument ( ) ;
27
+ expect ( modal . getByText ( 'Chat cleared when you close pdf' ) ) . toBeInTheDocument ( ) ;
34
28
35
29
expect ( modal . getByText ( 'Ask Box AI' ) ) . toBeInTheDocument ( ) ;
36
30
} ,
@@ -76,27 +70,6 @@ export const submitAnswer = {
76
70
} ,
77
71
} ;
78
72
79
- export const clickOnSuggestion = {
80
- play : async ( { canvasElement } ) => {
81
- const canvas = within ( canvasElement ) ;
82
- const button = await canvas . findByRole ( 'button' , { name : 'Box AI' } , { timeout : WAIT_TIMEOUT } ) ;
83
- expect ( button ) . toBeInTheDocument ( ) ;
84
- await userEvent . click ( button ) ;
85
-
86
- const dialog = await waitFor ( ( ) => document . querySelector ( '[role="dialog"]' ) ) ;
87
- expect ( dialog ) . toBeInTheDocument ( ) ;
88
-
89
- const modal = within ( dialog ) ;
90
- const suggestion = modal . getByText ( 'Summarize this document' ) ;
91
- await userEvent . click ( suggestion ) ;
92
-
93
- const answer = await modal . findByText ( 'Public APIs are important because of key and important reasons.' ) ;
94
- expect ( answer ) . toBeInTheDocument ( ) ;
95
-
96
- expect ( modal . getByText ( 'Based on:' ) ) . toBeInTheDocument ( ) ;
97
- } ,
98
- } ;
99
-
100
73
export const hoverOverCitation = {
101
74
play : async ( { canvasElement } ) => {
102
75
const canvas = within ( canvasElement ) ;
@@ -108,8 +81,11 @@ export const hoverOverCitation = {
108
81
109
82
expect ( dialog ) . toBeInTheDocument ( ) ;
110
83
const modal = within ( dialog ) ;
111
- const suggestion = modal . getByText ( 'Summarize this document' ) ;
112
- await userEvent . click ( suggestion ) ;
84
+ const textInput = modal . getByRole ( 'textbox' , { name : 'Ask Box AI' } ) ;
85
+ expect ( textInput ) . toBeInTheDocument ( ) ;
86
+ textInput . focus ( ) ;
87
+ await userEvent . keyboard ( 'Why are public APIs important?' ) ;
88
+ await userEvent . click ( modal . getByRole ( 'button' , { name : 'Ask' } ) , { pointerEventsCheck : 0 } ) ;
113
89
114
90
const answer = await modal . findByText ( 'Public APIs are important because of key and important reasons.' ) ;
115
91
expect ( answer ) . toBeInTheDocument ( ) ;
@@ -146,8 +122,11 @@ export const citationDisabled = {
146
122
expect ( dialog ) . toBeInTheDocument ( ) ;
147
123
148
124
const modal = within ( dialog ) ;
149
- const suggestion = modal . getByText ( 'Summarize this document' ) ;
150
- await userEvent . click ( suggestion ) ;
125
+ const textInput = modal . getByRole ( 'textbox' , { name : 'Ask Box AI' } ) ;
126
+ expect ( textInput ) . toBeInTheDocument ( ) ;
127
+ textInput . focus ( ) ;
128
+ await userEvent . keyboard ( 'Why are public APIs important?' ) ;
129
+ await userEvent . click ( modal . getByRole ( 'button' , { name : 'Ask' } ) , { pointerEventsCheck : 0 } ) ;
151
130
152
131
const answer = await modal . findByText ( 'Public APIs are important because of key and important reasons.' ) ;
153
132
expect ( answer ) . toBeInTheDocument ( ) ;
@@ -167,8 +146,11 @@ export const clearConversation = {
167
146
expect ( dialog ) . toBeInTheDocument ( ) ;
168
147
169
148
const modal = within ( dialog ) ;
170
- const suggestion = modal . getByText ( 'Summarize this document' ) ;
171
- await userEvent . click ( suggestion ) ;
149
+ const textInput = modal . getByRole ( 'textbox' , { name : 'Ask Box AI' } ) ;
150
+ expect ( textInput ) . toBeInTheDocument ( ) ;
151
+ textInput . focus ( ) ;
152
+ await userEvent . keyboard ( 'Why are public APIs important?' ) ;
153
+ await userEvent . click ( modal . getByRole ( 'button' , { name : 'Ask' } ) , { pointerEventsCheck : 0 } ) ;
172
154
173
155
const answer = await modal . findByText ( 'Public APIs are important because of key and important reasons.' ) ;
174
156
expect ( answer ) . toBeInTheDocument ( ) ;
0 commit comments