-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathsequenceId.simple.html
More file actions
55 lines (49 loc) · 1.72 KB
/
sequenceId.simple.html
File metadata and controls
55 lines (49 loc) · 1.72 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
<!DOCTYPE html>
<html lang="en-US">
<head>
<link href="/assets/index.css" rel="stylesheet" type="text/css" />
<script crossorigin="anonymous" src="/test-harness.js"></script>
<script crossorigin="anonymous" src="/test-page-object.js"></script>
<script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
</head>
<body>
<main id="webchat"></main>
<script>
const BASE_TIMESTAMP = +new Date(2020, 0, 1, 12, 34);
function createActivity(text, timestamp, sequenceId) {
return {
channelData: {
'webchat:sequence-id': sequenceId
},
from: { role: 'bot' },
id: Math.random().toString(36).substr(2, 5),
text,
timestamp: new Date(BASE_TIMESTAMP + timestamp),
type: 'message'
};
}
run(async function () {
const directLine = await testHelpers.createDirectLineWithTranscript(
new Array(10).fill().map((_, index) => {
const timestamp = index < 5 ? index * 2 : (index - 5) * 2 + 1;
const sequenceId = 10 - index;
const text = `seq=${sequenceId}, index=${index}, ts=${timestamp}`;
return createActivity(text, timestamp, sequenceId);
})
);
WebChat.renderWebChat(
{
directLine,
store: testHelpers.createStore()
},
document.getElementById('webchat')
);
await pageConditions.uiConnected();
await pageConditions.numActivitiesShown(10);
await pageConditions.scrollToBottomCompleted();
// THEN: It should show a transcript sorted based on "seq" field.
await host.snapshot('local');
});
</script>
</body>
</html>