Skip to content

Commit 382d795

Browse files
authored
Bump QFE to 4.14.2 and backporting some tests (#4407)
* Bump to 4.14.2 and fixing and backporting tests * Backport tests
1 parent 991a74e commit 382d795

23 files changed

+113
-110
lines changed
Loading

__tests__/html/chatAdapter.directLineAppServiceExtension.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
WebChat.renderWebChat(
1414
{
1515
directLine: await WebChat.createDirectLineAppServiceExtension({
16-
domain: 'https://webchat-mockbot2.azurewebsites.net/.bot/v3/directline',
16+
domain: 'https://webchat-mockbot3.azurewebsites.net/.bot/v3/directline',
1717
token: await testHelpers.token.fetchDirectLineAppServiceExtensionToken()
1818
}),
1919
store: testHelpers.createStore()

__tests__/html/conversationStartProperties.noLocaleIsSent.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
{
1616
directLine: WebChat.createDirectLine({
1717
token: await testHelpers.token.fetchDirectLineToken(
18-
'https://webchat-mockbot2.azurewebsites.net/api/token/directline'
18+
'https://webchat-mockbot3.azurewebsites.net/api/token/directline'
1919
)
2020
}),
2121
store: testHelpers.createStore()

__tests__/html/conversationStartProperties.sendEnUs.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
locale: 'en-US'
1919
},
2020
token: await testHelpers.token.fetchDirectLineToken(
21-
'https://webchat-mockbot2.azurewebsites.net/api/token/directline'
21+
'https://webchat-mockbot3.azurewebsites.net/api/token/directline'
2222
)
2323
}),
2424
store: testHelpers.createStore()

__tests__/html/conversationStartProperties.sendInvalidType.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
locale: { invalid: true }
1919
},
2020
token: await testHelpers.token.fetchDirectLineToken(
21-
'https://webchat-mockbot2.azurewebsites.net/api/token/directline'
21+
'https://webchat-mockbot3.azurewebsites.net/api/token/directline'
2222
)
2323
}),
2424
store: testHelpers.createStore()

__tests__/html/conversationStartProperties.sendNonExisting.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
locale: 'xx-YY'
1919
},
2020
token: await testHelpers.token.fetchDirectLineToken(
21-
'https://webchat-mockbot2.azurewebsites.net/api/token/directline'
21+
'https://webchat-mockbot3.azurewebsites.net/api/token/directline'
2222
)
2323
}),
2424
store: testHelpers.createStore()

__tests__/html/conversationStartProperties.sendNonISOFormat.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
locale: '1a2b3c'
1919
},
2020
token: await testHelpers.token.fetchDirectLineToken(
21-
'https://webchat-mockbot2.azurewebsites.net/api/token/directline'
21+
'https://webchat-mockbot3.azurewebsites.net/api/token/directline'
2222
)
2323
}),
2424
store: testHelpers.createStore()

__tests__/html/conversationStartProperties.sendZhCn.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
locale: 'zh-CN'
1919
},
2020
token: await testHelpers.token.fetchDirectLineToken(
21-
'https://webchat-mockbot2.azurewebsites.net/api/token/directline'
21+
'https://webchat-mockbot3.azurewebsites.net/api/token/directline'
2222
)
2323
}),
2424
store: testHelpers.createStore()

__tests__/html/localization.fileUpload.polish.html

+10-3
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
<body>
1010
<div id="webchat"></div>
1111
<script>
12-
run(async function () {
12+
const clock = lolex.install();
13+
14+
run(async function () {
1315
const directLine = testHelpers.createDirectLineWithTranscript([
1416
{
1517
type: 'message',
1618
id: 'A0000001',
17-
timestamp: '2022-09-06T20:49:30.3628667Z',
18-
localTimestamp: '2022-09-06T13:49:29.166-07:00',
19+
timestamp: '2000-01-23T12:34:56.12345Z',
20+
localTimestamp: '2000-01-23T12:34:56.12345Z',
1921
localTimezone: 'America/Los_Angeles',
2022
channelId: 'directline',
2123
from: {
@@ -47,6 +49,11 @@
4749
document.getElementById('webchat')
4850
);
4951

52+
await pageConditions.webChatRendered();
53+
54+
// Wait for "Connecting..." message to dismiss
55+
clock.tick(600);
56+
5057
await pageConditions.uiConnected();
5158
await host.snapshot();
5259
});

__tests__/setup/setupTestNightly.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test.nightly = process.env.CI_PULL_REQUEST ? test.skip.bind(test) : test;

__tests__/video.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ test('video', async () => {
3535
await driver.sleep(4000);
3636

3737
// Pause the video
38-
await clickButton(driver, By.css('button[aria-label="Pause (k)"]'));
38+
await clickButton(driver, By.css('button[title="Pause (k)"]'));
3939

4040
// Jump back for 10 seconds, to get the buffering bar the same
4141
await driver.actions().sendKeys('j').perform();

jest.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ module.exports = {
8181
'<rootDir>/__tests__/setup/setupGlobalAgent.js',
8282
'<rootDir>/__tests__/setup/preSetupTestFramework.js',
8383
'<rootDir>/__tests__/setup/setupImageSnapshot.js',
84+
'<rootDir>/__tests__/setup/setupTestNightly.js',
8485
'<rootDir>/__tests__/setup/setupTimeout.js'
8586
],
8687
testPathIgnorePatterns: [

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "botframework-webchat-root",
3-
"version": "4.14.1",
3+
"version": "4.14.2",
44
"private": true,
55
"files": [
66
"lib/**/*"

packages/directlinespeech/__tests__/refreshToken.authorizationToken.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import 'global-agent/bootstrap';
66

7-
import { PropertyId } from 'microsoft-cognitiveservices-speech-sdk';
87
import { timeouts } from './constants.json';
98
import createTestHarness from './utilities/createTestHarness';
109
import MockAudioContext from './utilities/MockAudioContext';
@@ -35,7 +34,11 @@ async function waitUntil(fn, timeout = 5000, intervalMS = 1000) {
3534
throw new Error('timed out');
3635
}
3736

38-
test('should refresh authorization token', async () => {
37+
test.nightly('should refresh authorization token', async () => {
38+
if (!process.env.SPEECH_SERVICES_SUBSCRIPTION_KEY) {
39+
throw new Error('"SPEECH_SERVICES_SUBSCRIPTION_KEY" environment variable must be set.');
40+
}
41+
3942
jest.useFakeTimers('modern');
4043

4144
const { directLine } = await createTestHarness();

packages/directlinespeech/__tests__/refreshToken.directLineToken.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,22 @@ async function waitUntil(fn, timeout = 5000, intervalMS = 1000) {
3535
throw new Error('timed out');
3636
}
3737

38-
test('should refresh Direct Line token', async () => {
38+
test.nightly('should refresh Direct Line token', async () => {
39+
if (!process.env.SPEECH_SERVICES_SUBSCRIPTION_KEY) {
40+
throw new Error('"SPEECH_SERVICES_SUBSCRIPTION_KEY" environment variable must be set.');
41+
}
42+
3943
jest.useFakeTimers('modern');
4044

4145
const { directLine } = await createTestHarness({ enableInternalHTTPSupport: true });
4246
const initialToken = directLine.dialogServiceConnector.properties.getProperty(PropertyId.Conversation_Agent_Connection_Id);
4347

48+
// We need to start the conversation, such as POST /conversations.
49+
// Otherwise, refreshing token will say "conversation not found".
50+
directLine.postActivity({
51+
type: 'event'
52+
});
53+
4454
// Wait until 2 seconds in real-time clock, to make sure the token renewed is different (JWT has a per-second timestamp).
4555
await sleep(2000);
4656

packages/directlinespeech/__tests__/sendSpeechActivity.js

+56-45
Original file line numberDiff line numberDiff line change
@@ -18,66 +18,77 @@ beforeEach(() => {
1818
global.AudioContext = MockAudioContext;
1919
});
2020

21-
describe.each([['without internal HTTP support'], ['with internal HTTP support', { enableInternalHTTPSupport: true }]])(
22-
'%s',
23-
(_, testHarnessOptions) => {
24-
test('should echo back when saying "hello" and "world"', async () => {
25-
const { directLine, fetchCredentials, sendTextAsSpeech } = await createTestHarness(testHarnessOptions);
21+
// TODO: [P2] #4053 Temporarily disable "internal HTTP" test until service recovered.
22+
// describe.each([['without internal HTTP support'], ['with internal HTTP support', { enableInternalHTTPSupport: true }]])(
23+
describe.each([['without internal HTTP support']])('%s', (_, testHarnessOptions) => {
24+
test.nightly('should echo back when saying "hello" and "world"', async () => {
25+
if (!process.env.SPEECH_SERVICES_SUBSCRIPTION_KEY) {
26+
throw new Error('"SPEECH_SERVICES_SUBSCRIPTION_KEY" environment variable must be set.');
27+
}
2628

27-
const connectedPromise = waitForConnected(directLine);
28-
const activitiesPromise = subscribeAll(take(directLine.activity$, 2));
29+
const { directLine, fetchCredentials, sendTextAsSpeech } = await createTestHarness(testHarnessOptions);
2930

30-
await connectedPromise;
31+
const connectedPromise = waitForConnected(directLine);
32+
const activitiesPromise = subscribeAll(take(directLine.activity$, 2));
3133

32-
await sendTextAsSpeech('hello');
33-
await sendTextAsSpeech('world');
34+
await connectedPromise;
3435

35-
const activities = await activitiesPromise;
36-
const activityUtterances = Promise.all(
37-
activities.map(activity => recognizeActivityAsText(activity, { fetchCredentials }))
38-
);
36+
await sendTextAsSpeech('hello');
37+
await sendTextAsSpeech('world');
3938

40-
await expect(activityUtterances).resolves.toEqual(['Hello.', 'World.']);
41-
});
39+
const activities = await activitiesPromise;
40+
const activityUtterances = Promise.all(
41+
activities.map(activity => recognizeActivityAsText(activity, { fetchCredentials }))
42+
);
4243

43-
test('should echo back "Bellevue" when saying "bellview"', async () => {
44-
const { directLine, fetchCredentials, sendTextAsSpeech } = await createTestHarness(testHarnessOptions);
44+
await expect(activityUtterances).resolves.toEqual(['Hello.', 'World.']);
45+
});
4546

46-
const connectedPromise = waitForConnected(directLine);
47-
const activitiesPromise = subscribeAll(take(directLine.activity$, 1));
47+
test.nightly('should echo back "Bellevue" when saying "bellview"', async () => {
48+
if (!process.env.SPEECH_SERVICES_SUBSCRIPTION_KEY) {
49+
throw new Error('"SPEECH_SERVICES_SUBSCRIPTION_KEY" environment variable must be set.');
50+
}
4851

49-
await connectedPromise;
52+
const { directLine, fetchCredentials, sendTextAsSpeech } = await createTestHarness(testHarnessOptions);
5053

51-
await sendTextAsSpeech('bellview');
54+
const connectedPromise = waitForConnected(directLine);
55+
const activitiesPromise = subscribeAll(take(directLine.activity$, 1));
5256

53-
const activities = await activitiesPromise;
54-
const activityUtterances = Promise.all(
55-
activities.map(activity => recognizeActivityAsText(activity, { fetchCredentials }))
56-
);
57+
await connectedPromise;
5758

58-
await expect(activityUtterances).resolves.toEqual(['Bellevue.']);
59-
});
60-
}
61-
);
59+
await sendTextAsSpeech('bellview');
6260

63-
// TODO: Re-enable this test for "enableInternalHttpSupport = true" once DLS bug fix is lit up in production.
64-
// 2020-05-11: Direct Line Speech protocol was updated to synthesize "text" if "speak" property is not set.
65-
test('should synthesis if "speak" is empty', async () => {
66-
const { directLine, fetchCredentials, sendTextAsSpeech } = await createTestHarness();
61+
const activities = await activitiesPromise;
62+
const activityUtterances = Promise.all(
63+
activities.map(activity => recognizeActivityAsText(activity, { fetchCredentials }))
64+
);
6765

68-
const connectedPromise = waitForConnected(directLine);
69-
const activitiesPromise = subscribeAll(take(directLine.activity$, 1));
66+
await expect(activityUtterances).resolves.toEqual(['Bellevue.']);
67+
});
7068

71-
await connectedPromise;
69+
// TODO: Re-enable this test for "enableInternalHttpSupport = true" once DLS bug fix is lit up in production.
70+
// 2020-05-11: Direct Line Speech protocol was updated to synthesize "text" if "speak" property is not set.
71+
test.nightly('should synthesis if "speak" is empty', async () => {
72+
if (!process.env.SPEECH_SERVICES_SUBSCRIPTION_KEY) {
73+
throw new Error('"SPEECH_SERVICES_SUBSCRIPTION_KEY" environment variable must be set.');
74+
}
7275

73-
// "Don't speak XXX" command will not send "speak" property on respond.
74-
await sendTextAsSpeech("Don't speak anything.");
76+
const { directLine, fetchCredentials, sendTextAsSpeech } = await createTestHarness(testHarnessOptions);
7577

76-
const activities = await activitiesPromise;
77-
const activityUtterances = await Promise.all(
78-
activities.map(activity => recognizeActivityAsText(activity, { fetchCredentials }))
79-
);
78+
const connectedPromise = waitForConnected(directLine);
79+
const activitiesPromise = subscribeAll(take(directLine.activity$, 1));
8080

81-
// Despite it does not have "speak" property, Direct Line Speech protocol will fallback to "text" property for synthesize.
82-
expect(activityUtterances).toEqual([`Don't speak anything.`]);
81+
await connectedPromise;
82+
83+
// "Don't speak XXX" command will not send "speak" property on respond.
84+
await sendTextAsSpeech("Don't speak anything.");
85+
86+
const activities = await activitiesPromise;
87+
const activityUtterances = await Promise.all(
88+
activities.map(activity => recognizeActivityAsText(activity, { fetchCredentials }))
89+
);
90+
91+
// Despite it does not have "speak" property, Direct Line Speech protocol will fallback to "text" property for synthesize.
92+
expect(activityUtterances).toEqual([`Don't speak anything.`]);
93+
});
8394
});

0 commit comments

Comments
 (0)