diff --git a/src/tests/frontend/specs/change_user_color.js b/src/tests/frontend/specs/change_user_color.js index 6d73fb805..f1cbd5493 100644 --- a/src/tests/frontend/specs/change_user_color.js +++ b/src/tests/frontend/specs/change_user_color.js @@ -57,46 +57,4 @@ describe('change user color', function () { expect($colorPickerPreview.css('background-color')).to.be(testColorRGB); expect($userSwatch.css('background-color')).to.be(testColorRGB); }); - - it('Own user color is shown when you enter a chat', function (done) { - this.timeout(1000); - const chrome$ = helper.padChrome$; - - const $colorOption = helper.padChrome$('#options-colorscheck'); - if (!$colorOption.is(':checked')) { - $colorOption.click(); - } - - // click on the settings button to make settings visible - const $userButton = chrome$('.buttonicon-showusers'); - $userButton.click(); - - const $userSwatch = chrome$('#myswatch'); - $userSwatch.click(); - - const fb = chrome$.farbtastic('#colorpicker'); - const $colorPickerSave = chrome$('#mycolorpickersave'); - - // Same color represented in two different ways - const testColorHash = '#abcdef'; - const testColorRGB = 'rgb(171, 205, 239)'; - - fb.setColor(testColorHash); - $colorPickerSave.click(); - - // click on the chat button to make chat visible - const $chatButton = chrome$('#chaticon'); - $chatButton.click(); - const $chatInput = chrome$('#chatinput'); - $chatInput.sendkeys('O hi'); // simulate a keypress of typing user - $chatInput.sendkeys('{enter}'); - - // wait until the chat message shows up - helper.waitFor(() => chrome$('#chattext').children('p').length !== 0).done(() => { - const $firstChatMessage = chrome$('#chattext').children('p'); - // expect the first chat message to be of the user's color - expect($firstChatMessage.css('background-color')).to.be(testColorRGB); - done(); - }); - }); }); diff --git a/src/tests/frontend/specs/change_user_name.js b/src/tests/frontend/specs/change_user_name.js index b146a1281..28bf21dbb 100644 --- a/src/tests/frontend/specs/change_user_name.js +++ b/src/tests/frontend/specs/change_user_name.js @@ -17,19 +17,4 @@ describe('change username value', function () { await helper.toggleUserList(); await helper.waitForPromise(() => helper.usernameField().val() === '😃'); }); - - it('Own user name is shown when you enter a chat', async function () { - this.timeout(10000); - await helper.toggleUserList(); - await helper.setUserName('😃'); - - await helper.showChat(); - await helper.sendChatMessage('O hi{enter}'); - - await helper.waitForPromise(() => { - // username:hours:minutes text - const chatText = helper.chatTextParagraphs().text(); - return chatText.indexOf('😃') === 0; - }); - }); }); diff --git a/src/tests/frontend/specs/chat.js b/src/tests/frontend/specs/chat.js index 82527f372..94fdb2b28 100644 --- a/src/tests/frontend/specs/chat.js +++ b/src/tests/frontend/specs/chat.js @@ -113,4 +113,61 @@ describe('Chat messages and UI', function () { // chat should be visible. expect(chaticon.is(':visible')).to.be(true); }); + + it('Own user color is shown when you enter a chat', function (done) { + this.timeout(1000); + const chrome$ = helper.padChrome$; + + const $colorOption = helper.padChrome$('#options-colorscheck'); + if (!$colorOption.is(':checked')) { + $colorOption.click(); + } + + // click on the settings button to make settings visible + const $userButton = chrome$('.buttonicon-showusers'); + $userButton.click(); + + const $userSwatch = chrome$('#myswatch'); + $userSwatch.click(); + + const fb = chrome$.farbtastic('#colorpicker'); + const $colorPickerSave = chrome$('#mycolorpickersave'); + + // Same color represented in two different ways + const testColorHash = '#abcdef'; + const testColorRGB = 'rgb(171, 205, 239)'; + + fb.setColor(testColorHash); + $colorPickerSave.click(); + + // click on the chat button to make chat visible + const $chatButton = chrome$('#chaticon'); + $chatButton.click(); + const $chatInput = chrome$('#chatinput'); + $chatInput.sendkeys('O hi'); // simulate a keypress of typing user + $chatInput.sendkeys('{enter}'); + + // wait until the chat message shows up + helper.waitFor(() => chrome$('#chattext').children('p').length !== 0).done(() => { + const $firstChatMessage = chrome$('#chattext').children('p'); + // expect the first chat message to be of the user's color + expect($firstChatMessage.css('background-color')).to.be(testColorRGB); + done(); + }); + }); + + it('Own user name is shown when you enter a chat', async function () { + this.timeout(10000); + await helper.toggleUserList(); + await helper.setUserName('😃'); + + await helper.showChat(); + await helper.sendChatMessage('O hi{enter}'); + + await helper.waitForPromise(() => { + // username:hours:minutes text + const chatText = helper.chatTextParagraphs().text(); + return chatText.indexOf('😃') === 0; + }); + }); });