diff --git a/tests/frontend/helper.js b/tests/frontend/helper.js
index 800dfb29315c..791f0e5972d8 100644
--- a/tests/frontend/helper.js
+++ b/tests/frontend/helper.js
@@ -75,20 +75,25 @@ var helper = {};
helper.newPad = function(cb, padName){
//build opts object
var opts = {clearCookies: true}
+
if(typeof cb === 'function'){
opts.cb = cb
} else {
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.clearCookies();
}
-
if(!padName)
padName = "FRONTEND_TEST_" + helper.randomString(20);
- $iframe = $("");
+ $iframe = $("");
//clean up inner iframe references
helper.padChrome$ = helper.padOuter$ = helper.padInner$ = null;
diff --git a/tests/frontend/specs/chat.js b/tests/frontend/specs/chat.js
index e48dad8b02fe..869d616c6776 100644
--- a/tests/frontend/specs/chat.js
+++ b/tests/frontend/specs/chat.js
@@ -127,4 +127,41 @@ describe("Chat messages and UI", function(){
done();
});
+
+ 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);
+
+ });
+
});