Files
Stirling-PDF/testing/cucumber/features/misc_new.feature
Anthony Stirling 0be10b2dff Cucumber concurrency validation plus fix (#7379)
# Description of Changes

cucumber tests to run multiple threads of commands at same time 

---

## Checklist

### General

- [ ] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [ ] I have read the [Stirling-PDF Developer
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md)
(if applicable)
- [ ] I have read the [How to add new languages to
Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md)
(if applicable)
- [ ] I have performed a self-review of my own code
- [ ] My changes generate no new warnings

### Documentation

- [ ] I have updated relevant docs on [Stirling-PDF's doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
(if functionality has heavily changed)
- [ ] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)

### Translations (if applicable)

- [ ] I ran
[`scripts/counter_translation.py`](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/docs/counter_translation.md)

### UI Changes (if applicable)

- [ ] Screenshots or videos demonstrating the UI changes are attached
(e.g., as comments or direct attachments in the PR)

### Testing (if applicable)

- [ ] I have run `task check` to verify linters, typechecks, and tests
pass
- [ ] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#7-testing)
for more details.
2026-08-14 14:01:45 +01:00

257 lines
11 KiB
Gherkin

@misc-new
Feature: Miscellaneous PDF Operations API Validation
@add-stamp @positive
Scenario Outline: add-stamp applies a text stamp at various positions
Given I generate a PDF file as "fileInput"
And the pdf contains 3 pages
And the request data includes
| parameter | value |
| stampType | text |
| stampText | Test Stamp |
| position | <position> |
| fontSize | 20 |
| rotation | 0 |
| opacity | 0.5 |
| customColor | #d3d3d3 |
| customMargin | medium |
| overrideX | -1 |
| overrideY | -1 |
When I send the API request to the endpoint "/api/v1/misc/add-stamp"
Then the response content type should be "application/pdf"
And the response status code should be 200
And the response file should have size greater than 200
And the response PDF should contain 3 pages
Examples:
| position |
| 1 |
| 5 |
| 9 |
@add-stamp @positive
Scenario: add-stamp with rotation and full opacity
Given I generate a PDF file as "fileInput"
And the pdf contains 2 pages
And the request data includes
| parameter | value |
| stampType | text |
| stampText | CONFIDENTIAL |
| position | 5 |
| fontSize | 30 |
| rotation | 45 |
| opacity | 1.0 |
| customColor | #d3d3d3 |
| customMargin | medium |
| overrideX | -1 |
| overrideY | -1 |
When I send the API request to the endpoint "/api/v1/misc/add-stamp"
And this operation is run 5 times in parallel
Then the response content type should be "application/pdf"
And the response status code should be 200
And the response file should have size greater than 200
And the response PDF should contain 2 pages
@add-page-numbers @positive
Scenario Outline: add-page-numbers inserts numbers at various positions
Given I generate a PDF file as "fileInput"
And the pdf contains 4 pages
And the request data includes
| parameter | value |
| startingNumber | 1 |
| position | <position> |
| fontSize | 12 |
When I send the API request to the endpoint "/api/v1/misc/add-page-numbers"
Then the response content type should be "application/pdf"
And the response status code should be 200
And the response file should have size greater than 200
And the response PDF should contain 4 pages
Examples:
| position |
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
| 7 |
| 8 |
| 9 |
@add-page-numbers @positive
Scenario: add-page-numbers starting from a custom number
Given I generate a PDF file as "fileInput"
And the pdf contains 5 pages
And the request data includes
| parameter | value |
| startingNumber | 10 |
| position | 2 |
| fontSize | 14 |
When I send the API request to the endpoint "/api/v1/misc/add-page-numbers"
And this operation is run 5 times in parallel against decoy traffic
Then the response content type should be "application/pdf"
And the response status code should be 200
And the response file should have size greater than 200
And the response PDF should contain 5 pages
@unlock-pdf-forms @positive
Scenario: unlock-pdf-forms returns a valid unlocked PDF
Given I generate a PDF file as "fileInput"
And the pdf contains 2 pages
When I send the API request to the endpoint "/api/v1/misc/unlock-pdf-forms"
And this operation is run 5 times in parallel
Then the response content type should be "application/pdf"
And the response status code should be 200
And the response file should have size greater than 0
@scanner-effect @positive
Scenario Outline: scanner-effect applies a scan simulation to a PDF
Given I generate a PDF file as "fileInput"
And the pdf contains 1 pages
And the request data includes
| parameter | value |
| colorspace | <colorspace> |
| quality | <quality> |
When I send the API request to the endpoint "/api/v1/misc/scanner-effect"
Then the response content type should be "application/pdf"
And the response status code should be 200
And the response file should have size greater than 0
And the response PDF should contain 1 pages
Examples:
| colorspace | quality |
| grayscale | low |
| grayscale | medium |
| grayscale | high |
@replace-invert-pdf @positive
Scenario: replace-invert-pdf returns a valid PDF
Given I generate a PDF file as "fileInput"
And the pdf contains 2 pages
And the request data includes
| parameter | value |
| replaceAndInvertOption | HIGH_CONTRAST_COLOR |
| highContrastColorCombination | WHITE_TEXT_ON_BLACK |
When I send the API request to the endpoint "/api/v1/misc/replace-invert-pdf"
And this operation is run 5 times in parallel
Then the response content type should be "application/pdf"
And the response status code should be 200
And the response file should have size greater than 0
And the response PDF should contain 2 pages
@replace-invert-pdf @positive
Scenario: replace-invert-pdf on a PDF with images returns a valid PDF
Given I generate a PDF file as "fileInput"
And the pdf contains 2 images of size 100x100 on 1 pages
And the request data includes
| parameter | value |
| replaceAndInvertOption | FULL_INVERSION |
| highContrastColorCombination | WHITE_TEXT_ON_BLACK |
When I send the API request to the endpoint "/api/v1/misc/replace-invert-pdf"
Then the response content type should be "application/pdf"
And the response status code should be 200
And the response file should have size greater than 0
@decompress-pdf @positive
Scenario: decompress-pdf returns a decompressed PDF
Given I generate a PDF file as "fileInput"
And the pdf contains 3 pages
When I send the API request to the endpoint "/api/v1/misc/decompress-pdf"
And this operation is run 5 times in parallel
Then the response content type should be "application/pdf"
And the response status code should be 200
And the response file should have size greater than 0
And the response PDF should contain 3 pages
@decompress-pdf @positive
Scenario: decompress-pdf on a single-page PDF returns valid output
Given I generate a PDF file as "fileInput"
And the pdf contains 1 pages
When I send the API request to the endpoint "/api/v1/misc/decompress-pdf"
Then the response content type should be "application/pdf"
And the response status code should be 200
And the response file should have size greater than 0
And the response PDF should contain 1 pages
@auto-rename @positive
Scenario: auto-rename renames PDF using first text content as filename
Given I generate a PDF file as "fileInput"
And the pdf contains 2 pages with random text
And the request data includes
| parameter | value |
| useFirstTextAsFallback | true |
When I send the API request to the endpoint "/api/v1/misc/auto-rename"
And this operation is run 5 times in parallel
Then the response content type should be "application/pdf"
And the response status code should be 200
And the response file should have size greater than 0
@auto-rename @positive
Scenario: auto-rename on a plain text PDF returns a PDF with a derived name
Given I generate a PDF file as "fileInput"
And the pdf contains 1 pages with random text
And the request data includes
| parameter | value |
| useFirstTextAsFallback | true |
When I send the API request to the endpoint "/api/v1/misc/auto-rename"
Then the response content type should be "application/pdf"
And the response status code should be 200
And the response file should have size greater than 0
And the response file should have extension ".pdf"
@show-javascript @positive
Scenario: show-javascript returns a response for a PDF without JavaScript
Given I generate a PDF file as "fileInput"
And the pdf contains 2 pages
When I send the API request to the endpoint "/api/v1/misc/show-javascript"
And this operation is run 5 times in parallel
Then the response status code should be 200
And the response file should have size greater than 0
@show-javascript @positive
Scenario: show-javascript on a multi-page PDF returns status 200
Given I generate a PDF file as "fileInput"
And the pdf contains 5 pages with random text
When I send the API request to the endpoint "/api/v1/misc/show-javascript"
Then the response status code should be 200
@auto-rotate-pdf @positive
Scenario: auto-rotate-pdf returns a PDF with the page count preserved
Given I generate a PDF file as "fileInput"
And the pdf contains 3 pages with random text
When I send the API request to the endpoint "/api/v1/misc/auto-rotate-pdf"
And this operation is run 5 times in parallel
Then the response status code should be 200
And the response content type should be "application/pdf"
And the response PDF should contain 3 pages
@add-comments @positive
Scenario: add-comments annotates a page without changing the page count
Given I generate a PDF file as "fileInput"
And the pdf contains 3 pages
And the request data includes
| parameter | value |
| comments | [{"pageNumber":1,"x":100,"y":100,"text":"review me","author":"qa"}] |
When I send the API request to the endpoint "/api/v1/misc/add-comments"
And this operation is run 5 times in parallel
Then the response status code should be 200
And the response content type should be "application/pdf"
And the response PDF should contain 3 pages