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

QFE for 4.5.3 #2454

Closed
wants to merge 20 commits into from
Closed
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
46 changes: 44 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,53 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fix [#XXX](https://github.com/microsoft/BotFramework-WebChat/issues/XXX). Patched something, by [@johndoe](https://github.com/johndoe) in PR [#XXX](https://github.com/microsoft/BotFramework-WebChat/pull/XXX)
-->

## [Unreleased]

<!-- ### Added
- Added something, by [@johndoe](https://github.com/johndoe), in PR [#XXX](https://github.com/microsoft/BotFramework-WebChat/pull/XXX)
-->

## [Unreleased]

## [4.5.3] - 2019-10-06

### Changed

- `bundle`: Bumped DirectLineJS to support metadata when uploading attachments, in PR [#2433](https://github.com/microsoft/BotFramework-WebChat/pull/2433)
- [`botframework-directlinejs@0.11.5`](https://www.npmjs.com/package/botframework-directlinejs)
- Removed DirectLineJS as a dev dependency for `component` because it was not referenced

### Fixed

- Fix [#2248](https://github.com/microsoft/BotFramework-WebChat/issues/2248). Remove download links from user-uploaded attachment without thumbnails, by [@compulim](https://github.com/compulim) in PR [#2262](https://github.com/microsoft/BotFramework-WebChat/pull/2262)
- Fix [Emulator:#1823](https://github.com/microsoft/BotFramework-Emulator/issues/1823). Fix Sendbox "Type your message" being read twice by AT, by [@corinagum](https://github.com/corinagum) in PR [#2423](https://github.com/microsoft/BotFramework-WebChat/pull/2423)
- Fix [#2422](https://github.com/microsoft/BotFramework-WebChat/issues/2422). Store thumbnail URL using the activity's `attachment.thumbnailUrl` field, by [@compulim](https://github.com/compulim) in PR [#2433](https://github.com/microsoft/BotFramework-WebChat/pull/2433)

### Added

- Make thumbnails when uploading GIF/JPEG/PNG and store it in `channelData.attachmentThumbnails`, by [@compulim](https://github.com/compulim), in PR [#2206](https://github.com/microsoft/BotFramework-WebChat/pull/2206), requires modern browsers with following features:
- [Web Workers API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API)
- [`createImageBitmap`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/createImageBitmap)
- [`MessageChannel`](https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel)/[`MessagePort`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort)
- [`OffscreenCanvas`](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas)
- Specifically [`OffscreenCanvas.getContext('2d')`](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas/getContext)
- Render thumbnail for image attachments using `activity.attachments[].thumbnailUrl`, by [@compulim](https://github.com/compulim) in PR [#2433](https://github.com/microsoft/BotFramework-WebChat/pull/2433)

## [4.5.2] - 2019-08-07

### Fixed

- Fix [#2273](https://github.com/microsoft/BotFramework-WebChat/issues/2273). Add `ScreenReaderText` component, by [@corinagum](https://github.com/corinagum) in PR [#2278](https://github.com/microsoft/BotFramework-WebChat/pull/2278)

## [4.5.1] - 2019-08-01

### Fixed

- Fix [#2187](https://github.com/microsoft/BotFramework-WebChat/issues/2187). Bump core-js and update core-js modules on index-es5.js, by [@corinagum](https://github.com/corinagum) in PR [#2195](https://github.com/microsoft/BotFramework-WebChat/pull/2195)
- Fix [#2193](https://github.com/microsoft/BotFramework-WebChat/issues/2193). Fix Adaptive Card/attachments do not get read by Narrator, by [@corinagum](https://github.com/corinagum) in PR [#2226](https://github.com/microsoft/BotFramework-WebChat/pull/2226)
- Fix [#2150](https://github.com/microsoft/BotFramework-WebChat/issues/2193). Fix timestamps read by Narrator, by [@corinagum](https://github.com/corinagum) in PR [#2226](https://github.com/microsoft/BotFramework-WebChat/pull/2226)
- Fix [#2250](https://github.com/microsoft/BotFramework-WebChat/issues/2250). Fix React warnings related prop types, by [@compulim](https://github.com/compulim) in PR [#2253](https://github.com/microsoft/BotFramework-WebChat/pull/2253)

## [4.5.0] - 2019-07-10

### Added

- `*`: Added [`eslint`](https://npmjs.com/package/eslint/) to static code analysis, by [@compulim](https://github.com/compulim), in PR [#1970](https://github.com/microsoft/BotFramework-WebChat/pull/1970)
Expand Down Expand Up @@ -70,6 +111,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fix [#1872](https://github.com/microsoft/BotFramework-WebChat/issues/1872). Fixed `observeOnce` to unsubscribe properly, by [@compulim](https://github.com/compulim) in PR [#2140](https://github.com/microsoft/BotFramework-WebChat/pull/2140)
- Fix [#2022](https://github.com/microsoft/BotFramework-WebChat/issues/2022). Fixed `"expectingInput"` in `inputHint` is not respected, by [@compulim](https://github.com/compulim) and [@corinagum](https://github.com/corinagum) in PR [#2149](https://github.com/microsoft/BotFramework-WebChat/pull/2149) and PR [#2166](https://github.com/microsoft/BotFramework-WebChat/pull/2166)


### Samples

- `*`: [Single sign-on for enterprise apps](https://microsoft.github.io/BotFramework-WebChat/19.a.single-sign-on-for-enterprise-apps/), by [@compulim](https://github.com/compulim) in [#2002](https://github.com/microsoft/BotFramework-WebChat/pull/2002)
Expand Down
6 changes: 6 additions & 0 deletions Dockerfile-selenium
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# https://github.com/SeleniumHQ/docker-selenium
# https://hub.docker.com/r/selenium/standalone-chrome/tags/

FROM selenium/standalone-chrome:3.141.59-radium

ADD __tests__/setup/local ~/Downloads
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added __tests__/setup/local/empty.mp3
Binary file not shown.
Binary file added __tests__/setup/local/empty.pdf
Binary file not shown.
Binary file added __tests__/setup/local/empty.zip
Binary file not shown.
Binary file added __tests__/setup/local/seaofthieves.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions __tests__/setup/pageObjects/getActivityElements.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { By } from 'selenium-webdriver';

export default async function getActivityElements(driver) {
return await driver.findElements(By.css(`[role="listitem"]`));
}
2 changes: 1 addition & 1 deletion __tests__/setup/pageObjects/getSendBoxTextBox.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { By } from 'selenium-webdriver';

export default async function isRecognizingSpeech(driver) {
export default async function getSendBoxTextBox(driver) {
return await driver.findElement(By.css('[role="form"] > * > form > input[type="text"]'));
}
5 changes: 5 additions & 0 deletions __tests__/setup/pageObjects/getUploadButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { By } from 'selenium-webdriver';

export default async function getUploadButton(driver) {
return await driver.findElement(By.css('input[type="file"]'));
}
8 changes: 8 additions & 0 deletions __tests__/setup/pageObjects/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import dispatchAction from './dispatchAction';
import endSpeechSynthesize from './endSpeechSynthesize';
import executePromiseScript from './executePromiseScript';
import getActivityElements from './getActivityElements';
import getMicrophoneButton from './getMicrophoneButton';
import getSendBoxTextBox from './getSendBoxTextBox';
import getStore from './getStore';
import getUploadButton from './getUploadButton';
import hasPendingSpeechSynthesisUtterance from './hasPendingSpeechSynthesisUtterance';
import isRecognizingSpeech from './isRecognizingSpeech';
import pingBot from './pingBot';
import putSpeechRecognitionResult from './putSpeechRecognitionResult';
import sendFile from './sendFile';
import sendMessageViaMicrophone from './sendMessageViaMicrophone';
import sendMessageViaSendBox from './sendMessageViaSendBox';
import startSpeechSynthesize from './startSpeechSynthesize';
Expand All @@ -25,12 +29,16 @@ export default function pageObjects(driver) {
dispatchAction,
endSpeechSynthesize,
executePromiseScript,
getActivityElements,
getMicrophoneButton,
getSendBoxTextBox,
getStore,
getUploadButton,
hasPendingSpeechSynthesisUtterance,
isRecognizingSpeech,
pingBot,
putSpeechRecognitionResult,
sendFile,
sendMessageViaMicrophone,
sendMessageViaSendBox,
startSpeechSynthesize
Expand Down
28 changes: 28 additions & 0 deletions __tests__/setup/pageObjects/sendFile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { join, posix } from 'path';
import { timeouts } from '../../constants.json';
import allOutgoingActivitiesSent from '../conditions/allOutgoingActivitiesSent';
import getActivityElements from './getActivityElements';
import getUploadButton from './getUploadButton';
import minNumActivitiesShown from '../conditions/minNumActivitiesShown.js';

function resolveDockerFile(filename) {
return posix.join('/~/Downloads', filename);
}

function resolveLocalFile(filename) {
return join(__dirname, '../local', filename);
}

export default async function sendFile(driver, filename, { waitForSend = true } = {}) {
const uploadButton = await getUploadButton(driver);
const isUnderDocker = !!(await driver.getCapabilities()).get('webdriver.remote.sessionid');

// The send file function is asynchronous, it doesn't send immediately until thumbnails are generated.
// We will save the numActivities, anticipate for numActivities + 1, then wait until everything is sent
const numActivities = (await getActivityElements(driver)).length;

await uploadButton.sendKeys(isUnderDocker ? resolveDockerFile(filename) : resolveLocalFile(filename));

await driver.wait(minNumActivitiesShown(numActivities + 1));
waitForSend && (await driver.wait(allOutgoingActivitiesSent(), timeouts.directLine));
}
169 changes: 169 additions & 0 deletions __tests__/upload.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
import { imageSnapshotOptions, timeouts } from './constants.json';

import allImagesLoaded from './setup/conditions/allImagesLoaded';
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);

describe('upload a picture', () => {
test('', async () => {
const { driver, pageObjects } = await setupWebDriver();

await driver.wait(uiConnected(), timeouts.directLine);

await pageObjects.sendFile('seaofthieves.jpg');
await driver.wait(minNumActivitiesShown(2));
await driver.wait(allImagesLoaded());

const base64PNG = await driver.takeScreenshot();

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

test('with custom thumbnail size', async () => {
const { driver, pageObjects } = await setupWebDriver({
props: {
styleOptions: {
uploadThumbnailContentType: 'image/png',
uploadThumbnailHeight: 60,
uploadThumbnailWidth: 120
}
}
});

await driver.wait(uiConnected(), timeouts.directLine);

await pageObjects.sendFile('seaofthieves.jpg');
await driver.wait(minNumActivitiesShown(2));
await driver.wait(allImagesLoaded());

const base64PNG = await driver.takeScreenshot();

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

test('with custom thumbnail quality', async () => {
const { driver, pageObjects } = await setupWebDriver({
props: {
styleOptions: {
uploadThumbnailQuality: 0.1
}
}
});

await driver.wait(uiConnected(), timeouts.directLine);

await pageObjects.sendFile('seaofthieves.jpg');
await driver.wait(minNumActivitiesShown(2));
await driver.wait(allImagesLoaded());

const base64PNG = await driver.takeScreenshot();

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

test('with custom thumbnail disabled', async () => {
const { driver, pageObjects } = await setupWebDriver({
props: {
styleOptions: {
enableUploadThumbnail: false
}
}
});

await driver.wait(uiConnected(), timeouts.directLine);

await pageObjects.sendFile('seaofthieves.jpg');
await driver.wait(minNumActivitiesShown(2));
await driver.wait(allImagesLoaded());

const base64PNG = await driver.takeScreenshot();

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

describe('without Web Worker', () => {
test('', async () => {
const { driver, pageObjects } = await setupWebDriver();

await driver.executeScript(() => {
window.Worker = undefined;
});
await driver.wait(uiConnected(), timeouts.directLine);

await pageObjects.sendFile('seaofthieves.jpg');
await driver.wait(minNumActivitiesShown(2));
await driver.wait(allImagesLoaded());

const base64PNG = await driver.takeScreenshot();

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

test('with custom thumbnail size', async () => {
const { driver, pageObjects } = await setupWebDriver({
props: {
styleOptions: {
uploadThumbnailContentType: 'image/png',
uploadThumbnailHeight: 60,
uploadThumbnailWidth: 120
}
}
});

await driver.executeScript(() => {
window.Worker = undefined;
});
await driver.wait(uiConnected(), timeouts.directLine);

await pageObjects.sendFile('seaofthieves.jpg');
await driver.wait(minNumActivitiesShown(2));
await driver.wait(allImagesLoaded());

const base64PNG = await driver.takeScreenshot();

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

test('with custom thumbnail quality', async () => {
const { driver, pageObjects } = await setupWebDriver({
props: {
styleOptions: {
uploadThumbnailQuality: 0.1
}
}
});

await driver.executeScript(() => {
window.Worker = undefined;
});
await driver.wait(uiConnected(), timeouts.directLine);

await pageObjects.sendFile('seaofthieves.jpg');
await driver.wait(minNumActivitiesShown(2));
await driver.wait(allImagesLoaded());

const base64PNG = await driver.takeScreenshot();

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

test('upload a ZIP file', async () => {
const { driver, pageObjects } = await setupWebDriver();

await driver.wait(uiConnected(), timeouts.directLine);

await pageObjects.sendFile('empty.zip');
await driver.wait(minNumActivitiesShown(2));
await driver.wait(allImagesLoaded());

const base64PNG = await driver.takeScreenshot();

expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions);
});
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ services:
# On Windows, run with COMPOSE_CONVERT_WINDOWS_PATHS=1

chrome:
# https://github.com/SeleniumHQ/docker-selenium
# https://hub.docker.com/r/selenium/standalone-chrome/tags/
image: selenium/standalone-chrome:3.141.0-actinium
build:
context: ./
dockerfile: Dockerfile-selenium
networks:
- selenium
depends_on:
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "botframework-webchat-root",
"version": "4.4.3-0",
"version": "4.5.3",
"private": true,
"files": [
"lib/**/*"
Expand Down
Loading