|
| 1 | +<!doctype html> |
| 2 | +<html lang="en-US"> |
| 3 | + <head> |
| 4 | + <link href="/assets/index.css" rel="stylesheet" type="text/css" /> |
| 5 | + <script crossorigin="anonymous" src="/test-harness.js"></script> |
| 6 | + <script crossorigin="anonymous" src="/test-page-object.js"></script> |
| 7 | + <script crossorigin="anonymous" src="/__dist__/webchat-minimal.js"></script> |
| 8 | + </head> |
| 9 | + <body> |
| 10 | + <main id="webchat"></main> |
| 11 | + <script> |
| 12 | + run(async function () { |
| 13 | + const { |
| 14 | + testHelpers: { createDirectLineEmulator } |
| 15 | + } = window; |
| 16 | + |
| 17 | + const { directLine, store } = createDirectLineEmulator(); |
| 18 | + |
| 19 | + WebChat.renderWebChat({ directLine, store }, document.getElementById('webchat')); |
| 20 | + |
| 21 | + await pageConditions.uiConnected(); |
| 22 | + |
| 23 | + await directLine.emulateIncomingActivity({ |
| 24 | + from: { |
| 25 | + id: 'bot', |
| 26 | + role: 'bot' |
| 27 | + }, |
| 28 | + text: 'Hello, World!', |
| 29 | + type: 'message' |
| 30 | + }); |
| 31 | + |
| 32 | + await pageConditions.numActivitiesShown(1); |
| 33 | + |
| 34 | + await host.snapshot('local'); |
| 35 | + |
| 36 | + const metaMap = new Map( |
| 37 | + Array.from(document.querySelectorAll('meta')) |
| 38 | + .filter(element => element.name.startsWith('botframework-webchat')) |
| 39 | + .map(element => [element.name, element.getAttribute('content')]) |
| 40 | + ); |
| 41 | + |
| 42 | + expect(metaMap.has('botframework-webchat:api')).toBe(true); |
| 43 | + expect(metaMap.get('botframework-webchat:bundle:variant')).toBe('minimal'); |
| 44 | + expect(metaMap.has('botframework-webchat:bundle:version')).toBe(true); |
| 45 | + expect(metaMap.has('botframework-webchat:bundle')).toBe(true); |
| 46 | + expect(metaMap.has('botframework-webchat:component')).toBe(true); |
| 47 | + expect(metaMap.has('botframework-webchat:core:version')).toBe(true); |
| 48 | + expect(metaMap.has('botframework-webchat:core')).toBe(true); |
| 49 | + expect(metaMap.has('botframework-webchat:ui:version')).toBe(true); |
| 50 | + }); |
| 51 | + </script> |
| 52 | + </body> |
| 53 | +</html> |
0 commit comments