mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-25 01:46:14 -04:00
tests: chat: Consolidate all frontend chat tests
This commit is contained in:
parent
16f84ba3d3
commit
8d062b254e
3 changed files with 57 additions and 57 deletions
|
@ -57,46 +57,4 @@ describe('change user color', function () {
|
||||||
expect($colorPickerPreview.css('background-color')).to.be(testColorRGB);
|
expect($colorPickerPreview.css('background-color')).to.be(testColorRGB);
|
||||||
expect($userSwatch.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();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -17,19 +17,4 @@ describe('change username value', function () {
|
||||||
await helper.toggleUserList();
|
await helper.toggleUserList();
|
||||||
await helper.waitForPromise(() => helper.usernameField().val() === '😃');
|
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;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -113,4 +113,61 @@ describe('Chat messages and UI', function () {
|
||||||
// chat should be visible.
|
// chat should be visible.
|
||||||
expect(chaticon.is(':visible')).to.be(true);
|
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;
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue