diff --git a/tests/frontend/specs/change_user_name.js b/tests/frontend/specs/change_user_name.js index b40b49534..236a168a9 100644 --- a/tests/frontend/specs/change_user_name.js +++ b/tests/frontend/specs/change_user_name.js @@ -26,6 +26,24 @@ describe("change username value", function(){ //check if the username has been changed to John McLear expect(correctUsernameValue).to.be(true); + + + //click on the chat button to make chat visible + var $chatButton = chrome$("#chaticon"); + $chatButton.click(); + var $chatInput = chrome$("#chatinput"); + $chatInput.sendkeys('O hi'); // simulate a keypress of typing JohnMcLear + $chatInput.sendkeys('{enter}'); // simulate a keypress of enter actually does evt.which = 10 not 13 + + //check if chat shows up + helper.waitFor(function(){ + return chrome$("#chattext").children("p").length !== 0; // wait until the chat message shows up + }).done(function(){ + var $firstChatMessage = chrome$("#chattext").children("p"); + var containsJohnMcLear = $firstChatMessage.text().indexOf("John McLear") !== -1; // does the string contain Jo$ + expect(containsJohnMcLear).to.be(true); // expect the first chat message to contain JohnMcLear + }); + done(); }); });