Skip to content

Commit

Permalink
Make external asset tests a little more flexible
Browse files Browse the repository at this point in the history
The toBeCloseTo matcher on currentTime was too strict, so I added a
tolerance of 0.1 seconds.  This fixes some test failures on various
browsers and platforms.

Change-Id: I0438d7a06be3c1e20c5cd4170f02213c63d58e85
  • Loading branch information
joeyparrish committed Apr 15, 2016
1 parent 3c3fe69 commit 6ffdaeb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/player_integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ describe('Player', function() {
return waitForTimeOrEnd(video, 30);
}).then(function() {
if (video.ended) {
expect(video.currentTime).toBeCloseTo(video.duration);
expect(video.currentTime).toBeCloseTo(video.duration, 0.1);
} else {
expect(video.currentTime).toBeGreaterThan(20);
// If it were very close to duration, why !video.ended?
Expand All @@ -193,7 +193,7 @@ describe('Player', function() {
// 30 seconds or video ended, whichever comes first.
return waitForTimeOrEnd(video, 30).then(function() {
expect(video.ended).toBe(true);
expect(video.currentTime).toBeCloseTo(video.duration);
expect(video.currentTime).toBeCloseTo(video.duration, 0.1);
});
}
}
Expand Down

0 comments on commit 6ffdaeb

Please sign in to comment.