Merge branch 'develop' of github.com:ether/etherpad-lite into gateway-timeout-during-tests

This commit is contained in:
John McLear 2020-05-28 14:28:51 +00:00
commit 78a3dd64de
5 changed files with 52 additions and 6 deletions

View file

@ -99,6 +99,11 @@ var helper = {};
opts = _.defaults(cb, opts);
}
// if opts.params is set we manipulate the URL to include URL parameters IE ?foo=Bah.
if(opts.params){
var encodedParams = "?" + $.param(opts.params);
}
//clear cookies
if(opts.clearCookies){
helper.clearSessionCookies();
@ -106,7 +111,7 @@ var helper = {};
if(!padName)
padName = "FRONTEND_TEST_" + helper.randomString(20);
$iframe = $("<iframe src='/p/" + padName + "'></iframe>");
$iframe = $("<iframe src='/p/" + padName + (encodedParams || '') + "'></iframe>");
//clean up inner iframe references
helper.padChrome$ = helper.padOuter$ = helper.padInner$ = null;

View file

@ -131,4 +131,41 @@ describe("Chat messages and UI", function(){
}, 10)
}, 10)
});
it("Checks showChat=false URL Parameter hides chat then when removed it shows chat", function(done) {
this.timeout(60000);
var inner$ = helper.padInner$;
var chrome$ = helper.padChrome$;
setTimeout(function(){ //give it a second to save the username on the server side
helper.newPad({ // get a new pad, but don't clear the cookies
clearCookies: false,
params:{
showChat: "false"
}, cb: function(){
var chrome$ = helper.padChrome$;
var chaticon = chrome$("#chaticon");
// chat should be hidden.
expect(chaticon.is(":visible")).to.be(false);
setTimeout(function(){ //give it a second to save the username on the server side
helper.newPad({ // get a new pad, but don't clear the cookies
clearCookies: false
, cb: function(){
var chrome$ = helper.padChrome$;
var chaticon = chrome$("#chaticon");
// chat should be visible.
expect(chaticon.is(":visible")).to.be(true);
done();
}
});
}, 1000);
}
});
}, 1000);
});
});

View file

@ -36,7 +36,6 @@ describe("the test helper", function(){
done();
});
});
// Make sure the cookies are cleared, and make sure that the cookie
// clearing has taken effect at this point in the code. It has been
// observed that the former can happen without the latter if there
@ -105,7 +104,7 @@ describe("the test helper", function(){
// confirm that the session was actually cleared
var $usernameInput = chrome$("#myusernameedit");
expect($usernameInput.val()).to.be('Enter your name');
expect($usernameInput.val()).to.be('');
done();
});