diff --git a/CHANGELOG.md b/CHANGELOG.md index e1e5829518..8e06a669f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixes [#4557](https://github.com/microsoft/BotFramework-WebChat/issues/4557). Flipper buttons in carousels and suggested actions is now renamed to "next/previous" from "left/right", by [@compulim](https://github.com/compulim), in PR [#4646](https://github.com/microsoft/BotFramework-WebChat/pull/4646) - Fixes [#4652](https://github.com/microsoft/BotFramework-WebChat/issues/4652). Keyboard help screen, activity focus traps, and chat history terminator should not be hidden behind `aria-hidden` because they are focusable, by [@compulim](https://github.com/compulim), in PR [#4659](https://github.com/microsoft/BotFramework-WebChat/pull/4659) - Fixes [#4665](https://github.com/microsoft/BotFramework-WebChat/issues/4665). Updated development server with latest ESBuild API, by [@compulim](https://github.com/compulim), in PR [#4662](https://github.com/microsoft/BotFramework-WebChat/pull/4662). +- Fixes [#4706](https://github.com/microsoft/BotFramework-WebChat/issues/4706). Send button and ENTER key should function after reconnected, by [@compulim](https://github.com/compulim), in PR [#4707](https://github.com/microsoft/BotFramework-WebChat/pull/4707). ### Changed diff --git a/__tests__/html/chatAdapter.reconnect.html b/__tests__/html/chatAdapter.reconnect.html new file mode 100644 index 0000000000..994da0a78d --- /dev/null +++ b/__tests__/html/chatAdapter.reconnect.html @@ -0,0 +1,78 @@ + + + + + + + + + +
+ + + diff --git a/__tests__/html/chatAdapter.reconnect.js b/__tests__/html/chatAdapter.reconnect.js new file mode 100644 index 0000000000..9108e20b89 --- /dev/null +++ b/__tests__/html/chatAdapter.reconnect.js @@ -0,0 +1,3 @@ +/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ + +test('after reconnect should send and receive message as usual', () => runHTML('chatAdapter.reconnect.html')); diff --git a/packages/component/src/providers/internal/SendBox/SendBoxComposer.tsx b/packages/component/src/providers/internal/SendBox/SendBoxComposer.tsx index 10ac8b7a51..ab65b7fdbb 100644 --- a/packages/component/src/providers/internal/SendBox/SendBoxComposer.tsx +++ b/packages/component/src/providers/internal/SendBox/SendBoxComposer.tsx @@ -91,7 +91,11 @@ const SendBoxComposer = ({ children }: PropsWithChildren<{}>) => { setErrorRef.current = setError; const submitErrorRef = useRefFrom<'empty' | 'offline' | undefined>( - connectivityStatus !== 'connected' ? 'offline' : !sendBoxValue ? 'empty' : undefined + connectivityStatus !== 'connected' && connectivityStatus !== 'reconnected' + ? 'offline' + : !sendBoxValue + ? 'empty' + : undefined ); const submit = useCallback( diff --git a/packages/test/page-object/src/globals/pageObjects/sendMessageViaSendBox.js b/packages/test/page-object/src/globals/pageObjects/sendMessageViaSendBox.js index 8a988d968c..893dcaab2a 100644 --- a/packages/test/page-object/src/globals/pageObjects/sendMessageViaSendBox.js +++ b/packages/test/page-object/src/globals/pageObjects/sendMessageViaSendBox.js @@ -1,6 +1,8 @@ import allOutgoingActivitiesSent from '../pageConditions/allOutgoingActivitiesSent'; +import became from '../pageConditions/became'; import numActivitiesShown from '../pageConditions/numActivitiesShown'; import getActivityElements from '../pageElements/activities'; +import getSendBoxTextBoxElement from '../pageElements/sendBoxTextBox'; import typeInSendBox from './typeInSendBox'; export default async function sendMessageViaSendBox(text, { waitForNumResponse = 0, waitForSend = true } = {}) { @@ -14,6 +16,10 @@ export default async function sendMessageViaSendBox(text, { waitForNumResponse = await typeInSendBox(text, '\n'); - waitForSend && (await allOutgoingActivitiesSent()); + if (waitForSend) { + await became('send box to be emptied', () => !getSendBoxTextBoxElement()?.value, 1000); + await allOutgoingActivitiesSent(); + } + waitForNumResponse && (await numActivitiesShown(numActivitiesShownBeforeSend + 1 + waitForNumResponse)); } diff --git a/packages/test/page-object/src/globals/testHelpers/createDirectLineEmulator.js b/packages/test/page-object/src/globals/testHelpers/createDirectLineEmulator.js index 26a2c4c640..eedae3a078 100644 --- a/packages/test/page-object/src/globals/testHelpers/createDirectLineEmulator.js +++ b/packages/test/page-object/src/globals/testHelpers/createDirectLineEmulator.js @@ -111,6 +111,13 @@ export default function createDirectLineEmulator({ autoConnect = true, ponyfill // This is a mock and will no-op on dispatch(). }, postActivity, + emulateReconnect: () => { + connectionStatusDeferredObservable.next(1); + + return { + resolve: () => connectionStatusDeferredObservable.next(2) + }; + }, emulateConnected: connectedDeferred.resolve, emulateIncomingActivity: async activity => { if (typeof activity === 'string') {