Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bringing fork up to date #1

Merged
merged 21 commits into from
Mar 25, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d78337c
Added join/list public/private teams permissions (#2393)
jespino Mar 19, 2019
764c126
MM-12488: Adds groups search and filters. (#2461)
mkraft Mar 19, 2019
b0ad1fb
Remove period from OAuth apps description in Main Menu > Integrations…
jasonblais Mar 19, 2019
abf1cdd
[MM-14253] Modify Elasticsearch admin console messages to reference u…
mgdelacroix Mar 19, 2019
2ddd75a
MM-13634 Fix error message when drag and dropping folders (#2449)
jwilander Mar 19, 2019
be23c33
[MM-14356] Some strings in Channel Settings aren't localizable (#2484)
bradjcoughlin Mar 20, 2019
1796712
[MM-14571] Add e2e to test @mentions notifications (#2507)
thekiiingbob Mar 20, 2019
b696197
MM-14533 - Removing width for channel title (#2497)
asaadmahmood Mar 20, 2019
c55a82e
[MM-13482] Adds e2e tests to check timestamp on edited post (#10041) …
letsila Mar 20, 2019
3ed1e03
UI Automation: Write an automated test for Mobile using cypress. Dele…
d28park Mar 20, 2019
c071663
MM-14350: Fixes relative link under custom subpath. (#2511)
mkraft Mar 20, 2019
543c0cd
translations PR 20190318 (#2517)
enahum Mar 20, 2019
ee41ff2
MM-14500 Fix for pop caused by size_aware_image (#2469)
sudheerDev Mar 20, 2019
320995d
[MM-14491] avoid hiding the popover when the cursor is moved away fro…
kosgrz Mar 20, 2019
38b9bd9
add hide prop to profile popover from the at_mention component (#2506)
mickmister Mar 20, 2019
c426e3a
added marked commit that fixes formatted embedded link to italicize w…
saturninoabril Mar 21, 2019
3380271
MM-14358 - E2E Test for "Message Draft Pencil Icon visible in channel…
kelvintyb Mar 21, 2019
a242f14
Add (SAML|LDAP|Email) Login Button Color Configurations (#2502)
lieut-data Mar 21, 2019
4b3ada3
[MM-14375] Fix flaky test on collapsed specs and separated markdown s…
saturninoabril Mar 22, 2019
89e0e82
fix flaky tests on some account settings specs (#2530)
saturninoabril Mar 23, 2019
ff2190a
custom URL scheme upper case letters not working (#2309)
Hobby-Student Mar 23, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[MM-14571] Add e2e to test @mentions notifications (mattermost#2507)
* [MM-14571] Add e2e to test @mentions notifications

* [MM-14571] Cleanup fixture usage, use async/await in plugin

* [MM-14571] Lock down axios version to current version

* [MM-14571] Rename post message as file

* [MM-14571] Additional work based on feedback

* Remove dupe id in channel header
* Add channelid to header
* Update snapshot
* Clean up test
* Add cypress command for getting channel id

* [MM-14571] scroll element into view before clicking

* [MM-14571] scroll another element into view before clicking

* [MM-14571] Remove unneccessary scrollIntoView()
  • Loading branch information
thekiiingbob authored and sudheerDev committed Mar 20, 2019
commit 17967125047ab742a40c27191842d02b34ab98d3
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
exports[`components/ChannelHeader should render archived view 1`] = `
<div
className="channel-header alt"
data-channelid="channel_id"
id="channel-header"
>
<div
Expand All @@ -17,7 +18,6 @@ exports[`components/ChannelHeader should render archived view 1`] = `
>
<div
className="channel-header__title dropdown"
id="channelHeaderTitle"
>
<h2>
<MenuWrapper
Expand Down Expand Up @@ -132,6 +132,7 @@ exports[`components/ChannelHeader should render archived view 1`] = `
exports[`components/ChannelHeader should render correct menu when muted 1`] = `
<div
className="channel-header alt"
data-channelid="channel_id"
id="channel-header"
>
<div
Expand All @@ -146,7 +147,6 @@ exports[`components/ChannelHeader should render correct menu when muted 1`] = `
>
<div
className="channel-header__title dropdown"
id="channelHeaderTitle"
>
<h2>
<MenuWrapper
Expand Down Expand Up @@ -353,6 +353,7 @@ exports[`components/ChannelHeader should render properly when empty 1`] = `
exports[`components/ChannelHeader should render properly when populated 1`] = `
<div
className="channel-header alt"
data-channelid="channel_id"
id="channel-header"
>
<div
Expand All @@ -367,7 +368,6 @@ exports[`components/ChannelHeader should render properly when populated 1`] = `
>
<div
className="channel-header__title dropdown"
id="channelHeaderTitle"
>
<h2>
<MenuWrapper
Expand Down Expand Up @@ -533,6 +533,7 @@ exports[`components/ChannelHeader should render properly when populated 1`] = `
exports[`components/ChannelHeader should render properly when populated with channel props 1`] = `
<div
className="channel-header alt"
data-channelid="channel_id"
id="channel-header"
>
<div
Expand All @@ -547,7 +548,6 @@ exports[`components/ChannelHeader should render properly when populated with cha
>
<div
className="channel-header__title dropdown"
id="channelHeaderTitle"
>
<h2>
<MenuWrapper
Expand Down
2 changes: 1 addition & 1 deletion components/channel_header/channel_header.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ export default class ChannelHeader extends React.PureComponent {
return (
<div
id='channel-header'
data-channelid={`${channel.id}`}
className='channel-header alt'
>
<div className='flex-parent'>
Expand All @@ -505,7 +506,6 @@ export default class ChannelHeader extends React.PureComponent {
className='channel-header__info'
>
<div
id='channelHeaderTitle'
className='channel-header__title dropdown'
>
<h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ exports[`component/sidebar/sidebar_channel_button_or_link/SidebarChannelButtonOr
</span>
<span
className="badge"
id="unreadMentions"
>
6
</span>
Expand Down Expand Up @@ -132,6 +133,7 @@ exports[`component/sidebar/sidebar_channel_button_or_link/SidebarChannelButtonOr
</span>
<span
className="badge"
id="unreadMentions"
>
6
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,14 @@ export default class SidebarChannelButtonOrLink extends React.PureComponent {
render = () => {
let badge = null;
if (this.props.badge) {
badge = <span className='badge'>{this.props.unreadMentions}</span>;
badge = (
<span
id='unreadMentions'
className='badge'
>
{this.props.unreadMentions}
</span>
);
}

const content = (
Expand Down
2 changes: 1 addition & 1 deletion cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"baseUrl": "http:https://localhost:8065",
"viewportWidth": 1300,
"defaultCommandTimeout": 20000,
"pluginsFile": false,
"taskTimeout": 20000,
"video": false,
"reporter": "junit",
"reporterOptions": {
Expand Down
106 changes: 106 additions & 0 deletions cypress/integration/at_mentions/at_mentions_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.

// ***************************************************************
// - [number] indicates a test step (e.g. 1. Go to a page)
// - [*] indicates an assertion (e.g. * Check the title)
// - Use element ID when selecting an element. Create one if none.
// ***************************************************************

/*eslint max-nested-callbacks: ["error", 4]*/
/*eslint-disable func-names*/

describe('at-mention', () => {
before(() => {
cy.fixture('users').as('usersJSON');
});

it('N14571 still triggers notification if username is not listed in words that trigger mentions', function() {
const receiver = this.usersJSON['user-1'];
const sender = this.usersJSON['user-2'];
const message = `@${receiver.username} I'm messaging you! ${Date.now()}`;

// 1. Login and navigate to the account settings
cy.toAccountSettingsModal(receiver.username);

// 2. Select "Notifications"
cy.get('#notificationsButton').click();

// * Notifications header should be visible
cy.get('#notificationSettingsTitle').should('be.visible').should('contain', 'Notifications');

// 3. Open up 'Words that trigger mentions' sub-section
cy.get('#keysTitle').scrollIntoView();
cy.get('#keysTitle').click();

// 4. Set checkboxes to desired state
cy.get('#notificationTriggerFirst').uncheck().should('not.be.checked');
cy.get('#notificationTriggerUsername').uncheck().should('not.be.checked');
cy.get('#notificationTriggerShouts').check().should('be.checked');
cy.get('#notificationTriggerCustom').check().should('be.checked');

// 5. Set Custom field to not include our name
cy.get('#notificationTriggerCustomText').clear().type('@');

// 6. Click “Save” and close modal
cy.get('#saveSetting').scrollIntoView().click();
cy.get('#accountSettingsHeader > .close').click();

// 7. Navigate to the channel we were mention to
// clear the notification gem and get the channelId
cy.get('#sidebarItem_town-square').click();

// 8. Get the current channelId
cy.getCurrentChannelId().as('channelId');

// 9. Stub out Notification so we can spy on it
cy.window().then((win) => {
cy.stub(win, 'Notification').as('notifyStub');
});

// 10. Navigate to a channel we are NOT going to post to
cy.get('#sidebarItem_saepe-5').click({force: true});

// 11. Use another account to post a message @-mentioning our receiver
cy.get('@channelId').then((channelId) => {
cy.task('postMessageAs', {sender, message, channelId});
});

// * Verify the stub
cy.get('@notifyStub').should((stub) => {
const [title, opts] = stub.firstCall.args;

// * Verify notification is coming from Town Square
expect(title).to.equal('Town Square');

const body = `@${sender.username}: ${message}`;

// * Verify additional args of notification
expect(opts).to.include({body, tag: body, requireInteraction: false, silent: false});
});

// * Verify unread mentions badge
cy.get('#sidebarItem_town-square').
scrollIntoView().
find('#unreadMentions').
should('be.visible').
and('have.text', '1');

// 12. Go to the channel where you were messaged
cy.get('#sidebarItem_town-square').click();

// * Verify that the message is there
cy.getLastPostId().then((postId) => {
const postMessageTextId = `#postMessageText_${postId}`;

// * Verify entire message
cy.get(postMessageTextId).should('have.text', message);

// * Verify highlight of username
cy.get(postMessageTextId).
find(`[data-mention=${receiver.username}]`).
should('be.visible').
and('have.text', `@${receiver.username}`);
});
});
});
10 changes: 10 additions & 0 deletions cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.

const postMessageAs = require('./post_message_as');

module.exports = (on) => {
on('task', {
postMessageAs,
});
};
26 changes: 26 additions & 0 deletions cypress/plugins/post_message_as.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.

require('@babel/polyfill');
require('isomorphic-fetch');

const {Client4} = require('mattermost-redux/client');
const axios = require('axios');

const cypressConfig = require('../../cypress.json');

module.exports = async ({sender, message, channelId}) => {
const url = `${cypressConfig.baseUrl}/api/v4/users/login`;

const response = await axios({url, method: 'post', data: {login_id: sender.username, password: sender.password}});
const token = response.headers.token;

Client4.setUrl(cypressConfig.baseUrl);
Client4.setToken(token);

return Client4.createPost({
channel_id: channelId,
message,
type: '',
});
};
8 changes: 8 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,3 +376,11 @@ Cypress.Commands.add('userStatus', (statusInt) => {
cy.get('.status-wrapper.status-selector').click();
cy.get('.MenuItem').eq(statusInt).click();
});

// ***********************************************************
// Channel
// ************************************************************

Cypress.Commands.add('getCurrentChannelId', () => {
return cy.get('#channel-header').invoke('attr', 'data-channelid');
});
Loading