Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up test from #1915 #1933

Merged
merged 2 commits into from
Apr 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fix [#1586](https://github.com/Microsoft/BotFramework-WebChat/issues/1586). Fix theming of suggested actions buttons, by [@corinagum](https://github.com/corinagum) in PR [#1883](https://github.com/Microsoft/BotFramework-WebChat/pull/1883)
- Fix [#1837](https://github.com/Microsoft/BotFramework-WebChat/issues/1837), [#1643](https://github.com/Microsoft/BotFramework-WebChat/issues/1643). Fix style conflicts with bootstrap and bump `memoize-one`, by [@corinagum](https://github.com/corinagum) in PR [#1884](https://github.com/Microsoft/BotFramework-WebChat/pull/1884)
- Fix [#1877](https://github.com/Microsoft/BotFramework-WebChat/issues/1877). Add viewport meta tag and fix a few sample links, by [@corinagum](https://github.com/corinagum) in PR [#1919](https://github.com/Microsoft/BotFramework-WebChat/pull/1919)
- Fix [#1789](https://github.com/Microsoft/BotFramework-WebChat/issues/1789). Return focus Send Box after Send Button is pushed, by [@corinagum](https://github.com/corinagum) in PR [#1915](https://github.com/Microsoft/BotFramework-WebChat/pull/1915)
- Fix [#1789](https://github.com/Microsoft/BotFramework-WebChat/issues/1789). Focus send box after message is being sent, by [@corinagum](https://github.com/corinagum) in PR [#1915](https://github.com/Microsoft/BotFramework-WebChat/pull/1915)
- Fix [#1920](https://github.com/Microsoft/BotFramework-WebChat/issues/1920). Added disabled property to send button, by [@tdurnford](https://github.com/tdurnford) in PR [#1922](https://github.com/Microsoft/BotFramework-WebChat/pull/1922)

### Changed
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 0 additions & 16 deletions __tests__/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,3 @@ test('unknown activities do not render anything in the transcript', async () =>

expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions);
});

describe('Sendbox UX', async () => {
test('should have a yellow background when focused', async () => {

const { driver, pageObjects } = await setupWebDriver({ styleInputBackground: true });

await driver.wait( uiConnected(), timeouts.directLine );
await pageObjects.sendMessageViaSendBox('them vanilllllla wafers');

await driver.wait(minNumActivitiesShown(1), 2000);

const base64PNG = await driver.takeScreenshot();

expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions);
});
})
41 changes: 41 additions & 0 deletions __tests__/sendBox.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { imageSnapshotOptions, timeouts } from './constants.json';

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,
{
sendBox: Object.assign(
{},
styleSet.sendBox,
{
'& > .main > form > input:focus': {
backgroundColor: 'Yellow'
}
}
)
}
);
}
});

await driver.wait(uiConnected(), timeouts.directLine);
await pageObjects.sendMessageViaSendBox('Hello, World!');
await driver.wait(minNumActivitiesShown(1), 2000);

const base64PNG = await driver.takeScreenshot();

expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions);
});
10 changes: 2 additions & 8 deletions __tests__/setup/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,10 @@
}

async function main(options) {
let { createDirectLine, props, setup, styleInputBackground = false } = unmarshal(options);
let { createDirectLine, createStyleSet, props, setup } = unmarshal(options);

props = unmarshal(props);

if(styleInputBackground) {
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('input:focus { background-color: yellow }'));
document.head.appendChild(style);
}

if (setup) { await setup(); }

await loadScript('/webchat-instrumented.js');
Expand Down Expand Up @@ -129,6 +122,7 @@
window.WebChat.renderWebChat({
directLine: createDirectLine({ token }),
store,
styleSet: createStyleSet && createStyleSet(props.styleOptions),
username: 'Happy Web Chat user',
...props
}, document.getElementById('webchat'));
Expand Down