From 1b842dfa80d07eb28cd23cacf72247c2c5caa40e Mon Sep 17 00:00:00 2001 From: William Wong Date: Tue, 7 Sep 2021 14:38:51 -0700 Subject: [PATCH] Bump to 4.14.1 for release (#4045) * 4.14.1 * Improves test reliability --- CHANGELOG.md | 2 ++ __tests__/inputHint.consecutive.js | 33 +++++++++++++++++------- __tests__/inputHint.js | 40 ++++++++++++++++++++++++------ __tests__/speech.recognition.js | 2 +- __tests__/speech.synthesis.js | 21 +++++++++++----- package-lock.json | 2 +- package.json | 2 +- 7 files changed, 76 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b29c1d89dc..6fd2c880fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [4.14.1] - 2021-09-07 + ### Fixed - Fixes [#3968](https://github.com/microsoft/BotFramework-WebChat/issues/3968). Fix typing for `usePerformCardAction` hook, by [@compulim](https://github.com/compulim), in PR [#3969](https://github.com/microsoft/BotFramework-WebChat/pull/3969) diff --git a/__tests__/inputHint.consecutive.js b/__tests__/inputHint.consecutive.js index 04e9c4e342..a29060fe6a 100644 --- a/__tests__/inputHint.consecutive.js +++ b/__tests__/inputHint.consecutive.js @@ -54,54 +54,69 @@ describe('input hint from consecutive messages', () => { test('should turn on microphone for accepting then accepting', async () => { await sendInputHintCommand('accepting', 'accepting'); - await expect(speechRecognitionStartCalled().fn(driver)).resolves.toBeFalsy(); + // TODO: [P3] #4046 Improves test reliability by identifying false positives and reduce wait time. + await expect(() => driver.wait(speechRecognitionStartCalled(), timeouts.ui)).rejects.toThrow( + 'Waiting SpeechRecognition.start to be called' + ); }); test('should turn on microphone for accepting then expecting', async () => { await sendInputHintCommand('accepting', 'expecting'); - await expect(speechRecognitionStartCalled().fn(driver)).resolves.toBeTruthy(); + await driver.wait(speechRecognitionStartCalled(), timeouts.ui); }); test('should turn on microphone for accepting then ignoring', async () => { await sendInputHintCommand('accepting', 'ignoring'); - await expect(speechRecognitionStartCalled().fn(driver)).resolves.toBeFalsy(); + // TODO: [P3] #4046 Improves test reliability by identifying false positives and reduce wait time. + await expect(() => driver.wait(speechRecognitionStartCalled(), timeouts.ui)).rejects.toThrow( + 'Waiting SpeechRecognition.start to be called' + ); }); test('should turn on microphone for expecting then accepting', async () => { await sendInputHintCommand('expecting', 'accepting'); - await expect(speechRecognitionStartCalled().fn(driver)).resolves.toBeTruthy(); + await driver.wait(speechRecognitionStartCalled(), timeouts.ui); }); test('should turn on microphone for expecting then expecting', async () => { await sendInputHintCommand('expecting', 'expecting'); - await expect(speechRecognitionStartCalled().fn(driver)).resolves.toBeTruthy(); + await driver.wait(speechRecognitionStartCalled(), timeouts.ui); }); test('should turn on microphone for expecting then ignoring', async () => { await sendInputHintCommand('expecting', 'ignoring'); - await expect(speechRecognitionStartCalled().fn(driver)).resolves.toBeFalsy(); + // TODO: [P3] #4046 Improves test reliability by identifying false positives and reduce wait time. + await expect(() => driver.wait(speechRecognitionStartCalled(), timeouts.ui)).rejects.toThrow( + 'Waiting SpeechRecognition.start to be called' + ); }); test('should turn on microphone for ignoring then accepting', async () => { await sendInputHintCommand('ignoring', 'accepting'); - await expect(speechRecognitionStartCalled().fn(driver)).resolves.toBeFalsy(); + // TODO: [P3] #4046 Improves test reliability by identifying false positives and reduce wait time. + await expect(() => driver.wait(speechRecognitionStartCalled(), timeouts.ui)).rejects.toThrow( + 'Waiting SpeechRecognition.start to be called' + ); }); test('should turn on microphone for ignoring then expecting', async () => { await sendInputHintCommand('ignoring', 'expecting'); - await expect(speechRecognitionStartCalled().fn(driver)).resolves.toBeTruthy(); + await driver.wait(speechRecognitionStartCalled(), timeouts.ui); }); test('should turn on microphone for ignoring then ignoring', async () => { await sendInputHintCommand('ignoring', 'ignoring'); - await expect(speechRecognitionStartCalled().fn(driver)).resolves.toBeFalsy(); + // TODO: [P3] #4046 Improves test reliability by identifying false positives and reduce wait time. + await expect(() => driver.wait(speechRecognitionStartCalled(), timeouts.ui)).rejects.toThrow( + 'Waiting SpeechRecognition.start to be called' + ); }); }); diff --git a/__tests__/inputHint.js b/__tests__/inputHint.js index e0474eae05..870ce0eaca 100644 --- a/__tests__/inputHint.js +++ b/__tests__/inputHint.js @@ -29,7 +29,10 @@ describe('input hint', () => { await pageObjects.startSpeechSynthesize(); await pageObjects.endSpeechSynthesize(); - await expect(speechRecognitionStartCalled().fn(driver)).resolves.toBeTruthy(); + // After synthesis completed, we will dispatch START_DICTATE action. + // The action will trigger a re-render and the useEffect() will kickoff speech recognition. + // There could be a slight time delay between "end of synthesis" and "kickoff recognition". + await driver.wait(speechRecognitionStartCalled(), timeouts.ui); }); test('should not turn on microphone if initiated via typing', async () => { @@ -45,7 +48,10 @@ describe('input hint', () => { await driver.wait(minNumActivitiesShown(2), timeouts.directLine); - await expect(speechRecognitionStartCalled().fn(driver)).resolves.toBeFalsy(); + // TODO: [P3] #4046 Improves test reliability by identifying false positives and reduce wait time. + await expect(() => driver.wait(speechRecognitionStartCalled(), timeouts.ui)).rejects.toThrow( + 'Waiting SpeechRecognition.start to be called' + ); }); }); @@ -67,7 +73,10 @@ describe('input hint', () => { await pageObjects.startSpeechSynthesize(); await pageObjects.endSpeechSynthesize(); - await expect(speechRecognitionStartCalled().fn(driver)).resolves.toBeFalsy(); + // TODO: [P3] #4046 Improves test reliability by identifying false positives and reduce wait time. + await expect(() => driver.wait(speechRecognitionStartCalled(), timeouts.ui)).rejects.toThrow( + 'Waiting SpeechRecognition.start to be called' + ); }); test('should not turn on microphone if initiated via typing', async () => { @@ -83,7 +92,10 @@ describe('input hint', () => { await driver.wait(minNumActivitiesShown(2), timeouts.directLine); - await expect(speechRecognitionStartCalled().fn(driver)).resolves.toBeFalsy(); + // TODO: [P3] #4046 Improves test reliability by identifying false positives and reduce wait time. + await expect(() => driver.wait(speechRecognitionStartCalled(), timeouts.ui)).rejects.toThrow( + 'Waiting SpeechRecognition.start to be called' + ); }); }); @@ -105,7 +117,10 @@ describe('input hint', () => { await pageObjects.startSpeechSynthesize(); await pageObjects.endSpeechSynthesize(); - await expect(speechRecognitionStartCalled().fn(driver)).resolves.toBeFalsy(); + // TODO: [P3] #4046 Improves test reliability by identifying false positives and reduce wait time. + await expect(() => driver.wait(speechRecognitionStartCalled(), timeouts.ui)).rejects.toThrow( + 'Waiting SpeechRecognition.start to be called' + ); }); test('should turn off microphone if initiated via typing', async () => { @@ -121,7 +136,10 @@ describe('input hint', () => { await driver.wait(minNumActivitiesShown(2), timeouts.directLine); - await expect(speechRecognitionStartCalled().fn(driver)).resolves.toBeFalsy(); + // TODO: [P3] #4046 Improves test reliability by identifying false positives and reduce wait time. + await expect(() => driver.wait(speechRecognitionStartCalled(), timeouts.ui)).rejects.toThrow( + 'Waiting SpeechRecognition.start to be called' + ); }); }); @@ -143,7 +161,10 @@ describe('input hint', () => { await pageObjects.startSpeechSynthesize(); await pageObjects.endSpeechSynthesize(); - await expect(speechRecognitionStartCalled().fn(driver)).resolves.toBeFalsy(); + // TODO: [P3] #4046 Improves test reliability by identifying false positives and reduce wait time. + await expect(() => driver.wait(speechRecognitionStartCalled(), timeouts.ui)).rejects.toThrow( + 'Waiting SpeechRecognition.start to be called' + ); }); test('should not turn on microphone if initiated via typing', async () => { @@ -159,7 +180,10 @@ describe('input hint', () => { await driver.wait(minNumActivitiesShown(2), timeouts.directLine); - await expect(speechRecognitionStartCalled().fn(driver)).resolves.toBeFalsy(); + // TODO: [P3] #4046 Improves test reliability by identifying false positives and reduce wait time. + await expect(() => driver.wait(speechRecognitionStartCalled(), timeouts.ui)).rejects.toThrow( + 'Waiting SpeechRecognition.start to be called' + ); }); }); }); diff --git a/__tests__/speech.recognition.js b/__tests__/speech.recognition.js index 86395e2d6f..62537cce0c 100644 --- a/__tests__/speech.recognition.js +++ b/__tests__/speech.recognition.js @@ -221,6 +221,6 @@ describe('speech recognition', () => { await pageObjects.clickMicrophoneButton(); - await expect(speechRecognitionStartCalled().fn(driver)).resolves.toHaveProperty('lang', 'zh-HK'); + await expect(driver.wait(speechRecognitionStartCalled(), timeouts.ui)).resolves.toHaveProperty('lang', 'zh-HK'); }); }); diff --git a/__tests__/speech.synthesis.js b/__tests__/speech.synthesis.js index d80f2bbb7e..b1595f8b4d 100644 --- a/__tests__/speech.synthesis.js +++ b/__tests__/speech.synthesis.js @@ -66,14 +66,17 @@ describe('speech synthesis', () => { await pageObjects.sendMessageViaMicrophone('hint expecting'); - await expect(speechRecognitionStartCalled().fn(driver)).resolves.toBeFalsy(); + // TODO: [P3] #4046 Improves test reliability by identifying false positives and reduce wait time. + await expect(() => driver.wait(speechRecognitionStartCalled(), timeouts.ui)).rejects.toThrow( + 'Waiting SpeechRecognition.start to be called' + ); await driver.wait(minNumActivitiesShown(2), timeouts.directLine); await driver.wait(speechSynthesisUtterancePended(), timeouts.ui); await pageObjects.startSpeechSynthesize(); await pageObjects.errorSpeechSynthesize(); - await expect(speechRecognitionStartCalled().fn(driver)).resolves.toBeTruthy(); + await driver.wait(speechRecognitionStartCalled(), timeouts.ui); }); test('should not synthesis if engine is explicitly configured off', async () => { @@ -94,7 +97,10 @@ describe('speech synthesis', () => { await pageObjects.sendMessageViaMicrophone('Hello, World!'); - await expect(speechRecognitionStartCalled().fn(driver)).resolves.toBeFalsy(); + // TODO: [P3] #4046 Improves test reliability by identifying false positives and reduce wait time. + await expect(() => driver.wait(speechRecognitionStartCalled(), timeouts.ui)).rejects.toThrow( + 'Waiting SpeechRecognition.start to be called' + ); await driver.wait(minNumActivitiesShown(2), timeouts.directLine); expect(await pageObjects.getConsoleErrors()).toEqual([]); @@ -109,7 +115,10 @@ describe('speech synthesis', () => { await pageObjects.sendMessageViaMicrophone('echo Hello, World!'); - await expect(speechRecognitionStartCalled().fn(driver)).resolves.toBeFalsy(); + // TODO: [P3] #4046 Improves test reliability by identifying false positives and reduce wait time. + await expect(() => driver.wait(speechRecognitionStartCalled(), timeouts.ui)).rejects.toThrow( + 'Waiting SpeechRecognition.start to be called' + ); await driver.wait(minNumActivitiesShown(3), timeouts.directLine); await expect(pageObjects.startSpeechSynthesize()).resolves.toHaveProperty( @@ -121,7 +130,7 @@ describe('speech synthesis', () => { await pageObjects.clickMicrophoneButton(); - await expect(speechRecognitionStartCalled().fn(driver)).resolves.toBeTruthy(); + await driver.wait(speechRecognitionStartCalled(), timeouts.ui); await driver.wait(negationOf(speechSynthesisUtterancePended()), timeouts.ui); }); @@ -144,7 +153,7 @@ describe('speech synthesis', () => { await driver.wait(minNumActivitiesShown(2), timeouts.directLine); - await expect(speechRecognitionStartCalled().fn(driver)).resolves.toBeTruthy(); + await driver.wait(speechRecognitionStartCalled(), timeouts.ui); await driver.wait(negationOf(speechSynthesisUtterancePended()), timeouts.ui); }); }); diff --git a/package-lock.json b/package-lock.json index 1115ebe741..3435aa00c8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "botframework-webchat-root", - "version": "4.14.1-0", + "version": "4.14.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 9cdca85a94..b8b856b69d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "botframework-webchat-root", - "version": "4.14.1-0", + "version": "4.14.1", "private": true, "files": [ "lib/**/*"