Commit 90b94a46 by Eric Fischer

Potential fix for flaky TeamDiscussionView js tests

Adding waitsFor check in the beforeEach method. The condition I'm
waiting for here is shamelessly borrowed from bok-choy's
wait_for_ajax._is_ajax_finished() method:
https://github.com/edx/bok-choy/blob/master/bok_choy/page_object.py#L431

This seems to fix the errors I was able to generate with the
set_timeout, which themselves looked ver similar to the failing
master tests, so I *think* this will fix our woes, but since I was
never able to get the tests to fail exactly the same way I can't be sure.

Since there don't seem to be any drawbacks, this is going into mainline
as-is and we'll monitor for the sporadic failures over the next few
weeks.
parent 045a67aa
......@@ -8,6 +8,7 @@ define([
var discussionView, createDiscussionView, createPost, expandReplies, postReply;
beforeEach(function() {
runs(function() {
setFixtures('<div class="discussion-module""></div>');
$('.discussion-module').data('course-id', TeamSpecHelpers.testCourseID);
$('.discussion-module').data('discussion-id', TeamSpecHelpers.testTeamDiscussionID);
......@@ -16,6 +17,13 @@ define([
DiscussionSpecHelper.setUnderscoreFixtures();
});
waitsFor(
function() {return typeof(jQuery)!='undefined' && jQuery.active==0;},
"Ajax did not finish",
10000
})
});
createDiscussionView = function(requests, threads) {
discussionView = new TeamDiscussionView({
el: '.discussion-module'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment