|
27 | 27 | const {
|
28 | 28 | React,
|
29 | 29 | ReactDOM: { render },
|
30 |
| - WebChat: { |
| 30 | + WebChat: { |
31 | 31 | decorator: { DecoratorComposer },
|
32 | 32 | FluentThemeProvider,
|
33 | 33 | ReactWebChat
|
|
43 | 43 | }
|
44 | 44 |
|
45 | 45 | const decoratorMiddleware = [
|
46 |
| - init => init === 'activity border' && (next => request => (request.state === 'completion' ? Flair : next(request))), |
47 |
| - init => init === 'activity border' && (next => request => (request.state === 'informative' ? Loader : next(request))) |
| 46 | + init => |
| 47 | + init === 'activity border' && |
| 48 | + (next => request => (request.livestreamingState === 'completing' ? Flair : next(request))), |
| 49 | + init => |
| 50 | + init === 'activity border' && |
| 51 | + (next => request => (request.livestreamingState === 'preparing' ? Loader : next(request))) |
48 | 52 | ];
|
49 | 53 |
|
50 | 54 | const { directLine, store } = testHelpers.createDirectLineEmulator();
|
51 | 55 |
|
52 |
| - const App = () => <ReactWebChat |
53 |
| - directLine={directLine} |
54 |
| - store={store} |
55 |
| - styleOptions={{ |
56 |
| - bubbleBorderRadius: 10, |
57 |
| - typingAnimationBackgroundImage: `url('data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAAUACgDASIAAhEBAxEB/8QAGgABAQACAwAAAAAAAAAAAAAAAAYCBwMFCP/EACsQAAECBQIEBQUAAAAAAAAAAAECAwAEBQYRBxITIjFBMlFhccFScoGh8f/EABQBAQAAAAAAAAAAAAAAAAAAAAD/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwD0lctx023JVD9UeKOIcNoSNylkdcCMbauSmXHLOPUx8r4ZAcQtO1SM9Mj5iO1gtWo1syc7S2zMKYSptbIPNgnII8/5HBpRZ9RpaKjNVVCpUzLPAQ1nmA7qPl6fmAondRrcaqhkVTiiQrYXgglsH7vnpHc3DcNNoEimaqT4Q2s4bCRuUs+gEaLd05uNFVMmiS3o3YEwFDhlP1Z7e3WLzUuzahUKHRk0zM07TmeApvOFLGEjcM9+Xp6wFnbN0Uu5GnF0x4qW1je2tO1Sc9Djy9oRD6QWlU6PPzVSqjRlgtksttKPMcqBKiO3h/cIDacIQgEIQgEIQgP/2Q==')` |
58 |
| - }} |
59 |
| - />; |
| 56 | + const App = () => ( |
| 57 | + <ReactWebChat |
| 58 | + directLine={directLine} |
| 59 | + store={store} |
| 60 | + styleOptions={{ |
| 61 | + bubbleBorderRadius: 10, |
| 62 | + typingAnimationBackgroundImage: `url('data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAAUACgDASIAAhEBAxEB/8QAGgABAQACAwAAAAAAAAAAAAAAAAYCBwMFCP/EACsQAAECBQIEBQUAAAAAAAAAAAECAwAEBQYRBxITIjFBMlFhccFScoGh8f/EABQBAQAAAAAAAAAAAAAAAAAAAAD/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwD0lctx023JVD9UeKOIcNoSNylkdcCMbauSmXHLOPUx8r4ZAcQtO1SM9Mj5iO1gtWo1syc7S2zMKYSptbIPNgnII8/5HBpRZ9RpaKjNVVCpUzLPAQ1nmA7qPl6fmAondRrcaqhkVTiiQrYXgglsH7vnpHc3DcNNoEimaqT4Q2s4bCRuUs+gEaLd05uNFVMmiS3o3YEwFDhlP1Z7e3WLzUuzahUKHRk0zM07TmeApvOFLGEjcM9+Xp6wFnbN0Uu5GnF0x4qW1je2tO1Sc9Djy9oRD6QWlU6PPzVSqjRlgtksttKPMcqBKiO3h/cIDacIQgEIQgEIQgP/2Q==')` |
| 63 | + }} |
| 64 | + /> |
| 65 | + ); |
60 | 66 |
|
61 | 67 | render(
|
62 | 68 | <FluentThemeProvider>
|
|
70 | 76 | await pageConditions.uiConnected();
|
71 | 77 |
|
72 | 78 | await directLine.emulateIncomingActivity({
|
73 |
| - channelData: { |
74 |
| - streamType: 'informative' |
75 |
| - }, |
76 |
| - from: { |
77 |
| - id: 'u-00001', |
78 |
| - name: 'Bot', |
79 |
| - role: 'bot' |
80 |
| - }, |
81 |
| - id: 'm-00001', |
82 |
| - text: 'Working on it...', |
83 |
| - type: 'message' |
84 |
| - }); |
85 |
| - |
86 |
| - await directLine.emulateIncomingActivity({ |
87 |
| - channelData: { |
88 |
| - streamType: 'informative' |
89 |
| - }, |
| 79 | + channelData: { streamSequence: 1, streamType: 'informative' }, |
90 | 80 | from: {
|
91 | 81 | id: 'u-00001',
|
92 | 82 | name: 'Bot',
|
|
97 | 87 | type: 'typing'
|
98 | 88 | });
|
99 | 89 |
|
100 |
| - await pageConditions.typingIndicatorShown(); |
101 | 90 | await pageConditions.numActivitiesShown(1);
|
102 | 91 | await host.snapshot();
|
103 | 92 |
|
|
128 | 117 | }
|
129 | 118 | ];
|
130 | 119 | await directLine.emulateIncomingActivity({
|
131 |
| - id: 'm-00001', |
| 120 | + attachments, |
| 121 | + channelData: { streamId: 't-00001', streamSequence: 2, streamType: 'final' }, |
132 | 122 | from: {
|
133 | 123 | id: 'u-00001',
|
134 | 124 | name: 'Bot',
|
135 | 125 | role: 'bot'
|
136 | 126 | },
|
137 |
| - text: 'Work completed!', |
138 |
| - channelData: { streamType: 'completion' }, |
139 |
| - attachments |
| 127 | + id: 'm-00001', |
| 128 | + text: 'Work completed!' |
140 | 129 | });
|
141 | 130 |
|
142 | 131 | await pageConditions.numActivitiesShown(1);
|
|
0 commit comments