Try wrapping the test code in a DOMContentLoaded handler to see if that's why it's failing tests on Travis-CI