-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathadaptiveCards.html
More file actions
84 lines (74 loc) · 2.46 KB
/
adaptiveCards.html
File metadata and controls
84 lines (74 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!doctype html>
<html lang="en-US">
<head>
<link href="/assets/index.css" rel="stylesheet" type="text/css" />
</head>
<body>
<main id="webchat"></main>
<script type="importmap">
{
"imports": {
"botframework-webchat": "/__dist__/packages/bundle/static/botframework-webchat.js",
"react": "https://cdn.jsdelivr.net/npm/react@18.3.1/+esm",
"react-dom": "https://cdn.jsdelivr.net/npm/react-dom@18.3.1/+esm",
"react-dom/client": "https://cdn.jsdelivr.net/npm/react-dom@18.3.1/client/+esm"
}
}
</script>
<script type="module">
import '/test-harness.mjs';
import '/test-page-object.mjs';
import { createDirectLine, createStoreWithOptions, renderWebChat } from 'botframework-webchat';
run(async function () {
const {
testHelpers: { createDirectLineEmulator }
} = window;
// TODO: This is for `createDirectLineEmulator` only, should find ways to eliminate this line.
window.WebChat = { createStoreWithOptions };
const { directLine, store } = createDirectLineEmulator();
renderWebChat(
{
directLine,
store
},
document.getElementById('webchat')
);
await pageConditions.uiConnected();
await directLine.emulateIncomingActivity({
attachments: [
{
content: {
type: 'AdaptiveCard',
body: [
{
type: 'TextBlock',
text: 'You can choose one of the followings.'
}
],
$schema: 'http://adaptivecards.io/schemas/adaptive-card.json',
version: '1.2',
actions: [
{
type: 'Action.Submit',
title: 'What time is it?'
},
{
type: 'Action.Submit',
title: 'What is the weather?'
}
]
},
contentType: 'application/vnd.microsoft.card.adaptive'
}
],
from: { id: 'bot', role: 'bot' },
text: 'What can I do for you?',
type: 'message'
});
await pageConditions.numActivitiesShown(1);
await host.snapshot('local');
expect(typeof globalThis.React).toBe('undefined');
});
</script>
</body>
</html>