forked from microsoft/BotFramework-WebChat
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsendBox.js
More file actions
34 lines (26 loc) · 1.24 KB
/
sendBox.js
File metadata and controls
34 lines (26 loc) · 1.24 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
import { imageSnapshotOptions, timeouts } from './constants.json';
import actionDispatched from './setup/conditions/actionDispatched';
import minNumActivitiesShown from './setup/conditions/minNumActivitiesShown';
import uiConnected from './setup/conditions/uiConnected';
// selenium-webdriver API doc:
// https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/index_exports_WebDriver.html
jest.setTimeout(timeouts.test);
test('should focus send box when message is being sent', async () => {
const { driver, pageObjects } = await setupWebDriver({
createStyleSet: styleOptions => {
const styleSet = window.WebChat.createStyleSet(styleOptions);
return Object.assign({}, styleSet, {
sendBoxTextBox: Object.assign({}, styleSet.sendBoxTextBox, {
'& .webchat__send-box-text-box__input:focus': {
backgroundColor: 'Yellow'
}
})
});
}
});
await driver.wait(uiConnected(), timeouts.directLine);
await pageObjects.sendMessageViaSendBox('Hello, World!', { waitForSend: true });
await driver.wait(minNumActivitiesShown(2), timeouts.directLine);
const base64PNG = await driver.takeScreenshot();
expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions);
});