-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
* Create and Delete resource on the fly * function to create swml application resource * relay app create and delete on the fly * integrate API in video room test * cleanup e2e-realtime utilities * create and delete swml resource
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import { uuid } from '@signalwire/core' | ||
Check failure on line 1 in internal/e2e-js/tests/callfabric/relayApp.spec.ts GitHub Actions / Run E2E tests (18.x, callfabric)[callfabric] › callfabric/relayApp.spec.ts:14:7 › CallFabric Relay Application › should connect to the relay app and expect an audio playback
Check failure on line 1 in internal/e2e-js/tests/callfabric/relayApp.spec.ts GitHub Actions / Run E2E tests (18.x, callfabric)[callfabric] › callfabric/relayApp.spec.ts:14:7 › CallFabric Relay Application › should connect to the relay app and expect an audio playback
|
||
import { SignalWire } from '@signalwire/realtime-api' | ||
import { | ||
createCFClient, | ||
|
@@ -12,6 +13,7 @@ import { test, expect } from '../../fixtures' | |
test.describe('CallFabric Relay Application', () => { | ||
test('should connect to the relay app and expect an audio playback', async ({ | ||
createCustomPage, | ||
resource, | ||
}) => { | ||
const client = await SignalWire({ | ||
host: process.env.RELAY_HOST, | ||
|
@@ -22,8 +24,14 @@ test.describe('CallFabric Relay Application', () => { | |
}, | ||
}) | ||
|
||
const reference = `e2e-relay-app_${uuid()}` | ||
await resource.createRelayAppResource({ | ||
name: reference, | ||
reference, | ||
}) | ||
|
||
await client.voice.listen({ | ||
topics: ['cf-e2e-test-relay'], | ||
topics: [reference], | ||
onCallReceived: async (call) => { | ||
try { | ||
console.log('Call received', call.id) | ||
|
@@ -50,16 +58,14 @@ test.describe('CallFabric Relay Application', () => { | |
|
||
await createCFClient(page) | ||
|
||
const resourceName = 'cf-e2e-test-relay' | ||
|
||
await page.evaluate( | ||
async (options) => { | ||
return new Promise<any>(async (resolve, _reject) => { | ||
// @ts-expect-error | ||
const client = window._client | ||
|
||
const call = await client.dial({ | ||
to: `/public/${options.resourceName}`, | ||
to: `/private/${options.reference}`, | ||
rootElement: document.getElementById('rootElement'), | ||
}) | ||
|
||
|
@@ -69,7 +75,7 @@ test.describe('CallFabric Relay Application', () => { | |
resolve(call) | ||
}) | ||
}, | ||
{ resourceName } | ||
{ reference } | ||
) | ||
|
||
const callPlayStarted = page.evaluate(async () => { | ||
Check failure on line 81 in internal/e2e-js/tests/callfabric/relayApp.spec.ts GitHub Actions / Run E2E tests (18.x, callfabric)[callfabric] › callfabric/relayApp.spec.ts:14:7 › CallFabric Relay Application › should connect to the relay app and expect an audio playback
|
||
|
@@ -126,6 +132,7 @@ test.describe('CallFabric Relay Application', () => { | |
|
||
test('should connect to the relay app and expect a silence', async ({ | ||
createCustomPage, | ||
resource, | ||
}) => { | ||
const client = await SignalWire({ | ||
host: process.env.RELAY_HOST, | ||
|
@@ -136,8 +143,14 @@ test.describe('CallFabric Relay Application', () => { | |
}, | ||
}) | ||
|
||
const reference = `e2e-relay-app_${uuid()}` | ||
await resource.createRelayAppResource({ | ||
name: reference, | ||
reference, | ||
}) | ||
|
||
await client.voice.listen({ | ||
topics: ['cf-e2e-test-relay'], | ||
topics: [reference], | ||
onCallReceived: async (call) => { | ||
try { | ||
console.log('Call received', call.id) | ||
|
@@ -160,16 +173,14 @@ test.describe('CallFabric Relay Application', () => { | |
|
||
await createCFClient(page) | ||
|
||
const resourceName = 'cf-e2e-test-relay' | ||
|
||
await page.evaluate( | ||
async (options) => { | ||
return new Promise<any>(async (resolve, _reject) => { | ||
// @ts-expect-error | ||
const client = window._client | ||
|
||
const call = await client.dial({ | ||
to: `/public/${options.resourceName}`, | ||
to: `/private/${options.reference}`, | ||
rootElement: document.getElementById('rootElement'), | ||
}) | ||
|
||
|
@@ -179,7 +190,7 @@ test.describe('CallFabric Relay Application', () => { | |
resolve(call) | ||
}) | ||
}, | ||
{ resourceName } | ||
{ reference } | ||
) | ||
|
||
const callPlayStarted = page.evaluate(async () => { | ||
|
@@ -249,6 +260,7 @@ test.describe('CallFabric Relay Application', () => { | |
|
||
test('should connect to the relay app and expect a hangup', async ({ | ||
createCustomPage, | ||
resource, | ||
}) => { | ||
const client = await SignalWire({ | ||
host: process.env.RELAY_HOST, | ||
|
@@ -259,8 +271,14 @@ test.describe('CallFabric Relay Application', () => { | |
}, | ||
}) | ||
|
||
const reference = `e2e-relay-app_${uuid()}` | ||
await resource.createRelayAppResource({ | ||
name: reference, | ||
reference, | ||
}) | ||
|
||
await client.voice.listen({ | ||
topics: ['cf-e2e-test-relay'], | ||
topics: [reference], | ||
onCallReceived: async (call) => { | ||
try { | ||
console.log('Call received', call.id) | ||
|
@@ -279,8 +297,6 @@ test.describe('CallFabric Relay Application', () => { | |
const page = await createCustomPage({ name: '[page]' }) | ||
await page.goto(SERVER_URL) | ||
|
||
const resourceName = 'cf-e2e-test-relay' | ||
|
||
await createCFClient(page) | ||
|
||
await page.evaluate( | ||
|
@@ -290,7 +306,7 @@ test.describe('CallFabric Relay Application', () => { | |
const client = window._client | ||
|
||
const call = await client.dial({ | ||
to: `/public/${options.resourceName}`, | ||
to: `/private/${options.reference}`, | ||
rootElement: document.getElementById('rootElement'), | ||
}) | ||
|
||
|
@@ -300,7 +316,7 @@ test.describe('CallFabric Relay Application', () => { | |
resolve(call) | ||
}) | ||
}, | ||
{ resourceName } | ||
{ reference } | ||
) | ||
|
||
const expectInitialEvents = expectCFInitialEvents(page) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import { uuid } from '@signalwire/core' | ||
Check failure on line 1 in internal/e2e-js/tests/callfabric/swml.spec.ts GitHub Actions / Run E2E tests (18.x, callfabric)[callfabric] › callfabric/swml.spec.ts:43:7 › CallFabric SWML › should dial an address and expect a TTS audio
Check failure on line 1 in internal/e2e-js/tests/callfabric/swml.spec.ts GitHub Actions / Run E2E tests (18.x, callfabric)[callfabric] › callfabric/swml.spec.ts:43:7 › CallFabric SWML › should dial an address and expect a TTS audio
|
||
import { test } from '../../fixtures' | ||
import { | ||
SERVER_URL, | ||
|
@@ -8,14 +9,49 @@ import { | |
} from '../../utils' | ||
|
||
test.describe('CallFabric SWML', () => { | ||
const swmlTTS = { | ||
sections: { | ||
main: [ | ||
'answer', | ||
{ | ||
play: { | ||
volume: 10, | ||
urls: [ | ||
'say:Hi', | ||
'say:Welcome to SignalWire', | ||
"say:Thank you for calling us. All our lines are currently busy, but your call is important to us. Please hang up, and we'll return your call as soon as our representative is available.", | ||
], | ||
}, | ||
}, | ||
], | ||
}, | ||
} | ||
const swmlHangup = { | ||
version: '1.0.0', | ||
sections: { | ||
main: [ | ||
'answer', | ||
{ | ||
hangup: { | ||
reason: 'busy', | ||
}, | ||
}, | ||
], | ||
}, | ||
} | ||
|
||
test('should dial an address and expect a TTS audio', async ({ | ||
createCustomPage, | ||
resource, | ||
}) => { | ||
const page = await createCustomPage({ name: '[page]' }) | ||
await page.goto(SERVER_URL) | ||
|
||
const resourceName = process.env.RESOURCE_NAME ?? '/public/cf-e2e-test-tts' | ||
console.log(`#### Dialing ${resourceName}`) | ||
const resourceName = `e2e-swml-app_${uuid()}` | ||
await resource.createSWMLAppResource({ | ||
name: resourceName, | ||
contents: swmlTTS, | ||
}) | ||
|
||
await createCFClient(page) | ||
|
||
|
@@ -28,7 +64,7 @@ test.describe('CallFabric SWML', () => { | |
const client = window._client | ||
|
||
const call = await client.dial({ | ||
to: resourceName, | ||
to: `/private/${resourceName}`, | ||
rootElement: document.getElementById('rootElement'), | ||
}) | ||
|
||
|
@@ -40,18 +76,6 @@ test.describe('CallFabric SWML', () => { | |
}, | ||
{ resourceName } | ||
) | ||
page.expectWsTraffic({ | ||
assertations: [ | ||
{ | ||
type: "send", | ||
name: "connect", | ||
expect: { | ||
method: "signalwire.connect", | ||
"params.version.major": 4, | ||
}, | ||
} | ||
] | ||
}) | ||
|
||
const callPlayStarted = page.evaluate(async () => { | ||
Check failure on line 80 in internal/e2e-js/tests/callfabric/swml.spec.ts GitHub Actions / Run E2E tests (18.x, callfabric)[callfabric] › callfabric/swml.spec.ts:43:7 › CallFabric SWML › should dial an address and expect a TTS audio
|
||
// @ts-expect-error | ||
|
@@ -101,12 +125,16 @@ test.describe('CallFabric SWML', () => { | |
|
||
test('should dial an address and expect a hangup', async ({ | ||
createCustomPage, | ||
resource, | ||
}) => { | ||
const page = await createCustomPage({ name: '[page]' }) | ||
await page.goto(SERVER_URL) | ||
|
||
const resourceName = | ||
process.env.RESOURCE_NAME ?? '/public/cf-e2e-test-hangup' | ||
const resourceName = `e2e-swml-app_${uuid()}` | ||
await resource.createSWMLAppResource({ | ||
name: resourceName, | ||
contents: swmlHangup, | ||
}) | ||
|
||
await createCFClient(page) | ||
|
||
|
@@ -118,7 +146,7 @@ test.describe('CallFabric SWML', () => { | |
const client = window._client | ||
|
||
const call = await client.dial({ | ||
to: resourceName, | ||
to: `/private/${resourceName}`, | ||
rootElement: document.getElementById('rootElement'), | ||
}) | ||
|
||
|