Skip to content

Commit

Permalink
Avoid failing YouTube CTL tests when network is slow (#1487)
Browse files Browse the repository at this point in the history
The YouTube Click to Load integration tests check a bunch of things,
including that interacting with the YouTube Iframe API works
correctly. Unfortunately, these tests fail sometimes when run inside a
GitHub action since the test runner is too slow to load (or even
request) the Iframe API script. When the script has failed to be
requested in time, let's mark the test as pending (aka skipped)
instead of declaring a failure.

1 - https://developers.google.com/youtube/iframe_api_reference
  • Loading branch information
kzar committed Oct 28, 2022
1 parent 60f3d20 commit b5a44e9
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions integration-test/background/click-to-load-youtube.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ describe('Test YouTube Click To Load', () => {
youTubeIframeApi, youTubeStandard, youTubeNocookie
} = summariseYouTubeRequests(pageRequests)

expect(youTubeIframeApi.checked).toBeTrue()
if (!youTubeIframeApi.checked) {
pending('Timed out requesting YouTube Iframe API script.')
}
expect(youTubeIframeApi.alwaysRedirected).toBeTrue()
expect(youTubeStandard.total).toBeGreaterThanOrEqual(2)
expect(youTubeStandard.blocked).toEqual(youTubeStandard.total)
Expand All @@ -114,7 +116,9 @@ describe('Test YouTube Click To Load', () => {
youTubeIframeApi, youTubeStandard, youTubeNocookie
} = summariseYouTubeRequests(pageRequests)

expect(youTubeIframeApi.checked).toBeTrue()
if (!youTubeIframeApi.checked) {
pending('Timed out requesting YouTube Iframe API script.')
}
expect(youTubeIframeApi.alwaysRedirected).toBeFalse()
expect(youTubeStandard.blocked).toEqual(0)
expect(youTubeNocookie.blocked).toEqual(0)
Expand All @@ -129,7 +133,9 @@ describe('Test YouTube Click To Load', () => {
youTubeIframeApi, youTubeStandard, youTubeNocookie
} = summariseYouTubeRequests(pageRequests)

expect(youTubeIframeApi.checked).toBeTrue()
if (!youTubeIframeApi.checked) {
pending('Timed out requesting YouTube Iframe API script.')
}
expect(youTubeIframeApi.alwaysRedirected).toBeTrue()
expect(youTubeStandard.total).toBeGreaterThanOrEqual(2)
expect(youTubeStandard.blocked).toEqual(youTubeStandard.total)
Expand All @@ -151,7 +157,9 @@ describe('Test YouTube Click To Load', () => {
youTubeIframeApi, youTubeStandard, youTubeNocookie
} = summariseYouTubeRequests(pageRequests)

expect(youTubeIframeApi.checked).toBeTrue()
if (!youTubeIframeApi.checked) {
pending('Timed out requesting YouTube Iframe API script.')
}
expect(youTubeIframeApi.alwaysRedirected).toBeFalse()
expect(youTubeStandard.blocked).toEqual(0)
expect(youTubeNocookie.blocked).toEqual(0)
Expand Down

0 comments on commit b5a44e9

Please sign in to comment.