Search code examples
polymertravis-cisaucelabsweb-component-tester

Polymer async tests timeout in sauce labs, but not locally


I have created several tests for a Polymer web component. The tests are written according to the guidelines provided in polycast #36. When I run the tests with Web-Component-Tester locally, all is fine and my tests pass. When I run the tests in a local browser (chrome and firefox) all is fine.

I've also set up Travis-CI and Sauce Labs for automated testing. Travis can run WCT locally in the shell. This works perfectly and my tests pass. However when WCT is run with the sauce plugin enabled, and the tests are run on the sauce labs browsers, ONLY the async tests fail.

My test is waiting for a JS-event to be fired. I presume the event is never received. The output from WCT is not really helpful. It just complains that the done() method is never called.

Does anyone else experience the same problems with WCT and Sauce Labs? If so, does anyone have a solution for these async tests?

Edit 1: I should add that my component wraps a native websocket. The async tests wait for websocket events that are refired by the component after it catches the websocket event.


Solution

  • The issue might have something to do with Sauce Labs' SSL Bumping.
    I could not figure out why the external connection fails when run in a Sauce browser.

    The solution is to stub the websocket connection such that only the wrapper gets tested instead of the wrapper + websocket.
    An aditional advantage to stubbing is of course that the tests run way faster.