2013-03-13 18:00:04 +00:00
|
|
|
describe("Chat messages and UI", function(){
|
2012-10-28 17:38:56 +00:00
|
|
|
//create a new pad before each test run
|
|
|
|
beforeEach(function(cb){
|
|
|
|
helper.newPad(cb);
|
|
|
|
});
|
|
|
|
|
2020-10-21 17:43:17 +00:00
|
|
|
it("opens chat, sends a message, makes sure it exists on the page and hides chat", async function() {
|
2012-10-28 17:38:56 +00:00
|
|
|
var chatValue = "JohnMcLear";
|
|
|
|
|
2020-10-21 17:43:17 +00:00
|
|
|
await helper.showChat();
|
|
|
|
await helper.sendChatMessage(`${chatValue}{enter}`);
|
2013-12-05 07:41:29 +00:00
|
|
|
|
2020-10-21 17:43:17 +00:00
|
|
|
expect(helper.chatTextParagraphs().length).to.be(1);
|
2013-03-05 19:01:22 +00:00
|
|
|
|
2020-10-21 17:43:17 +00:00
|
|
|
// <p data-authorid="a.qjkwNs4z0pPROphS"
|
|
|
|
// class="author-a-qjkwz78zs4z122z0pz80zz82zz79zphz83z">
|
|
|
|
// <b>unnamed:</b>
|
|
|
|
// <span class="time author-a-qjkwz78zs4z122z0pz80zz82zz79zphz83z">12:38
|
|
|
|
// </span> JohnMcLear
|
|
|
|
// </p>
|
|
|
|
let username = helper.chatTextParagraphs().children("b").text();
|
|
|
|
let time = helper.chatTextParagraphs().children(".time").text();
|
2013-03-13 18:00:04 +00:00
|
|
|
|
2020-10-21 17:43:17 +00:00
|
|
|
expect(helper.chatTextParagraphs().text()).to.be(`${username}${time} ${chatValue}`);
|
2013-03-13 18:00:04 +00:00
|
|
|
|
2020-10-21 17:43:17 +00:00
|
|
|
await helper.hideChat();
|
|
|
|
});
|
2013-03-13 18:00:04 +00:00
|
|
|
|
2020-10-21 17:43:17 +00:00
|
|
|
it("makes sure that an empty message can't be sent", async function() {
|
|
|
|
var chatValue = "mluto";
|
2020-04-18 10:17:14 +00:00
|
|
|
|
2020-10-21 17:43:17 +00:00
|
|
|
await helper.showChat();
|
2020-04-18 10:17:14 +00:00
|
|
|
|
2020-10-21 17:43:17 +00:00
|
|
|
await helper.sendChatMessage(`{enter}${chatValue}{enter}`); // simulate a keypress of typing enter, mluto and enter (to send 'mluto')
|
2020-04-18 10:17:14 +00:00
|
|
|
|
2020-10-21 17:43:17 +00:00
|
|
|
let chat = helper.chatTextParagraphs();
|
2020-04-18 10:17:14 +00:00
|
|
|
|
2020-10-21 17:43:17 +00:00
|
|
|
expect(chat.length).to.be(1);
|
2020-04-18 10:17:14 +00:00
|
|
|
|
2020-10-21 17:43:17 +00:00
|
|
|
// check that the received message is not the empty one
|
|
|
|
let username = chat.children("b").text();
|
|
|
|
let time = chat.children(".time").text();
|
2020-04-18 10:17:14 +00:00
|
|
|
|
2020-10-21 17:43:17 +00:00
|
|
|
expect(chat.text()).to.be(`${username}${time} ${chatValue}`);
|
2013-03-13 18:00:04 +00:00
|
|
|
});
|
2014-12-28 19:25:46 +00:00
|
|
|
|
2020-10-21 17:43:17 +00:00
|
|
|
it("makes chat stick to right side of the screen via settings, remove sticky via settings, close it", async function() {
|
|
|
|
await helper.showSettings();
|
2014-12-28 19:25:46 +00:00
|
|
|
|
2020-10-21 17:43:17 +00:00
|
|
|
await helper.enableStickyChatviaSettings();
|
|
|
|
expect(helper.isChatboxShown()).to.be(true);
|
|
|
|
expect(helper.isChatboxSticky()).to.be(true);
|
2014-12-28 19:25:46 +00:00
|
|
|
|
2020-10-21 17:43:17 +00:00
|
|
|
await helper.disableStickyChatviaSettings();
|
|
|
|
expect(helper.isChatboxSticky()).to.be(false);
|
|
|
|
expect(helper.isChatboxShown()).to.be(true);
|
|
|
|
|
|
|
|
await helper.hideChat();
|
|
|
|
expect(helper.isChatboxSticky()).to.be(false);
|
|
|
|
expect(helper.isChatboxShown()).to.be(false);
|
|
|
|
});
|
2014-12-28 19:25:46 +00:00
|
|
|
|
2020-10-21 17:43:17 +00:00
|
|
|
it("makes chat stick to right side of the screen via icon on the top right, remove sticky via icon, close it", async function() {
|
|
|
|
await helper.showChat();
|
2014-12-28 19:25:46 +00:00
|
|
|
|
2020-10-21 17:43:17 +00:00
|
|
|
await helper.enableStickyChatviaIcon();
|
|
|
|
expect(helper.isChatboxShown()).to.be(true);
|
|
|
|
expect(helper.isChatboxSticky()).to.be(true);
|
2014-12-28 19:25:46 +00:00
|
|
|
|
2020-10-21 17:43:17 +00:00
|
|
|
await helper.disableStickyChatviaIcon();
|
|
|
|
expect(helper.isChatboxShown()).to.be(true);
|
|
|
|
expect(helper.isChatboxSticky()).to.be(false);
|
2014-12-28 19:25:46 +00:00
|
|
|
|
2020-10-21 17:43:17 +00:00
|
|
|
await helper.hideChat();
|
|
|
|
expect(helper.isChatboxSticky()).to.be(false);
|
|
|
|
expect(helper.isChatboxShown()).to.be(false);
|
2014-12-28 19:25:46 +00:00
|
|
|
});
|
2020-05-28 14:18:13 +00:00
|
|
|
|
2020-06-05 23:06:50 +00:00
|
|
|
xit("Checks showChat=false URL Parameter hides chat then when removed it shows chat", function(done) {
|
2020-05-28 14:18:13 +00:00
|
|
|
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);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2013-03-13 18:00:04 +00:00
|
|
|
});
|