Files
Stirling-PDF/testing/cucumber/features/general_new.feature
T
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

312 lines
13 KiB
Gherkin

@general-new
Feature: General PDF Operations API Validation
@rotate-pdf @positive
Scenario Outline: rotate-pdf with valid rotation angles
Given I generate a PDF file as "fileInput"
And the pdf contains 3 pages
And the request data includes
| parameter | value |
| angle | <angle> |
When I send the API request to the endpoint "/api/v1/general/rotate-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 200
And the response PDF should contain 3 pages
Examples:
| angle |
| 90 |
| 180 |
| 270 |
@rotate-pdf @negative @rotate-pdf-negative
Scenario: rotate-pdf with invalid angle returns error
Given I generate a PDF file as "fileInput"
And the pdf contains 2 pages
And the request data includes
| parameter | value |
| angle | 45 |
When I send the API request to the endpoint "/api/v1/general/rotate-pdf"
Then the response status code should be 400
@remove-pages @positive
Scenario: remove-pages removes the specified page from a multi-page PDF
Given I generate a PDF file as "fileInput"
And the pdf contains 5 pages
And the request data includes
| parameter | value |
| pageNumbers | 3 |
When I send the API request to the endpoint "/api/v1/general/remove-pages"
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 4 pages
@remove-pages @positive
Scenario Outline: remove-pages with various page selections
Given I generate a PDF file as "fileInput"
And the pdf contains 6 pages
And the request data includes
| parameter | value |
| pageNumbers | <pageNumbers> |
When I send the API request to the endpoint "/api/v1/general/remove-pages"
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 <remaining> pages
Examples:
| pageNumbers | remaining |
| 1 | 5 |
| 6 | 5 |
| 2,4 | 4 |
| 1,2,3 | 3 |
@rearrange-pages @positive
Scenario Outline: rearrange-pages with different custom modes
Given I generate a PDF file as "fileInput"
And the pdf contains 4 pages
And the request data includes
| parameter | value |
| customMode | <customMode> |
When I send the API request to the endpoint "/api/v1/general/rearrange-pages"
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 <expectedPages> pages
Examples:
| customMode | expectedPages |
| REVERSE_ORDER | 4 |
@rearrange-duplicate
Examples:
| customMode | expectedPages |
| DUPLICATE | 8 |
Examples:
| customMode | expectedPages |
| ODD_EVEN_SPLIT | 4 |
@scale-pages @positive
Scenario Outline: scale-pages to various standard page sizes
Given I generate a PDF file as "fileInput"
And the pdf contains 3 pages
And the request data includes
| parameter | value |
| pageSize | <pageSize> |
When I send the API request to the endpoint "/api/v1/general/scale-pages"
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 3 pages
Examples:
| pageSize |
| A4 |
| LETTER |
| A3 |
| LEGAL |
@crop @positive
Scenario: crop PDF pages to a specific region
Given I generate a PDF file as "fileInput"
And the pdf contains 2 pages
And the request data includes
| parameter | value |
| x | 0 |
| y | 0 |
| width | 50 |
| height | 50 |
When I send the API request to the endpoint "/api/v1/general/crop"
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
@crop @positive
Scenario: crop single-page PDF preserves page count
Given I generate a PDF file as "fileInput"
And the pdf contains 1 pages
And the request data includes
| parameter | value |
| x | 0 |
| y | 0 |
| width | 50 |
| height | 50 |
When I send the API request to the endpoint "/api/v1/general/crop"
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
@pdf-to-single-page @positive
Scenario: pdf-to-single-page combines all pages into one long page
Given I generate a PDF file as "fileInput"
And the pdf contains 5 pages
When I send the API request to the endpoint "/api/v1/general/pdf-to-single-page"
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 1 pages
@pdf-to-single-page @positive
Scenario: pdf-to-single-page with a single-page input returns one page
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/general/pdf-to-single-page"
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
@multi-page-layout @positive
Scenario Outline: multi-page-layout combines input pages onto fewer sheets
Given I generate a PDF file as "fileInput"
And the pdf contains 4 pages
And the request data includes
| parameter | value |
| pagesPerSheet | <pagesPerSheet> |
When I send the API request to the endpoint "/api/v1/general/multi-page-layout"
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 <outputPages> pages
Examples:
| pagesPerSheet | outputPages |
| 2 | 2 |
| 4 | 1 |
@multi-page-layout @positive
Scenario: multi-page-layout with 9 pages per sheet on 9 input pages
Given I generate a PDF file as "fileInput"
And the pdf contains 9 pages
And the request data includes
| parameter | value |
| pagesPerSheet | 9 |
When I send the API request to the endpoint "/api/v1/general/multi-page-layout"
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 1 pages
@booklet-imposition @positive
Scenario: booklet-imposition returns a valid PDF
Given I generate a PDF file as "fileInput"
And the pdf contains 4 pages
And the request data includes
| parameter | value |
| pagesPerSheet | 2 |
When I send the API request to the endpoint "/api/v1/general/booklet-imposition"
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
@booklet-imposition @positive
Scenario: booklet-imposition with 8-page input returns valid PDF
Given I generate a PDF file as "fileInput"
And the pdf contains 8 pages
And the request data includes
| parameter | value |
| pagesPerSheet | 2 |
When I send the API request to the endpoint "/api/v1/general/booklet-imposition"
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
# @remove-image-pdf @positive
# Scenario: remove-image-pdf strips images from a PDF containing images
# Given I generate a PDF file as "fileInput"
# And the pdf contains 3 images of size 100x100 on 2 pages
# When I send the API request to the endpoint "/api/v1/general/remove-image-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
#
#
# @remove-image-pdf @positive
# Scenario: remove-image-pdf on a plain text PDF returns a PDF
# 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/general/remove-image-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
@edit-table-of-contents @positive
Scenario: edit-table-of-contents rewrites the outline
Given I generate a PDF file as "fileInput"
And the pdf contains 3 pages
And the pdf has bookmarks
And the request data includes
| parameter | value |
| bookmarkData | [{"title":"Intro","pageNumber":1,"children":[]}] |
When I send the API request to the endpoint "/api/v1/general/edit-table-of-contents"
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
@edit-text @positive
Scenario: edit-text applies a find and replace across the document
Given I generate a PDF file as "fileInput"
And the pdf contains 3 pages
And the pdf pages all contain the text "Hello world"
And the request data includes
| parameter | value |
| edits | [{"find":"Hello","replace":"Goodbye"}] |
When I send the API request to the endpoint "/api/v1/general/edit-text"
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"
@edit-text @negative
Scenario: edit-text without any operations returns 400
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/general/edit-text"
Then the response status code should be 400
And the response JSON error should contain "find/replace"
@split-for-poster-print @positive
Scenario: split-for-poster-print tiles each page into an archive
Given I generate a PDF file as "fileInput"
And the pdf contains 2 pages
And the request data includes
| parameter | value |
| horizontalDivisions | 1 |
| verticalDivisions | 1 |
When I send the API request to the endpoint "/api/v1/general/split-for-poster-print"
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 200