From dfeba48dea277fb171c6e034e7663e6f775375f6 Mon Sep 17 00:00:00 2001 From: Saturnino Abril <5334504+saturninoabril@users.noreply.github.com> Date: Fri, 13 Sep 2024 19:15:20 +0800 Subject: [PATCH 1/3] feat: tests for root post delete helper plugin --- .../plugins/post-delete-helper/test_1.md | 66 ++++++++++++++++++ .../plugins/post-delete-helper/test_2.md | 51 ++++++++++++++ .../plugins/post-delete-helper/test_3.md | 59 ++++++++++++++++ .../plugins/post-delete-helper/test_4.md | 61 +++++++++++++++++ .../plugins/post-delete-helper/test_5.md | 48 +++++++++++++ .../plugins/post-delete-helper/test_6.md | 67 +++++++++++++++++++ 6 files changed, 352 insertions(+) create mode 100644 data/test-cases/plugins/post-delete-helper/test_1.md create mode 100644 data/test-cases/plugins/post-delete-helper/test_2.md create mode 100644 data/test-cases/plugins/post-delete-helper/test_3.md create mode 100644 data/test-cases/plugins/post-delete-helper/test_4.md create mode 100644 data/test-cases/plugins/post-delete-helper/test_5.md create mode 100644 data/test-cases/plugins/post-delete-helper/test_6.md diff --git a/data/test-cases/plugins/post-delete-helper/test_1.md b/data/test-cases/plugins/post-delete-helper/test_1.md new file mode 100644 index 000000000..1156beeb4 --- /dev/null +++ b/data/test-cases/plugins/post-delete-helper/test_1.md @@ -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`. diff --git a/data/test-cases/plugins/post-delete-helper/test_2.md b/data/test-cases/plugins/post-delete-helper/test_2.md new file mode 100644 index 000000000..e7287748d --- /dev/null +++ b/data/test-cases/plugins/post-delete-helper/test_2.md @@ -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. diff --git a/data/test-cases/plugins/post-delete-helper/test_3.md b/data/test-cases/plugins/post-delete-helper/test_3.md new file mode 100644 index 000000000..679d24af6 --- /dev/null +++ b/data/test-cases/plugins/post-delete-helper/test_3.md @@ -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. + +**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. diff --git a/data/test-cases/plugins/post-delete-helper/test_4.md b/data/test-cases/plugins/post-delete-helper/test_4.md new file mode 100644 index 000000000..77fd1882d --- /dev/null +++ b/data/test-cases/plugins/post-delete-helper/test_4.md @@ -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. diff --git a/data/test-cases/plugins/post-delete-helper/test_5.md b/data/test-cases/plugins/post-delete-helper/test_5.md new file mode 100644 index 000000000..c853467c6 --- /dev/null +++ b/data/test-cases/plugins/post-delete-helper/test_5.md @@ -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. diff --git a/data/test-cases/plugins/post-delete-helper/test_6.md b/data/test-cases/plugins/post-delete-helper/test_6.md new file mode 100644 index 000000000..602a5edbb --- /dev/null +++ b/data/test-cases/plugins/post-delete-helper/test_6.md @@ -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 `. + +**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 `. + +**Expected** + +- The `Delete Root Post` dialog should not appear, and the post should not be deleted, as the root post has no replies. + + +**Step 3** + +1. Post a thread, retrieve the post ID of any reply within the thread, and execute the slash command `/deleterootpost `. + +**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. From d3232228dfd4b43892925eed92aa0208d0a18f63 Mon Sep 17 00:00:00 2001 From: Saturnino Abril <5334504+saturninoabril@users.noreply.github.com> Date: Fri, 13 Sep 2024 19:36:47 +0800 Subject: [PATCH 2/3] add scenario for executing a slash command for the deleted root post --- data/test-cases/plugins/post-delete-helper/test_6.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/data/test-cases/plugins/post-delete-helper/test_6.md b/data/test-cases/plugins/post-delete-helper/test_6.md index 602a5edbb..8f7941769 100644 --- a/data/test-cases/plugins/post-delete-helper/test_6.md +++ b/data/test-cases/plugins/post-delete-helper/test_6.md @@ -37,17 +37,21 @@ steps_hashed: null **Step 1** 1. Post a thread, retrieve its root post ID, and execute the slash command `/deleterootpost `. +2. After successfully deleting the root post, run the slash command again using the same deleted root post ID: `/deleterootpost `. **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 `Cancel` leaves the post unchanged. - 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. +- After the root post is successfully deleted, executing the slash command again with the same (deleted) root post ID should: + - Not trigger the `Delete Root Post` dialog. + - Display a system message stating that the root post has already been deleted. **Step 2** From 586b7ba33f3dde2655f58ac43f9dc0bc17742834 Mon Sep 17 00:00:00 2001 From: Saturnino Abril <5334504+saturninoabril@users.noreply.github.com> Date: Wed, 18 Sep 2024 15:52:25 +0800 Subject: [PATCH 3/3] update priority to P3 --- data/test-cases/plugins/post-delete-helper/test_1.md | 2 +- data/test-cases/plugins/post-delete-helper/test_2.md | 2 +- data/test-cases/plugins/post-delete-helper/test_3.md | 2 +- data/test-cases/plugins/post-delete-helper/test_4.md | 2 +- data/test-cases/plugins/post-delete-helper/test_5.md | 2 +- data/test-cases/plugins/post-delete-helper/test_6.md | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/data/test-cases/plugins/post-delete-helper/test_1.md b/data/test-cases/plugins/post-delete-helper/test_1.md index 1156beeb4..555795ac6 100644 --- a/data/test-cases/plugins/post-delete-helper/test_1.md +++ b/data/test-cases/plugins/post-delete-helper/test_1.md @@ -7,7 +7,7 @@ folder: Post Delete Helper authors: "@saturninoabril" team_ownership: - Deployment Eng -priority_p1_to_p4: P2 - Core Functions (Do core functions work?) +priority_p1_to_p4: P3 - Deep Functions (Do extensive scenarios work?) # (Optional) location: Plugins diff --git a/data/test-cases/plugins/post-delete-helper/test_2.md b/data/test-cases/plugins/post-delete-helper/test_2.md index e7287748d..9444253d9 100644 --- a/data/test-cases/plugins/post-delete-helper/test_2.md +++ b/data/test-cases/plugins/post-delete-helper/test_2.md @@ -7,7 +7,7 @@ folder: Post Delete Helper authors: "@saturninoabril" team_ownership: - Deployment Eng -priority_p1_to_p4: P2 - Core Functions (Do core functions work?) +priority_p1_to_p4: P3 - Deep Functions (Do extensive scenarios work?) # (Optional) location: Plugins diff --git a/data/test-cases/plugins/post-delete-helper/test_3.md b/data/test-cases/plugins/post-delete-helper/test_3.md index 679d24af6..92cc5c600 100644 --- a/data/test-cases/plugins/post-delete-helper/test_3.md +++ b/data/test-cases/plugins/post-delete-helper/test_3.md @@ -7,7 +7,7 @@ folder: Post Delete Helper authors: "@saturninoabril" team_ownership: - Deployment Eng -priority_p1_to_p4: P2 - Core Functions (Do core functions work?) +priority_p1_to_p4: P3 - Deep Functions (Do extensive scenarios work?) # (Optional) location: Plugins diff --git a/data/test-cases/plugins/post-delete-helper/test_4.md b/data/test-cases/plugins/post-delete-helper/test_4.md index 77fd1882d..998fe1b6f 100644 --- a/data/test-cases/plugins/post-delete-helper/test_4.md +++ b/data/test-cases/plugins/post-delete-helper/test_4.md @@ -7,7 +7,7 @@ folder: Post Delete Helper authors: "@saturninoabril" team_ownership: - Deployment Eng -priority_p1_to_p4: P2 - Core Functions (Do core functions work?) +priority_p1_to_p4: P3 - Deep Functions (Do extensive scenarios work?) # (Optional) location: Plugins diff --git a/data/test-cases/plugins/post-delete-helper/test_5.md b/data/test-cases/plugins/post-delete-helper/test_5.md index c853467c6..a2763690f 100644 --- a/data/test-cases/plugins/post-delete-helper/test_5.md +++ b/data/test-cases/plugins/post-delete-helper/test_5.md @@ -7,7 +7,7 @@ folder: Post Delete Helper authors: "@saturninoabril" team_ownership: - Deployment Eng -priority_p1_to_p4: P2 - Core Functions (Do core functions work?) +priority_p1_to_p4: P3 - Deep Functions (Do extensive scenarios work?) # (Optional) location: Plugins diff --git a/data/test-cases/plugins/post-delete-helper/test_6.md b/data/test-cases/plugins/post-delete-helper/test_6.md index 8f7941769..10ae09edc 100644 --- a/data/test-cases/plugins/post-delete-helper/test_6.md +++ b/data/test-cases/plugins/post-delete-helper/test_6.md @@ -7,7 +7,7 @@ folder: Post Delete Helper authors: "@saturninoabril" team_ownership: - Deployment Eng -priority_p1_to_p4: P2 - Core Functions (Do core functions work?) +priority_p1_to_p4: P3 - Deep Functions (Do extensive scenarios work?) # (Optional) location: Plugins