Skip to content

Commit

Permalink
Merge branch 'master' into 1877
Browse files Browse the repository at this point in the history
  • Loading branch information
Corina authored Apr 22, 2019
2 parents 05e5f52 + 8ec98f8 commit 16fdb0d
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 37 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,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 [#XXX](https://github.com/Microsoft/BotFramework-WebChat/pull/XXX)
- 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)

### Changed
- `component`: Bumps to [`[email protected]`](https://npmjs.com/package/react-film/), by [@corinagum](https://github.com/corinagum) and [@compulim](https://github.com/compulim), in PR [#1900](https://github.com/Microsoft/BotFramework-WebChat/pull/1900)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
88 changes: 52 additions & 36 deletions __tests__/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,76 +7,92 @@ 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 );
jest.setTimeout(timeouts.test);

test( 'setup', async () => {
test('setup', async () => {
const { driver, pageObjects } = await setupWebDriver();

await driver.wait( uiConnected(), timeouts.directLine );
await pageObjects.sendMessageViaSendBox( 'layout carousel' );
await driver.wait(uiConnected(), timeouts.directLine);
await pageObjects.sendMessageViaSendBox('layout carousel');

await driver.wait( minNumActivitiesShown( 2 ), 2000 );
await driver.wait( allImagesLoaded(), 2000 );
await driver.wait(minNumActivitiesShown(2), 2000);
await driver.wait(allImagesLoaded(), 2000);

const base64PNG = await driver.takeScreenshot();

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

test( 'long URLs with break-word', async () => {
test('long URLs with break-word', async () => {
const { driver, pageObjects } = await setupWebDriver();

await driver.wait( uiConnected(), timeouts.directLine );
await pageObjects.sendMessageViaSendBox( 'https://subdomain.domain.com/pathname0/pathname1/pathname2/pathname3/pathname4/' )
await driver.wait(uiConnected(), timeouts.directLine);
await pageObjects.sendMessageViaSendBox('https://subdomain.domain.com/pathname0/pathname1/pathname2/pathname3/pathname4/')

await driver.wait( minNumActivitiesShown( 2 ), 2000 );
await driver.wait( allImagesLoaded(), 2000 );
await driver.wait(minNumActivitiesShown(2), 2000);
await driver.wait(allImagesLoaded(), 2000);

const base64PNG = await driver.takeScreenshot();

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

test( 'long URLs with break-all', async () => {
test('long URLs with break-all', async () => {
const WEB_CHAT_PROPS = { styleOptions: { messageActivityWordBreak: 'break-all' } };

const { driver, pageObjects } = await setupWebDriver( { props: WEB_CHAT_PROPS } );
const { driver, pageObjects } = await setupWebDriver({ props: WEB_CHAT_PROPS });

await driver.wait( uiConnected(), timeouts.directLine );
await pageObjects.sendMessageViaSendBox( 'https://subdomain.domain.com/pathname0/pathname1/pathname2/pathname3/pathname4/' )
await driver.wait(uiConnected(), timeouts.directLine);
await pageObjects.sendMessageViaSendBox('https://subdomain.domain.com/pathname0/pathname1/pathname2/pathname3/pathname4/')

await driver.wait( minNumActivitiesShown( 2 ), 2000 );
await driver.wait( allImagesLoaded(), 2000 );
await driver.wait(minNumActivitiesShown(2), 2000);
await driver.wait(allImagesLoaded(), 2000);

const base64PNG = await driver.takeScreenshot();

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

test( 'long URLs with keep-all', async () => {
test('long URLs with keep-all', async () => {
const WEB_CHAT_PROPS = { styleOptions: { messageActivityWordBreak: 'keep-all' } };

const { driver, pageObjects } = await setupWebDriver( { props: WEB_CHAT_PROPS } );
const { driver, pageObjects } = await setupWebDriver({ props: WEB_CHAT_PROPS });

await pageObjects.sendMessageViaSendBox( '箸より重いものを持ったことがない箸より重いものを持ったことがない' );
await pageObjects.sendMessageViaSendBox('箸より重いものを持ったことがない箸より重いものを持ったことがない');

await driver.wait( minNumActivitiesShown( 2 ), 2000 );
await driver.wait( allImagesLoaded(), 2000 );
await driver.wait(minNumActivitiesShown(2), 2000);
await driver.wait(allImagesLoaded(), 2000);

const base64PNG = await driver.takeScreenshot();

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

test( 'unknown activities do not render anything in the transcript', async () => {
test('unknown activities do not render anything in the transcript', async () => {
const { driver, pageObjects } = await setupWebDriver();

await driver.wait( uiConnected(), timeouts.directLine );
await pageObjects.sendMessageViaSendBox( 'unknown activity' );
await driver.wait(uiConnected(), timeouts.directLine);
await pageObjects.sendMessageViaSendBox('unknown activity');

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

const base64PNG = await driver.takeScreenshot();

expect( base64PNG ).toMatchImageSnapshot( imageSnapshotOptions );
} );
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);
});
})
9 changes: 8 additions & 1 deletion __tests__/setup/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,17 @@
}

async function main(options) {
let { createDirectLine, props, setup } = unmarshal(options);
let { createDirectLine, props, setup, styleInputBackground = false } = 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
2 changes: 2 additions & 0 deletions packages/component/src/SendBox/SendButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import SendIcon from './Assets/SendIcon';

const connectSendButton = (...selectors) => connectToWebChat(
({
focusSendBox,
language,
sendBoxValue,
setSendBox,
Expand All @@ -15,6 +16,7 @@ const connectSendButton = (...selectors) => connectToWebChat(
click: () => {
setSendBox(sendBoxValue.trim());
submitSendBox();
focusSendBox();
},
language
}),
Expand Down

0 comments on commit 16fdb0d

Please sign in to comment.