mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2026-02-01 20:10:35 +01:00
# Description of Changes <!-- Please provide a summary of the changes, including: - What was changed - Why the change was made - Any challenges encountered Closes #(issue_number) --> --- ## 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/devGuide/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) ### 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 tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md#6-testing) for more details. --------- Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Balázs Szücs <bszucs1209@gmail.com> Signed-off-by: stirlingbot[bot] <stirlingbot[bot]@users.noreply.github.com> Co-authored-by: ConnorYoh <40631091+ConnorYoh@users.noreply.github.com> Co-authored-by: Connor Yoh <connor@stirlingpdf.com> Co-authored-by: OUNZAR Aymane <aymane.ounzar@imt-atlantique.net> Co-authored-by: YAOU Reda <yaoureda24@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: stirlingbot[bot] <195170888+stirlingbot[bot]@users.noreply.github.com> Co-authored-by: Balázs Szücs <127139797+balazs-szucs@users.noreply.github.com> Co-authored-by: Ludy <Ludy87@users.noreply.github.com> Co-authored-by: tkymmm <136296842+tkymmm@users.noreply.github.com> Co-authored-by: Peter Dave Hello <hsu@peterdavehello.org> Co-authored-by: albanobattistella <34811668+albanobattistella@users.noreply.github.com> Co-authored-by: PingLin8888 <88387490+PingLin8888@users.noreply.github.com> Co-authored-by: FdaSilvaYY <FdaSilvaYY@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: OteJlo <106060728+OteJlo@users.noreply.github.com> Co-authored-by: Angel <41905618+TheShadowAngel@users.noreply.github.com> Co-authored-by: Ricardo Catarino <ricardomicc@gmail.com> Co-authored-by: Luis Antonio Argüelles González <luis.arguelles@encora.com> Co-authored-by: Dawid Urbański <31166488+urbaned121@users.noreply.github.com> Co-authored-by: Stephan Paternotte <Stephan-P@users.noreply.github.com> Co-authored-by: Leonardo Santos Paulucio <leonardo.paulucio@hotmail.com> Co-authored-by: hamza khalem <72972114+hamzakhalem@users.noreply.github.com> Co-authored-by: IT Creativity + Art Team <admin@it-playground.net> Co-authored-by: Reece Browne <74901996+reecebrowne@users.noreply.github.com> Co-authored-by: James Brunton <jbrunton96@gmail.com> Co-authored-by: Victor Villarreal <133383186+vvillarreal-cfee@users.noreply.github.com>
133 lines
5.9 KiB
Gherkin
133 lines
5.9 KiB
Gherkin
@example @general
|
|
Feature: API Validation
|
|
|
|
@positive @password
|
|
Scenario: Remove password
|
|
Given I generate a PDF file as "fileInput"
|
|
And the pdf contains 3 pages
|
|
And the pdf is encrypted with password "password123"
|
|
And the request data includes
|
|
| parameter | value |
|
|
| password | password123 |
|
|
When I send the API request to the endpoint "/api/v1/security/remove-password"
|
|
Then the response content type should be "application/pdf"
|
|
And the response file should have size greater than 0
|
|
And the response PDF is not passworded
|
|
And the response status code should be 200
|
|
|
|
@negative @password
|
|
Scenario: Remove password wrong password
|
|
Given I generate a PDF file as "fileInput"
|
|
And the pdf contains 3 pages
|
|
And the pdf is encrypted with password "password123"
|
|
And the request data includes
|
|
| parameter | value |
|
|
| password | wrongPassword |
|
|
When I send the API request to the endpoint "/api/v1/security/remove-password"
|
|
Then the response status code should be 400
|
|
And the response should contain error message "The PDF Document is passworded and either the password was not provided or was incorrect"
|
|
|
|
@positive @info
|
|
Scenario: Get info
|
|
Given I generate a PDF file as "fileInput"
|
|
When I send the API request to the endpoint "/api/v1/security/get-info-on-pdf"
|
|
Then the response content type should be "application/json"
|
|
And the response file should have size greater than 100
|
|
And the response status code should be 200
|
|
|
|
@positive @password
|
|
Scenario: Add password
|
|
Given I generate a PDF file as "fileInput"
|
|
And the pdf contains 3 pages
|
|
And the request data includes
|
|
| parameter | value |
|
|
| password | password123 |
|
|
When I send the API request to the endpoint "/api/v1/security/add-password"
|
|
Then the response content type should be "application/pdf"
|
|
And the response file should have size greater than 100
|
|
And the response PDF is passworded
|
|
And the response status code should be 200
|
|
|
|
@positive @password
|
|
Scenario: Add password with other params
|
|
Given I generate a PDF file as "fileInput"
|
|
And the pdf contains 3 pages
|
|
And the request data includes
|
|
| parameter | value |
|
|
| ownerPassword | ownerPass |
|
|
| password | password123 |
|
|
| keyLength | 256 |
|
|
| canPrint | true |
|
|
| canModify | false |
|
|
When I send the API request to the endpoint "/api/v1/security/add-password"
|
|
Then the response content type should be "application/pdf"
|
|
And the response file should have size greater than 100
|
|
And the response PDF is passworded
|
|
And the response status code should be 200
|
|
|
|
@positive @watermark
|
|
Scenario: Add watermark
|
|
Given I generate a PDF file as "fileInput"
|
|
And the pdf contains 3 pages
|
|
And the request data includes
|
|
| parameter | value |
|
|
| watermarkType | text |
|
|
| watermarkText | Sample Watermark |
|
|
| fontSize | 30 |
|
|
| rotation | 45 |
|
|
| opacity | 0.5 |
|
|
| widthSpacer | 50 |
|
|
| heightSpacer | 50 |
|
|
| alphabet | roman |
|
|
| customColor | #d3d3d3 |
|
|
When I send the API request to the endpoint "/api/v1/security/add-watermark"
|
|
Then the response content type should be "application/pdf"
|
|
And the response file should have size greater than 100
|
|
And the response status code should be 200
|
|
|
|
@positive
|
|
Scenario: Remove blank pages
|
|
Given I generate a PDF file as "fileInput"
|
|
And the pdf contains 3 blank pages
|
|
And the request data includes
|
|
| parameter | value |
|
|
| threshold | 90 |
|
|
| whitePercent | 99.9 |
|
|
When I send the API request to the endpoint "/api/v1/misc/remove-blanks"
|
|
Then the response content type should be "application/octet-stream"
|
|
And the response file should have extension ".zip"
|
|
And the response ZIP should contain 1 files
|
|
And the response file should have size greater than 0
|
|
|
|
@positive @flatten
|
|
Scenario: Flatten PDF
|
|
Given I generate a PDF file as "fileInput"
|
|
And the request data includes
|
|
| parameter | value |
|
|
| flattenOnlyForms | false |
|
|
When I send the API request to the endpoint "/api/v1/misc/flatten"
|
|
Then the response content type should be "application/pdf"
|
|
And the response file should have size greater than 0
|
|
And the response status code should be 200
|
|
|
|
@positive @metadata
|
|
Scenario: Update metadata
|
|
Given I generate a PDF file as "fileInput"
|
|
And the request data includes
|
|
| parameter | value |
|
|
| author | John Doe |
|
|
| title | Sample Title |
|
|
| subject | Sample Subject |
|
|
| keywords | sample, test |
|
|
| producer | Test Producer |
|
|
When I send the API request to the endpoint "/api/v1/misc/update-metadata"
|
|
Then the response content type should be "application/pdf"
|
|
And the response file should have size greater than 0
|
|
And the response PDF metadata should include "Author" as "John Doe"
|
|
And the response PDF metadata should include "Keywords" as "sample, test"
|
|
And the response PDF metadata should include "Subject" as "Sample Subject"
|
|
And the response PDF metadata should include "Title" as "Sample Title"
|
|
And the response status code should be 200
|
|
|
|
|