mattermost-mobile/detox/e2e/support/ui/component/post_options.js
Joseph Baylon 4f668f0fdf
MM-30286 Detox/E2E: Add e2e test for MM-T3222 and some cleanup (#4959)
* MM-30286 Detox/E2E: Add e2e test for MM-T3222 and some cleanup

* Fix merge issues

* Fix more issues

* Fixed new line

* Remove redundant check

* Updated instance to getElement

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-17 10:52:03 -08:00

49 lines
2 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
class PostOptions {
testID = {
postOptions: 'post.options',
reactionPickerAction: 'post.options.reaction_picker.action',
replyAction: 'post.options.reply.action',
permalinkAction: 'post.options.permalink.action',
copyAction: 'post.options.copy.action',
deleteAction: 'post.options.delete.action',
editAction: 'post.options.edit.action',
saveAction: 'post.options.flagged.action',
unsaveAction: 'post.options.unflag.action',
pinAction: 'post.options.pin.action',
unpinAction: 'post.options.unpin.action',
markUnreadAction: 'post.options.markUnread.action',
openAddReactionButton: 'open.add_reaction.button',
slideUpPanel: 'slide_up_panel',
}
postOptions = element(by.id(this.testID.postOptions));
reactionPickerAction = element(by.id(this.testID.reactionPickerAction));
replyAction = element(by.id(this.testID.replyAction));
permalinkAction = element(by.id(this.testID.permalinkAction));
deleteAction = element(by.id(this.testID.deleteAction));
editAction = element(by.id(this.testID.editAction));
saveAction = element(by.id(this.testID.saveAction));
unsaveAction = element(by.id(this.testID.unsaveAction));
pinAction = element(by.id(this.testID.pinAction));
unpinAction = element(by.id(this.testID.unpinAction));
markUnreadAction = element(by.id(this.testID.markUnreadAction));
openAddReactionButton = element(by.id(this.testID.openAddReactionButton));
slideUpPanel = element(by.id(this.testID.slideUpPanel));
toBeVisible = async () => {
await expect(this.postOptions).toBeVisible();
return postOptions;
}
close = async () => {
await this.postOptions.tap();
await expect(this.postOptions).not.toBeVisible();
}
}
const postOptions = new PostOptions();
export default postOptions;