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

SoundsTest passes in ChromeHeadless #32518

Merged
merged 1 commit into from Jan 6, 2020
Merged

Conversation

islemaster
Copy link
Contributor

@islemaster islemaster commented Dec 20, 2019

I've been trying to run tests in ChromeHeadless on my local machine, since PhantomJS isn't working properly on recent versions of Ubuntu. Eventually, I'd like us to use ChromeHeadless in our CI builds too, but to do that, we need to fix up all the tests that fail on this browser.

One of the tests that fails is SoundsTest#does play URLs when unmuted. I believe this fixes that test under both ChromeHeadless and PhantomJS.

Reviewer Checklist:

  • Tests provide adequate coverage
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked


describe('Sounds', () => {
const sounds = new Sounds();
const sourceURL =
'studio.code.org/api/v1/sound-library/KyZOBksdJiQSlvoiOzFGpryJiMexdfks/category_ui/click1.mp3';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This URL 404s, and where PhantomJS left its sound in a "still loading" state so that the test would pass, ChromeHeadless resolves the 404 right away and leaves the sound in a "load failed" state.

@@ -1,11 +1,11 @@
import {expect} from '../util/deprecatedChai';
import Sounds from '@cdo/apps/Sounds';
import sinon from 'sinon';
import winMp3 from '!!file-loader!../audio/assets/win.mp3';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've fixed this by using Webpack's file-loader inline (which is nice because we don't really need this as part of our global config) to pull an existing fixture mp3 file from our repo, which is guaranteed to load unlike the broken URL below.

Copy link
Contributor

@ajpal ajpal left a comment

Choose a reason for hiding this comment

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

Thanks for doing this!

@islemaster islemaster merged commit eef2d73 into staging Jan 6, 2020
@islemaster islemaster deleted the soundstests-chromeheadless branch January 6, 2020 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants