-
Notifications
You must be signed in to change notification settings - Fork 18
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
feat: tests for root post delete helper plugin #182
Open
saturninoabril
wants to merge
5
commits into
main
Choose a base branch
from
plugin-post-delete-helper
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+356
−0
Open
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
dfeba48
feat: tests for root post delete helper plugin
saturninoabril d323222
add scenario for executing a slash command for the deleted root post
saturninoabril 586b7ba
update priority to P3
saturninoabril 7862dae
Merge branch 'main' into plugin-post-delete-helper
wiggin77 b31c403
Merge branch 'main' into plugin-post-delete-helper
saturninoabril File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--- | ||
# (Required) Ensure all values are filled up | ||
name: "Installation and uninstallation of the Post Delete Helper Plugin" | ||
status: Active | ||
priority: Normal | ||
folder: Post Delete Helper | ||
authors: "@saturninoabril" | ||
team_ownership: | ||
- Deployment Eng | ||
priority_p1_to_p4: P2 - Core Functions (Do core functions work?) | ||
|
||
# (Optional) | ||
location: Plugins | ||
component: null | ||
tags: [] | ||
labels: [] | ||
tested_by_contributor: "" | ||
|
||
# (Optional) Test type and tools | ||
cypress: N/A | ||
detox: N/A | ||
mmctl: N/A | ||
playwright: N/A | ||
rainforest: [] | ||
manual_test_environments: [] | ||
|
||
# Do not change | ||
id: null | ||
key: null | ||
created_on: null | ||
last_updated: null | ||
case_hashed: null | ||
steps_hashed: null | ||
|
||
--- | ||
|
||
**Step 1** | ||
|
||
Install Across Different Server Setups | ||
|
||
1. Obtain the plugin by either downloading it from the [repository](https://github.com/mattermost/mattermost-plugin-post-delete-helper) or by building it from source. | ||
2. Upload the plugin to the Mattermost server. | ||
3. Perform sanity check | ||
|
||
**Expected** | ||
|
||
The plugin should install and uninstall without any issues across different server setups, including: | ||
|
||
- Server Editions: All | ||
- Licensing: With or without a license | ||
- Hosting: Self-hosted only, Cloud does not allow plugin upload | ||
- Deployment: Single-tenant or High-Availability setup | ||
|
||
The plugin should perform its intended functionality (delete root posts without deleting the thread) correctly without errors or unexpected behavior. | ||
|
||
--- | ||
|
||
**Step 2** | ||
|
||
Install Plugin on Supported and Unsupported Server Versions | ||
|
||
1. Attempt to install the plugin on both supported and unsupported Mattermost server versions. | ||
|
||
**Expected** | ||
|
||
The plugin should install successfully only on supported versions. The minimum supported server version is `6.2.1`. |
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,51 @@ | ||
--- | ||
# (Required) Ensure all values are filled up | ||
name: "Verify 'Remove root post' Post Option Availability" | ||
status: Active | ||
priority: Normal | ||
folder: Post Delete Helper | ||
authors: "@saturninoabril" | ||
team_ownership: | ||
- Deployment Eng | ||
priority_p1_to_p4: P2 - Core Functions (Do core functions work?) | ||
|
||
# (Optional) | ||
location: Plugins | ||
component: null | ||
tags: [] | ||
labels: [] | ||
tested_by_contributor: "" | ||
|
||
# (Optional) Test type and tools | ||
cypress: N/A | ||
detox: N/A | ||
mmctl: N/A | ||
playwright: N/A | ||
rainforest: [] | ||
manual_test_environments: [] | ||
|
||
# Do not change | ||
id: null | ||
key: null | ||
created_on: null | ||
last_updated: null | ||
case_hashed: null | ||
steps_hashed: null | ||
|
||
--- | ||
|
||
**Step 1** | ||
|
||
1. Confirm that the "Remove root post" option is available in the "Message Actions" menu of posts, except for: | ||
|
||
- System messages | ||
- Not a root post | ||
- Root post without any reply | ||
- Posts where the user lacks permission to edit | ||
- Posts created after the edit time limit has expired | ||
|
||
2. Create posts of each type listed above and confirm that the "Remove root post" option is not available. | ||
|
||
**Expected** | ||
|
||
The "Remove root post" option should not appear in the "Message Actions" menu for the specified posts. |
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,59 @@ | ||
--- | ||
# (Required) Ensure all values are filled up | ||
name: "Delete a root post" | ||
status: Active | ||
priority: Normal | ||
folder: Post Delete Helper | ||
authors: "@saturninoabril" | ||
team_ownership: | ||
- Deployment Eng | ||
priority_p1_to_p4: P2 - Core Functions (Do core functions work?) | ||
|
||
# (Optional) | ||
location: Plugins | ||
component: null | ||
tags: [] | ||
labels: [] | ||
tested_by_contributor: "" | ||
|
||
# (Optional) Test type and tools | ||
cypress: N/A | ||
detox: N/A | ||
mmctl: N/A | ||
playwright: N/A | ||
rainforest: [] | ||
manual_test_environments: [] | ||
|
||
# Do not change | ||
id: null | ||
key: null | ||
created_on: null | ||
last_updated: null | ||
case_hashed: null | ||
steps_hashed: null | ||
|
||
--- | ||
|
||
**Step 1** | ||
|
||
1. Post a root message with one or more replies. A root post could be: | ||
- with or without attachments | ||
- with or without reactions | ||
- with attachment only and without message | ||
2. Verify that the "Remove root post" option is visible in the root post's menu. | ||
3. Select "Remove root post". | ||
|
||
**Expected** | ||
|
||
The "Remove root post" option should be available for a root post. When selected, the root message is replaced with `*Deleted*` (default), attachments and reactions are removed, the root post is marked as `Edited`, and the thread remains unchanged. After deletion, the "Remove root post" option is no longer visible for the root post. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should steps also be added to verify:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch Linda! Let's hear from @wiggin77 then I'll update accordingly.
|
||
**Step 2** | ||
|
||
1. Navigate to `System Console > PLUGINS > Post Delete Helper` and change the `Message text to be used after deletion` to a custom value (e.g. `(root post deleted)`) | ||
2. Post a root message with one or more replies. | ||
3. Verify that the "Remove root post" option is visible in the root post's menu. | ||
4. Select "Remove root post". | ||
|
||
**Expected** | ||
|
||
The "Remove root post" option should be available for the root post. When selected, the root message is replaced with the custom text `(root post deleted)`, the root post is marked as `Edited`, and the thread remains unchanged. |
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,61 @@ | ||
--- | ||
# (Required) Ensure all values are filled up | ||
name: "Permission-Based Root Post Deletion" | ||
status: Active | ||
priority: Normal | ||
folder: Post Delete Helper | ||
authors: "@saturninoabril" | ||
team_ownership: | ||
- Deployment Eng | ||
priority_p1_to_p4: P2 - Core Functions (Do core functions work?) | ||
|
||
# (Optional) | ||
location: Plugins | ||
component: null | ||
tags: [] | ||
labels: [] | ||
tested_by_contributor: "" | ||
|
||
# (Optional) Test type and tools | ||
cypress: N/A | ||
detox: N/A | ||
mmctl: N/A | ||
playwright: N/A | ||
rainforest: [] | ||
manual_test_environments: [] | ||
|
||
# Do not change | ||
id: null | ||
key: null | ||
created_on: null | ||
last_updated: null | ||
case_hashed: null | ||
steps_hashed: null | ||
|
||
--- | ||
|
||
**Step 1** | ||
|
||
1. Create two threads: one with a root post where the user has the `Edit Own Posts` permission (configured in `System Console > Permission`), and another without such permission. | ||
2. Check if the "Remove root post" option is available for each root post. | ||
3. If available, select "Remove root post". | ||
|
||
**Expected** | ||
|
||
- The "Remove root post" option should be available only for root posts where the user has permission to edit their own posts. | ||
- When the root post is deleted by its own user with the correct permission, the root post message is replaced with `*Deleted*` (default), marked as `Edited`, and the thread remains unchanged. | ||
- If the user lacks permission, the option to delete the root post should not be available. | ||
|
||
--- | ||
|
||
**Step 2** | ||
|
||
1. Post two threads: one with root post where the user has `Edit Others' Posts` permission (configured in `System Console > Permission`), and another without such permission. | ||
2. Verify if the "Remove root post" option is available for each root post. | ||
3. If available, select "Remove root post". | ||
|
||
**Expected** | ||
|
||
- The "Remove root post" option should be available only for root posts where the user has permission to edit others' posts. | ||
- When the root post is deleted by other user with the correct permission, the root post message is replaced with `*Deleted*` (default), marked as `Edited`, and the thread remains unchanged. | ||
- If the user lacks permission, the option to delete the root post of others should not be available. |
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,48 @@ | ||
--- | ||
# (Required) Ensure all values are filled up | ||
name: "Root Post Deletion with Time Limit" | ||
status: Active | ||
priority: Normal | ||
folder: Post Delete Helper | ||
authors: "@saturninoabril" | ||
team_ownership: | ||
- Deployment Eng | ||
priority_p1_to_p4: P2 - Core Functions (Do core functions work?) | ||
|
||
# (Optional) | ||
location: Plugins | ||
component: null | ||
tags: [] | ||
labels: [] | ||
tested_by_contributor: "" | ||
|
||
# (Optional) Test type and tools | ||
cypress: N/A | ||
detox: N/A | ||
mmctl: N/A | ||
playwright: N/A | ||
rainforest: [] | ||
manual_test_environments: [] | ||
|
||
# Do not change | ||
id: null | ||
key: null | ||
created_on: null | ||
last_updated: null | ||
case_hashed: null | ||
steps_hashed: null | ||
|
||
--- | ||
|
||
**Step 1** | ||
|
||
1. Enable `Edit Own Posts` in `System Console > Permission` and set the `Edit Post Time Limit` (e.g., `60` seconds). | ||
2. Post a thread and delete the root post within the time limit. | ||
3. Post another thread, then verify whether the "Remove root post" option is still available after the time limit has expired. | ||
|
||
**Expected** | ||
|
||
- The "Remove root post" option should only be available within the edit time limit. | ||
- Deleting within the time limit successfully deleted the root post with its message replaced with `*Deleted*` (default) and the post is marked as `Edited`, and its thread remains unchanged. | ||
- Once the edit time limit has passed, the option to remove the root post should no longer be available. | ||
- These expectations apply both to users who own the post and users with permission to edit others' posts. |
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,67 @@ | ||
--- | ||
# (Required) Ensure all values are filled up | ||
name: "Delete Root Post via Slash Command" | ||
status: Active | ||
priority: Normal | ||
folder: Post Delete Helper | ||
authors: "@saturninoabril" | ||
team_ownership: | ||
- Deployment Eng | ||
priority_p1_to_p4: P2 - Core Functions (Do core functions work?) | ||
|
||
# (Optional) | ||
location: Plugins | ||
component: null | ||
tags: [] | ||
labels: [] | ||
tested_by_contributor: "" | ||
|
||
# (Optional) Test type and tools | ||
cypress: N/A | ||
detox: N/A | ||
mmctl: N/A | ||
playwright: N/A | ||
rainforest: [] | ||
manual_test_environments: [] | ||
|
||
# Do not change | ||
id: null | ||
key: null | ||
created_on: null | ||
last_updated: null | ||
case_hashed: null | ||
steps_hashed: null | ||
|
||
--- | ||
|
||
**Step 1** | ||
|
||
1. Post a thread, retrieve its root post ID, and execute the slash command `/deleterootpost <root_post_id>`. | ||
|
||
**Expected** | ||
|
||
- No autocompletion is available when typing `/deleterootpost`. | ||
- A dialog appears with the header `Delete Root Post` and the message `Are you sure you want to delete this post? The thread will remain.`, along with `Cancel` and `Delete` buttons. | ||
- Selecting `Cancel` keeps the attachment intact. | ||
- Selecting `Delete` successfully deletes the root post provided all deletion conditions are met. Otherwise, a system message appears in the channel indicating the reason for failure, such as: | ||
- `Can't delete root post: Invalid post ID` if `root_post_id` is not valid. | ||
- `Can't delete root post: Post does not exist` if `root_post_id` cannot be found. | ||
- `Can't delete root post: Not authorized` if the user has no permission. | ||
- `Can't delete root post: Post is too old to edit` if the edit time limit has expired. | ||
|
||
**Step 2** | ||
|
||
1. Create a root post without any replies, retrieve its post ID, and execute the slash command `/deleterootpost <root_post_id>`. | ||
|
||
**Expected** | ||
|
||
- The `Delete Root Post` dialog should not appear, and the post should not be deleted, as the root post has no replies. | ||
saturninoabril marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
**Step 3** | ||
|
||
1. Post a thread, retrieve the post ID of any reply within the thread, and execute the slash command `/deleterootpost <post_id>`. | ||
|
||
**Expected** | ||
|
||
- The `Delete Root Post` dialog should not appear, and the post should not be deleted, as the command is intended only for root posts. | ||
saturninoabril marked this conversation as resolved.
Show resolved
Hide resolved
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be more explicit about what is involved in the sanity check? E.g. Can the plugin be started and stopped? Or, given the steps to follow that test the plugin functionality, maybe the "sanity check" step isn't needed here?
Also, a nit: should have a
.
at the end of the sentence for consistency. :)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Steps 1 and 2 cover general plugin functionality. To make it more plugin-specific, I've added "perform sanity check," which could focus on a core function (deleting a root post). However, I’ve kept the details minimal, as it could correspond to any of the tests from 2 to 7. However, as I read again, looks good to remove step 3. (I'll update but will wait for the other comment).
Thanks!