Skip to content

Commit 89ac86d

Browse files
committed
Add tests
1 parent 2d3e1e5 commit 89ac86d

2 files changed

Lines changed: 109 additions & 0 deletions

File tree

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<!doctype html>
2+
<html lang="en-US">
3+
<head>
4+
<link href="/assets/index.css" rel="stylesheet" type="text/css" />
5+
</head>
6+
<body>
7+
<main id="webchat"></main>
8+
<script type="importmap">
9+
{
10+
"imports": {
11+
"botframework-webchat": "/__dist__/packages/bundle/static/botframework-webchat.js",
12+
"react": "/__dist__/packages/bundle/static/react.js",
13+
"react-dom": "/__dist__/packages/bundle/static/react-dom.js"
14+
}
15+
}
16+
</script>
17+
<script type="module">
18+
import '/test-harness.mjs';
19+
import '/test-page-object.mjs';
20+
21+
import { createStoreWithOptions, renderWebChat, testIds } from 'botframework-webchat';
22+
23+
const {
24+
testHelpers: { createDirectLineEmulator }
25+
} = window;
26+
27+
// TODO: Should find ways to eliminate this line.
28+
window.WebChat = { createStoreWithOptions, testIds };
29+
30+
testHelpers.hideKnownError();
31+
32+
run(async function () {
33+
const { directLine, store } = createDirectLineEmulator();
34+
35+
renderWebChat(
36+
{
37+
directLine,
38+
overrideLocalizedStrings: {
39+
TEXT_INPUT_ALT: 'Hello, World!'
40+
},
41+
store
42+
},
43+
document.getElementById('webchat')
44+
);
45+
46+
await pageConditions.uiConnected();
47+
48+
expect(pageElements.sendBoxTextBox().tagName).toBe('INPUT');
49+
expect(pageElements.sendBoxTextBox().getAttribute('aria-label')).toBe('Hello, World!');
50+
});
51+
</script>
52+
</body>
53+
</html>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<!doctype html>
2+
<html lang="en-US">
3+
<head>
4+
<link href="/assets/index.css" rel="stylesheet" type="text/css" />
5+
</head>
6+
<body>
7+
<main id="webchat"></main>
8+
<script type="importmap">
9+
{
10+
"imports": {
11+
"botframework-webchat": "/__dist__/packages/bundle/static/botframework-webchat.js",
12+
"react": "/__dist__/packages/bundle/static/react.js",
13+
"react-dom": "/__dist__/packages/bundle/static/react-dom.js"
14+
}
15+
}
16+
</script>
17+
<script type="module">
18+
import '/test-harness.mjs';
19+
import '/test-page-object.mjs';
20+
21+
import { createStoreWithOptions, renderWebChat, testIds } from 'botframework-webchat';
22+
23+
const {
24+
testHelpers: { createDirectLineEmulator }
25+
} = window;
26+
27+
// TODO: Should find ways to eliminate this line.
28+
window.WebChat = { createStoreWithOptions, testIds };
29+
30+
testHelpers.hideKnownError();
31+
32+
run(async function () {
33+
const { directLine, store } = createDirectLineEmulator();
34+
35+
renderWebChat(
36+
{
37+
directLine,
38+
overrideLocalizedStrings: {
39+
TEXT_INPUT_ALT: 'Hello, World!'
40+
},
41+
store,
42+
styleOptions: {
43+
sendBoxTextWrap: true
44+
}
45+
},
46+
document.getElementById('webchat')
47+
);
48+
49+
await pageConditions.uiConnected();
50+
51+
expect(pageElements.sendBoxTextBox().tagName).toBe('TEXTAREA');
52+
expect(pageElements.sendBoxTextBox().getAttribute('aria-label')).toBe('Hello, World!');
53+
});
54+
</script>
55+
</body>
56+
</html>

0 commit comments

Comments
 (0)