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

Add "send failed retry" prompt to live region #4362

Merged
merged 52 commits into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
fe18d69
Adds ActivitySendStatus provider
compulim Jul 22, 2022
24772d6
Use ActivitySendStatus provider
compulim Jul 22, 2022
ff8a4d7
Fix test
compulim Jul 25, 2022
cd6cfcb
Fix test
compulim Jul 25, 2022
ad84e2a
Fix test
compulim Jul 25, 2022
3a5beff
Add new field
compulim Jul 26, 2022
330f304
Add IMPEDED action
compulim Jul 26, 2022
01ee69d
Fix build
compulim Jul 26, 2022
5c3bf04
Fix types for deleteKey
compulim Jul 26, 2022
a6c1d5b
Clean up console.log
compulim Jul 26, 2022
20a8d0f
Fix tests
compulim Jul 27, 2022
b15cdd2
Update comment
compulim Jul 27, 2022
2ef8a22
Fix test
compulim Jul 27, 2022
76ca606
Fix test
compulim Jul 27, 2022
6a17c7e
Add tests for impeded/rejected
compulim Jul 27, 2022
ecc6e8f
Fix tests
compulim Jul 27, 2022
4cee282
Fix test
compulim Jul 27, 2022
a7128b3
Fix tests
compulim Jul 27, 2022
0d81c29
Fix test
compulim Jul 27, 2022
deee0bd
Add tests
compulim Jul 28, 2022
f099250
Fix test
compulim Jul 29, 2022
7daa13f
Clean up
compulim Jul 29, 2022
746d329
Fix path
compulim Jul 29, 2022
57723ea
Clean up
compulim Jul 29, 2022
6c4d0c4
Fix test
compulim Jul 29, 2022
bbffaf1
Add new DirectLineEmulator
compulim Jul 29, 2022
52fe4df
Fix test
compulim Jul 30, 2022
5ffce21
Clean up
compulim Jul 31, 2022
7e6f70f
Fix tests
compulim Jul 31, 2022
9f69274
Clean up
compulim Aug 1, 2022
9a7c4a4
Clean up
compulim Aug 1, 2022
1e900da
Add tests
compulim Aug 1, 2022
2848a43
Fix test
compulim Aug 1, 2022
0d04e62
Clean up comments
compulim Aug 1, 2022
c306aaa
Clean up
compulim Aug 1, 2022
3281258
Clean up
compulim Aug 1, 2022
2b8d932
Add comments
compulim Aug 1, 2022
f6dd947
Rename isDiffMap to isMapEqual
compulim Aug 1, 2022
3f80345
Add comments
compulim Aug 1, 2022
ea44858
Add comments
compulim Aug 1, 2022
c785dd2
Add send failed to live region and active descendant
compulim Aug 2, 2022
a870f6e
Commentary clean up
compulim Aug 2, 2022
16bd0b1
Update description
compulim Aug 2, 2022
16c7790
Typo
compulim Aug 2, 2022
66fb235
Update doc
compulim Aug 2, 2022
8716933
Verbiage
compulim Aug 2, 2022
98ce8dc
Apply suggestions from code review
compulim Aug 2, 2022
ce301fd
Constant-ize SendStatus
compulim Aug 3, 2022
8d6f059
Optionalize hideTimestamp
compulim Aug 3, 2022
b62d614
Use reduce
compulim Aug 3, 2022
6143368
Use reduce
compulim Aug 3, 2022
d566f13
Update CHANGELOG.md
compulim Aug 3, 2022
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
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Suggested actions container is not longer a live region. The suggested action buttons will now be narrated by the chat history live region
- Published NPM packages will now include `/dist`, `/lib`, and `/src` folders
- The `/dist` folder was previously missing from our NPM packages
- The `activity.channelData.state` property is being deprecated in favor of the updated [`activity.channelData['webchat:send-status']`](https://github.com/microsoft/BotFramework-WebChat/blob/main/packages/core/src/types/WebChatActivity.ts) property. Main differences include:
- Previously, we would set the `state` property to `"send failed"` when the chat adapter failed to send the activity, or after passing a timeout as defined in `styleOptions.sendTimeout`
- The new `'webchat:send-status'` property will be set to `"send failed"` when the chat adapter fails to send the activity or after passing a hardcoded timeout of 5 minutes
- See PR [#4362](https://github.com/microsoft/BotFramework-WebChat/pull/4362) for details

### Changed

- Resolves [#4301](https://github.com/microsoft/BotFramework-WebChat/issues/4301). Updated `Dockerfile` to support secure container supply chain, by [@compulim](https://github.com/compulim) in PR [#4303](https://github.com/microsoft/BotFramework-WebChat/pull/4303)
- Resolves [#4317](https://github.com/microsoft/BotFramework-WebChat/issues/4317). Updated `package.json` to allowlist `/dist`, `/lib`, `/src`, by [@compulim](https://github.com/compulim) in PR [#4318](https://github.com/microsoft/BotFramework-WebChat/pull/4318)
- Resolves [#4322](https://github.com/microsoft/BotFramework-WebChat/issues/4322). Improved error messages for sending activities, by [@compulim](https://github.com/compulim) in PR [#4362](https://github.com/microsoft/BotFramework-WebChat/pull/4362)
- Resolves [#4211](https://github.com/microsoft/BotFramework-WebChat/issues/4211). Added new `useSendStatusByActivityKey` hook to check the UI send status of an outgoing activity, by [@compulim](https://github.com/compulim) in PR [#4362](https://github.com/microsoft/BotFramework-WebChat/pull/4362)
- The send status returned by this hook is designed to display different UIs that reflect the "sending", "send failed" or "sent" status of the activity
- When modifying `styleOptions.sendTimeout` prop, the send status returned by this hook may transition from `"send failed"` to `"sending"`, and vice versa
- This is different from the send status provided by the chat adapter, namely `activity.channelData['webchat:send-status']`

### Fixed

Expand All @@ -51,6 +60,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixes [#4325](https://github.com/microsoft/BotFramework-WebChat/issues/4325). `aria-keyshortcuts` should use modifier keys according to `KeyboardEvent` key values spec, by [@compulim](https://github.com/compulim), in PR [#4323](https://github.com/microsoft/BotFramework-WebChat/issues/4323)
- Fixes [#4327](https://github.com/microsoft/BotFramework-WebChat/issues/4327). In Adaptive Cards, `TextBlock` with `style="heading"` should have `aria-level` set, by [@compulim](https://github.com/compulim), in PR [#4329](https://github.com/microsoft/BotFramework-WebChat/issues/4329)
- Fixes [#3949](https://github.com/microsoft/BotFramework-WebChat/issues/3949). For accessibility reasons, buttons in Adaptive Cards should be `role="button"` instead of `role="menubar"`/`role="menuitem"`, by [@compulim](https://github.com/compulim), in PR [#4263](https://github.com/microsoft/BotFramework-WebChat/issues/4263)
- Fixes [#4211](https://github.com/microsoft/BotFramework-WebChat/issues/4211). Screen reader should read when an activity was failed to send, by [@compulim](https://github.com/compulim), in PR [#4326](https://github.com/microsoft/BotFramework-WebChat/issues/4326), also fixed:
- The "send failed" status on the activity should show up as soon as the chat adapter failed to send the activity

## Changes

Expand Down
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 not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<link href="/assets/index.css" rel="stylesheet" type="text/css" />
<script crossorigin="anonymous" src="/test-harness.js"></script>
<script crossorigin="anonymous" src="/test-page-object.js"></script>
<script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
</head>
<body>
<div id="webchat"></div>
<script>
run(
async function () {
const store = testHelpers.createStore();

const directLine = testHelpers.createDirectLineEmulator(store);

WebChat.renderWebChat(
{
directLine,
store,
styleOptions: {
groupTimestamp: 60000,
sendTimeout: 5000
}
},
document.getElementById('webchat')
);

await pageConditions.uiConnected();

const sendMessage = await directLine.emulateOutgoingActivity('Hello, World!');

await directLine.emulateIncomingActivity('Aloha!');

sendMessage.rejectPostActivity(new Error('artificial error'));

await pageConditions.became(
'failed to send message',
() => pageElements.activityStatuses()[0]?.innerText === 'Send failed. Retry.',
1000
);

expect(pageElements.activityActiveDescendantLabels().map(({ innerText }) => innerText)).toEqual([
'You said: Hello, World! Send failed. Click to interact.',
'Bot said: Aloha!'
]);
},
{ ignoreErrors: true }
);
</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */

describe('accessibility requirement', () => {
test('active descendant accessible name should contains "Send failed" for failing activities', () =>
runHTML('accessibility.accessibleName.activityStatus.sendFailed'));
});
47 changes: 47 additions & 0 deletions __tests__/html/accessibility.accessibleName.simple.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<link href="/assets/index.css" rel="stylesheet" type="text/css" />
<script crossorigin="anonymous" src="/test-harness.js"></script>
<script crossorigin="anonymous" src="/test-page-object.js"></script>
<script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
</head>
<body>
<div id="webchat"></div>
<script>
run(
async function () {
const store = testHelpers.createStore();

const directLine = testHelpers.createDirectLineEmulator(store);

WebChat.renderWebChat(
{
directLine,
store,
styleOptions: {
groupTimestamp: 60000,
sendTimeout: 5000
}
},
document.getElementById('webchat')
);

await pageConditions.uiConnected();

const sendMessage = await directLine.emulateOutgoingActivity('Hello, World!');

await sendMessage.resolveAll();

await directLine.emulateIncomingActivity('Aloha!');

expect(pageElements.activityActiveDescendantLabels().map(({ innerText }) => innerText)).toEqual([
'You said: Hello, World!',
'Bot said: Aloha!'
]);
},
{ ignoreErrors: true }
);
</script>
</body>
</html>
6 changes: 6 additions & 0 deletions __tests__/html/accessibility.accessibleName.simple.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */

describe('accessibility requirement', () => {
test('active descendant accessible name should contains simple message content', () =>
runHTML('accessibility.accessibleName.simple'));
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<link href="/assets/index.css" rel="stylesheet" type="text/css" />
<script crossorigin="anonymous" src="/test-harness.js"></script>
<script crossorigin="anonymous" src="/test-page-object.js"></script>
<script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
</head>
<body>
<div id="webchat"></div>
<script>
run(
async function () {
const store = testHelpers.createStore();

const directLine = testHelpers.createDirectLineEmulator(store);

WebChat.renderWebChat(
{
directLine,
store,
styleOptions: {
groupTimestamp: 60000,
sendTimeout: 5000
}
},
document.getElementById('webchat')
);

await pageConditions.uiConnected();

const { flush } = pageObjects.observeLiveRegion();

const sendMessage = await directLine.emulateOutgoingActivity({ name: 'hello', type: 'event', value: 'aloha' });

sendMessage.rejectPostActivity(new Error('artificial error'));

await directLine.emulateIncomingActivity('Aloha!');

expect(flush()).toEqual(['Bot said:\nAloha!']);
},
{ ignoreErrors: true }
);
</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */

describe('live region', () => {
test('should not narrate "failed to send message" through live region for event activity', () =>
runHTML('accessibility.liveRegion.activityStatus.sendFailed.event.html'));
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<link href="/assets/index.css" rel="stylesheet" type="text/css" />
<script crossorigin="anonymous" src="/test-harness.js"></script>
<script crossorigin="anonymous" src="/test-page-object.js"></script>
<script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
</head>
<body>
<div id="webchat"></div>
<script>
run(
async function () {
const store = testHelpers.createStore();

const directLine = testHelpers.createDirectLineEmulator(store);

WebChat.renderWebChat(
{
directLine,
store,
styleOptions: {
groupTimestamp: 60000,
sendTimeout: 5000
}
},
document.getElementById('webchat')
);

await pageConditions.uiConnected();

const { flush } = pageObjects.observeLiveRegion();

const sendMessage = await directLine.emulateOutgoingActivity('Hello, World!');

await directLine.emulateIncomingActivity('Aloha!');

sendMessage.rejectPostActivity(new Error('artificial error'));

await pageConditions.became(
'failed to send message',
() => pageElements.activityStatuses()[0]?.innerText === 'Send failed. Retry.',
1000
);

expect(flush()).toEqual(['You said:\nHello, World!', 'Bot said:\nAloha!', 'Failed to send message.']);
},
{ ignoreErrors: true }
);
</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */

describe('live region', () => {
test('should narrate "failed to send message" through live region', () =>
runHTML('accessibility.liveRegion.activityStatus.sendFailed.html'));
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<link href="/assets/index.css" rel="stylesheet" type="text/css" />
<script crossorigin="anonymous" src="/test-harness.js"></script>
<script crossorigin="anonymous" src="/test-page-object.js"></script>
<script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
</head>
<body>
<div id="webchat"></div>
<script>
run(
async function () {
const store = testHelpers.createStore();

const directLine = testHelpers.createDirectLineEmulator(store);

WebChat.renderWebChat(
{
directLine,
store,
styleOptions: {
groupTimestamp: 60000,
sendTimeout: 5000
}
},
document.getElementById('webchat')
);

await pageConditions.uiConnected();

const { flush } = pageObjects.observeLiveRegion();

const sendMessage = await directLine.emulateOutgoingActivity({ type: 'typing' });

sendMessage.rejectPostActivity(new Error('artificial error'));

await directLine.emulateIncomingActivity('Aloha!');

expect(flush()).toEqual(['Bot said:\nAloha!']);
},
{ ignoreErrors: true }
);
</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */

describe('live region', () => {
test('should not narrate "failed to send message" through live region for typing activity', () =>
runHTML('accessibility.liveRegion.activityStatus.sendFailed.typing.html'));
});
Loading