test: fix chat

Change way of clicking the settings button, and use stick-to-screen button is second test
This commit is contained in:
Sebastian Castro 2020-04-18 12:17:14 +02:00 committed by muxator
parent 87fb23149d
commit 7a6d212e17

View file

@ -75,56 +75,60 @@ describe("Chat messages and UI", function(){
//get the chat selector //get the chat selector
var $stickychatCheckbox = chrome$("#options-stickychat"); var $stickychatCheckbox = chrome$("#options-stickychat");
//select chat always on screen and fire change event //select chat always on screen
$stickychatCheckbox.attr('selected','selected'); if (!$stickychatCheckbox.is(':checked')) {
$stickychatCheckbox.change();
$stickychatCheckbox.click(); $stickychatCheckbox.click();
}
// due to animation, we need to make some timeout...
setTimeout(function() {
//check if chat changed to get the stickychat Class //check if chat changed to get the stickychat Class
var $chatbox = chrome$("#chatbox"); var $chatbox = chrome$("#chatbox");
var hasStickyChatClass = $chatbox.hasClass("stickyChat"); var hasStickyChatClass = $chatbox.hasClass("stickyChat");
expect(hasStickyChatClass).to.be(true); expect(hasStickyChatClass).to.be(true);
//select chat always on screen and fire change event // select chat always on screen and fire change event
$stickychatCheckbox.attr('selected','selected');
$stickychatCheckbox.change();
$stickychatCheckbox.click(); $stickychatCheckbox.click();
setTimeout(function() {
//check if chat changed to remove the stickychat Class //check if chat changed to remove the stickychat Class
var hasStickyChatClass = $chatbox.hasClass("stickyChat"); var hasStickyChatClass = $chatbox.hasClass("stickyChat");
expect(hasStickyChatClass).to.be(false); expect(hasStickyChatClass).to.be(false);
done(); done();
}, 10)
}, 10)
}); });
it("makes chat stick to right side of the screen then makes it one step smaller", function(done) { it("makes chat stick to right side of the screen then makes it one step smaller", function(done) {
var inner$ = helper.padInner$; var inner$ = helper.padInner$;
var chrome$ = helper.padChrome$; var chrome$ = helper.padChrome$;
//click on the settings button to make settings visible // open chat
var $settingsButton = chrome$(".buttonicon-settings"); chrome$('#chaticon').click();
$settingsButton.click();
//get the chat selector // select chat always on screen from chatbox
var $stickychatCheckbox = chrome$("#options-stickychat"); 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 //check if chat changed to get the stickychat Class
var $chatbox = chrome$("#chatbox"); var $chatbox = chrome$("#chatbox");
var hasStickyChatClass = $chatbox.hasClass("stickyChat"); var hasStickyChatClass = $chatbox.hasClass("stickyChat");
expect(hasStickyChatClass).to.be(true); expect(hasStickyChatClass).to.be(true);
//select chat always on screen and fire change event // select chat always on screen and fire change event
chrome$('#titlecross').click(); chrome$('#titlecross').click();
setTimeout(function() {
//check if chat changed to remove the stickychat Class //check if chat changed to remove the stickychat Class
var hasStickyChatClass = $chatbox.hasClass("stickyChat"); var hasStickyChatClass = $chatbox.hasClass("stickyChat");
expect(hasStickyChatClass).to.be(false); expect(hasStickyChatClass).to.be(false);
done(); done();
}, 10)
}, 10)
}); });
}); });