[MM-30697, MM-30699] Detox/E2E: Add e2e for MM-T3273 and MM-T3228 (#5146)
* [MM-30697, MM-30699] Detox/E2E: Add e2e for MM-T3273 and MM-T3228 * Rename test ids
This commit is contained in:
parent
acd2b09fa8
commit
cf7731e30f
6 changed files with 112 additions and 10 deletions
|
|
@ -65,7 +65,7 @@ exports[`EditPost should match snapshot 1`] = `
|
|||
},
|
||||
]
|
||||
}
|
||||
testID="edit_post.input"
|
||||
testID="edit_post.message.input"
|
||||
underlineColorAndroid="transparent"
|
||||
/>
|
||||
</View>
|
||||
|
|
|
|||
|
|
@ -47,12 +47,13 @@ export default class EditPost extends PureComponent {
|
|||
|
||||
leftButton = {
|
||||
id: 'close-edit-post',
|
||||
testID: 'edit_post.close',
|
||||
testID: 'close.edit_post.button',
|
||||
};
|
||||
|
||||
rightButton = {
|
||||
id: 'edit-post',
|
||||
showAsAction: 'always',
|
||||
testID: 'edit_post.save.button',
|
||||
};
|
||||
|
||||
constructor(props, context) {
|
||||
|
|
@ -266,7 +267,7 @@ export default class EditPost extends PureComponent {
|
|||
{displayError}
|
||||
<View style={[inputContainerStyle, {height}]}>
|
||||
<TextInputWithLocalizedPlaceholder
|
||||
testID='edit_post.input'
|
||||
testID='edit_post.message.input'
|
||||
ref={this.messageRef}
|
||||
value={message}
|
||||
blurOnSubmit={false}
|
||||
|
|
|
|||
|
|
@ -7,13 +7,15 @@ import {isAndroid} from '@support/utils';
|
|||
class EditPostScreen {
|
||||
testID = {
|
||||
editPostScreen: 'edit_post.screen',
|
||||
editPostInput: 'edit_post.input',
|
||||
editPostClose: 'edit_post.close',
|
||||
closeEditPostButton: 'close.edit_post.button',
|
||||
messageInput: 'edit_post.message.input',
|
||||
saveButton: 'edit_post.save.button',
|
||||
}
|
||||
|
||||
editPostScreen = element(by.id(this.testID.editPostScreen));
|
||||
editPostInput = element(by.id(this.testID.editPostInput));
|
||||
editPostClose = element(by.id(this.testID.editPostClose));
|
||||
closeEditPostButton = element(by.id(this.testID.closeEditPostButton));
|
||||
messageInput = element(by.id(this.testID.messageInput));
|
||||
saveButton = element(by.id(this.testID.saveButton));
|
||||
|
||||
toBeVisible = async () => {
|
||||
if (isAndroid()) {
|
||||
|
|
|
|||
|
|
@ -50,16 +50,19 @@ describe('Autocomplete', () => {
|
|||
await EditPostScreen.open();
|
||||
|
||||
const {atMentionSuggestionList} = Autocomplete;
|
||||
const {editPostInput, editPostClose} = EditPostScreen;
|
||||
const {
|
||||
closeEditPostButton,
|
||||
messageInput,
|
||||
} = EditPostScreen;
|
||||
|
||||
// # Open autocomplete
|
||||
await expect(atMentionSuggestionList).not.toExist();
|
||||
await editPostInput.typeText(' @');
|
||||
await messageInput.typeText(' @');
|
||||
|
||||
// * Expect at_mention autocomplete to render
|
||||
await expect(atMentionSuggestionList).toExist();
|
||||
|
||||
// # Close edit post screen
|
||||
await editPostClose.tap();
|
||||
await closeEditPostButton.tap();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
30
detox/e2e/test/smoke_test/logout.e2e.js
Normal file
30
detox/e2e/test/smoke_test/logout.e2e.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
// 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 {SettingsSidebar} from '@support/ui/component';
|
||||
import {
|
||||
ChannelScreen,
|
||||
SelectServerScreen,
|
||||
} from '@support/ui/screen';
|
||||
import {Setup} from '@support/server_api';
|
||||
|
||||
describe('Logout', () => {
|
||||
beforeAll(async () => {
|
||||
const {user} = await Setup.apiInit();
|
||||
|
||||
// # Open channel screen
|
||||
await ChannelScreen.open(user);
|
||||
});
|
||||
|
||||
it('MM-T3273 should be able to log out', async () => {
|
||||
await ChannelScreen.openSettingsSidebar();
|
||||
await SettingsSidebar.tapLogoutAction();
|
||||
await SelectServerScreen.toBeVisible();
|
||||
});
|
||||
});
|
||||
66
detox/e2e/test/smoke_test/message_edit.e2e.js
Normal file
66
detox/e2e/test/smoke_test/message_edit.e2e.js
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
// 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 {
|
||||
ChannelScreen,
|
||||
EditPostScreen,
|
||||
} from '@support/ui/screen';
|
||||
import {
|
||||
Channel,
|
||||
Post,
|
||||
Setup,
|
||||
} from '@support/server_api';
|
||||
|
||||
describe('Message Edit', () => {
|
||||
let testChannel;
|
||||
|
||||
beforeAll(async () => {
|
||||
const {team, user} = await Setup.apiInit();
|
||||
const {channel} = await Channel.apiGetChannelByName(team.name, 'town-square');
|
||||
testChannel = channel;
|
||||
|
||||
// # Open channel screen
|
||||
await ChannelScreen.open(user);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await ChannelScreen.logout();
|
||||
});
|
||||
|
||||
it('MM-T3228 should be able to edit a message and save', async () => {
|
||||
const {
|
||||
getPostListPostItem,
|
||||
openPostOptionsFor,
|
||||
postMessage,
|
||||
} = ChannelScreen;
|
||||
const {
|
||||
messageInput,
|
||||
saveButton,
|
||||
} = EditPostScreen;
|
||||
|
||||
// # Post a message
|
||||
const testMessage = Date.now().toString();
|
||||
await postMessage(testMessage);
|
||||
|
||||
// # Open edit post screen
|
||||
const {post} = await Post.apiGetLastPostInChannel(testChannel.id);
|
||||
await openPostOptionsFor(post.id, testMessage);
|
||||
await EditPostScreen.open();
|
||||
|
||||
// # Edit post and save
|
||||
const additionalText = ' additional text';
|
||||
await messageInput.typeText(additionalText);
|
||||
await saveButton.tap();
|
||||
|
||||
// * Verify post is edited
|
||||
await ChannelScreen.toBeVisible();
|
||||
const {postListPostItem} = await getPostListPostItem(post.id, `${testMessage}${additionalText} (edited)`);
|
||||
await expect(postListPostItem).toBeVisible();
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue