# CleanCopy E2E Manual Testing Sandbox

Use this document to manually verify that all clipboard sanitization rules work correctly end-to-end.

## How to Use

1. Make sure CleanCopy is running in the system tray.
2. Copy the **"Copy this"** block to your clipboard (`Ctrl+C`).
3. Press the CleanCopy hotkey (`Alt + Shift + C` or your configured shortcut).
4. Paste the result into a text editor and compare with the **Expected Output**.

### Prerequisites

- CleanCopy is running in the system tray (lavender clipboard icon).
- All cleaning rules are **enabled** in Settings -> Rules (unless a scenario says otherwise).
- You have a text editor open to paste and inspect results.

## [URL] Scenario 1: Tracking Parameter Scrubber

Tests the removal of marketing and analytic trackers while preserving legitimate query variables.

### Copy this

```text
https://example.com/shop/item-102?utm_source=newsletter&utm_medium=email&utm_campaign=summer_sale&gclid=CL_12345&fbclid=FB_67890&si=SI_abcde&q=running+shoes&category=activewear
```

### Expected Output

```text
https://example.com/shop/item-102?q=running+shoes&category=activewear
```

_(Tracks `utm_source`, `utm_medium`, `utm_campaign`, `gclid`, `fbclid`, and `si` are stripped; `q` and `category` are kept.)_

## [URL] Scenario 2: Custom URL Parameters

Tests that user-defined custom tracking params (added in Settings -> Rules) are also stripped.

### Setup

In Settings -> Rules, type `foo,bar` in the custom tracking parameters input and wait for the save indicator.

### Copy this

```text
https://example.com/page?foo=abc&bar=123&keep=this&utm_source=x
```

### Expected Output

```text
https://example.com/page?keep=this
```

_(Custom params `foo` and `bar` are stripped alongside built-in `utm_source`.)_

## [URL] Scenario 3: URL with Only Tracked Parameters

Tests that a URL with no legitimate params is cleaned of the entire query string.

### Copy this

```text
https://example.com/article?utm_source=newsletter&utm_medium=email&gclid=abc123&fbclid=xyz789
```

### Expected Output

```text
https://example.com/article
```

_(All params were trackers — the `?` is removed entirely.)_

## [URL] Scenario 4: Multiple URLs in One Clipboard

Tests that all URLs in a single clipboard block get their trackers stripped independently.

### Copy this

```text
Check these links:
https://store.com/deal?utm_source=ad&product=shoes
https://blog.com/post?gclid=123&id=456
```

### Expected Output

```text
Check these links:
https://store.com/deal?product=shoes
https://blog.com/post?id=456
```

_(Both URLs have their trackers stripped independently.)_

## [URL] Scenario 5: Already-Clean URL Passes Through

Tests that a URL with no tracking parameters is left completely untouched.

### Copy this

```text
https://example.com/docs/getting-started?section=install&version=2
```

### Expected Output

```text
https://example.com/docs/getting-started?section=install&version=2
```

_(No trackers present — URL is unchanged.)_

## [TYPOGRAPHY] Scenario 6: Smart Quotes & Dash Typography

Tests the transformation of curly quotes, smart apostrophes, en-dashes, and em-dashes.

### Copy this

```text
"The developer's code," she said — "should compile without warnings." The cost was $5–$10.
```

### Expected Output

```text
"The developer's code," she said -- "should compile without warnings." The cost was $5-$10.
```

_(Curly double quotes → `"`, smart apostrophe → `'`, em-dash → `--`, en-dash → `-`.)_

## [TYPOGRAPHY] Scenario 7: Invisible Character Cleanup

Tests removal of zero-width spaces, null bytes, and other invisible Unicode characters.

### Copy this (these contain invisible characters)

```text
H​e​l​l​o​ ​W​o​r​l​d
```

_(Each letter above is separated by zero-width spaces U+200B.)_

### Expected Output

```text
Hello World
```

_(All zero-width spaces are removed, letters join together.)_

## [NEWLINES] Scenario 8: Messenger Line-Break Collapse

Tests that single line wraps from chat apps are joined, while paragraph breaks are preserved.

### Copy this

```text
This is a long sentence that got split
across multiple lines by a chat app's
auto-wrap feature.

This second paragraph should remain on
its own separate line.
```

### Expected Output

```text
This is a long sentence that got split across multiple lines by a chat app's auto-wrap feature.

This second paragraph should remain on its own separate line.
```

_(Single line breaks → space; double-newline paragraph break preserved.)_

## [NEWLINES] Scenario 9: Hyphenated Line Break

Tests that words split with a hyphen at end-of-line are rejoined correctly.

### Copy this

```text
This is an example of inno-
vation that was split across lines.
```

### Expected Output

```text
This is an example of innovation that was split across lines.
```

_(The hyphen at end of line is removed and the word is joined.)_

## [NEWLINES] Scenario 10: Markdown List & Header Preservation

Tests that Markdown structure (headers, lists) is not collapsed.

### Copy this

```text
# Main Header
* Item 1 in list
* Item 2 in list

Here is some body text.
```

### Expected Output

```text
# Main Header
* Item 1 in list
* Item 2 in list

Here is some body text.
```

_(Markdown lists and headers are preserved — the line-joining cleanser skips them.)_

## [COMBINED] Scenario 11: Multiple Cleansers Combined

Tests all rules running simultaneously on a single dirty clipboard block.

### Copy this

```text
   "Check this link—it's amazing!"
https://store.com/deal?utm_source=ad&fbclid=999
```

### Expected Output

```text
"Check this link--it's amazing!"
https://store.com/deal
```

_(Whitespace trimmed, quotes/dashes fixed, trackers stripped.)_

## [COMBINED] Scenario 12: Mixed Content Stress Test

Tests all three cleansers on different lines within a single clipboard block.

### Copy this

```text
Here's a message from WhatsApp:
Hey check out this link https://shop.com/sale?utm_source=sms&cid=abc123
The price was $20–$50 for the "Premium" plan — totally worth it according
to the review I read yesterday.
```

### Expected Output

```text
Here's a message from WhatsApp:
Hey check out this link https://shop.com/sale?cid=abc123
The price was $20-$50 for the "Premium" plan -- totally worth it according to the review I read yesterday.
```

_(Line break joined, trackers stripped, en-dash → `-`, em-dash → `--`, smart quotes → straight quotes.)_

## [EDGE] Scenario 13: Empty / Whitespace-Only Clipboard

Tests that an empty or whitespace-only clipboard does not cause errors.

### Copy this

```text

```

_(Just whitespace — spaces or tabs.)_

### Expected Output

```text

```

_(Empty string — no crash, no garbage output.)_

## [EDGE] Scenario 14: Non-URL Text Unchanged

Tests that plain text without URLs passes through all cleansers without modification.

### Copy this

```text
The quick brown fox jumps over the lazy dog. Nothing to clean here!
```

### Expected Output

```text
The quick brown fox jumps over the lazy dog. Nothing to clean here!
```

_(No trackers, no smart quotes, no line breaks — text is unchanged.)_

## [UI] Scenario 15: Settings Toggle Each Rule Off

Tests that each cleaning rule can be individually disabled and verified.

### Steps

1. Open Settings -> Rules.
2. Toggle OFF **"Strip tracking parameters"**.
3. Copy a URL with trackers (from Scenario 1).
4. Trigger CleanCopy, paste, and verify trackers are **still present**.
5. Re-enable the toggle and repeat — trackers should now be stripped.
6. Repeat for each rule: Smart Quotes, Line-Break Normalizer.

### Expected

Each rule's toggle independently controls that specific cleaning behavior.

## [UI] Scenario 16: Custom Params Debounce & Save Indicator

Tests that the custom params input debounces correctly and shows save feedback.

### Steps

1. Open Settings -> Rules.
2. Click the custom tracking parameters input.
3. Type `test1`.
4. Observe: a `...` indicator appears while debouncing.
5. Wait ~500ms: a `✓` checkmark appears indicating save.
6. Wait ~1.5s: the `✓` fades out.
7. Type `,test2` (appending to existing text).
8. Repeat the debounce observation.

### Expected

- `...` appears immediately on input change.
- `✓` appears after ~500ms debounce completes.
- `✓` fades out after ~1.5s.
- Input field does not shrink when indicators appear.

## [EDGE] Scenario 17: Ctrl+C Hotkey Uses Clipboard Monitor

Tests that setting the hotkey to `Ctrl+C` switches to the clipboard monitor approach and cleans clipboard changes from any source.

### Steps

1. Open Settings -> General.
2. Start recording a new hotkey.
3. Press `Ctrl+C` to set it as the hotkey.
4. Check the logs for `"Clipboard monitor started."`.
5. Open a text editor and type some text with smart quotes (e.g. `\u201cHello \u2014 World\u201d`).
6. Select the text and press `Ctrl+C`.
7. Paste the clipboard content.
8. Now right-click paste some other text with trackers (e.g. `https://example.com?utm_source=x&id=1`).
9. Paste again and verify trackers are stripped.
10. Change the hotkey back to `Alt+Shift+C`.
11. Check the logs for `"Clipboard monitor shutting down."`.
12. Verify `Alt+Shift+C` works as before.

### Expected

- Log shows `"Clipboard monitor started."` after setting Ctrl+C.
- Ctrl+C copy cleans smart quotes → straight quotes, em-dash → `--`.
- Right-click copy also triggers cleaning (clipboard monitor catches all sources).
- Log shows `"Clipboard monitor shutting down."` after changing away from Ctrl+C.
- Alt+Shift+C works via the global shortcut path as before.
