@@ -18,66 +18,77 @@ beforeEach(() => {
18
18
global . AudioContext = MockAudioContext ;
19
19
} ) ;
20
20
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
+ }
26
28
27
- const connectedPromise = waitForConnected ( directLine ) ;
28
- const activitiesPromise = subscribeAll ( take ( directLine . activity$ , 2 ) ) ;
29
+ const { directLine, fetchCredentials, sendTextAsSpeech } = await createTestHarness ( testHarnessOptions ) ;
29
30
30
- await connectedPromise ;
31
+ const connectedPromise = waitForConnected ( directLine ) ;
32
+ const activitiesPromise = subscribeAll ( take ( directLine . activity$ , 2 ) ) ;
31
33
32
- await sendTextAsSpeech ( 'hello' ) ;
33
- await sendTextAsSpeech ( 'world' ) ;
34
+ await connectedPromise ;
34
35
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' ) ;
39
38
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
+ ) ;
42
43
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
+ } ) ;
45
46
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
+ }
48
51
49
- await connectedPromise ;
52
+ const { directLine , fetchCredentials , sendTextAsSpeech } = await createTestHarness ( testHarnessOptions ) ;
50
53
51
- await sendTextAsSpeech ( 'bellview' ) ;
54
+ const connectedPromise = waitForConnected ( directLine ) ;
55
+ const activitiesPromise = subscribeAll ( take ( directLine . activity$ , 1 ) ) ;
52
56
53
- const activities = await activitiesPromise ;
54
- const activityUtterances = Promise . all (
55
- activities . map ( activity => recognizeActivityAsText ( activity , { fetchCredentials } ) )
56
- ) ;
57
+ await connectedPromise ;
57
58
58
- await expect ( activityUtterances ) . resolves . toEqual ( [ 'Bellevue.' ] ) ;
59
- } ) ;
60
- }
61
- ) ;
59
+ await sendTextAsSpeech ( 'bellview' ) ;
62
60
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
+ ) ;
67
65
68
- const connectedPromise = waitForConnected ( directLine ) ;
69
- const activitiesPromise = subscribeAll ( take ( directLine . activity$ , 1 ) ) ;
66
+ await expect ( activityUtterances ) . resolves . toEqual ( [ 'Bellevue.' ] ) ;
67
+ } ) ;
70
68
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
+ }
72
75
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 ) ;
75
77
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 ) ) ;
80
80
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
+ } ) ;
83
94
} ) ;
0 commit comments