From 4b3a899faea5bc96fb5a76ebcdeabf32bcf85bcc Mon Sep 17 00:00:00 2001 From: Antoine SEIN <142824551+asein-sinch@users.noreply.github.com> Date: Mon, 23 Sep 2024 20:35:35 +0200 Subject: [PATCH] DEVEXP-524: E2E Voice/Callouts (#133) --- .github/workflows/run-ci.yaml | 11 +- packages/voice/cucumber.js | 8 ++ packages/voice/package.json | 3 +- .../conference-callout-request.ts | 3 +- .../tests/rest/v1/callouts/callouts.steps.ts | 121 ++++++++++++++++++ 5 files changed, 135 insertions(+), 11 deletions(-) create mode 100644 packages/voice/cucumber.js create mode 100644 packages/voice/tests/rest/v1/callouts/callouts.steps.ts diff --git a/.github/workflows/run-ci.yaml b/.github/workflows/run-ci.yaml index 846bee5f..cae140be 100644 --- a/.github/workflows/run-ci.yaml +++ b/.github/workflows/run-ci.yaml @@ -32,10 +32,6 @@ jobs: token: ${{ secrets.PAT_CI }} fetch-depth: 0 path: sinch-sdk-mockserver - - name: Build custom Docker image - run: | - cd sinch-sdk-mockserver - docker build -t sinch-sdk-mockserver -f Dockerfile . - name: Install Docker Compose run: | sudo apt-get update @@ -44,11 +40,6 @@ jobs: run: | cd sinch-sdk-mockserver docker-compose up -d - - name: Wait for the mock servers to be healthy - run: | - cd sinch-sdk-mockserver - chmod +x ./scripts/healthcheck.sh - ./scripts/healthcheck.sh - name: Create target directories for feature files run: | mkdir -p ./packages/fax/tests/e2e/features @@ -57,6 +48,7 @@ jobs: mkdir -p ./packages/elastic-sip-trunking/tests/e2e/features mkdir -p ./packages/sms/tests/e2e/features mkdir -p ./packages/verification/tests/e2e/features + mkdir -p ./packages/voice/tests/e2e/features - name: Copy feature files run: | cp sinch-sdk-mockserver/features/fax/*.feature ./packages/fax/tests/e2e/features/ @@ -65,6 +57,7 @@ jobs: cp sinch-sdk-mockserver/features/elastic-sip-trunking/*.feature ./packages/elastic-sip-trunking/tests/e2e/features/ cp sinch-sdk-mockserver/features/sms/*.feature ./packages/sms/tests/e2e/features/ cp sinch-sdk-mockserver/features/verification/*.feature ./packages/verification/tests/e2e/features/ + cp sinch-sdk-mockserver/features/voice/*.feature ./packages/voice/tests/e2e/features/ - name: Run e2e tests run: | yarn install diff --git a/packages/voice/cucumber.js b/packages/voice/cucumber.js new file mode 100644 index 00000000..691a9809 --- /dev/null +++ b/packages/voice/cucumber.js @@ -0,0 +1,8 @@ +module.exports = { + default: [ + 'tests/e2e/features/**/*.feature', + '--require-module ts-node/register', + '--require tests/rest/v1/**/*.steps.ts', + `--format-options '{"snippetInterface": "synchronous"}'`, + ].join(' '), +}; diff --git a/packages/voice/package.json b/packages/voice/package.json index 473628fc..3a5528f4 100644 --- a/packages/voice/package.json +++ b/packages/voice/package.json @@ -25,7 +25,8 @@ "scripts": { "build": "yarn run clean && yarn run compile", "clean": "rimraf dist tsconfig.tsbuildinfo tsconfig.build.tsbuildinfo", - "compile": "tsc -p tsconfig.build.json && tsc -p tsconfig.tests.json && rimraf dist/tests tsconfig.build.tsbuildinfo" + "compile": "tsc -p tsconfig.build.json && tsc -p tsconfig.tests.json && rimraf dist/tests tsconfig.build.tsbuildinfo", + "test:e2e": "cucumber-js" }, "dependencies": { "@sinch/sdk-client": "^1.1.0" diff --git a/packages/voice/src/models/v1/conference-callout-request/conference-callout-request.ts b/packages/voice/src/models/v1/conference-callout-request/conference-callout-request.ts index 6d7583da..54a96829 100644 --- a/packages/voice/src/models/v1/conference-callout-request/conference-callout-request.ts +++ b/packages/voice/src/models/v1/conference-callout-request/conference-callout-request.ts @@ -1,5 +1,6 @@ import { Destination } from '../destination'; import { ConferenceDtmfOptions } from '../conference-dtmf-options'; +import { MusicOnHold } from '../enums'; /** * The conference callout calls a phone number or a user. When the call is answered, it's connected to a conference room. @@ -28,7 +29,7 @@ export interface ConferenceCalloutRequest { /** The text that will be spoken as a greeting. */ greeting?: string; /** Means "music-on-hold." It's an optional parameter that specifies what the first participant should listen to while they're alone in the conference, waiting for other participants to join. It can take one of these pre-defined values: