Skip to content

Commit 0e46c91

Browse files
committed
test: fix assertion tests for sending live region announcement
Updated tests to include "Sending message." in expected live region output: - activityStatus.sendFailed.html: prepend Sending message. to expected array - activityStatus.sendSending.html: use toContain with proper accumulation - suggestedActions.accessKey.html: add Sending message. to expected array - suggestedActions.noAccessKey.html: add Sending message. to expected array
1 parent c4a883b commit 0e46c91

4 files changed

Lines changed: 46 additions & 33 deletions

File tree

__tests__/html2/accessibility/liveRegion/activityStatus.sendFailed.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
liveRegionText.push(...flush());
5252

5353
expect(liveRegionText).toEqual([
54+
'Sending message.',
5455
'You said:\nHello, World!',
5556
'Bot said:\nAloha!',
5657
'Failed to send message.'

__tests__/html2/accessibility/liveRegion/activityStatus.sendSending.html

Lines changed: 43 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,42 +9,52 @@
99
<body>
1010
<main id="webchat"></main>
1111
<script>
12-
run(async function () {
13-
const { directLine, store } = testHelpers.createDirectLineEmulator();
14-
15-
WebChat.renderWebChat(
16-
{
17-
directLine,
18-
store
19-
},
20-
document.getElementById('webchat')
21-
);
22-
23-
await pageConditions.uiConnected();
24-
25-
const { disconnect, flush } = pageObjects.observeLiveRegion();
26-
27-
try {
28-
// Emulate outgoing activity but do not acknowledge it, keeping it in "sending" state.
29-
directLine.emulateOutgoingActivity('Hello, World!');
30-
31-
await pageConditions.became(
32-
'live region narrated sending message',
33-
() => {
34-
try {
35-
expect(flush()).toEqual(['You said:\nHello, World!', 'Sending message.']);
36-
37-
return true;
38-
} catch {
39-
return false;
12+
run(
13+
async function () {
14+
const { directLine, store } = testHelpers.createDirectLineEmulator();
15+
16+
WebChat.renderWebChat(
17+
{
18+
directLine,
19+
store,
20+
styleOptions: {
21+
sendTimeout: 20000
4022
}
4123
},
42-
1000
24+
document.getElementById('webchat')
4325
);
44-
} finally {
45-
disconnect();
46-
}
47-
});
26+
27+
await pageConditions.uiConnected();
28+
29+
const { disconnect, flush } = pageObjects.observeLiveRegion();
30+
31+
try {
32+
// Emulate outgoing activity but do not acknowledge it, keeping it in "sending" state.
33+
await directLine.emulateOutgoingActivity('Hello, World!');
34+
35+
const liveRegionText = [];
36+
37+
await pageConditions.became(
38+
'live region narrated sending message',
39+
() => {
40+
try {
41+
liveRegionText.push(...flush());
42+
43+
expect(liveRegionText).toContain('Sending message.');
44+
45+
return true;
46+
} catch (err) {
47+
return false;
48+
}
49+
},
50+
1000
51+
);
52+
} finally {
53+
disconnect();
54+
}
55+
},
56+
{ ignoreErrors: true }
57+
);
4858
</script>
4959
</body>
5060
</html>

__tests__/html2/suggestedActions/suggestedActions.accessKey.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393

9494
expect(screenReaderTexts).toEqual([
9595
'connecting',
96+
'Sending message.',
9697
'You said:\nsuggested-actions',
9798
'Bot said:\nPlease select one of the actions below\nIM back as string\nPost back as string\nPost back as JSON\nMessage back as JSON with display text\nMessage back as JSON without display text\nMessage back as string with display text',
9899
'Message has suggested actions. Press Alt Shift A to select them.'

__tests__/html2/suggestedActions/suggestedActions.noAccessKey.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383

8484
expect(screenReaderTexts).toEqual([
8585
'connecting',
86+
'Sending message.',
8687
'You said:\nsuggested-actions',
8788
'Bot said:\nPlease select one of the actions below\nIM back as string\nPost back as string\nPost back as JSON\nMessage back as JSON with display text\nMessage back as JSON without display text\nMessage back as string with display text',
8889
'Message has suggested actions. Press shift tab 2 to 3 times to select them.'

0 commit comments

Comments
 (0)