Skip to content

Commit

Permalink
feat(playertesting): add more meaningful tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rolandkakonyi committed Nov 28, 2023
1 parent a4c62d7 commit 23323d3
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions integration_test/tests/exampleSpec.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,39 @@
import { TestScope } from 'cavy';
import { loadSourceConfig, playFor, startPlayerTest } from '../playertesting';
import {
callPlayerAndExpectEvents,
EventSequence,
EventType,
expectEvents,
loadSourceConfig,
RepeatedEvent,
startPlayerTest,
} from '../playertesting';
import { SourceType } from 'bitmovin-player-react-native';

export default (spec: TestScope) => {
spec.describe('player', () => {
spec.it('loads source and plays for 5 seconds', async () => {
spec.describe('calling play when a source is loaded', () => {
spec.it('emits a Play and Playing event', async () => {
await startPlayerTest({}, async () => {
await loadSourceConfig({
url: 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8',
type: SourceType.HLS,
});
await playFor(5);
await callPlayerAndExpectEvents((player) => {
player.play();
}, EventSequence(EventType.Play, EventType.Playing));
});
});
});
spec.describe('playing a source', () => {
spec.it('emits TimeChanged events', async () => {
await startPlayerTest({}, async () => {
await loadSourceConfig({
url: 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8',
type: SourceType.HLS,
});
await callPlayerAndExpectEvents((player) => {
player.play();
}, EventSequence(EventType.Play, EventType.Playing));
await expectEvents(RepeatedEvent(EventType.TimeChanged, 5));
});
});
});
Expand Down

0 comments on commit 23323d3

Please sign in to comment.