diff options
author | mluto <m@luto.at> | 2013-01-13 10:39:13 +0100 |
---|---|---|
committer | mluto <m@luto.at> | 2013-01-13 10:39:13 +0100 |
commit | 176719b331c3b6880afc3c258a9a0865ee4af2c6 (patch) | |
tree | 2b60d5dc1ef397cd5a58af93224dc2b06ad772ae /tests | |
parent | bc05f9eb0adf5d9f674159106644f64d363e62e1 (diff) | |
download | etherpad-lite-176719b331c3b6880afc3c258a9a0865ee4af2c6.zip |
Added tests
Diffstat (limited to 'tests')
-rw-r--r-- | tests/frontend/specs/chat_load_messages.js | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/tests/frontend/specs/chat_load_messages.js b/tests/frontend/specs/chat_load_messages.js new file mode 100644 index 00000000..71006413 --- /dev/null +++ b/tests/frontend/specs/chat_load_messages.js @@ -0,0 +1,70 @@ +describe("chat-load-messages", function(){ + it("create pad", function(done) { + helper.newPad(done); + }); + + it("add a lot of messages", function(done) { + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; + var chatButton = chrome$("#chaticon"); + chatButton.click(); + var chatInput = chrome$("#chatinput"); + var chatText = chrome$("#chattext"); + + var messages = 140; + for(var i=1; i <= messages; i++) { + var num = ''+i; + if(num.length == 1) + num = '00'+num; + if(num.length == 2) + num = '0'+num; + chatInput.sendkeys('msg' + num); + chatInput.sendkeys('{enter}'); + } + setTimeout(function() { + expect(chatText.children("p").length).to.be(messages); + $('#iframe-container iframe')[0].contentWindow.location.reload(); + done(); + }, 500); + }); + + it("check initial message count", function(done) { + setTimeout(function() { + var chrome$ = $('#iframe-container iframe')[0].contentWindow.$; + var chatButton = chrome$("#chaticon"); + chatButton.click(); + var chatText = chrome$("#chattext"); + + expect(chatText.children("p").length).to.be(101); + done(); + }, 500); + }); + + it("load more messages", function(done) { + var chrome$ = $('#iframe-container iframe')[0].contentWindow.$; + var chatButton = chrome$("#chaticon"); + chatButton.click(); + var chatText = chrome$("#chattext"); + var loadMsgBtn = chrome$("#chatloadmessagesbutton"); + + loadMsgBtn.click(); + setTimeout(function() { + expect(chatText.children("p").length).to.be(122); + done(); + }, 500); + }); + + it("btn vanishes", function(done) { + var chrome$ = $('#iframe-container iframe')[0].contentWindow.$; + var chatButton = chrome$("#chaticon"); + chatButton.click(); + var chatText = chrome$("#chattext"); + var loadMsgBtn = chrome$("#chatloadmessagesbutton"); + + loadMsgBtn.click(); + setTimeout(function() { + expect(loadMsgBtn.css('display')).to.be('none'); + done(); + }, 200); + }); +}); |