diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ad40bb66..c7ab5f7d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -129,6 +129,8 @@ yarn integration-test test:android yarn integration-test test:ios ``` +To set the license key to be used for the tests, you can set the key `"licenseKey"` in `integration_test/app.json`. + See available API for testing [here](/integration_test/playertesting/PlayerTesting.ts). ### Adding new tests diff --git a/integration_test/README.md b/integration_test/README.md index ea2bffdc..fd12cf6a 100644 --- a/integration_test/README.md +++ b/integration_test/README.md @@ -28,4 +28,6 @@ Hint: You can provide a specific iOS simulator by name when using `--simulator` yarn example ios --simulator="iPhone 14 Pro" ``` +To set the license key to be used for the tests, you can set the key `"licenseKey"` in `integration_test/app.json`. + Note: The tests are currently only supported on iOS simulators and Android emulators. Running them on real devices is not supported at the moment. diff --git a/integration_test/playertesting/PlayerTestWorld.ts b/integration_test/playertesting/PlayerTestWorld.ts index a5b77660..6005bbdd 100644 --- a/integration_test/playertesting/PlayerTestWorld.ts +++ b/integration_test/playertesting/PlayerTestWorld.ts @@ -72,10 +72,15 @@ export default class PlayerTestWorld { player.initialize(); this.player = player; + // Trick to wait for the player to be initialized + // otherwise initial events might be missed + await player.isPlaying(); + await fn().finally(() => { player.destroy(); this.isFinished_ = true; this.player = undefined; + this.eventListeners = {}; }); }; diff --git a/integration_test/playertesting/PlayerTesting.ts b/integration_test/playertesting/PlayerTesting.ts index 74c13a70..c20cce83 100644 --- a/integration_test/playertesting/PlayerTesting.ts +++ b/integration_test/playertesting/PlayerTesting.ts @@ -126,8 +126,8 @@ export const expectEvents = async ( * @see {@link Player} * @see {@link EventType} */ -export const callPlayerAndExpectEvent = async ( - fn: (player: Player) => Promise

, +export const callPlayerAndExpectEvent = async ( + fn: (player: Player) => void, expectationConvertible: SingleEventExpectation | EventType, timeoutSeconds: number = 10 ): Promise => { diff --git a/integration_test/tests/helper/Sources.ts b/integration_test/tests/helper/Sources.ts new file mode 100644 index 00000000..e969b9d9 --- /dev/null +++ b/integration_test/tests/helper/Sources.ts @@ -0,0 +1,13 @@ +import { SourceConfig, SourceType } from 'bitmovin-player-react-native'; + +export const Sources = { + artOfMotionHls: { + url: 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8', + type: SourceType.HLS, + } as SourceConfig, + + artOfMotionDash: { + url: 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd', + type: SourceType.DASH, + } as SourceConfig, +};