Commit a118fd96 by Jesse Zoldak

Merge pull request #8811 from edx/zoldak/fix-flaky-js-tests

Fix flaky js tests caused by ajax requests TE-970
parents 658519d0 de25880c
......@@ -167,22 +167,23 @@ define ["js/views/course_info_handout", "js/views/course_info_update", "js/model
@courseInfoEdit.render()
@event = {preventDefault : () -> 'no op'}
@courseInfoEdit.onNew(@event)
@requests = AjaxHelpers["requests"](this)
it "shows push notification checkbox as selected by default", ->
expect(@courseInfoEdit.$el.find('.toggle-checkbox')).toBeChecked()
it "sends correct default value for push_notification_selected", ->
requests = AjaxHelpers.requests(this);
@courseInfoEdit.$el.find('.save-button').click()
requestSent = JSON.parse(@requests[@requests.length - 1].requestBody)
requestSent = JSON.parse(requests[requests.length - 1].requestBody)
expect(requestSent.push_notification_selected).toEqual(true)
it "sends correct value for push_notification_selected when it is unselected", ->
requests = AjaxHelpers.requests(this);
# unselect push notification
@courseInfoEdit.$el.find('.toggle-checkbox').attr('checked', false);
@courseInfoEdit.$el.find('.save-button').click()
requestSent = JSON.parse(@requests[@requests.length - 1].requestBody)
requestSent = JSON.parse(requests[requests.length - 1].requestBody)
expect(requestSent.push_notification_selected).toEqual(false)
describe "Course Handouts", ->
......
define(
[
'jquery', 'underscore', 'common/js/spec_helpers/ajax_helpers', 'squire'
'jquery', 'underscore', 'squire'
],
function ($, _, AjaxHelpers, Squire) {
function ($, _, Squire) {
'use strict';
describe('FileUploader', function () {
var FileUploaderTemplate = readFixtures(
......
......@@ -8,7 +8,9 @@ define(
],
function ($, _, Utils, VideoList, MetadataModel, AbstractEditor, sinon) {
'use strict';
describe('CMS.Views.Metadata.VideoList', function () {
// TODO: reenable these specs, using AjaxHelpers and the correct pattern
// to avoid flakiness. See TNL-2689.
xdescribe('CMS.Views.Metadata.VideoList', function () {
var videoListEntryTemplate = readFixtures(
'video/transcripts/metadata-videolist-entry.underscore'
),
......
define(
[
'jquery', 'underscore', 'common/js/spec_helpers/ajax_helpers', 'squire'
'jquery', 'underscore', 'squire'
],
function ($, _, AjaxHelpers, Squire) {
function ($, _, Squire) {
'use strict';
// TODO: fix BLD-1100 Disabled due to intermittent failure on master and in PR builds
xdescribe('VideoTranslations', function () {
......
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