Skip to content

Commit

Permalink
enable all the CI jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
iAmmar7 committed May 18, 2023
1 parent 8def1f2 commit 3f64076
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ const handler = () => {

async function main() {
const runner = createTestRunner({
name: 'Voice Playback E2E',
name: 'Voice Playback multiple E2E',
testHandler: handler,
executionTime: 60_000,
})
Expand Down
17 changes: 15 additions & 2 deletions internal/e2e-realtime-api/src/voiceRecordMultiple.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import tap from 'tap'
import { Voice } from '@signalwire/realtime-api'
import { createTestRunner } from './utils'
import { createTestRunner, sleep } from './utils'

const handler = () => {
return new Promise<number>(async (resolve, reject) => {
Expand All @@ -9,12 +9,19 @@ const handler = () => {
project: process.env.RELAY_PROJECT as string,
token: process.env.RELAY_TOKEN as string,
contexts: [process.env.VOICE_CONTEXT as string],
debug: {
// logWsTraffic: true,
},
})

let waitForTheAnswerResolve: (value: void) => void
const waitForTheAnswer = new Promise((resolve) => {
waitForTheAnswerResolve = resolve
})
let waitForOutboundRecordFinishResolve
const waitForOutboundRecordFinish = new Promise((resolve) => {
waitForOutboundRecordFinishResolve = resolve
})

client.on('call.received', async (call) => {
console.log(
Expand Down Expand Up @@ -58,6 +65,9 @@ const handler = () => {
'Inbound - firstRecording state is "finished"'
)

// Wait till the second recording ends
await waitForOutboundRecordFinish

// Callee hangs up a call
await call.hangup()
} catch (error) {
Expand Down Expand Up @@ -97,6 +107,9 @@ const handler = () => {
'Outbound - secondRecording state is "finished"'
)

// Resolve the record finish promise to inform the callee
waitForOutboundRecordFinishResolve()

const waitForParams = ['ended', 'ending', ['ending', 'ended']] as const
const results = await Promise.all(
waitForParams.map((params) => call.waitFor(params as any))
Expand All @@ -122,7 +135,7 @@ const handler = () => {

async function main() {
const runner = createTestRunner({
name: 'Voice Playback E2E',
name: 'Voice Recording multiple E2E',
testHandler: handler,
executionTime: 60_000,
})
Expand Down

0 comments on commit 3f64076

Please sign in to comment.