From e33678e6255d7bc1b0d591c7b8cdc61fc2752d3c Mon Sep 17 00:00:00 2001 From: John McLear Date: Sun, 28 Oct 2012 17:47:17 +0000 Subject: [PATCH] extend changing username to make sure it shows up the changes in the chat dialogue for new messages --- tests/frontend/specs/change_user_name.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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(); }); });