Added ability to load the same pad twice with helper.newPad, use this in load-message-tests

This commit is contained in:
mluto 2013-01-15 22:17:40 +01:00
parent 5eb09f981b
commit 09fa1d49a1
2 changed files with 16 additions and 15 deletions

View file

@ -1,6 +1,9 @@
describe("chat-load-messages", function(){
var padName;
it("creates a pad", function(done) {
helper.newPad(done);
padName = helper.newPad(done);
this.timeout(60000);
});
it("adds a lot of messages", function(done) {
@ -11,6 +14,8 @@ describe("chat-load-messages", function(){
var chatInput = chrome$("#chatinput");
var chatText = chrome$("#chattext");
this.timeout(10000);
var messages = 140;
for(var i=1; i <= messages; i++) {
var num = ''+i;
@ -25,20 +30,15 @@ describe("chat-load-messages", function(){
return chatText.children("p").length == messages;
}).always(function(){
expect(chatText.children("p").length).to.be(messages);
$('#iframe-container iframe')[0].contentWindow.location.reload();
done();
helper.newPad(done, padName);
});
});
it("checks initial message count", function(done) {
var chatText;
var expectedCount = 101;
var chrome$ = helper.padChrome$;
helper.waitFor(function(){
// wait for the frame to load
var chrome$ = $('#iframe-container iframe')[0].contentWindow.$;
if(!chrome$) // page not fully loaded
return false;
var chatButton = chrome$("#chaticon");
chatButton.click();
chatText = chrome$("#chattext");
@ -51,7 +51,7 @@ describe("chat-load-messages", function(){
it("loads more messages", function(done) {
var expectedCount = 122;
var chrome$ = $('#iframe-container iframe')[0].contentWindow.$;
var chrome$ = helper.padChrome$;
var chatButton = chrome$("#chaticon");
chatButton.click();
var chatText = chrome$("#chattext");
@ -68,7 +68,7 @@ describe("chat-load-messages", function(){
it("checks for button vanishing", function(done) {
var expectedDisplay = 'none';
var chrome$ = $('#iframe-container iframe')[0].contentWindow.$;
var chrome$ = helper.padChrome$;
var chatButton = chrome$("#chaticon");
chatButton.click();
var chatText = chrome$("#chattext");