From af49e5cc23369936aada0593a626a23080baab1b Mon Sep 17 00:00:00 2001 From: Saturnino Abril <5334504+saturninoabril@users.noreply.github.com> Date: Tue, 3 Sep 2024 17:14:02 +0800 Subject: [PATCH 1/2] feat(test): attachments removal plugin --- .../plugins/attachment-remover/test-01.md | 62 +++++++++++++++++++ .../plugins/attachment-remover/test-02.md | 45 ++++++++++++++ .../plugins/attachment-remover/test-03.md | 44 +++++++++++++ .../plugins/attachment-remover/test-04.md | 46 ++++++++++++++ .../plugins/attachment-remover/test-05.md | 46 ++++++++++++++ .../plugins/attachment-remover/test-06.md | 44 +++++++++++++ .../plugins/attachment-remover/test-07.md | 44 +++++++++++++ .../plugins/attachment-remover/test-08.md | 45 ++++++++++++++ .../plugins/attachment-remover/test-09.md | 45 ++++++++++++++ .../plugins/attachment-remover/test-10.md | 44 +++++++++++++ src/util/test_case.ts | 9 +-- 11 files changed, 467 insertions(+), 7 deletions(-) create mode 100644 data/test-cases/plugins/attachment-remover/test-01.md create mode 100644 data/test-cases/plugins/attachment-remover/test-02.md create mode 100644 data/test-cases/plugins/attachment-remover/test-03.md create mode 100644 data/test-cases/plugins/attachment-remover/test-04.md create mode 100644 data/test-cases/plugins/attachment-remover/test-05.md create mode 100644 data/test-cases/plugins/attachment-remover/test-06.md create mode 100644 data/test-cases/plugins/attachment-remover/test-07.md create mode 100644 data/test-cases/plugins/attachment-remover/test-08.md create mode 100644 data/test-cases/plugins/attachment-remover/test-09.md create mode 100644 data/test-cases/plugins/attachment-remover/test-10.md diff --git a/data/test-cases/plugins/attachment-remover/test-01.md b/data/test-cases/plugins/attachment-remover/test-01.md new file mode 100644 index 000000000..5612b55c3 --- /dev/null +++ b/data/test-cases/plugins/attachment-remover/test-01.md @@ -0,0 +1,62 @@ +--- +# (Required) Ensure all values are filled up +name: "Installation and uninstallation of the Attachments Remover Plugin" +status: Active +priority: Normal +folder: Attachment Remover +authors: "@saturninoabril" +team_ownership: +- Deployment Eng +priority_p1_to_p4: P2 - Core Functions (Do core functions work?) + +# (Optional) +location: null +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-attachments-remover) 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: Free and Enterprise +- Licensing: With or without a license +- Hosting: Self-hosted or Cloud +- Deployment: Single-server or High-Availability setup + +The plugin should perform its intended functionality (removing attachments) 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/attachment-remover/test-02.md b/data/test-cases/plugins/attachment-remover/test-02.md new file mode 100644 index 000000000..049498f07 --- /dev/null +++ b/data/test-cases/plugins/attachment-remover/test-02.md @@ -0,0 +1,45 @@ +--- +# (Required) Ensure all values are filled up +name: 'Verify "Remove Attachments" Post Option Availability' +status: Active +priority: Normal +folder: Attachment Remover +authors: "@saturninoabril" +team_ownership: +- Deployment Eng +priority_p1_to_p4: P2 - Core Functions (Do core functions work?) + +# (Optional) +location: null +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 attachments" option is available in the "Message Actions" menu, except for: +- System messages +- Posts without attachment +2. Create the above types of messages/posts and verify that the "Remove attachments" option is not present. + +**Expected** + +The "Remove attachments" option is not available in the "Message Actions" menu for system messages and posts without attachment. diff --git a/data/test-cases/plugins/attachment-remover/test-03.md b/data/test-cases/plugins/attachment-remover/test-03.md new file mode 100644 index 000000000..557029d44 --- /dev/null +++ b/data/test-cases/plugins/attachment-remover/test-03.md @@ -0,0 +1,44 @@ +--- +# (Required) Ensure all values are filled up +name: "Remove Attachments from Posts" +status: Active +priority: Normal +folder: Attachment Remover +authors: "@saturninoabril" +team_ownership: +- Deployment Eng +priority_p1_to_p4: P2 - Core Functions (Do core functions work?) + +# (Optional) +location: null +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 two messages: one with a single attachment and another with multiple attachments. +2. Ensure the "Remove attachments" option is available in the menu. +3. Select "Remove Attachments" for each post. + +**Expected** + +The "Remove attachments" option is available for both posts. Upon selection, the attachments are removed, and the post is marked as `Edited`. diff --git a/data/test-cases/plugins/attachment-remover/test-04.md b/data/test-cases/plugins/attachment-remover/test-04.md new file mode 100644 index 000000000..ff6964fe6 --- /dev/null +++ b/data/test-cases/plugins/attachment-remover/test-04.md @@ -0,0 +1,46 @@ +--- +# (Required) Ensure all values are filled up +name: "Permission-Based Attachment Removal" +status: Active +priority: Normal +folder: Attachment Remover +authors: "@saturninoabril" +team_ownership: +- Deployment Eng +priority_p1_to_p4: P2 - Core Functions (Do core functions work?) + +# (Optional) +location: null +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 two messages with attachments: one where the user has permission to edit others' posts, and one without that permission. +2. Check if the "Remove attachments" option is available. +3. Attempt to remove attachments for both posts. + +**Expected** + +- The "Remove attachments" option is available for both posts. +- If the user has permission, the attachment is removed, and the post is marked as `Edited`. +- If the user lacks permission, the attachment is not removed, and a system message displays `Can't remove attachments: Not authorized`. diff --git a/data/test-cases/plugins/attachment-remover/test-05.md b/data/test-cases/plugins/attachment-remover/test-05.md new file mode 100644 index 000000000..8c0088e8a --- /dev/null +++ b/data/test-cases/plugins/attachment-remover/test-05.md @@ -0,0 +1,46 @@ +--- +# (Required) Ensure all values are filled up +name: "Attachment Removal with Time Limit" +status: Active +priority: Normal +folder: Attachment Remover +authors: "@saturninoabril" +team_ownership: +- Deployment Eng +priority_p1_to_p4: P2 - Core Functions (Do core functions work?) + +# (Optional) +location: null +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. Set a post edit time limit (e.g., `60` seconds). +2. Post a message with an attachment and remove it within the time limit. +3. Post another message with an attachment and attempt to remove it after the time limit. + +**Expected** + +- The "Remove attachments" option is available for both posts. +- Removing within the time limit successfully removes the attachment, and the post is marked as `Edited`. +- Attempting removal after the time limit fails, with a system message: `Can't remove attachments: Post is too old to edit`. diff --git a/data/test-cases/plugins/attachment-remover/test-06.md b/data/test-cases/plugins/attachment-remover/test-06.md new file mode 100644 index 000000000..9a20e1dc7 --- /dev/null +++ b/data/test-cases/plugins/attachment-remover/test-06.md @@ -0,0 +1,44 @@ +--- +# (Required) Ensure all values are filled up +name: "Attachment Removal from Posts Without Text" +status: Active +priority: Normal +folder: Attachment Remover +authors: "@saturninoabril" +team_ownership: +- Deployment Eng +priority_p1_to_p4: P2 - Core Functions (Do core functions work?) + +# (Optional) +location: null +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 message that has only an attachment (no text), then remove the attachment. +2. Post a root message with only an attachment (no text), reply to this root post, and then remove the attachment from the root post. +3. Post a root message with text, reply to it with only an attachment (no text), and then remove the attachment from the reply. + +**Expected** + +- The post that originally contained only an attachment is successfully cleared (attachment removed), marked as `Edited`, and displayed as a blank post, without being deleted. diff --git a/data/test-cases/plugins/attachment-remover/test-07.md b/data/test-cases/plugins/attachment-remover/test-07.md new file mode 100644 index 000000000..2c18c8ba7 --- /dev/null +++ b/data/test-cases/plugins/attachment-remover/test-07.md @@ -0,0 +1,44 @@ +--- +# (Required) Ensure all values are filled up +name: "Verify Attachment Removal from Search and Channel Files" +status: Active +priority: Normal +folder: Attachment Remover +authors: "@saturninoabril" +team_ownership: +- Deployment Eng +priority_p1_to_p4: P2 - Core Functions (Do core functions work?) + +# (Optional) +location: null +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 message with an attachment and then search for the file or click on `Channel files`. +2. Confirm that the file is searchable and listed in `Channel files`. +3. Remove the attachment from the post. + +**Expected** + +- The file should no longer appear in search results or be listed in `Channel files` after the attachment is removed. diff --git a/data/test-cases/plugins/attachment-remover/test-08.md b/data/test-cases/plugins/attachment-remover/test-08.md new file mode 100644 index 000000000..5b314eb51 --- /dev/null +++ b/data/test-cases/plugins/attachment-remover/test-08.md @@ -0,0 +1,45 @@ +--- +# (Required) Ensure all values are filled up +name: "Remove Attachments via Slash Command" +status: Active +priority: Normal +folder: Attachment Remover +authors: "@saturninoabril" +team_ownership: +- Deployment Eng +priority_p1_to_p4: P2 - Core Functions (Do core functions work?) + +# (Optional) +location: null +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 message with an attachment, retrieve its post ID, and post a slash command `/removeattachments `. + +**Expected** + +- No autocompletion is available when typing `/removeattachments`. +- A dialog appears with the header `Remove Attachments` and the message `Are you sure you want to remove all attachments from this post?`, along with `Cancel` and `Remove` buttons. +- Selecting `Cancel` keeps the attachment intact. +- Selecting `Remove` successfully removes the attachment if all conditions for removal are met. If not, a system message is posted in the channel indicating the reason. diff --git a/data/test-cases/plugins/attachment-remover/test-09.md b/data/test-cases/plugins/attachment-remover/test-09.md new file mode 100644 index 000000000..28628f126 --- /dev/null +++ b/data/test-cases/plugins/attachment-remover/test-09.md @@ -0,0 +1,45 @@ +--- +# (Required) Ensure all values are filled up +name: "Verify Attachment Removal Across Supported File Storage Systems" +status: Active +priority: Normal +folder: Attachment Remover +authors: "@saturninoabril" +team_ownership: +- Deployment Eng +priority_p1_to_p4: P2 - Core Functions (Do core functions work?) + +# (Optional) +location: null +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 attachment removal works for the following server supported file storage options: +- Local files +- AWS S3 +- MinIO + +**Expected** + +- Attachments should be successfully removed across all supported file storage systems. diff --git a/data/test-cases/plugins/attachment-remover/test-10.md b/data/test-cases/plugins/attachment-remover/test-10.md new file mode 100644 index 000000000..39de7c71f --- /dev/null +++ b/data/test-cases/plugins/attachment-remover/test-10.md @@ -0,0 +1,44 @@ +--- +# (Required) Ensure all values are filled up +name: "Verify Attachment Removal Across Supported Databases" +status: Active +priority: Normal +folder: Attachment Remover +authors: "@saturninoabril" +team_ownership: +- Deployment Eng +priority_p1_to_p4: P2 - Core Functions (Do core functions work?) + +# (Optional) +location: null +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 attachment removal works for the following server supported databases: +- PostgreSQL +- MySQL + +**Expected** + +- Attachments should be successfully removed across all supported databases. diff --git a/src/util/test_case.ts b/src/util/test_case.ts index 0f12c292b..600e4cc89 100644 --- a/src/util/test_case.ts +++ b/src/util/test_case.ts @@ -187,21 +187,16 @@ function customFieldsValues() { 'Boards', 'Calls', 'Channels', - 'Cloud Platform', - 'Customer Reliability Engineering', - 'Data Eng', - 'Deployment Engineering', - 'Desktop Platform', + 'Deployment Eng', 'Growth', 'ICU', 'Integration Frameworks', - 'Mobile Platform', 'MS Teams', 'Playbooks', 'QA Platform', 'Self-Serve', - 'Suite Users', 'Server Platform', + 'Suite Users', 'Web Platform', 'XYZ', ], From ff8e3a033a8aa973f5cee7adf043ed77395b97e1 Mon Sep 17 00:00:00 2001 From: Saturnino Abril <5334504+saturninoabril@users.noreply.github.com> Date: Tue, 3 Sep 2024 17:59:32 +0800 Subject: [PATCH 2/2] update hosting to self-hosted only --- data/test-cases/plugins/attachment-remover/test-01.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/test-cases/plugins/attachment-remover/test-01.md b/data/test-cases/plugins/attachment-remover/test-01.md index 5612b55c3..c21b4bc7c 100644 --- a/data/test-cases/plugins/attachment-remover/test-01.md +++ b/data/test-cases/plugins/attachment-remover/test-01.md @@ -46,7 +46,7 @@ Install Across Different Server Setups The plugin should install and uninstall without any issues across different server setups, including: - Server Editions: Free and Enterprise - Licensing: With or without a license -- Hosting: Self-hosted or Cloud +- Hosting: Self-hosted only, Cloud does not allow plugin upload - Deployment: Single-server or High-Availability setup The plugin should perform its intended functionality (removing attachments) correctly without errors or unexpected behavior.