diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3d04537372..c52bac6584 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -85,6 +85,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fix [#2298](https://github.com/microsoft/BotFramework-WebChat/issues/2298). Speech synthesize errors to be ignored, by [@compulim](https://github.com/compulim) in PR [#2300](https://github.com/microsoft/BotFramework-WebChat/issues/2300)
- Fix [#2243](https://github.com/microsoft/BotFramework-WebChat/issues/2243). Fixed sagas to correctly mark activities with speaking attachments, by [@tdurnford](https://github.com/tdurnford) in PR [#2320](https://github.com/microsoft/BotFramework-WebChat/issues/2320)
- Fix [#2365](https://github.com/microsoft/BotFramework-WebChat/issues/2365). Fix Adaptive Card `pushButton` appearance on Chrome, by [@corinagum](https://github.com/corinagum) in PR [#2382](https://github.com/microsoft/BotFramework-WebChat/pull/2382)
+- Fix [#2379](https://github.com/microsoft/BotFramework-WebChat/issues/2379). Speech synthesis can be configured off by passing `null`, by [@compulim](https://github.com/compulim) in PR [#2408](https://github.com/microsoft/BotFramework-WebChat/pull/2408)
### Added
diff --git a/__tests__/setup/pageObjects/getConsoleLogs.js b/__tests__/setup/pageObjects/getConsoleLogs.js
new file mode 100644
index 0000000000..72e565a063
--- /dev/null
+++ b/__tests__/setup/pageObjects/getConsoleLogs.js
@@ -0,0 +1,3 @@
+export default async function getConsoleLogs(driver) {
+ return await driver.executeScript(() => window.__console__);
+}
diff --git a/__tests__/setup/pageObjects/index.js b/__tests__/setup/pageObjects/index.js
index 120c89a898..8b275e67e0 100644
--- a/__tests__/setup/pageObjects/index.js
+++ b/__tests__/setup/pageObjects/index.js
@@ -5,6 +5,7 @@ import dispatchAction from './dispatchAction';
import endSpeechSynthesize from './endSpeechSynthesize';
import errorSpeechSynthesize from './errorSpeechSynthesize';
import executePromiseScript from './executePromiseScript';
+import getConsoleLogs from './getConsoleLogs';
import getNotificationText from './getNotificationText';
import getNumActivitiesShown from './getNumActivitiesShown';
import getSendBoxText from './getSendBoxText';
@@ -37,6 +38,7 @@ export default function pageObjects(driver) {
endSpeechSynthesize,
errorSpeechSynthesize,
executePromiseScript,
+ getConsoleLogs,
getNotificationText,
getNumActivitiesShown,
getSendBoxText,
diff --git a/__tests__/speech.synthesis.js b/__tests__/speech.synthesis.js
index c4312b3799..5a8aa48f32 100644
--- a/__tests__/speech.synthesis.js
+++ b/__tests__/speech.synthesis.js
@@ -74,4 +74,28 @@ describe('speech synthesis', () => {
await expect(speechRecognitionStartCalled().fn(driver)).resolves.toBeTruthy();
});
+
+ test('should not synthesis if engine is explicitly configured off', async () => {
+ const { driver, pageObjects } = await setupWebDriver({
+ props: {
+ webSpeechPonyfillFactory: () => {
+ const { SpeechGrammarList, SpeechRecognition } = window.WebSpeechMock;
+
+ return {
+ SpeechGrammarList,
+ SpeechRecognition,
+ speechSynthesis: null,
+ SpeechSynthesisUtterance: null
+ };
+ }
+ }
+ });
+
+ await pageObjects.sendMessageViaMicrophone('Hello, World!');
+
+ await expect(speechRecognitionStartCalled().fn(driver)).resolves.toBeFalsy();
+ await driver.wait(minNumActivitiesShown(2), timeouts.directLine);
+
+ expect((await pageObjects.getConsoleLogs()).filter(([type]) => type === 'error')).toEqual([]);
+ });
});
diff --git a/packages/component/src/BasicTranscript.js b/packages/component/src/BasicTranscript.js
index 3449e1d6aa..8a80c50614 100644
--- a/packages/component/src/BasicTranscript.js
+++ b/packages/component/src/BasicTranscript.js
@@ -110,7 +110,9 @@ const BasicTranscript = ({
>
{element}
{// TODO: [P2] We should use core/definitions/speakingActivity for this predicate instead
- activity.channelData && activity.channelData.speak && }
+ speechSynthesis && activity.channelData && activity.channelData.speak && (
+
+ )}
))}
@@ -141,8 +143,8 @@ BasicTranscript.propTypes = {
}).isRequired
}).isRequired,
webSpeechPonyfill: PropTypes.shape({
- speechSynthesis: PropTypes.any.isRequired,
- SpeechSynthesisUtterance: PropTypes.any.isRequired
+ speechSynthesis: PropTypes.any,
+ SpeechSynthesisUtterance: PropTypes.any
})
};