use always() instead of done() and call expect() in there, fixed whitespace
This commit is contained in:
parent
c3dd433c99
commit
21b99ccd53
|
@ -23,27 +23,34 @@ describe("chat-load-messages", function(){
|
||||||
}
|
}
|
||||||
helper.waitFor(function(){
|
helper.waitFor(function(){
|
||||||
return chatText.children("p").length == messages;
|
return chatText.children("p").length == messages;
|
||||||
}).done(function(){
|
}).always(function(){
|
||||||
|
expect(chatText.children("p").length).to.be(messages);
|
||||||
$('#iframe-container iframe')[0].contentWindow.location.reload();
|
$('#iframe-container iframe')[0].contentWindow.location.reload();
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("checks initial message count", function(done) {
|
it("checks initial message count", function(done) {
|
||||||
|
var chatText;
|
||||||
|
var expectedCount = 101;
|
||||||
helper.waitFor(function(){
|
helper.waitFor(function(){
|
||||||
// wait for the frame to load
|
// wait for the frame to load
|
||||||
var chrome$ = $('#iframe-container iframe')[0].contentWindow.$;
|
var chrome$ = $('#iframe-container iframe')[0].contentWindow.$;
|
||||||
if(!chrome$) // page not fully loaded
|
if(!chrome$) // page not fully loaded
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var chatButton = chrome$("#chaticon");
|
var chatButton = chrome$("#chaticon");
|
||||||
chatButton.click();
|
chatButton.click();
|
||||||
var chatText = chrome$("#chattext");
|
chatText = chrome$("#chattext");
|
||||||
return chatText.children("p").length == 101;
|
return chatText.children("p").length == expectedCount;
|
||||||
}).done(done);
|
}).always(function(){
|
||||||
|
expect(chatText.children("p").length).to.be(expectedCount);
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("loads more messages", function(done) {
|
it("loads more messages", function(done) {
|
||||||
|
var expectedCount = 122;
|
||||||
var chrome$ = $('#iframe-container iframe')[0].contentWindow.$;
|
var chrome$ = $('#iframe-container iframe')[0].contentWindow.$;
|
||||||
var chatButton = chrome$("#chaticon");
|
var chatButton = chrome$("#chaticon");
|
||||||
chatButton.click();
|
chatButton.click();
|
||||||
|
@ -52,11 +59,15 @@ describe("chat-load-messages", function(){
|
||||||
|
|
||||||
loadMsgBtn.click();
|
loadMsgBtn.click();
|
||||||
helper.waitFor(function(){
|
helper.waitFor(function(){
|
||||||
return chatText.children("p").length == 122;
|
return chatText.children("p").length == expectedCount;
|
||||||
}).done(done);
|
}).always(function(){
|
||||||
|
expect(chatText.children("p").length).to.be(expectedCount);
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("checks for button vanishing", function(done) {
|
it("checks for button vanishing", function(done) {
|
||||||
|
var expectedDisplay = 'none';
|
||||||
var chrome$ = $('#iframe-container iframe')[0].contentWindow.$;
|
var chrome$ = $('#iframe-container iframe')[0].contentWindow.$;
|
||||||
var chatButton = chrome$("#chaticon");
|
var chatButton = chrome$("#chaticon");
|
||||||
chatButton.click();
|
chatButton.click();
|
||||||
|
@ -65,7 +76,10 @@ describe("chat-load-messages", function(){
|
||||||
|
|
||||||
loadMsgBtn.click();
|
loadMsgBtn.click();
|
||||||
helper.waitFor(function(){
|
helper.waitFor(function(){
|
||||||
return loadMsgBtn.css('display') == 'none';
|
return loadMsgBtn.css('display') == expectedDisplay;
|
||||||
}).done(done);
|
}).always(function(){
|
||||||
|
expect(loadMsgBtn.css('display')).to.be(expectedDisplay);
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue