From 7a6d212e173ea15504b6ecbc01d9deba5b523a26 Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Sat, 18 Apr 2020 12:17:14 +0200 Subject: [PATCH] test: fix chat Change way of clicking the settings button, and use stick-to-screen button is second test --- tests/frontend/specs/chat.js | 76 +++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 36 deletions(-) diff --git a/tests/frontend/specs/chat.js b/tests/frontend/specs/chat.js index e48dad8b0..8eaf08a95 100644 --- a/tests/frontend/specs/chat.js +++ b/tests/frontend/specs/chat.js @@ -75,56 +75,60 @@ describe("Chat messages and UI", function(){ //get the chat selector var $stickychatCheckbox = chrome$("#options-stickychat"); - //select chat always on screen and fire change event - $stickychatCheckbox.attr('selected','selected'); - $stickychatCheckbox.change(); - $stickychatCheckbox.click(); + //select chat always on screen + if (!$stickychatCheckbox.is(':checked')) { + $stickychatCheckbox.click(); + } - //check if chat changed to get the stickychat Class - var $chatbox = chrome$("#chatbox"); - var hasStickyChatClass = $chatbox.hasClass("stickyChat"); - expect(hasStickyChatClass).to.be(true); + // due to animation, we need to make some timeout... + setTimeout(function() { + //check if chat changed to get the stickychat Class + var $chatbox = chrome$("#chatbox"); + var hasStickyChatClass = $chatbox.hasClass("stickyChat"); + expect(hasStickyChatClass).to.be(true); - //select chat always on screen and fire change event - $stickychatCheckbox.attr('selected','selected'); - $stickychatCheckbox.change(); - $stickychatCheckbox.click(); + // select chat always on screen and fire change event + $stickychatCheckbox.click(); + + setTimeout(function() { + //check if chat changed to remove the stickychat Class + var hasStickyChatClass = $chatbox.hasClass("stickyChat"); + expect(hasStickyChatClass).to.be(false); + + done(); + }, 10) + }, 10) - //check if chat changed to remove the stickychat Class - var hasStickyChatClass = $chatbox.hasClass("stickyChat"); - expect(hasStickyChatClass).to.be(false); - done(); }); it("makes chat stick to right side of the screen then makes it one step smaller", function(done) { var inner$ = helper.padInner$; var chrome$ = helper.padChrome$; - //click on the settings button to make settings visible - var $settingsButton = chrome$(".buttonicon-settings"); - $settingsButton.click(); + // open chat + chrome$('#chaticon').click(); - //get the chat selector - var $stickychatCheckbox = chrome$("#options-stickychat"); + // select chat always on screen from chatbox + chrome$('.stick-to-screen-btn').click(); - //select chat always on screen and fire change event - $stickychatCheckbox.attr('selected','selected'); - $stickychatCheckbox.change(); - $stickychatCheckbox.click(); + // due to animation, we need to make some timeout... + setTimeout(function() { + //check if chat changed to get the stickychat Class + var $chatbox = chrome$("#chatbox"); + var hasStickyChatClass = $chatbox.hasClass("stickyChat"); + expect(hasStickyChatClass).to.be(true); - //check if chat changed to get the stickychat Class - var $chatbox = chrome$("#chatbox"); - var hasStickyChatClass = $chatbox.hasClass("stickyChat"); - expect(hasStickyChatClass).to.be(true); + // select chat always on screen and fire change event + chrome$('#titlecross').click(); - //select chat always on screen and fire change event - chrome$('#titlecross').click(); + setTimeout(function() { + //check if chat changed to remove the stickychat Class + var hasStickyChatClass = $chatbox.hasClass("stickyChat"); + expect(hasStickyChatClass).to.be(false); - //check if chat changed to remove the stickychat Class - var hasStickyChatClass = $chatbox.hasClass("stickyChat"); - expect(hasStickyChatClass).to.be(false); - - done(); + done(); + }, 10) + }, 10) }); });