Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial set of player tests #340

Merged
merged 4 commits into from
Dec 13, 2023
Merged

Conversation

rolandkakonyi
Copy link
Contributor

@rolandkakonyi rolandkakonyi commented Nov 30, 2023

Description

We have no meaningful tests for player behavior.

Changes

Added 11 tests for basic player behavior testing.

Checklist

  • 🗒 CHANGELOG entry - not applicable

@rolandkakonyi rolandkakonyi self-assigned this Nov 30, 2023
@rolandkakonyi rolandkakonyi changed the base branch from player-testing/add-more-documentation to prepare-for-player-tests November 30, 2023 13:37
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this as we have actual tests now

@rolandkakonyi rolandkakonyi marked this pull request as ready for review November 30, 2023 15:38
Copy link
Contributor

@matamegger matamegger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. One small structural suggestion.

Comment on lines 16 to 37
spec.describe('calling player API when a source is loaded', () => {
spec.it(
'emits a Play and Playing events after calling play API',
async () => {
await startPlayerTest({}, async () => {
await loadSourceConfig(Sources.artOfMotionHls);
await callPlayerAndExpectEvents((player) => {
player.play();
}, EventSequence(EventType.Play, EventType.Playing));
});
}
);
spec.it('emits a Paused event after calling pause API', async () => {
await startPlayerTest({}, async () => {
await loadSourceConfig(Sources.artOfMotionHls);
await playFor(1);
await callPlayerAndExpectEvent((player) => {
player.pause();
}, EventType.Paused);
});
});
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be two separate blocks I think.

Suggested change
spec.describe('calling player API when a source is loaded', () => {
spec.it(
'emits a Play and Playing events after calling play API',
async () => {
await startPlayerTest({}, async () => {
await loadSourceConfig(Sources.artOfMotionHls);
await callPlayerAndExpectEvents((player) => {
player.play();
}, EventSequence(EventType.Play, EventType.Playing));
});
}
);
spec.it('emits a Paused event after calling pause API', async () => {
await startPlayerTest({}, async () => {
await loadSourceConfig(Sources.artOfMotionHls);
await playFor(1);
await callPlayerAndExpectEvent((player) => {
player.pause();
}, EventType.Paused);
});
});
});
spec.describe('calling play when a source is loaded', () => {
spec.it(
'emits a Play and Playing events',
async () => {
await startPlayerTest({}, async () => {
await loadSourceConfig(Sources.artOfMotionHls);
await callPlayerAndExpectEvents((player) => {
player.play();
}, EventSequence(EventType.Play, EventType.Playing));
});
}
);
});
spec.describe('calling pause when a source is loaded', () => {
spec.it('emits a Paused event', async () => {
await startPlayerTest({}, async () => {
await loadSourceConfig(Sources.artOfMotionHls);
await playFor(1);
await callPlayerAndExpectEvent((player) => {
player.pause();
}, EventType.Paused);
});
});
});

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied feedback in 118b30c

Base automatically changed from prepare-for-player-tests to development December 13, 2023 07:40
@rolandkakonyi rolandkakonyi merged commit 7cfda29 into development Dec 13, 2023
9 checks passed
@rolandkakonyi rolandkakonyi deleted the add-player-tests branch December 13, 2023 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants