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- await host . snapshot ( 'local' ) ;
71-
72- // Click like button
73- await host . sendKeys ( 'ENTER' ) ;
60+ await host . sendKeys ( 'ENTER' ) ;
61+ await host . sendKeys ( 'ENTER' ) ;
7462
75- await pageConditions . became (
76- 'feedback form is open' ,
77- ( ) => document . activeElement === pageElements . byTestId ( 'feedback sendbox' ) ,
78- 1000
79- ) ;
63+ await host . snapshot ( 'local' ) ;
8064
81- // Go to cancel button
82- await host . sendTab ( 2 ) ;
83- await host . sendKeys ( 'ENTER' ) ;
65+ // Dismiss like button
66+ await host . sendShiftTab ( 2 ) ;
67+ await host . sendKeys ( 'ENTER' ) ;
8468
85- await host . snapshot ( 'local' ) ;
69+ await host . snapshot ( 'local' ) ;
8670
87- pageElements . byTestId ( 'send box text area' ) . focus ( ) ;
88- await host . sendShiftTab ( 2 ) ;
71+ // Click like button
72+ await host . sendKeys ( 'ENTER' ) ;
8973
90- await host . sendKeys ( 'ENTER' ) ;
91- // Send dislike
92- await host . sendTab ( 1 ) ;
93- await host . sendKeys ( 'ENTER' ) ;
74+ await pageConditions . became (
75+ 'feedback form is open' ,
76+ ( ) => document . activeElement === pageElements . byTestId ( 'feedback sendbox' ) ,
77+ 1000
78+ ) ;
9479
95- await pageConditions . became (
96- 'feedback form is open' ,
97- ( ) => document . activeElement === pageElements . byTestId ( 'feedback sendbox' ) ,
98- 1000
99- ) ;
80+ // Go to cancel button
81+ await host . sendTab ( 2 ) ;
82+ await host . sendKeys ( 'ENTER' ) ;
10083
101- await host . sendKeys ( 'Test feedback ') ;
84+ await host . snapshot ( 'local ') ;
10285
103- await host . snapshot ( 'local' ) ;
86+ pageElements . byTestId ( 'send box text area' ) . focus ( ) ;
87+ await host . sendShiftTab ( 2 ) ;
10488
105- const { activity } = await directLine . actPostActivity ( async ( ) => {
89+ await host . sendKeys ( 'ENTER' ) ;
90+ // Send dislike
10691 await host . sendTab ( 1 ) ;
10792 await host . sendKeys ( 'ENTER' ) ;
108- } ) ;
10993
110- expect ( activity ) . toEqual (
111- expect . objectContaining ( {
112- type : 'invoke' ,
113- name : 'message/submitAction' ,
114- value : {
115- actionName : 'feedback' ,
116- actionValue : {
117- reaction : 'dislike' ,
118- feedback : {
119- feedbackText : 'Test feedback'
94+ await pageConditions . became (
95+ 'feedback form is open' ,
96+ ( ) => document . activeElement === pageElements . byTestId ( 'feedback sendbox' ) ,
97+ 1000
98+ ) ;
99+
100+ await host . sendKeys ( 'Test feedback' ) ;
101+
102+ await host . snapshot ( 'local' ) ;
103+
104+ const { activity } = await directLine . actPostActivity ( async ( ) => {
105+ await host . sendTab ( 1 ) ;
106+ await host . sendKeys ( 'ENTER' ) ;
107+ } ) ;
108+
109+ expect ( activity ) . toEqual (
110+ expect . objectContaining ( {
111+ type : 'invoke' ,
112+ name : 'message/submitAction' ,
113+ value : {
114+ actionName : 'feedback' ,
115+ actionValue : {
116+ reaction : 'dislike' ,
117+ feedback : {
118+ feedbackText : 'Test feedback'
119+ }
120120 }
121121 }
122- }
123- } )
124- ) ;
125- } ) ;
126- </ script >
127- </ body >
128-
129- </ html >
122+ } )
123+ ) ;
124+ } ) ;
125+ </ script >
126+ </ body >
127+ </ html >
0 commit comments