-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MM-30428 Detox/E2E: Add e2e for MM-T3199, MM-T3223, MM-T3224 (#5240)
* MM-30428 Detox/E2E: Add e2e for MM-T3199, MM-T3223, MM-T3224 * Updated variables to better names
- Loading branch information
Joseph Baylon
authored
Mar 24, 2021
1 parent
e75d367
commit 48d4775
Showing
19 changed files
with
235 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | ||
// See LICENSE.txt for license information. | ||
|
||
// ******************************************************************* | ||
// - [#] indicates a test step (e.g. # Go to a screen) | ||
// - [*] indicates an assertion (e.g. * Check the title) | ||
// - Use element testID when selecting an element. Create one if none. | ||
// ******************************************************************* | ||
|
||
import { | ||
AddReactionScreen, | ||
ChannelScreen, | ||
} from '@support/ui/screen'; | ||
import { | ||
Channel, | ||
Post, | ||
Setup, | ||
Team, | ||
User, | ||
} from '@support/server_api'; | ||
|
||
describe('Add Reaction', () => { | ||
let testChannel; | ||
let testOtherUser; | ||
|
||
beforeAll(async () => { | ||
const {team, user} = await Setup.apiInit(); | ||
|
||
({channel: testChannel} = await Channel.apiGetChannelByName(team.name, 'town-square')); | ||
|
||
({user: testOtherUser} = await User.apiCreateUser()); | ||
await Team.apiAddUserToTeam(testOtherUser.id, team.id); | ||
|
||
// # Open channel screen | ||
await ChannelScreen.open(user); | ||
}); | ||
|
||
afterAll(async () => { | ||
await ChannelScreen.logout(); | ||
}); | ||
|
||
it('MM-T3223 should be able to add a reaction to a post using long press and +:', async () => { | ||
const { | ||
openPostOptionsFor, | ||
postMessage, | ||
} = ChannelScreen; | ||
const {searchInput} = AddReactionScreen; | ||
|
||
// # Post a message | ||
const message = Date.now().toString(); | ||
await postMessage(message); | ||
|
||
// # Add a reaction to the post using long press | ||
const {post} = await Post.apiGetLastPostInChannel(testChannel.id); | ||
await openPostOptionsFor(post.id, message); | ||
await AddReactionScreen.open(); | ||
await searchInput.typeText(':fox_face:'); | ||
await element(by.text('🦊')).tap(); | ||
|
||
// # Add a reaction to the post using +: | ||
await postMessage('+:dog:'); | ||
|
||
// * Verify emojis are added to post | ||
await expect(element(by.text('🦊').withAncestor(by.id(`channel.post_list.post.${post.id}`)))).toExist(); | ||
await expect(element(by.text('🐶').withAncestor(by.id(`channel.post_list.post.${post.id}`)))).toExist(); | ||
|
||
// * Verify emoji exists in recently used section | ||
await openPostOptionsFor(post.id, message); | ||
await AddReactionScreen.open(); | ||
await expect(element(by.text('🦊').withAncestor(by.id('RECENTLY USED')))).toExist(); | ||
await expect(element(by.text('🐶').withAncestor(by.id('RECENTLY USED')))).toExist(); | ||
|
||
// # Close add reaction screen | ||
await AddReactionScreen.close(); | ||
}); | ||
|
||
it('MM-T3224 should be able to remove own reaction and add to another user reaction', async () => { | ||
// # Tap on own reaction to remove | ||
await element(by.text('🦊')).tap(); | ||
|
||
// * Verify own reaction is removed | ||
const {post} = await Post.apiGetLastPostInChannel(testChannel.id); | ||
await expect(element(by.text('🦊').withAncestor(by.id(`channel.post_list.post.${post.id}`)))).not.toExist(); | ||
|
||
// # Login as new user | ||
await ChannelScreen.logout(); | ||
await ChannelScreen.open(testOtherUser); | ||
|
||
// # Add the same existing reaction | ||
await expect(element(by.id('reaction.emoji.dog.count'))).toHaveText('1'); | ||
await element(by.text('🐶')).tap(); | ||
|
||
// * Verify count incremented | ||
await expect(element(by.id('reaction.emoji.dog.count'))).toHaveText('2'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.