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.
This commit is contained in:
@@ -8,12 +8,20 @@ define([
|
||||
var discussionView, createDiscussionView, createPost, expandReplies, postReply;
|
||||
|
||||
beforeEach(function() {
|
||||
setFixtures('<div class="discussion-module""></div>');
|
||||
$('.discussion-module').data('course-id', TeamSpecHelpers.testCourseID);
|
||||
$('.discussion-module').data('discussion-id', TeamSpecHelpers.testTeamDiscussionID);
|
||||
$('.discussion-module').data('user-create-comment', true);
|
||||
$('.discussion-module').data('user-create-subcomment', true);
|
||||
DiscussionSpecHelper.setUnderscoreFixtures();
|
||||
runs(function() {
|
||||
setFixtures('<div class="discussion-module""></div>');
|
||||
$('.discussion-module').data('course-id', TeamSpecHelpers.testCourseID);
|
||||
$('.discussion-module').data('discussion-id', TeamSpecHelpers.testTeamDiscussionID);
|
||||
$('.discussion-module').data('user-create-comment', true);
|
||||
$('.discussion-module').data('user-create-subcomment', true);
|
||||
DiscussionSpecHelper.setUnderscoreFixtures();
|
||||
});
|
||||
|
||||
waitsFor(
|
||||
function() {return typeof(jQuery)!='undefined' && jQuery.active==0;},
|
||||
"Ajax did not finish",
|
||||
10000
|
||||
})
|
||||
});
|
||||
|
||||
createDiscussionView = function(requests, threads) {
|
||||
|
||||
Reference in New Issue
Block a user