11<!doctype html>
22< html lang ="en-US ">
3-
4- < head >
5- < link href =" /assets/index.css " rel =" stylesheet " type =" text/css " / >
6- < script crossorigin ="anonymous " src ="https://unpkg.com/@babel/standalone@7 .8.7/babel .min.js "> </ script >
7- < script crossorigin ="anonymous " src ="https://unpkg.com/react@16.8.6/umd/react.production.min.js "> </ script >
8- < script crossorigin ="anonymous " src ="https://unpkg.com/react-dom@16.8.6/umd/react-dom.production.min .js "> </ script >
9- < script crossorigin ="anonymous " src ="/test-harness .js "> </ script >
10- < script crossorigin ="anonymous " src ="/test-page-object .js "> </ script >
11- < script crossorigin ="anonymous " src ="/__dist__/webchat-es5 .js "> </ script >
12- < script crossorigin =" anonymous " src =" /__dist__/botframework-webchat-fluent-theme.production.min.js " > </ script >
13- </ head >
14-
15- < body >
16- < main id =" webchat " > </ main >
17- < script type =" text/babel " >
18- run ( async function ( ) {
19- const {
20- React ,
21- ReactDOM : { render } ,
22- WebChat : { FluentThemeProvider , ReactWebChat }
23- } = window ; // Imports in UMD fashion.
24-
25- const { directLine , store } = testHelpers . createDirectLineEmulator ( ) ;
26-
27- const App = ( ) => < ReactWebChat directLine = { directLine } store = { store } /> ;
28-
29- render (
30- < FluentThemeProvider >
31- < App />
32- </ FluentThemeProvider > ,
33- document . getElementById ( 'webchat' )
34- ) ;
35-
36- await pageConditions . uiConnected ( ) ;
37-
38- await directLine . emulateIncomingActivity ( {
39- type : 'message ' ,
40- id : 'a-00000' ,
41- timestamp : 0 ,
42- text : 'This is a test message to show feedback buttons' ,
43- from : {
44- role : 'bot'
45- } ,
46- locale : 'en-US' ,
47- entities : [ ] ,
48- channelData : {
49- feedbackLoop : {
50- type : 'default' ,
51- disclaimer : 'This is a test disclaimer message'
3+ < head >
4+ < link href =" /assets/index.css " rel =" stylesheet " type =" text/css " / >
5+ < script crossorigin =" anonymous " src =" https://unpkg.com/@babel/standalone@7.8.7/babel.min.js " > </ script >
6+ < script crossorigin ="anonymous " src ="https://unpkg.com/react@16 .8.6/umd/react.production .min.js "> </ script >
7+ < script crossorigin ="anonymous " src ="https://unpkg.com/react-dom @16.8.6/umd/react-dom .production.min.js "> </ script >
8+ < script crossorigin ="anonymous " src ="/test-harness .js "> </ script >
9+ < script crossorigin ="anonymous " src ="/test-page-object .js "> </ script >
10+ < script crossorigin ="anonymous " src ="/__dist__/webchat-es5 .js "> </ script >
11+ < script crossorigin ="anonymous " src ="/__dist__/botframework- webchat-fluent-theme.production.min .js "> </ script >
12+ </ head >
13+
14+ < body >
15+ < main id =" webchat " > </ main >
16+ < script type =" text/babel " >
17+ run ( async function ( ) {
18+ const {
19+ React ,
20+ ReactDOM : { render } ,
21+ WebChat : { FluentThemeProvider , ReactWebChat }
22+ } = window ; // Imports in UMD fashion.
23+
24+ const { directLine , store } = testHelpers . createDirectLineEmulator ( ) ;
25+
26+ const App = ( ) => < ReactWebChat directLine = { directLine } store = { store } /> ;
27+
28+ render (
29+ < FluentThemeProvider >
30+ < App / >
31+ </ FluentThemeProvider > ,
32+ document . getElementById ( 'webchat' )
33+ ) ;
34+
35+ await pageConditions . uiConnected ( ) ;
36+
37+ await directLine . emulateIncomingActivity ( {
38+ type : 'message' ,
39+ id : 'a-00000 ' ,
40+ timestamp : 0 ,
41+ text : 'This is a test message to show feedback buttons' ,
42+ from : {
43+ role : 'bot'
44+ } ,
45+ locale : 'en-US' ,
46+ entities : [ ] ,
47+ channelData : {
48+ feedbackLoop : {
49+ type : 'default' ,
50+ disclaimer : 'This is a test disclaimer message'
51+ }
5252 }
53- }
54- } ) ;
55-
56- await pageConditions . numActivitiesShown ( 1 ) ;
57-
58- pageElements . byTestId ( 'send box text area' ) . focus ( ) ;
59- await host . sendShiftTab ( 2 ) ;
53+ } ) ;
6054
61- await host . sendKeys ( 'ENTER' ) ;
62- await host . sendKeys ( 'ENTER' ) ;
55+ await pageConditions . numActivitiesShown ( 1 ) ;
6356
64- await host . snapshot ( 'local' ) ;
57+ pageElements . byTestId ( 'send box text area' ) . focus ( ) ;
58+ await host . sendShiftTab ( 2 ) ;
6559
66- // Dismiss like button
67- await host . sendShiftTab ( 2 ) ;
68- await host . sendKeys ( 'ENTER' ) ;
69-
70- // Click like button
71- await host . sendKeys ( 'ENTER' ) ;
72-
73- await pageConditions . became (
74- 'feedback form is open' ,
75- ( ) => document . activeElement === pageElements . byTestId ( 'feedback sendbox' ) ,
76- 1000
77- ) ;
60+ await host . sendKeys ( 'ENTER' ) ;
61+ await host . sendKeys ( 'ENTER' ) ;
7862
79- // Go to cancel button
80- await host . sendTab ( 2 ) ;
81- await host . sendKeys ( 'ENTER' ) ;
63+ await host . snapshot ( 'local' ) ;
8264
83- await host . snapshot ( 'local' ) ;
65+ // Dismiss like button
66+ await host . sendShiftTab ( 2 ) ;
67+ await host . sendKeys ( 'ENTER' ) ;
8468
85- pageElements . byTestId ( 'send box text area' ) . focus ( ) ;
86- await host . sendShiftTab ( 2 ) ;
69+ // Click like button
70+ await host . sendKeys ( 'ENTER' ) ;
8771
88- await host . sendKeys ( 'ENTER' ) ;
89- // Send dislike
90- await host . sendTab ( 1 ) ;
91- await host . sendKeys ( 'ENTER' ) ;
72+ await pageConditions . became (
73+ 'feedback form is open' ,
74+ ( ) => document . activeElement === pageElements . byTestId ( 'feedback sendbox' ) ,
75+ 1000
76+ ) ;
9277
93- await pageConditions . became (
94- 'feedback form is open' ,
95- ( ) => document . activeElement === pageElements . byTestId ( 'feedback sendbox' ) ,
96- 1000
97- ) ;
78+ // Go to cancel button
79+ await host . sendTab ( 2 ) ;
80+ await host . sendKeys ( 'ENTER' ) ;
9881
99- await host . sendKeys ( 'Test feedback ') ;
82+ await host . snapshot ( 'local ') ;
10083
101- await host . snapshot ( 'local' ) ;
84+ pageElements . byTestId ( 'send box text area' ) . focus ( ) ;
85+ await host . sendShiftTab ( 2 ) ;
10286
103- const { activity } = await directLine . actPostActivity ( async ( ) => {
87+ await host . sendKeys ( 'ENTER' ) ;
88+ // Send dislike
10489 await host . sendTab ( 1 ) ;
10590 await host . sendKeys ( 'ENTER' ) ;
106- } ) ;
10791
108- expect ( activity ) . toEqual (
109- expect . objectContaining ( {
110- type : 'invoke' ,
111- name : 'message/submitAction' ,
112- value : {
113- actionName : 'feedback' ,
114- actionValue : {
115- reaction : 'dislike' ,
116- feedback : {
117- feedbackText : 'Test feedback'
92+ await pageConditions . became (
93+ 'feedback form is open' ,
94+ ( ) => document . activeElement === pageElements . byTestId ( 'feedback sendbox' ) ,
95+ 1000
96+ ) ;
97+
98+ await host . sendKeys ( 'Test feedback' ) ;
99+
100+ await host . snapshot ( 'local' ) ;
101+
102+ const { activity } = await directLine . actPostActivity ( async ( ) => {
103+ await host . sendTab ( 1 ) ;
104+ await host . sendKeys ( 'ENTER' ) ;
105+ } ) ;
106+
107+ expect ( activity ) . toEqual (
108+ expect . objectContaining ( {
109+ type : 'invoke' ,
110+ name : 'message/submitAction' ,
111+ value : {
112+ actionName : 'feedback' ,
113+ actionValue : {
114+ reaction : 'dislike' ,
115+ feedback : {
116+ feedbackText : 'Test feedback'
117+ }
118118 }
119119 }
120- }
121- } )
122- ) ;
120+ } )
121+ ) ;
123122
124- await expect ( pageElements . byTestId ( 'feedback sendbox' ) ) . toBeFalsy ( ) ;
123+ await expect ( pageElements . byTestId ( 'feedback sendbox' ) ) . toBeFalsy ( ) ;
125124
126- // Feedback button state should persist
127- await host . snapshot ( 'local' ) ;
128- } ) ;
129- </ script >
130- </ body >
131-
132- </ html >
125+ // Feedback button state should persist
126+ await host . snapshot ( 'local' ) ;
127+ } ) ;
128+ </ script >
129+ </ body >
130+ </ html >
0 commit comments