-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "send failed retry" prompt to live region (#4362)
* Adds ActivitySendStatus provider * Use ActivitySendStatus provider * Fix test * Fix test * Fix test * Add new field * Add IMPEDED action * Fix build * Fix types for deleteKey * Clean up console.log * Fix tests * Update comment * Fix test * Fix test * Add tests for impeded/rejected * Fix tests * Fix test * Fix tests * Fix test * Add tests * Fix test * Clean up * Fix path * Clean up * Fix test * Add new DirectLineEmulator * Fix test * Clean up * Fix tests * Clean up * Clean up * Add tests * Fix test * Clean up comments * Clean up * Clean up * Add comments * Rename isDiffMap to isMapEqual * Add comments * Add comments * Add send failed to live region and active descendant * Commentary clean up * Update description * Typo * Update doc * Verbiage * Apply suggestions from code review Co-authored-by: TJ Durnford <[email protected]> * Constant-ize SendStatus * Optionalize hideTimestamp * Use reduce * Use reduce * Update CHANGELOG.md Co-authored-by: TJ Durnford <[email protected]> Co-authored-by: TJ Durnford <[email protected]>
- Loading branch information
Showing
120 changed files
with
9,058 additions
and
7,399 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+8.7 KB
...ctivity-status-should-show-send-failed-when-no-echo-back-is-received-1-snap.png
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
BIN
+9.57 KB
...ctivity-status-should-show-send-failed-when-no-echo-back-is-received-2-snap.png
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
BIN
+8.7 KB
...-status-should-show-send-failed-when-post-activity-returned-an-error-1-snap.png
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
BIN
+9.57 KB
...-status-should-show-send-failed-when-post-activity-returned-an-error-2-snap.png
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
BIN
+8.7 KB
...should-show-send-failed-when-post-activity-did-not-return-any-values-1-snap.png
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
BIN
+9.57 KB
...should-show-send-failed-when-post-activity-did-not-return-any-values-2-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+881 Bytes
(110%)
...retry-js-focus-management-click-on-retry-button-should-focus-on-main-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+875 Bytes
(100%)
...-connectivity-status-when-a-java-script-error-is-present-in-the-code-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-14.6 KB
...display-send-failed-retry-when-activity-is-sent-but-not-acknowledged-1-snap.png
Binary file not shown.
Binary file removed
BIN
-11.5 KB
...i-should-display-send-failed-retry-when-activity-is-not-able-to-send-1-snap.png
Binary file not shown.
Binary file removed
BIN
-13.2 KB
...i-should-display-send-failed-retry-when-activity-is-not-able-to-send-2-snap.png
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
53 changes: 53 additions & 0 deletions
53
__tests__/html/accessibility.accessibleName.activityStatus.sendFailed.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
6 changes: 6 additions & 0 deletions
6
__tests__/html/accessibility.accessibleName.activityStatus.sendFailed.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')); | ||
}); |
46 changes: 46 additions & 0 deletions
46
__tests__/html/accessibility.liveRegion.activityStatus.sendFailed.event.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
6 changes: 6 additions & 0 deletions
6
__tests__/html/accessibility.liveRegion.activityStatus.sendFailed.event.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')); | ||
}); |
52 changes: 52 additions & 0 deletions
52
__tests__/html/accessibility.liveRegion.activityStatus.sendFailed.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
6 changes: 6 additions & 0 deletions
6
__tests__/html/accessibility.liveRegion.activityStatus.sendFailed.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')); | ||
}); |
46 changes: 46 additions & 0 deletions
46
__tests__/html/accessibility.liveRegion.activityStatus.sendFailed.typing.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
6 changes: 6 additions & 0 deletions
6
__tests__/html/accessibility.liveRegion.activityStatus.sendFailed.typing.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')); | ||
}); |
Oops, something went wrong.