mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-19 22:23:33 +01:00
Fixed test-names, use waitFor instead of setTimeout
This commit is contained in:
parent
176719b331
commit
c3dd433c99
1 changed files with 26 additions and 25 deletions
|
@ -1,9 +1,9 @@
|
||||||
describe("chat-load-messages", function(){
|
describe("chat-load-messages", function(){
|
||||||
it("create pad", function(done) {
|
it("creates a pad", function(done) {
|
||||||
helper.newPad(done);
|
helper.newPad(done);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("add a lot of messages", function(done) {
|
it("adds a lot of messages", function(done) {
|
||||||
var inner$ = helper.padInner$;
|
var inner$ = helper.padInner$;
|
||||||
var chrome$ = helper.padChrome$;
|
var chrome$ = helper.padChrome$;
|
||||||
var chatButton = chrome$("#chaticon");
|
var chatButton = chrome$("#chaticon");
|
||||||
|
@ -21,26 +21,29 @@ describe("chat-load-messages", function(){
|
||||||
chatInput.sendkeys('msg' + num);
|
chatInput.sendkeys('msg' + num);
|
||||||
chatInput.sendkeys('{enter}');
|
chatInput.sendkeys('{enter}');
|
||||||
}
|
}
|
||||||
setTimeout(function() {
|
helper.waitFor(function(){
|
||||||
expect(chatText.children("p").length).to.be(messages);
|
return chatText.children("p").length == messages;
|
||||||
|
}).done(function(){
|
||||||
$('#iframe-container iframe')[0].contentWindow.location.reload();
|
$('#iframe-container iframe')[0].contentWindow.location.reload();
|
||||||
done();
|
done();
|
||||||
}, 500);
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("check initial message count", function(done) {
|
it("checks initial message count", function(done) {
|
||||||
setTimeout(function() {
|
helper.waitFor(function(){
|
||||||
var chrome$ = $('#iframe-container iframe')[0].contentWindow.$;
|
// wait for the frame to load
|
||||||
var chatButton = chrome$("#chaticon");
|
var chrome$ = $('#iframe-container iframe')[0].contentWindow.$;
|
||||||
chatButton.click();
|
if(!chrome$) // page not fully loaded
|
||||||
var chatText = chrome$("#chattext");
|
return false;
|
||||||
|
|
||||||
expect(chatText.children("p").length).to.be(101);
|
var chatButton = chrome$("#chaticon");
|
||||||
done();
|
chatButton.click();
|
||||||
}, 500);
|
var chatText = chrome$("#chattext");
|
||||||
|
return chatText.children("p").length == 101;
|
||||||
|
}).done(done);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("load more messages", function(done) {
|
it("loads more messages", function(done) {
|
||||||
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();
|
||||||
|
@ -48,13 +51,12 @@ describe("chat-load-messages", function(){
|
||||||
var loadMsgBtn = chrome$("#chatloadmessagesbutton");
|
var loadMsgBtn = chrome$("#chatloadmessagesbutton");
|
||||||
|
|
||||||
loadMsgBtn.click();
|
loadMsgBtn.click();
|
||||||
setTimeout(function() {
|
helper.waitFor(function(){
|
||||||
expect(chatText.children("p").length).to.be(122);
|
return chatText.children("p").length == 122;
|
||||||
done();
|
}).done(done);
|
||||||
}, 500);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("btn vanishes", function(done) {
|
it("checks for button vanishing", function(done) {
|
||||||
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();
|
||||||
|
@ -62,9 +64,8 @@ describe("chat-load-messages", function(){
|
||||||
var loadMsgBtn = chrome$("#chatloadmessagesbutton");
|
var loadMsgBtn = chrome$("#chatloadmessagesbutton");
|
||||||
|
|
||||||
loadMsgBtn.click();
|
loadMsgBtn.click();
|
||||||
setTimeout(function() {
|
helper.waitFor(function(){
|
||||||
expect(loadMsgBtn.css('display')).to.be('none');
|
return loadMsgBtn.css('display') == 'none';
|
||||||
done();
|
}).done(done);
|
||||||
}, 200);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue