Do not use token for inline code

pull/6158/head
Maki Nishifuji 8 years ago
commit 54bcb9d9d5
  1. 1
      .eslintrc
  2. 1
      .meteor/versions
  3. 4
      client/startup/startup.js
  4. 1
      package.json
  5. 3
      packages/rocketchat-channel-settings/client/views/channelSettings.coffee
  6. 2
      packages/rocketchat-emoji/keyboardFix.js
  7. 2
      packages/rocketchat-file-upload/lib/FileUpload.js
  8. 1
      packages/rocketchat-i18n/i18n/en.i18n.json
  9. 2
      packages/rocketchat-i18n/package.js
  10. 4
      packages/rocketchat-integrations/client/views/integrationsIncoming.js
  11. 3
      packages/rocketchat-integrations/client/views/integrationsOutgoing.js
  12. 4
      packages/rocketchat-integrations/client/views/integrationsOutgoingHistory.js
  13. 1
      packages/rocketchat-integrations/package.js
  14. 2
      packages/rocketchat-lib/server/methods/updateMessage.js
  15. 76
      packages/rocketchat-livechat/app/client/views/livechatWindow.html
  16. 3
      packages/rocketchat-livechat/app/client/views/livechatWindow.js
  17. 2
      packages/rocketchat-livechat/client/collections/livechatOfficeHour.js
  18. 2
      packages/rocketchat-livechat/server/lib/OfficeClock.js
  19. 2
      packages/rocketchat-livechat/server/methods/saveOfficeHours.js
  20. 4
      packages/rocketchat-livechat/server/models/LivechatExternalMessage.js
  21. 2
      packages/rocketchat-livechat/server/publications/livechatOfficeHours.js
  22. 1
      packages/rocketchat-markdown/package.js
  23. 14
      packages/rocketchat-markdown/parser/marked/marked.js
  24. 2
      packages/rocketchat-markdown/parser/original/code.js
  25. 2
      packages/rocketchat-slashcommands-inviteall/client.js
  26. 2
      packages/rocketchat-theme/client/imports/base.less
  27. 12
      packages/rocketchat-ui-account/account/accountProfile.coffee
  28. 12
      packages/rocketchat-ui-master/master/main.coffee
  29. 2
      packages/rocketchat-ui-message/message/message.html
  30. 8
      packages/rocketchat-ui-sidenav/client/createCombinedFlex.html
  31. 2
      packages/rocketchat-ui/lib/fileUpload.coffee
  32. 2
      server/methods/OEmbedCacheCleanup.js
  33. 2
      tests/data/channel.js
  34. 2
      tests/data/interactions.js
  35. 2
      tests/end-to-end/ui/02-forgot-password.js
  36. 44
      tests/end-to-end/ui/04-main-elements-render.js
  37. 6
      tests/end-to-end/ui/06-messaging.js
  38. 35
      tests/end-to-end/ui/08-resolutions.js
  39. 99
      tests/end-to-end/ui/09-channel.js
  40. 23
      tests/end-to-end/ui/10-user-preferences.js
  41. 4
      tests/end-to-end/ui/11-admin.js
  42. 7
      tests/pageobjects/Page.js
  43. 113
      tests/pageobjects/flex-tab.page.js
  44. 15
      tests/pageobjects/global.js
  45. 6
      tests/pageobjects/main-content.page.js
  46. 3
      tests/pageobjects/preferences-main-content.page.js
  47. 18
      tests/pageobjects/side-nav.page.js

@ -55,6 +55,7 @@
"space-before-function-paren": [2, "never"],
"space-before-blocks": [2, "always"],
"indent": [2, "tab", {"SwitchCase": 1}],
"eol-last": [2, "always"],
"comma-dangle": [2, "never"],
"keyword-spacing": 2,
"block-spacing": 2,

@ -220,7 +220,6 @@ service-configuration@1.0.11
session@1.1.7
sha@1.0.9
shell-server@0.2.2
simple:highlight.js@1.2.0
simple:json-routes@2.1.0
smoral:sweetalert@1.1.1
spacebars@1.0.13

@ -2,6 +2,10 @@
import moment from 'moment';
import toastr from 'toastr';
import hljs from 'highlight.js';
import 'highlight.js/styles/github.css';
hljs.initHighlightingOnLoad();
if (window.DISABLE_ANIMATION) {
toastr.options.timeOut = 1;

@ -64,6 +64,7 @@
"bcrypt": "^1.0.2",
"codemirror": "^5.23.0",
"file-type": "^4.1.0",
"highlight.js": "^9.9.0",
"jquery": "^3.1.1",
"mime-db": "^1.26.0",
"mime-type": "^3.0.4",

@ -195,11 +195,14 @@ Template.channelSettings.onCreated ->
reactWhenReadOnly:
type: 'boolean'
label: 'React_when_read_only'
processing: new ReactiveVar(false)
canView: (room) => room.t isnt 'd' and room.ro
canEdit: (room) => RocketChat.authz.hasAllPermission('set-react-when-readonly', room._id)
save: (value, room) ->
@processing.set(true)
Meteor.call 'saveRoomSettings', room._id, 'reactWhenReadOnly', value, (err, result) ->
return handleError err if err
@processing.set(false)
toastr.success TAPi18n.__ 'React_when_read_only_changed_successfully'
archived:

@ -11,4 +11,4 @@ if (Meteor.isCordova) {
RocketChat.EmojiPicker.setPosition();
}
});
}
}

@ -57,4 +57,4 @@ FileUpload = {
RocketChat.settings.get('FileUpload_MaxFileSize', function(key, value) {
maxFileSize = value;
});
});

@ -1502,6 +1502,7 @@
"Unnamed": "Unnamed",
"Unpin_Message": "Unpin Message",
"Unread_Alert": "Unread Alert",
"Unread_Messages": "Unread Messages",
"Unread_Rooms": "Unread Rooms",
"Unread_Rooms_Mode": "Unread Rooms Mode",
"Unstar_Message": "Remove Star",

@ -17,4 +17,4 @@ Package.onUse(function(api) {
});
api.use('tap:i18n@1.8.2');
});
});

@ -1,4 +1,6 @@
/* global ChatIntegrations, hljs */
/* global ChatIntegrations */
import hljs from 'highlight.js';
import toastr from 'toastr';
Template.integrationsIncoming.onCreated(function _incomingIntegrationsOnCreated() {

@ -1,5 +1,6 @@
/* global ChatIntegrations, hljs */
/* global ChatIntegrations */
import hljs from 'highlight.js';
import toastr from 'toastr';
Template.integrationsOutgoing.onCreated(function _integrationsOutgoingOnCreated() {

@ -1,4 +1,6 @@
/* global ChatIntegrations, ChatIntegrationHistory, hljs */
/* global ChatIntegrations, ChatIntegrationHistory */
import hljs from 'highlight.js';
import moment from 'moment';
import toastr from 'toastr';

@ -11,7 +11,6 @@ Package.onUse(function(api) {
api.use('underscore');
api.use('ecmascript');
api.use('babel-compiler');
api.use('simple:highlight.js');
api.use('rocketchat:lib');
api.use('rocketchat:authorization');
api.use('rocketchat:api');

@ -33,6 +33,8 @@ Meteor.methods({
}
}
message.u = originalMessage.u;
return RocketChat.updateMessage(message, Meteor.user());
}
});

@ -1,50 +1,52 @@
<template name="livechatWindow">
{{#if livechatStarted}}
<div class="livechat-room {{#if popoutActive}}popout{{/if}}">
<div class="title" style="background-color:{{color}}; color: {{fontColor}}">
<div class="toolbar">
&nbsp;
{{#unless popoutActive}}
{{#if isOpened}}
<svg class="minimize" title="Minimize" viewBox="0 0 448 448" xmlns="http://www.w3.org/2000/svg">
<path d="M448 328v48c0 22-18 40-40 40h-368c-22 0-40-18-40-40v-48c0-22 18-40 40-40h368c22 0 40 18 40 40z"></path>
{{#if showWidget}}
<div class="livechat-room {{#if popoutActive}}popout{{/if}}">
<div class="title" style="background-color:{{color}}; color: {{fontColor}}">
<div class="toolbar">
&nbsp;
{{#unless popoutActive}}
{{#if isOpened}}
<svg class="minimize" title="Minimize" viewBox="0 0 448 448" xmlns="http://www.w3.org/2000/svg">
<path d="M448 328v48c0 22-18 40-40 40h-368c-22 0-40-18-40-40v-48c0-22 18-40 40-40h368c22 0 40 18 40 40z"></path>
</svg>
{{else}}
<svg class="maximize" title="Maximize" viewBox="0 0 448 448" xmlns="http://www.w3.org/2000/svg">
<path d="M64 352h320v-192h-320v192zM448 72v304c0 22-18 40-40 40h-368c-22 0-40-18-40-40v-304c0-22 18-40 40-40h368c22 0 40 18 40 40z"></path>
</svg>
{{/if}}
{{/unless}}
{{#if soundActive}}
<svg class="sound" title="Toggle notification sound" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg">
<path d="M912 1696q0-16-16-16-59 0-101.5-42.5t-42.5-101.5q0-16-16-16t-16 16q0 73 51.5 124.5t124.5 51.5q16 0 16-16zm816-288q0 52-38 90t-90 38h-448q0 106-75 181t-181 75-181-75-75-181h-448q-52 0-90-38t-38-90q50-42 91-88t85-119.5 74.5-158.5 50-206 19.5-260q0-152 117-282.5t307-158.5q-8-19-8-39 0-40 28-68t68-28 68 28 28 68q0 20-8 39 190 28 307 158.5t117 282.5q0 139 19.5 260t50 206 74.5 158.5 85 119.5 91 88z" />
</svg>
{{else}}
<svg class="maximize" title="Maximize" viewBox="0 0 448 448" xmlns="http://www.w3.org/2000/svg">
<path d="M64 352h320v-192h-320v192zM448 72v304c0 22-18 40-40 40h-368c-22 0-40-18-40-40v-304c0-22 18-40 40-40h368c22 0 40 18 40 40z"></path>
<svg class="sound" title="Toggle notification sound" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg">
<path d="M1430 852q61 356 298 556 0 52-38 90t-90 38h-448q0 106-75 181t-181 75-180.5-74.5-75.5-180.5zm-534 860q16 0 16-16t-16-16q-59 0-101.5-42.5t-42.5-101.5q0-16-16-16t-16 16q0 73 51.5 124.5t124.5 51.5zm1002-1600q8 10 7.5 23.5t-10.5 22.5l-1872 1622q-10 8-23.5 7t-21.5-11l-84-96q-8-10-7.5-23.5t10.5-21.5l186-161q-19-32-19-66 50-42 91-88t85-119.5 74.5-158.5 50-206 19.5-260q0-152 117-282.5t307-158.5q-8-19-8-39 0-40 28-68t68-28 68 28 28 68q0 20-8 39 124 18 219 82.5t148 157.5l418-363q10-8 23.5-7t21.5 11z" />
</svg>
{{/if}}
{{/unless}}
{{#if soundActive}}
<svg class="sound" title="Toggle notification sound" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg">
<path d="M912 1696q0-16-16-16-59 0-101.5-42.5t-42.5-101.5q0-16-16-16t-16 16q0 73 51.5 124.5t124.5 51.5q16 0 16-16zm816-288q0 52-38 90t-90 38h-448q0 106-75 181t-181 75-181-75-75-181h-448q-52 0-90-38t-38-90q50-42 91-88t85-119.5 74.5-158.5 50-206 19.5-260q0-152 117-282.5t307-158.5q-8-19-8-39 0-40 28-68t68-28 68 28 28 68q0 20-8 39 190 28 307 158.5t117 282.5q0 139 19.5 260t50 206 74.5 158.5 85 119.5 91 88z" />
</svg>
{{#unless popoutActive}}
<svg class="popout" aria-label="{{_ "Open in a new window"}}" viewBox="0 0 448 448" xmlns="http://www.w3.org/2000/svg">
<path d="M320 232v-120c0-8.75-7.25-16-16-16h-120c-6.5 0-12.25 4-14.75 9.75-2.5 6-1.25 13 3.5 17.5l36 36-133.5 133.5c-6.25 6.25-6.25 16.25 0 22.5l25.5 25.5c6.25 6.25 16.25 6.25 22.5 0l133.5-133.5 36 36c3 3.25 7 4.75 11.25 4.75 2 0 4.25-0.5 6.25-1.25 5.75-2.5 9.75-8.25 9.75-14.75zM384 104v240c0 39.75-32.25 72-72 72h-240c-39.75 0-72-32.25-72-72v-240c0-39.75 32.25-72 72-72h240c39.75 0 72 32.25 72 72z"></path>
</svg>
{{/unless}}
</div>
<h1>{{title}}</h1>
</div>
{{#if livechatOnline}}
{{#if showRegisterForm}}
{{> register}}
{{else}}
<svg class="sound" title="Toggle notification sound" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg">
<path d="M1430 852q61 356 298 556 0 52-38 90t-90 38h-448q0 106-75 181t-181 75-180.5-74.5-75.5-180.5zm-534 860q16 0 16-16t-16-16q-59 0-101.5-42.5t-42.5-101.5q0-16-16-16t-16 16q0 73 51.5 124.5t124.5 51.5zm1002-1600q8 10 7.5 23.5t-10.5 22.5l-1872 1622q-10 8-23.5 7t-21.5-11l-84-96q-8-10-7.5-23.5t10.5-21.5l186-161q-19-32-19-66 50-42 91-88t85-119.5 74.5-158.5 50-206 19.5-260q0-152 117-282.5t307-158.5q-8-19-8-39 0-40 28-68t68-28 68 28 28 68q0 20-8 39 124 18 219 82.5t148 157.5l418-363q10-8 23.5-7t21.5 11z" />
</svg>
{{> messages}}
{{/if}}
{{#unless popoutActive}}
<svg class="popout" aria-label="{{_ "Open in a new window"}}" viewBox="0 0 448 448" xmlns="http://www.w3.org/2000/svg">
<path d="M320 232v-120c0-8.75-7.25-16-16-16h-120c-6.5 0-12.25 4-14.75 9.75-2.5 6-1.25 13 3.5 17.5l36 36-133.5 133.5c-6.25 6.25-6.25 16.25 0 22.5l25.5 25.5c6.25 6.25 16.25 6.25 22.5 0l133.5-133.5 36 36c3 3.25 7 4.75 11.25 4.75 2 0 4.25-0.5 6.25-1.25 5.75-2.5 9.75-8.25 9.75-14.75zM384 104v240c0 39.75-32.25 72-72 72h-240c-39.75 0-72-32.25-72-72v-240c0-39.75 32.25-72 72-72h240c39.75 0 72 32.25 72 72z"></path>
</svg>
{{/unless}}
</div>
<h1>{{title}}</h1>
</div>
{{#if livechatOnline}}
{{#if showRegisterForm}}
{{> register}}
{{else}}
{{> messages}}
<div class="offline">
{{> offlineForm (offlineData)}}
</div>
{{/if}}
{{else}}
<div class="offline">
{{> offlineForm (offlineData)}}
</div>
{{/if}}
{{> poweredBy }}
</div>
{{> poweredBy }}
</div>
{{/if}}
{{/if}}
{{#if videoCalling}}
{{> videoCall}}

@ -44,6 +44,9 @@ Template.livechatWindow.helpers({
},
isOpened() {
return Livechat.isWidgetOpened();
},
showWidget() {
return Livechat.online || Livechat.displayOfflineForm;
}
});

@ -1 +1 @@
this.LivechatOfficeHour = new Mongo.Collection('rocketchat_livechat_office_hour');
this.LivechatOfficeHour = new Mongo.Collection('rocketchat_livechat_office_hour');

@ -7,4 +7,4 @@ Meteor.setInterval(function() {
RocketChat.models.Users.closeOffice();
}
}
}, 60000);
}, 60000);

@ -2,4 +2,4 @@ Meteor.methods({
'livechat:saveOfficeHours'(day, start, finish, open) {
RocketChat.models.LivechatOfficeHour.updateHours(day, start, finish, open);
}
});
});

@ -1,6 +1,10 @@
class LivechatExternalMessage extends RocketChat.models._Base {
constructor() {
super('livechat_external_message');
if (Meteor.isClient) {
this._initModel('livechat_external_message');
}
}
// FIND

@ -4,4 +4,4 @@ Meteor.publish('livechat:officeHour', function() {
}
return RocketChat.models.LivechatOfficeHour.find();
});
});

@ -14,7 +14,6 @@ Package.onUse(function(api) {
'ecmascript',
'underscore',
'templating',
'simple:highlight.js',
'rocketchat:lib'
]);

@ -1,6 +1,6 @@
import { Random } from 'meteor/random';
import { _ } from 'meteor/underscore';
import { hljs } from 'meteor/simple:highlight.js';
import hljs from 'highlight.js';
import _marked from 'marked';
const renderer = new _marked.Renderer();
@ -44,19 +44,9 @@ renderer.code = function(code, lang, escaped) {
};
renderer.codespan = function(text) {
text = `<code class="code-colors inline">${text}</code>`;
if (_.isString(msg)) {
return text;
}
const token = `=&=${Random.id()}=&=`;
msg.tokens.push({
token,
text
});
return token;
return `<code class="code-colors inline">${text}</code>`;
};
renderer.blockquote = function(quote) {
return `<blockquote class="background-transparent-darker-before">${quote}</blockquote>`;
};

@ -4,7 +4,7 @@
*/
import { Random } from 'meteor/random';
import { _ } from 'meteor/underscore';
import { hljs } from 'meteor/simple:highlight.js';
import hljs from 'highlight.js';
const inlineCode = (message) => {
message.html = message.html.replace(/(^|&gt;|[ >_*~])\`([^`\r\n]+)\`([<_*~]|\B|\b|$)/gm, (match, p1, p2, p3) => {

@ -5,4 +5,4 @@ RocketChat.slashCommands.add('invite-all-to', undefined, {
RocketChat.slashCommands.add('invite-all-from', undefined, {
description: 'Invite_user_to_join_channel_all_from',
params: '#room'
});
});

@ -202,7 +202,7 @@ blockquote {
}
&::after {
content: "unread messages";
content: attr(data-unread-text);
display: block;
position: absolute;
right: 0;

@ -117,7 +117,9 @@ Template.accountProfile.events
type: "input",
inputType: "password",
showCancelButton: true,
closeOnConfirm: false
closeOnConfirm: false,
confirmButtonText: t('Save'),
cancelButtonText: t('Cancel')
, (typedPassword) =>
if typedPassword
@ -144,7 +146,9 @@ Template.accountProfile.events
type: "input",
inputType: "password",
showCancelButton: true,
closeOnConfirm: false
closeOnConfirm: false,
confirmButtonText: t('Delete')
cancelButtonText: t('Cancel')
, (typedPassword) =>
if typedPassword
@ -165,7 +169,9 @@ Template.accountProfile.events
text: t("If_you_are_sure_type_in_your_username"),
type: "input",
showCancelButton: true,
closeOnConfirm: false
closeOnConfirm: false,
confirmButtonText: t('Delete')
cancelButtonText: t('Cancel')
, (deleteConfirmation) =>
if deleteConfirmation is Meteor.user()?.username

@ -34,10 +34,13 @@ Template.body.onRendered ->
return
if /input|textarea|select/i.test(target.tagName)
return
$inputMessage = $('textarea.input-message')
if 0 == $inputMessage.length
if target.id is 'pswp'
return
$inputMessage.focus()
inputMessage = $('textarea.input-message')
if inputMessage.length is 0
return
inputMessage.focus()
$(document.body).on 'click', 'a', (e) ->
link = e.currentTarget
@ -226,7 +229,10 @@ Template.main.onRendered ->
$('.input-message').focus()
, 100
Tracker.autorun ->
swal.setDefaults({cancelButtonText: t('Cancel')})
prefs = Meteor.user()?.settings?.preferences
if prefs?.hideUsernames
$(document.body).on('mouseleave', 'button.thumb', (e) ->

@ -47,7 +47,7 @@
<i class="icon-cog message-cog" aria-label="{{_ "Actions"}}"></i>
</div>
</span>
<div class="body color-primary-font-color {{system true}}" dir="auto">
<div class="body color-primary-font-color {{system true}}" dir="auto" data-unread-text="{{_ "Unread_Messages"}}">
{{{body}}}
{{#if hasOembed}}
{{#each urls}}

@ -35,7 +35,7 @@
</ul>
</div>
{{#if error.fields}}
<div class="input-error error-color">
<div class="input-error">
<strong>{{_ "Oops!"}}</strong>
{{#each error.fields}}
<p>{{_ "The_field_is_required" .}}</p>
@ -43,19 +43,19 @@
</div>
{{/if}}
{{#if error.invalid}}
<div class="input-error error-color">
<div class="input-error">
<strong>{{_ "Oops!"}}</strong>
{{{_ "Invalid_room_name" roomName}}}
</div>
{{/if}}
{{#if error.duplicate}}
<div class="input-error error-color">
<div class="input-error">
<strong>{{_ "Oops!"}}</strong>
{{{_ "Duplicate_channel_name" roomName}}}
</div>
{{/if}}
{{#if error.archivedduplicate}}
<div class="input-error error-color">
<div class="input-error">
<strong>{{_ "Oops!"}}</strong>
{{{_ "Duplicate_archived_channel_name" roomName}}}
</div>

@ -84,6 +84,8 @@ readAsArrayBuffer = (file, callback) ->
showCancelButton: true
closeOnConfirm: false
closeOnCancel: false
confirmButtonText: t('Send')
cancelButtonText: t('Cancel')
html: true
, (isConfirm) ->
consume()

@ -14,4 +14,4 @@ Meteor.methods({
message: 'cache_cleared'
};
}
});
});

@ -1,2 +1,2 @@
export const publicChannelName = 'channel-test-'+Date.now();
export const privateChannelName = 'private-channel-test-'+Date.now();
export const privateChannelName = 'private-channel-test-'+Date.now();

@ -1,2 +1,2 @@
export const targetUser = 'rocket.cat';
export const imgURL = './public/images/logo/1024x1024.png';
export const imgURL = './public/images/logo/1024x1024.png';

@ -2,7 +2,7 @@
import loginPage from '../../pageobjects/login.page';
describe.skip('register', () => {
describe('register', () => {
before(() => {
loginPage.open();
loginPage.gotToForgotPassword();

@ -49,10 +49,6 @@ describe('Main Elements Render', function() {
it('should show spotlight search bar', () => {
sideNav.spotlightSearch.isVisible().should.be.true;
});
it.skip('should not show eye icon on general', () => {
sideNav.channelHoverIcon.isVisible().should.be.true;
});
});
describe('spotlight search render', () => {
@ -228,11 +224,11 @@ describe('Main Elements Render', function() {
});
describe('Room Info Tab', () => {
before(()=> {
flexTab.channelTab.click();
flexTab.operateFlexTab('info', true);
});
after(()=> {
flexTab.channelTab.click();
flexTab.operateFlexTab('info', false);
});
it('should show the room info button', () => {
@ -253,11 +249,11 @@ describe('Main Elements Render', function() {
describe('Search Tab', () => {
before(()=> {
flexTab.searchTab.click();
flexTab.operateFlexTab('search', true);
});
after(()=> {
flexTab.searchTab.click();
flexTab.operateFlexTab('search', false);
});
it('should show the message search button', () => {
@ -271,37 +267,35 @@ describe('Main Elements Render', function() {
describe('Members Tab', () => {
before(()=> {
flexTab.membersTab.click();
flexTab.operateFlexTab('members', true);
});
after(()=> {
flexTab.membersTab.click();
flexTab.operateFlexTab('members', false);
});
it('should show the members tab button', () => {
flexTab.membersTab.waitForVisible(5000);
flexTab.membersTab.isVisible().should.be.true;
});
it('should show the members content', () => {
flexTab.membersTabContent.waitForVisible(5000);
flexTab.membersTabContent.isVisible().should.be.true;
});
it.skip('should show the members search bar', () => {
flexTab.userSearchBar.isVisible().should.be.true;
});
it.skip('should show the show all link', () => {
it('should show the show all link', () => {
flexTab.showAll.isVisible().should.be.true;
});
});
describe('Notifications Tab', () => {
before(()=> {
flexTab.notificationsTab.click();
flexTab.operateFlexTab('notifications', true);
});
after(()=> {
flexTab.notificationsTab.click();
flexTab.operateFlexTab('notifications', false);
});
it('should show the notifications button', () => {
@ -315,11 +309,11 @@ describe('Main Elements Render', function() {
describe('Files Tab', () => {
before(()=> {
flexTab.filesTab.click();
flexTab.operateFlexTab('files', true);
});
after(()=> {
flexTab.filesTab.click();
flexTab.operateFlexTab('files', false);
});
it('should show the files button', () => {
@ -333,11 +327,11 @@ describe('Main Elements Render', function() {
describe('Mentions Tab', () => {
before(()=> {
flexTab.mentionsTab.click();
flexTab.operateFlexTab('mentions', true);
});
after(()=> {
flexTab.mentionsTab.click();
flexTab.operateFlexTab('mentions', false);
});
it('should show the mentions button', () => {
@ -351,11 +345,11 @@ describe('Main Elements Render', function() {
describe('Starred Messages Tab', () => {
before(()=> {
flexTab.starredTab.click();
flexTab.operateFlexTab('starred', true);
});
after(()=> {
flexTab.starredTab.click();
flexTab.operateFlexTab('starred', false);
});
it('should show the starred messages button', () => {
@ -369,11 +363,11 @@ describe('Main Elements Render', function() {
describe('Pinned Messages Tab', () => {
before(()=> {
flexTab.pinnedTab.click();
flexTab.operateFlexTab('pinned', true);
});
after(()=> {
flexTab.pinnedTab.click();
flexTab.operateFlexTab('pinned', false);
});
it('should show the pinned button', () => {

@ -170,8 +170,8 @@ function messageActionsTest() {
mainContent.sendBtn.click();
});
it.skip('checks if the message was replied', () => {
mainContent.lastMessageTextAttachment.waitForExist(5000);
it('checks if the message was replied', () => {
mainContent.lastMessageTextAttachment.waitForVisible(5000);
mainContent.lastMessageTextAttachment.getText().should.equal(mainContent.beforeLastMessage.getText());
});
});
@ -308,7 +308,7 @@ describe('Messaging in different channels', () => {
describe('Messaging in created direct message', () => {
before(()=>{
if (!directMessageCreated) {
sideNav.startDirectMessage(targetUser);
sideNav.searchChannel(targetUser);
setDirectMessageCreated(true);
console.log(' Direct message not found, creating one...');
}

@ -1,24 +1,27 @@
/* eslint-env mocha */
/* eslint-disable func-names, prefer-arrow-callback */
import page from '../../pageobjects/Page';
import Global from '../../pageobjects/global';
import mainContent from '../../pageobjects/main-content.page';
import sideNav from '../../pageobjects/side-nav.page';
import {username, email, password} from '../../data/user.js';
import {checkIfUserIsValid} from '../../data/checks';
describe.skip('resolutions tests', ()=> {
describe('resolutions tests', ()=> {
describe('mobile render', ()=> {
before(()=> {
checkIfUserIsValid(username, email, password);
sideNav.getChannelFromList('general').waitForExist(5000);
sideNav.openChannel('general');
page.setWindowSize(650, 800);
Global.setWindowSize(650, 800);
});
after(()=> {
page.setWindowSize(1450, 900);
Global.setWindowSize(1450, 900);
sideNav.preferencesClose.waitForVisible(5000);
sideNav.preferencesClose.click();
sideNav.spotlightSearch.waitForVisible(5000);
});
describe('moving elements ', () => {
@ -27,7 +30,7 @@ describe.skip('resolutions tests', ()=> {
});
it('press the navbar button', () => {
sideNav.sideNavBtn.click();
sideNav.burgerBtn.click();
});
it('should open de sidenav', () => {
@ -43,18 +46,18 @@ describe.skip('resolutions tests', ()=> {
});
it('press the navbar button', () => {
sideNav.sideNavBtn.click();
sideNav.burgerBtn.click();
});
it('opens the user preferences screen', () => {
sideNav.accountBoxUserName.waitForVisible();
sideNav.accountBoxUserName.waitForVisible(5000);
sideNav.accountBoxUserName.click();
sideNav.account.waitForVisible();
sideNav.account.waitForVisible(5000);
sideNav.account.click();
});
it('press the preferences link', () => {
sideNav.preferences.waitForVisible();
sideNav.preferences.waitForVisible(5000);
sideNav.preferences.click();
});
@ -63,11 +66,11 @@ describe.skip('resolutions tests', ()=> {
});
it('press the navbar button', () => {
sideNav.sideNavBtn.click();
sideNav.burgerBtn.click();
});
it('press the profile link', () => {
sideNav.profile.waitForVisible();
sideNav.profile.waitForVisible(5000);
sideNav.profile.click();
});
@ -76,11 +79,11 @@ describe.skip('resolutions tests', ()=> {
});
it('press the navbar button', () => {
sideNav.sideNavBtn.click();
sideNav.burgerBtn.click();
});
it('press the avatar link', () => {
sideNav.avatar.waitForVisible();
sideNav.avatar.waitForVisible(5000);
sideNav.avatar.click();
});
@ -89,11 +92,7 @@ describe.skip('resolutions tests', ()=> {
});
it('press the navbar button', () => {
sideNav.sideNavBtn.click();
});
it('close the preferences menu', () => {
sideNav.preferencesClose.click();
sideNav.burgerBtn.click();
});
});
});

@ -123,20 +123,19 @@ describe('channel', ()=> {
describe('Adding a user to the room', () => {
before(()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
flexTab.membersTab.waitForVisible();
flexTab.membersTab.click();
flexTab.operateFlexTab('members', true);
});
after(()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
flexTab.membersTab.waitForVisible();
flexTab.membersTab.click();
flexTab.operateFlexTab('members', false);
});
it('add people to the room', () => {
@ -149,19 +148,19 @@ describe('channel', ()=> {
describe('Channel name edit', ()=> {
before(()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
flexTab.channelTab.waitForVisible();
flexTab.channelTab.click();
flexTab.operateFlexTab('info', true);
});
after(()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
flexTab.channelTab.waitForVisible(5000);
flexTab.operateFlexTab('info', false);
});
it('should show the old name', ()=> {
@ -191,17 +190,15 @@ describe('channel', ()=> {
describe('Channel topic edit', ()=> {
before(()=> {
flexTab.channelTab.waitForVisible();
flexTab.channelTab.click();
flexTab.operateFlexTab('info', true);
});
after(()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
flexTab.channelTab.waitForVisible();
flexTab.channelTab.click();
flexTab.operateFlexTab('info', false);
});
it('click the edit topic', ()=> {
@ -225,17 +222,15 @@ describe('channel', ()=> {
describe('Channel description edit', ()=> {
before(()=> {
flexTab.channelTab.waitForVisible();
flexTab.channelTab.click();
flexTab.operateFlexTab('info', true);
});
after(()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
flexTab.channelTab.waitForVisible();
flexTab.channelTab.click();
flexTab.operateFlexTab('info', false);
});
it('click the edit description', ()=> {
@ -259,23 +254,35 @@ describe('channel', ()=> {
});
describe('Members tab usage', () => {
describe('User muted', () => {
before(()=> {
flexTab.operateFlexTab('members', true);
});
after(()=> {
flexTab.operateFlexTab('members', false);
});
it('mute rocket cat', ()=> {
flexTab.muteUser(targetUser);
});
});
describe('Owner added', () => {
before(()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
flexTab.membersTab.waitForVisible();
flexTab.membersTab.click();
flexTab.operateFlexTab('members', true);
});
after(()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
flexTab.membersTab.waitForVisible();
flexTab.membersTab.click();
flexTab.operateFlexTab('members', false);
});
it('sets rocket cat as owner', ()=> {
@ -284,7 +291,7 @@ describe('channel', ()=> {
it('dismiss the toast', ()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
});
@ -301,20 +308,19 @@ describe('channel', ()=> {
describe('Moderator added', () => {
before(()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
flexTab.membersTab.waitForVisible();
flexTab.membersTab.click();
flexTab.operateFlexTab('members', true);
});
after(()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
flexTab.membersTab.waitForVisible();
flexTab.membersTab.click();
flexTab.operateFlexTab('members', false);
});
it('sets rocket cat as moderator', ()=> {
@ -323,7 +329,7 @@ describe('channel', ()=> {
it('dismiss the toast', ()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
});
@ -374,29 +380,6 @@ describe('channel', ()=> {
sideNav.getChannelFromList('NAME-EDITED-'+publicChannelName).isVisible().should.be.true;
});
});
describe.skip('User muted', () => {
before(()=> {
flexTab.membersTab.waitForVisible(5000);
flexTab.membersTab.click();
});
after(()=> {
flexTab.membersTab.waitForVisible();
flexTab.membersTab.click();
});
it('mute rocket cat', ()=> {
flexTab.muteUser(targetUser);
});
it('confirms the popup', ()=> {
flexTab.confirmPopup();
});
});
});
});
});

@ -12,7 +12,7 @@ import {imgURL} from '../../data/interactions.js';
import {checkIfUserIsValid} from '../../data/checks';
describe.skip('user preferences', ()=> {
describe('user preferences', ()=> {
before(() => {
checkIfUserIsValid(username, email, password);
sideNav.spotlightSearch.waitForVisible(10000);
@ -63,7 +63,7 @@ describe.skip('user preferences', ()=> {
});
//it gives off a "Too Many Requests Error" due the 60 seconds username change restriction
describe.skip('user info change', ()=> {
describe('user info change', ()=> {
it('click on the profile link', ()=> {
sideNav.profile.click();
});
@ -97,7 +97,9 @@ describe.skip('user preferences', ()=> {
});
it('close the preferences menu', () => {
sideNav.preferencesClose.waitForVisible(5000);
sideNav.preferencesClose.click();
sideNav.getChannelFromList('general').waitForVisible(5000);
});
it('open GENERAL', () => {
@ -106,9 +108,11 @@ describe.skip('user preferences', ()=> {
it('send a message to be tested', () => {
mainContent.sendMessage('HI');
mainContent.waitForLastMessageEqualsText('HI');
});
it('the name on the last message should be the edited one', () => {
it.skip('the name on the last message should be the edited one', () => {
mainContent.waitForLastMessageUserEqualsText('EditedUserName'+username);
mainContent.lastMessageUser.getText().should.equal('EditedUserName'+username);
});
@ -116,20 +120,15 @@ describe.skip('user preferences', ()=> {
sideNav.accountBoxUserName.getText().should.equal('EditedUserName'+username);
});
it('click on the last message ', () => {
it.skip('the user name on the members flex tab should be the edited one', () => {
mainContent.lastMessageUser.click();
});
it('the user name on the members flex tab should be the edited one', () => {
flexTab.memberUserName.waitForVisible(5000);
flexTab.memberUserName.getText().should.equal('EditedUserName'+username);
});
it('the real name on the members flex tab should be the edited one', () => {
it.skip('the real name on the members flex tab should be the edited one', () => {
flexTab.memberRealName.waitForVisible(5000);
flexTab.memberRealName.getText().should.equal('EditedRealName'+username);
});
it('close the flexTab', () => {
flexTab.membersTab.click();
});
});
});

@ -208,7 +208,7 @@ describe('Admin Login', () => {
});
it.skip('should show rocket.cat', () => {
it('should show rocket.cat', () => {
//it cant find the user if there is too many users
admin.usersRocketCat.isVisible().should.be.true;
});
@ -679,4 +679,4 @@ describe('Admin Login', () => {
});
});
});
});
});

@ -11,12 +11,5 @@ class Page {
this.body.waitForExist();
}
setWindowSize(width, height) {
browser.windowHandleSize({
width: width,
height: height
});
}
}
module.exports = Page;

@ -1,4 +1,5 @@
import Page from './Page';
import Global from './global';
class FlexTab extends Page {
get membersTab() { return browser.element('.flex-tab-bar .icon-users'); }
@ -12,6 +13,8 @@ class FlexTab extends Page {
get startVideoCall() { return browser.element('.start-video-call'); }
get startAudioCall() { return browser.element('.start-audio-call'); }
get showAll() { return browser.element('.see-all'); }
get membersUserInfo() { return browser.element('.flex-tab-container .info'); }
get avatarImage() { return browser.element('.flex-tab-container .avatar-image'); }
get channelTab() { return browser.element('.flex-tab-bar .tab-button:not(.hidden) .icon-info-circled'); }
get channelSettings() { return browser.element('.channel-settings'); }
@ -90,16 +93,6 @@ class FlexTab extends Page {
getUserEl(username) { return browser.element(`.flex-tab button[title="${username}"] > p`); }
confirmPopup() {
this.confirmBtn.waitForVisible(5000);
this.confirmBtn.click();
this.sweetAlertOverlay.waitForVisible(5000, true);
}
dismissToast() {
this.toastAlert.click();
}
archiveChannel() {
this.archiveBtn.waitForVisible();
this.archiveBtn.click();
@ -115,6 +108,74 @@ class FlexTab extends Page {
browser.click('.-autocomplete-item');
}
operateFlexTab(desiredTab, desiredState) {
//desiredState true=open false=closed
switch (desiredTab) {
case 'info':
if ((!this.channelSettings.isVisible() && desiredState) || (this.channelSettings.isVisible() && !desiredState)) {
this.channelTab.waitForVisible(5000);
this.channelTab.click();
this.channelSettings.waitForVisible(5000, !desiredState);
}
break;
case 'search':
if ((!this.messageSearchBar.isVisible() && desiredState) || (this.messageSearchBar.isVisible() && !desiredState)) {
this.searchTab.waitForVisible(5000);
this.searchTab.click();
this.messageSearchBar.waitForVisible(5000, !desiredState);
}
break;
case 'members':
if ((!this.avatarImage.isVisible() && desiredState) || (this.userSearchBar.isVisible() && !desiredState)) {
this.membersTab.waitForVisible(5000);
this.membersTab.click();
this.avatarImage.waitForVisible(5000, !desiredState);
}
break;
case 'notifications':
if ((!this.notificationsSettings.isVisible() && desiredState) || (this.notificationsSettings.isVisible() && !desiredState)) {
this.notificationsTab.waitForVisible(5000);
this.notificationsTab.click();
this.notificationsSettings.waitForVisible(5000, !desiredState);
}
break;
case 'files':
if ((!this.filesTabContent.isVisible() && desiredState) || (this.filesTabContent.isVisible() && !desiredState)) {
this.filesTab.waitForVisible(5000);
this.filesTab.click();
this.filesTabContent.waitForVisible(5000, !desiredState);
}
break;
case 'mentions':
if ((!this.mentionsTabContent.isVisible() && desiredState) || (this.mentionsTabContent.isVisible() && !desiredState)) {
this.mentionsTab.waitForVisible(5000);
this.mentionsTab.click();
this.mentionsTabContent.waitForVisible(5000, !desiredState);
}
break;
case 'starred':
if ((!this.starredTabContent.isVisible() && desiredState) || (this.starredTabContent.isVisible() && !desiredState)) {
this.starredTab.waitForVisible(5000);
this.starredTab.click();
this.starredTabContent.waitForVisible(5000, !desiredState);
}
break;
case 'pinned':
if ((!this.pinnedTabContent.isVisible() && desiredState) || (this.pinnedTabContent.isVisible() && !desiredState)) {
this.pinnedTab.waitForVisible(5000);
this.pinnedTab.click();
this.pinnedTabContent.waitForVisible(5000, !desiredState);
}
break;
}
}
removePeopleFromChannel(user) {
const userEl = this.getUserEl(user);
userEl.waitForVisible();
@ -123,9 +184,11 @@ class FlexTab extends Page {
}
setUserOwner(user) {
const userEl = this.getUserEl(user);
userEl.waitForVisible();
userEl.click();
if (!this.membersUserInfo.isVisible()) {
const userEl = this.getUserEl(user);
userEl.waitForVisible();
userEl.click();
}
this.setOwnerBtn.waitForVisible(5000);
this.setOwnerBtn.click();
this.viewAllBtn.click();
@ -133,9 +196,11 @@ class FlexTab extends Page {
}
setUserModerator(user) {
const userEl = this.getUserEl(user);
userEl.waitForVisible();
userEl.click();
if (!this.membersUserInfo.isVisible()) {
const userEl = this.getUserEl(user);
userEl.waitForVisible();
userEl.click();
}
this.setModeratorBtn.waitForVisible();
this.setModeratorBtn.click();
this.viewAllBtn.click();
@ -143,16 +208,16 @@ class FlexTab extends Page {
}
muteUser(user) {
const userEl = this.getUserEl(user);
if (this.showAll.isVisible()) {
this.muteUserBtn.waitForVisible(5000);
this.muteUserBtn.click();
} else {
userEl.waitForVisible(5000);
if (!this.membersUserInfo.isVisible()) {
const userEl = this.getUserEl(user);
userEl.waitForVisible();
userEl.click();
this.muteUserBtn.waitForVisible(5000);
this.muteUserBtn.click();
}
this.muteUserBtn.waitForVisible(5000);
this.muteUserBtn.click();
Global.confirmPopup();
this.viewAllBtn.click();
browser.pause(100);
}
}

@ -7,10 +7,21 @@ class Global {
confirmPopup() {
this.sweetAlertConfirm.waitForVisible(5000);
browser.pause(1000);
browser.pause(500);
this.sweetAlertConfirm.click();
this.sweetAlert.waitForVisible(5000, true);
}
setWindowSize(width, height) {
browser.windowHandleSize({
width: width,
height: height
});
}
dismissToast() {
this.toastAlert.click();
}
}
module.exports = new Global();
module.exports = new Global();

@ -115,6 +115,12 @@ class MainContent extends Page {
}, 2000);
}
waitForLastMessageUserEqualsText(text) {
browser.waitUntil(function() {
return browser.getText('.message:last-child .user-card-message:nth-of-type(2)') === text;
}, 2000);
}
tryToMentionAll() {
this.addTextToInput('@all');
this.sendBtn.click();

@ -34,9 +34,10 @@ class PreferencesMainContent extends Page {
changeAvatarUpload(url) {
this.avatarFileInput.chooseFile(url);
this.useUploadedAvatar.click();
browser.pause(1000);
}
}
module.exports = new PreferencesMainContent();
module.exports = new PreferencesMainContent();

@ -7,6 +7,7 @@ class SideNav extends Page {
get saveChannelBtn() { return browser.element('.save-channel'); }
get messageInput() { return browser.element('.input-message'); }
get burgerBtn() { return browser.element('.burger'); }
get accountBoxUserName() { return browser.element('.account-box .data h4'); }
get accountBoxUserAvatar() { return browser.element('.account-box .avatar-image'); }
@ -30,9 +31,9 @@ class SideNav extends Page {
get logout() { return browser.element('#logout'); }
get sideNavBar() { return browser.element('.side-nav '); }
get preferences() { return browser.element('.account-link:nth-of-type(1)'); }
get profile() { return browser.element('.account-link:nth-of-type(2)'); }
get avatar() { return browser.element('.account-link:nth-of-type(3)'); }
get preferences() { return browser.element('[href="/account/preferences"]'); }
get profile() { return browser.element('[href="/account/profile"]'); }
get avatar() { return browser.element('[href="/changeavatar"]'); }
get preferencesClose() { return browser.element('.side-nav .arrow.close'); }
get spotlightSearch() { return browser.element('.toolbar-search__input'); }
get spotlightSearchPopUp() { return browser.element('.toolbar .message-popup'); }
@ -105,17 +106,6 @@ class SideNav extends Page {
browser.click('[title="'+user+'"]');
this.removeUserBtn.click();
}
startDirectMessage(user) {
this.newDirectMessageBtn.waitForVisible(3000);
this.newDirectMessageBtn.click();
this.directMessageTarget.waitForVisible(3000);
this.directMessageTarget.setValue(user);
browser.waitForVisible('.-autocomplete-item', 5000);
browser.click('.-autocomplete-item');
this.saveDirectMessageBtn.click();
browser.waitForExist('[title="'+user+'"]', 5000);
}
}
module.exports = new SideNav();

Loading…
Cancel
Save