Commit 42f9b06b by Will Daly

Merge pull request #1515 from edx/will/fix-js-transcript-tests

Add explicit wait to JS transcript tests
parents d8444266 3c9d86f7
...@@ -168,6 +168,8 @@ function ($, Backbone, _, Utils, Editor, MetadataView, MetadataModel, MetadataCo ...@@ -168,6 +168,8 @@ function ($, Backbone, _, Utils, Editor, MetadataView, MetadataModel, MetadataCo
return (displayNameValue !== "" && displayNameValue != "video_id"); return (displayNameValue !== "" && displayNameValue != "video_id");
}, "Defaults never loaded", 1000); }, "Defaults never loaded", 1000);
runs(function() {
var displayNameValue = collection[0].getValue(); var displayNameValue = collection[0].getValue();
var videoUrlValue = collection[1].getValue(); var videoUrlValue = collection[1].getValue();
...@@ -178,6 +180,7 @@ function ($, Backbone, _, Utils, Editor, MetadataView, MetadataModel, MetadataCo ...@@ -178,6 +180,7 @@ function ($, Backbone, _, Utils, Editor, MetadataView, MetadataModel, MetadataCo
'default.webm' 'default.webm'
]); ]);
}); });
});
it('If metadataCollection is not defined', function () { it('If metadataCollection is not defined', function () {
transcripts.syncBasicTab(null); transcripts.syncBasicTab(null);
...@@ -220,11 +223,19 @@ function ($, Backbone, _, Utils, Editor, MetadataView, MetadataModel, MetadataCo ...@@ -220,11 +223,19 @@ function ($, Backbone, _, Utils, Editor, MetadataView, MetadataModel, MetadataCo
it('Correct data', function () { it('Correct data', function () {
transcripts.syncAdvancedTab(metadataCollection); transcripts.syncAdvancedTab(metadataCollection);
var collection = metadataCollection.models, var collection = metadataCollection.models;
displayNameValue = collection[0].getValue(),
subValue = collection[1].getValue(), waitsFor(function() {
html5SourcesValue = collection[2].getValue(), var displayNameValue = collection[0].getValue();
youtubeValue = collection[3].getValue(); return (displayNameValue !== "" && displayNameValue != "video_id");
}, "Defaults never loaded", 1000);
runs(function() {
var displayNameValue = collection[0].getValue();
var subValue = collection[1].getValue();
var html5SourcesValue = collection[2].getValue();
var youtubeValue = collection[3].getValue();
expect(displayNameValue).toBe('display value'); expect(displayNameValue).toBe('display value');
expect(subValue).toBe('default'); expect(subValue).toBe('default');
...@@ -234,6 +245,7 @@ function ($, Backbone, _, Utils, Editor, MetadataView, MetadataModel, MetadataCo ...@@ -234,6 +245,7 @@ function ($, Backbone, _, Utils, Editor, MetadataView, MetadataModel, MetadataCo
]); ]);
expect(youtubeValue).toBe('12345678901'); expect(youtubeValue).toBe('12345678901');
}); });
});
it('metadataCollection is not defined', function () { it('metadataCollection is not defined', function () {
transcripts.syncAdvancedTab(null); transcripts.syncAdvancedTab(null);
......
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