Skip to content
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(test): attachments removal plugin #177

Merged
merged 3 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions data/test-cases/plugins/attachment-remover/test-01.md
Original file line number Diff line number Diff line change
@@ -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 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.

**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`.
45 changes: 45 additions & 0 deletions data/test-cases/plugins/attachment-remover/test-02.md
Original file line number Diff line number Diff line change
@@ -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.
44 changes: 44 additions & 0 deletions data/test-cases/plugins/attachment-remover/test-03.md
Original file line number Diff line number Diff line change
@@ -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`.
46 changes: 46 additions & 0 deletions data/test-cases/plugins/attachment-remover/test-04.md
Original file line number Diff line number Diff line change
@@ -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`.
46 changes: 46 additions & 0 deletions data/test-cases/plugins/attachment-remover/test-05.md
Original file line number Diff line number Diff line change
@@ -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`.
44 changes: 44 additions & 0 deletions data/test-cases/plugins/attachment-remover/test-06.md
Original file line number Diff line number Diff line change
@@ -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.
44 changes: 44 additions & 0 deletions data/test-cases/plugins/attachment-remover/test-07.md
Original file line number Diff line number Diff line change
@@ -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.
45 changes: 45 additions & 0 deletions data/test-cases/plugins/attachment-remover/test-08.md
Original file line number Diff line number Diff line change
@@ -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 <post_id>`.

**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.
Loading
Loading