Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
6ec76f1
Upgrade tests to html2
compulim Feb 25, 2025
7ff9532
Support regretting a livestream
compulim Feb 25, 2025
2dafb36
More comments
compulim Feb 25, 2025
10529af
Move to another folder
compulim Mar 4, 2025
1147bc6
Add livestream with attachments test
compulim Mar 5, 2025
cb2548c
Add screenshots
compulim Mar 5, 2025
9467ceb
Fix tests
compulim Mar 5, 2025
3f271ed
Don't show PNGs
compulim Mar 5, 2025
6e76ad9
Fix message activity should remove typing indicator
compulim Mar 5, 2025
8117617
Fix tests
compulim Mar 5, 2025
5be2cb4
Upgrade a test
compulim Mar 5, 2025
0d21f9f
Upgrade a test
compulim Mar 5, 2025
175da60
Rename
compulim Mar 5, 2025
bddca6d
Upgrade a test
compulim Mar 5, 2025
94365d9
Remove upgraded test
compulim Mar 5, 2025
dbb2e57
Upgrade a test
compulim Mar 5, 2025
b8e89e6
Upgrade the last test
compulim Mar 5, 2025
85dd97b
Use emulator
compulim Mar 5, 2025
f96199b
Use emulator
compulim Mar 5, 2025
06ea56f
Add test for batched activities
compulim Mar 7, 2025
6117bd9
Add test for typing indicator and livestream simultaneously
compulim Mar 7, 2025
e0e965b
Add tests
compulim Mar 10, 2025
44f8882
Add useReduceActivities
compulim Mar 11, 2025
36ce124
Supports typing from multiple livestreams
compulim Mar 11, 2025
774ac06
Fix test
compulim Mar 11, 2025
3b66bdc
Add test
compulim Mar 11, 2025
982d145
Upgrade tests
compulim Mar 11, 2025
666d7c1
Move to another folder
compulim Mar 11, 2025
5fcd0b5
Add test
compulim Mar 11, 2025
67c330d
Rename to contentless
compulim Mar 11, 2025
c765364
Remove upgraded test
compulim Mar 11, 2025
6e6d0a1
Fix ESLint
compulim Mar 11, 2025
fd16f90
Fix flaky tests
compulim Mar 11, 2025
dd35b78
Add test
compulim Mar 11, 2025
bde8cc1
Remove todo
compulim Mar 11, 2025
6304ef8
Add test
compulim Mar 11, 2025
29c3e83
Add snapshot
compulim Mar 11, 2025
f237567
Add decorator
compulim Mar 11, 2025
f7eb4b7
Update docs
compulim Mar 11, 2025
046f0cc
Typo
compulim Mar 11, 2025
360766d
Clarity
compulim Mar 11, 2025
046bb35
Revert unneeded change
compulim Mar 11, 2025
f47808a
Allow `undefinedable`
compulim Mar 11, 2025
b534559
Fix activity without text but attachments
compulim Mar 12, 2025
2e449b4
Wordings
compulim Mar 12, 2025
ae53e1d
Wordings
compulim Mar 12, 2025
698a032
Add changelog entry
compulim Mar 12, 2025
d9984dc
Fix optional channelData
compulim Mar 12, 2025
5903531
Upgrade tests
compulim Mar 12, 2025
0c4a7c5
Add FAQs
compulim Mar 12, 2025
18a8e2c
Wordings
compulim Mar 12, 2025
c39197f
Use URLSearchParams
compulim Mar 12, 2025
66a318a
Move to unpkg
compulim Mar 12, 2025
860f1a0
Should recompute after an element changed
compulim Mar 12, 2025
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
26 changes: 18 additions & 8 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ parserOptions:
sourceType: module

overrides:
- files:
- '__tests__/**/*.js'
- '*.spec.js'
- '*.test.js'

env:
jest: true

- files:
- 'jest.config.js'
- 'jest.*.config.js'
Expand Down Expand Up @@ -85,6 +77,24 @@ overrides:
# Shorthanding if-condition with && and ||.
'@typescript-eslint/no-unused-expressions': off

- files:
- '__tests__/**/*.js'
- '**/*.spec.js'
- '**/*.spec.jsx'
- '**/*.spec.ts'
- '**/*.spec.tsx'
- '**/*.test.js'
- '**/*.test.jsx'
- '**/*.test.ts'
- '**/*.test.tsx'

env:
jest: true

rules:
'@typescript-eslint/no-require-imports': off
no-magic-numbers: off

rules:
# Only list rules that are not in *:recommended set
# If rules are set to disable the one in *:recommended, please elaborate the reason
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ Notes: web developers are advised to use [`~` (tilde range)](https://github.com/
- Added dedicated loading animation for messages in preparing state for Fluent theme, in PR [#5423](https://github.com/microsoft/BotFramework-WebChat/pull/5423), by [@OEvgeny](https://github.com/OEvgeny)
- Resolved [#2661](https://github.com/microsoft/BotFramework-WebChat/issues/2661) and [#5352](https://github.com/microsoft/BotFramework-WebChat/issues/5352). Added speech recognition continuous mode with barge-in support, in PR [#5426](https://github.com/microsoft/BotFramework-WebChat/pull/5426), by [@RushikeshGavali](https://github.com/RushikeshGavali) and [@compulim](https://github.com/compulim)
- Set `styleOptions.speechRecognitionContinuous` to `true` with a Web Speech API provider with continuous mode support
- Added support of [contentless activity in livestream](https://github.com/microsoft/BotFramework-WebChat/blob/main/docs/LIVESTREAMING.md#scenario-3-interim-activities-with-no-content), in PR [#5430](https://github.com/microsoft/BotFramework-WebChat/pull/5430), by [@compulim](https://github.com/compulim)

### Changed

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
181 changes: 0 additions & 181 deletions __tests__/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,184 +22,3 @@ test('setup', async () => {

expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions);
});

test('long URLs with break-word', async () => {
const { driver, pageObjects } = await setupWebDriver();

await driver.wait(uiConnected(), timeouts.directLine);
await pageObjects.sendMessageViaSendBox(
'https://subdomain.domain.com/pathname0/pathname1/pathname2/pathname3/pathname4/',
{ waitForSend: true }
);

await driver.wait(minNumActivitiesShown(2), timeouts.directLine);
await driver.wait(allImagesLoaded(), timeouts.fetchImage);

const base64PNG = await driver.takeScreenshot();

expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions);
});

test('long URLs with break-all', async () => {
const WEB_CHAT_PROPS = { styleOptions: { messageActivityWordBreak: 'break-all' } };

const { driver, pageObjects } = await setupWebDriver({ props: WEB_CHAT_PROPS });

await driver.wait(uiConnected(), timeouts.directLine);
await pageObjects.sendMessageViaSendBox(
'https://subdomain.domain.com/pathname0/pathname1/pathname2/pathname3/pathname4/',
{ waitForSend: true }
);

await driver.wait(minNumActivitiesShown(2), timeouts.directLine);
await driver.wait(allImagesLoaded(), timeouts.fetchImage);

const base64PNG = await driver.takeScreenshot();

expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions);
});

test('long URLs with keep-all', async () => {
const WEB_CHAT_PROPS = { styleOptions: { messageActivityWordBreak: 'keep-all' } };

const { driver, pageObjects } = await setupWebDriver({ props: WEB_CHAT_PROPS });

await driver.wait(uiConnected(), timeouts.directLine);
await pageObjects.sendMessageViaSendBox('箸より重いものを持ったことがない箸より重いものを持ったことがない', {
waitForSend: true
});

await driver.wait(minNumActivitiesShown(2), timeouts.directLine);
await driver.wait(allImagesLoaded(), timeouts.fetchImage);

const base64PNG = await driver.takeScreenshot();

expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions);
});

test('hero card with a long title and richCardWrapTitle set to true', async () => {
const { driver, pageObjects } = await setupWebDriver({ props: { styleOptions: { richCardWrapTitle: true } } });

await driver.wait(uiConnected(), timeouts.directLine);
await pageObjects.sendMessageViaSendBox('herocard long title', { waitForSend: true });

await driver.wait(minNumActivitiesShown(2), timeouts.directLine);
await driver.wait(allImagesLoaded(), timeouts.fetchImage);

const base64PNG = await driver.takeScreenshot();

expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions);
});

test('hero card with a long title and richCardWrapTitle set to default value', async () => {
const { driver, pageObjects } = await setupWebDriver();

await driver.wait(uiConnected(), timeouts.directLine);
await pageObjects.sendMessageViaSendBox('herocard long title', { waitForSend: true });

await driver.wait(minNumActivitiesShown(2), timeouts.directLine);
await driver.wait(allImagesLoaded(), timeouts.fetchImage);

const base64PNG = await driver.takeScreenshot();

expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions);
});

test('thumbnail card with a long title and richCardWrapTitle set to true', async () => {
const { driver, pageObjects } = await setupWebDriver({ props: { styleOptions: { richCardWrapTitle: true } } });

await driver.wait(uiConnected(), timeouts.directLine);
await pageObjects.sendMessageViaSendBox('thumbnailcard long title', { waitForSend: true });

await driver.wait(minNumActivitiesShown(2), timeouts.directLine);
await driver.wait(allImagesLoaded(), timeouts.fetchImage);

const base64PNG = await driver.takeScreenshot();

expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions);
});

test('thumbnail card with a long title and richCardWrapTitle set to default value', async () => {
const { driver, pageObjects } = await setupWebDriver();

await driver.wait(uiConnected(), timeouts.directLine);
await pageObjects.sendMessageViaSendBox('thumbnailcard long title', { waitForSend: true });

await driver.wait(minNumActivitiesShown(2), timeouts.directLine);
await driver.wait(allImagesLoaded(), timeouts.fetchImage);

const base64PNG = await driver.takeScreenshot();

expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions);
});

test('absolute timestamp', async () => {
const activities = [
{
channelData: {},
type: 'message',
id: '6266x5ZXhXkBfuIH0fNx0h-o|0000000',
timestamp: '2019-08-08T16:41:12.9397263Z',
from: {
id: 'dl_654b35e09ab4149595a70aa6f1af6f50',
name: '',
role: 'user'
},
textFormat: 'plain',
text: 'echo "Hello, World!"'
},
{
channelData: {},
type: 'message',
id: '6266x5ZXhXkBfuIH0fNx0h-o|0000001',
timestamp: '2019-08-08T16:41:13.1835518Z',
from: {
id: 'webchat-mockbot',
name: 'webchat-mockbot',
role: 'bot'
},
text: 'Echoing back in a separate activity.'
},
{
channelData: {},
type: 'message',
id: '6266x5ZXhXkBfuIH0fNx0h-o|0000002',
timestamp: '2019-08-08T16:41:13.3963019Z',
from: {
id: 'webchat-mockbot',
name: 'webchat-mockbot',
role: 'bot'
},
text: 'Hello, World!'
}
];
const styleOptions = { timestampFormat: 'absolute' };
const { driver } = await setupWebDriver({ storeInitialState: { activities }, props: { styleOptions } });

await driver.wait(uiConnected(), timeouts.directLine);
await driver.wait(minNumActivitiesShown(3), timeouts.directLine);

const base64PNG = await driver.takeScreenshot();

expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions);
});

test('avatar background color', async () => {
const styleOptions = {
botAvatarBackgroundColor: 'red',
botAvatarInitials: 'B',
userAvatarBackgroundColor: 'blue',
userAvatarInitials: 'TJ'
};

const { driver, pageObjects } = await setupWebDriver({ props: { styleOptions } });

await driver.wait(uiConnected(), timeouts.directLine);
await pageObjects.sendMessageViaSendBox('echo "Hello, World!"', { waitForSend: true });

await driver.wait(minNumActivitiesShown(3), timeouts.directLine);

const base64PNG = await driver.takeScreenshot();

expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions);
});
23 changes: 0 additions & 23 deletions __tests__/hooks/useEmitTypingIndicator.js

This file was deleted.

25 changes: 0 additions & 25 deletions __tests__/hooks/useSendTypingIndicator.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
await pageConditions.uiConnected();

await pageObjects.sendMessageViaSendBox('conversationstart');
await pageConditions.minNumActivitiesShown(1);
await pageConditions.minNumActivitiesShown(2);

await host.snapshot();
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/html/conversationStartProperties.sendEnUs.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
await pageConditions.uiConnected();

await pageObjects.sendMessageViaSendBox('conversationstart');
await pageConditions.minNumActivitiesShown(1);
await pageConditions.minNumActivitiesShown(2);

await host.snapshot();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
await pageConditions.uiConnected();

await pageObjects.sendMessageViaSendBox('conversationstart');
await pageConditions.minNumActivitiesShown(1);
await pageConditions.minNumActivitiesShown(2);

await host.snapshot();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
await pageConditions.uiConnected();

await pageObjects.sendMessageViaSendBox('conversationstart');
await pageConditions.minNumActivitiesShown(1);
await pageConditions.minNumActivitiesShown(2);

await host.snapshot();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
await pageConditions.uiConnected();

await pageObjects.sendMessageViaSendBox('conversationstart');
await pageConditions.minNumActivitiesShown(1);
await pageConditions.minNumActivitiesShown(2);

await host.snapshot();
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/html/conversationStartProperties.sendZhCn.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
await pageConditions.uiConnected();

await pageObjects.sendMessageViaSendBox('conversationstart');
await pageConditions.minNumActivitiesShown(1);
await pageConditions.minNumActivitiesShown(2);

await host.snapshot();
});
Expand Down
38 changes: 22 additions & 16 deletions __tests__/html/hooks.useActiveTyping.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,22 +90,28 @@
await pageObjects.typeInSendBox('.');

// THEN: `useActiveTyping` should return both.
await expect(renderWithFunction(() => Object.values(useActiveTyping()[0]))).resolves.toEqual([
{
at: 600,
expireAt: 5600,
name: expect.any(String),
role: 'bot',
type: 'busy'
},
{
at: 600,
expireAt: 5600,
name: expect.any(String),
role: 'user',
type: 'busy'
}
]);
const hookResult = await renderWithFunction(() => Object.values(useActiveTyping()[0]));

expect(hookResult).toHaveLength(2);

expect(hookResult).toEqual(
expect.arrayContaining([
{
at: 600,
expireAt: 5600,
name: expect.any(String),
role: 'bot',
type: 'busy'
},
{
at: 600,
expireAt: 5600,
name: expect.any(String),
role: 'user',
type: 'busy'
}
])
);
});
</script>
</body>
Expand Down
2 changes: 1 addition & 1 deletion __tests__/html/hooks.useActiveTyping.livestream.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
{
bot: {
at: 600,
expireAt: 5600,
expireAt: Infinity,
name: 'Bot',
role: 'bot',
type: 'livestream'
Expand Down
5 changes: 0 additions & 5 deletions __tests__/html/hooks.useActiveTyping.variable.js

This file was deleted.

Loading
Loading