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

Bump to Adaptive Cards 2.11.1 #4424

Merged
merged 4 commits into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Changed

- Bumped Adaptive Cards to [`adaptivecards@2.11.1`](https://npmjs.com/package/adaptivecards), by [@compulim](https://github.com/compulim) in PR [#4424](https://github.com/microsoft/BotFramework-WebChat/pull/4424)
- Bumped all dependencies to the latest versions, by [@compulim](https://github.com/compulim) in PR [#4423](https://github.com/microsoft/BotFramework-WebChat/pull/4423)
- Production dependencies
- [`@babel/runtime@7.19.0`](https://npmjs.com/package/@babel/runtime)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,13 @@
// WHEN: Pressing TAB key.
await host.sendKeys('TAB');

// THEN: It should focus on the first textbox (this is done by Adaptive Cards, they set tabindex="-1" on other buttons).
// We just verify whatever behavior they have.
// THEN: It should focus on the "Skip" button.
expect(document.activeElement).toBe(document.querySelector('button[title="Skip"]'));

// WHEN: Pressing TAB key again.
await host.sendKeys('TAB');

// THEN: It should focus on the textbox.
expect(document.activeElement).toBe(document.querySelector('input'));

// WHEN: Pressing TAB key.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
'DOWN', // What color do you want? Red
'DOWN', // Green
'TAB',
'TAB', // AC 2.11: Checkbox group container has tabindex="0"
'SPACE', // What colors do you want? Red
'TAB',
'SPACE', // Green
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,35 @@

await pageConditions.uiConnected();

const { flush } = pageObjects.observeLiveRegion();
const { disconnect, flush } = pageObjects.observeLiveRegion();

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

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

await directLine.emulateIncomingActivity('Aloha!');
await directLine.emulateIncomingActivity('Aloha!');

expect(flush()).toEqual(['Bot said:\nAloha!']);
await pageConditions.became(
'live region narrated bot message',
() => {
try {
expect(flush()).toEqual(['Bot said:\nAloha!']);

return true;
} catch {
return false;
}
},
1000
);
} finally {
disconnect();
}
},
{ ignoreErrors: true }
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,45 @@

await pageConditions.uiConnected();

const { flush } = pageObjects.observeLiveRegion();
const { disconnect, flush } = pageObjects.observeLiveRegion();

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

await directLine.emulateIncomingActivity('Aloha!');
await directLine.emulateIncomingActivity('Aloha!');

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

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

const liveRegionText = [];

await pageConditions.became(
'live region narrated failed to send message',
() => {
try {
liveRegionText.push(...flush());

expect(liveRegionText).toEqual([
'You said:\nHello, World!',
'Bot said:\nAloha!',
'Failed to send message.'
]);

expect(flush()).toEqual(['You said:\nHello, World!', 'Bot said:\nAloha!', 'Failed to send message.']);
return true;
} catch (err) {
return false;
}
},
1000
);
} finally {
disconnect();
}
},
{ ignoreErrors: true }
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,31 @@

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!']);
const { disconnect, flush } = pageObjects.observeLiveRegion();

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

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

await directLine.emulateIncomingActivity('Aloha!');

await pageConditions.became(
'live region narrated bot message',
() => {
try {
expect(flush()).toEqual(['Bot said:\nAloha!']);

return true;
} catch {
return false;
}
},
1000
);
} finally {
disconnect();
}
},
{ ignoreErrors: true }
);
Expand Down
16 changes: 8 additions & 8 deletions packages/bundle/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/bundle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
},
"dependencies": {
"@babel/runtime": "7.19.0",
"adaptivecards": "2.10.0",
"adaptivecards": "2.11.1",
"botframework-directlinejs": "0.15.1",
"botframework-directlinespeech-sdk": "0.0.0-0",
"botframework-webchat-api": "0.0.0-0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default function observeLiveRegion() {
mutationObserver.observe(liveRegionElement, { childList: true });

return {
disconnect: () => mutationObserver.disconnect(),
flush: () => liveRegionInnerTexts.splice(0),
getInnerTexts: () => Object.freeze([...liveRegionInnerTexts])
};
Expand Down