Skip to content

Commit f675069

Browse files
committed
Update tests
1 parent 211d535 commit f675069

File tree

2 files changed

+55
-20
lines changed

2 files changed

+55
-20
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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="https://unpkg.com/react@16.8.6/umd/react.production.min.js"></script>
6+
<script crossorigin="anonymous" src="https://unpkg.com/react-dom@16.8.6/umd/react-dom.production.min.js"></script>
7+
<script crossorigin="anonymous" src="/test-harness.js"></script>
8+
<script crossorigin="anonymous" src="/test-page-object.js"></script>
9+
<script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
10+
</head>
11+
<body>
12+
<main id="webchat"></main>
13+
<script type="module">
14+
run(async function () {
15+
const {
16+
React: { createElement },
17+
ReactDOM: { render },
18+
testHelpers: {
19+
createStore,
20+
token: { fetchDirectLineToken }
21+
},
22+
WebChat: { createDirectLine, ReactWebChat }
23+
} = window; // Imports in UMD fashion.
24+
25+
const directLine = createDirectLine({ token: await fetchDirectLineToken() });
26+
const store = createStore();
27+
28+
render(
29+
createElement(ReactWebChat, {
30+
directLine,
31+
store
32+
}),
33+
document.getElementById('webchat')
34+
);
35+
36+
await pageConditions.uiConnected();
37+
38+
await pageObjects.sendMessageViaSendBox(
39+
'\u00A0\u00A0There should be no space before and after this message.\u00A0\u00A0',
40+
{ waitForSend: false }
41+
);
42+
43+
await pageConditions.actionDispatched(
44+
'DIRECT_LINE/INCOMING_ACTIVITY',
45+
({ payload: { activity } = {}, type }) =>
46+
type === 'DIRECT_LINE/INCOMING_ACTIVITY' &&
47+
activity.from.role === 'user' &&
48+
activity.text === 'There should be no space before and after this message.'
49+
);
50+
51+
await pageConditions.minNumActivitiesShown(2);
52+
});
53+
</script>
54+
</body>
55+
</html>

__tests__/sendBox.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,3 @@ test('should focus send box when message is being sent', async () => {
3232

3333
expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions);
3434
});
35-
36-
test('should trim outgoing message when being sent', async () => {
37-
const { driver, pageObjects } = await setupWebDriver();
38-
39-
await driver.wait(uiConnected(), timeouts.directLine);
40-
await pageObjects.sendMessageViaSendBox(
41-
'\u00A0\u00A0There should be no space before and after this message.\u00A0\u00A0',
42-
{ waitForSend: false }
43-
);
44-
await driver.wait(
45-
actionDispatched(
46-
({ payload: { activity } = {}, type }) =>
47-
type === 'DIRECT_LINE/INCOMING_ACTIVITY' &&
48-
activity.from.role === 'user' &&
49-
activity.text === 'There should be no space before and after this message.'
50-
),
51-
timeouts.directLine
52-
);
53-
await driver.wait(minNumActivitiesShown(2), timeouts.directLine);
54-
});

0 commit comments

Comments
 (0)