test(integration): add more tags, complete embed feature tests suite, fix order with metadata

This commit is contained in:
Julien Neuhart
2025-11-13 22:08:28 +01:00
parent 4429aea8a4
commit f9ad8bd2d5
23 changed files with 449 additions and 182 deletions

View File

@@ -160,9 +160,39 @@ test-unit: ## Run unit tests
PLATFORM= PLATFORM=
NO_CONCURRENCY=false NO_CONCURRENCY=false
# Available tags:
# chromium
# chromium-convert-html
# chromium-convert-markdown
# chromium-convert-url
# debug
# health
# libreoffice
# libreoffice-convert
# output-filename
# pdfengines
# pdfengines-convert
# pdfengines-embed
# embed
# pdfengines-encrypt
# encrypt
# pdfengines-flatten
# flatten
# pdfengines-merge
# merge
# pdfengines-metadata
# metadata
# pdfengines-split
# split
# prometheus-metrics
# root
# version
# webhook
# download-from
TAGS=
.PHONY: test-integration .PHONY: test-integration
test-integration: ## Run integration tests, use TAGS environment variable to filter tests by tags test-integration: ## Run integration tests
go test -timeout 40m -tags=integration -v github.com/gotenberg/gotenberg/v8/test/integration -args \ go test -timeout 40m -tags=integration -v github.com/gotenberg/gotenberg/v8/test/integration -args \
--gotenberg-docker-repository=$(DOCKER_REPOSITORY) \ --gotenberg-docker-repository=$(DOCKER_REPOSITORY) \
--gotenberg-version=$(GOTENBERG_VERSION) \ --gotenberg-version=$(GOTENBERG_VERSION) \

View File

@@ -685,16 +685,16 @@ func convertUrl(ctx *api.Context, chromium Api, engine gotenberg.PdfEngine, url
return fmt.Errorf("convert PDF(s): %w", err) return fmt.Errorf("convert PDF(s): %w", err)
} }
err = pdfengines.WriteMetadataStub(ctx, engine, metadata, convertOutputPaths)
if err != nil {
return fmt.Errorf("write metadata: %w", err)
}
err = pdfengines.EmbedFilesStub(ctx, engine, embedPaths, convertOutputPaths) err = pdfengines.EmbedFilesStub(ctx, engine, embedPaths, convertOutputPaths)
if err != nil { if err != nil {
return fmt.Errorf("embed files into PDFs: %w", err) return fmt.Errorf("embed files into PDFs: %w", err)
} }
err = pdfengines.WriteMetadataStub(ctx, engine, metadata, convertOutputPaths)
if err != nil {
return fmt.Errorf("write metadata: %w", err)
}
err = pdfengines.EncryptPdfStub(ctx, engine, userPassword, ownerPassword, convertOutputPaths) err = pdfengines.EncryptPdfStub(ctx, engine, userPassword, ownerPassword, convertOutputPaths)
if err != nil { if err != nil {
return fmt.Errorf("encrypt PDFs: %w", err) return fmt.Errorf("encrypt PDFs: %w", err)

View File

@@ -253,6 +253,11 @@ func convertRoute(libreOffice libreofficeapi.Uno, engine gotenberg.PdfEngine) ap
} }
} }
err = pdfengines.EmbedFilesStub(ctx, engine, embedPaths, outputPaths)
if err != nil {
return fmt.Errorf("embed files into PDFs: %w", err)
}
err = pdfengines.WriteMetadataStub(ctx, engine, metadata, outputPaths) err = pdfengines.WriteMetadataStub(ctx, engine, metadata, outputPaths)
if err != nil { if err != nil {
return fmt.Errorf("write metadata: %w", err) return fmt.Errorf("write metadata: %w", err)
@@ -265,11 +270,6 @@ func convertRoute(libreOffice libreofficeapi.Uno, engine gotenberg.PdfEngine) ap
} }
} }
err = pdfengines.EmbedFilesStub(ctx, engine, embedPaths, outputPaths)
if err != nil {
return fmt.Errorf("embed files into PDFs: %w", err)
}
err = pdfengines.EncryptPdfStub(ctx, engine, userPassword, ownerPassword, outputPaths) err = pdfengines.EncryptPdfStub(ctx, engine, userPassword, ownerPassword, outputPaths)
if err != nil { if err != nil {
return fmt.Errorf("encrypt PDFs: %w", err) return fmt.Errorf("encrypt PDFs: %w", err)

View File

@@ -337,6 +337,11 @@ func mergeRoute(engine gotenberg.PdfEngine) api.Route {
return fmt.Errorf("convert PDF: %w", err) return fmt.Errorf("convert PDF: %w", err)
} }
err = EmbedFilesStub(ctx, engine, embedPaths, outputPaths)
if err != nil {
return fmt.Errorf("embed files into PDFs: %w", err)
}
err = WriteMetadataStub(ctx, engine, metadata, outputPaths) err = WriteMetadataStub(ctx, engine, metadata, outputPaths)
if err != nil { if err != nil {
return fmt.Errorf("write metadata: %w", err) return fmt.Errorf("write metadata: %w", err)
@@ -349,11 +354,6 @@ func mergeRoute(engine gotenberg.PdfEngine) api.Route {
} }
} }
err = EmbedFilesStub(ctx, engine, embedPaths, outputPaths)
if err != nil {
return fmt.Errorf("embed files into PDFs: %w", err)
}
err = EncryptPdfStub(ctx, engine, userPassword, ownerPassword, outputPaths) err = EncryptPdfStub(ctx, engine, userPassword, ownerPassword, outputPaths)
if err != nil { if err != nil {
return fmt.Errorf("encrypt PDFs: %w", err) return fmt.Errorf("encrypt PDFs: %w", err)
@@ -405,6 +405,11 @@ func splitRoute(engine gotenberg.PdfEngine) api.Route {
return fmt.Errorf("convert PDFs: %w", err) return fmt.Errorf("convert PDFs: %w", err)
} }
err = EmbedFilesStub(ctx, engine, embedPaths, convertOutputPaths)
if err != nil {
return fmt.Errorf("embed files into PDFs: %w", err)
}
err = WriteMetadataStub(ctx, engine, metadata, convertOutputPaths) err = WriteMetadataStub(ctx, engine, metadata, convertOutputPaths)
if err != nil { if err != nil {
return fmt.Errorf("write metadata: %w", err) return fmt.Errorf("write metadata: %w", err)
@@ -417,11 +422,6 @@ func splitRoute(engine gotenberg.PdfEngine) api.Route {
} }
} }
err = EmbedFilesStub(ctx, engine, embedPaths, convertOutputPaths)
if err != nil {
return fmt.Errorf("embed files into PDFs: %w", err)
}
err = EncryptPdfStub(ctx, engine, userPassword, ownerPassword, convertOutputPaths) err = EncryptPdfStub(ctx, engine, userPassword, ownerPassword, convertOutputPaths)
if err != nil { if err != nil {
return fmt.Errorf("encrypt PDFs: %w", err) return fmt.Errorf("encrypt PDFs: %w", err)

View File

@@ -1,6 +1,8 @@
# TODO: # TODO:
# 1. JavaScript disabled on some feature. # 1. JavaScript disabled on some feature.
@chromium
@chromium-pdf-html
Feature: /forms/chromium/convert/html Feature: /forms/chromium/convert/html
Scenario: POST /forms/chromium/convert/html (Default) Scenario: POST /forms/chromium/convert/html (Default)
@@ -557,6 +559,7 @@ Feature: /forms/chromium/convert/html
Invalid form data: form field 'metadata' is invalid (got 'foo', resulting to unmarshal metadata: invalid character 'o' in literal false (expecting 'a')) Invalid form data: form field 'metadata' is invalid (got 'foo', resulting to unmarshal metadata: invalid character 'o' in literal false (expecting 'a'))
""" """
@split
Scenario: POST /forms/chromium/convert/html (Split Intervals) Scenario: POST /forms/chromium/convert/html (Split Intervals)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
@@ -585,6 +588,8 @@ Feature: /forms/chromium/convert/html
""" """
# See https://github.com/gotenberg/gotenberg/issues/1130. # See https://github.com/gotenberg/gotenberg/issues/1130.
@split
@output-filename
Scenario: POST /forms/chromium/convert/html (Split Output Filename) Scenario: POST /forms/chromium/convert/html (Split Output Filename)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
@@ -614,6 +619,7 @@ Feature: /forms/chromium/convert/html
Page 3 Page 3
""" """
@split
Scenario: POST /forms/chromium/convert/html (Split Pages) Scenario: POST /forms/chromium/convert/html (Split Pages)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
@@ -637,6 +643,7 @@ Feature: /forms/chromium/convert/html
Page 3 Page 3
""" """
@split
Scenario: POST /forms/chromium/convert/html (Split Pages & Unify) Scenario: POST /forms/chromium/convert/html (Split Pages & Unify)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
@@ -660,6 +667,7 @@ Feature: /forms/chromium/convert/html
Page 3 Page 3
""" """
@split
Scenario: POST /forms/chromium/convert/html (Split Many PDFs - Lot of Pages) Scenario: POST /forms/chromium/convert/html (Split Many PDFs - Lot of Pages)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
@@ -693,6 +701,7 @@ Feature: /forms/chromium/convert/html
Page 12 Page 12
""" """
@convert
Scenario: POST /forms/chromium/convert/html (PDF/A-1b & PDF/UA-1) Scenario: POST /forms/chromium/convert/html (PDF/A-1b & PDF/UA-1)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
@@ -705,6 +714,8 @@ Feature: /forms/chromium/convert/html
Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 1 failed rule(s) Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 1 failed rule(s)
Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 3 failed rule(s) Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 3 failed rule(s)
@convert
@split
Scenario: POST /forms/chromium/convert/html (Split & PDF/A-1b & PDF/UA-1) Scenario: POST /forms/chromium/convert/html (Split & PDF/A-1b & PDF/UA-1)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
@@ -737,6 +748,9 @@ Feature: /forms/chromium/convert/html
Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 3 failed rule(s) Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 3 failed rule(s)
# See https://github.com/gotenberg/gotenberg/issues/1130. # See https://github.com/gotenberg/gotenberg/issues/1130.
@convert
@split
@output-filename
Scenario: POST /forms/chromium/convert/html (Split & PDF/A-1b & PDF/UA-1 & Output Filename) Scenario: POST /forms/chromium/convert/html (Split & PDF/A-1b & PDF/UA-1 & Output Filename)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
@@ -770,6 +784,7 @@ Feature: /forms/chromium/convert/html
Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 1 failed rule(s) Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 1 failed rule(s)
Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 3 failed rule(s) Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 3 failed rule(s)
@metadata
Scenario: POST /forms/chromium/convert/html (Metadata) Scenario: POST /forms/chromium/convert/html (Metadata)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
@@ -805,6 +820,7 @@ Feature: /forms/chromium/convert/html
} }
""" """
@flatten
Scenario: POST /forms/chromium/convert/html (Flatten) Scenario: POST /forms/chromium/convert/html (Flatten)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
@@ -815,6 +831,7 @@ Feature: /forms/chromium/convert/html
Then there should be 1 PDF(s) in the response Then there should be 1 PDF(s) in the response
Then the response PDF(s) should be flatten Then the response PDF(s) should be flatten
@encrypt
Scenario: POST /forms/chromium/convert/html (Encrypt - user password only) Scenario: POST /forms/chromium/convert/html (Encrypt - user password only)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
@@ -825,6 +842,7 @@ Feature: /forms/chromium/convert/html
Then there should be 1 PDF(s) in the response Then there should be 1 PDF(s) in the response
Then the response PDF(s) should be encrypted Then the response PDF(s) should be encrypted
@encrypt
Scenario: POST /forms/chromium/convert/html (Encrypt - both user and owner passwords) Scenario: POST /forms/chromium/convert/html (Encrypt - both user and owner passwords)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
@@ -836,8 +854,28 @@ Feature: /forms/chromium/convert/html
Then there should be 1 PDF(s) in the response Then there should be 1 PDF(s) in the response
Then the response PDF(s) should be encrypted Then the response PDF(s) should be encrypted
@embed
Scenario: POST /forms/chromium/convert/html (Embeds)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
| files | testdata/page-1-html/index.html | file |
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf"
Then there should be 1 PDF(s) in the response
Then there should be the following file(s) in the response:
| foo.pdf |
Then the response PDF(s) should have the "embed_1.xml" file embedded
Then the response PDF(s) should have the "embed_2.xml" file embedded
# FIXME: once decrypt is done, add encrypt and check after the content of the PDF. # FIXME: once decrypt is done, add encrypt and check after the content of the PDF.
Scenario: POST /forms/chromium/convert/html (PDF/A-1b & PDF/UA-1 & Metadata & Flatten) @convert
@metadata
@flatten
@embed
Scenario: POST /forms/chromium/convert/html (PDF/A-1b & PDF/UA-1 & Metadata & Flatten & Embeds)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
| files | testdata/page-1-html/index.html | file | | files | testdata/page-1-html/index.html | file |
@@ -845,15 +883,19 @@ Feature: /forms/chromium/convert/html
| pdfua | true | field | | pdfua | true | field |
| metadata | {"Author":"Julien Neuhart","Copyright":"Julien Neuhart","CreateDate":"2006-09-18T16:27:50-04:00","Creator":"Gotenberg","Keywords":["first","second"],"Marked":true,"ModDate":"2006-09-18T16:27:50-04:00","PDFVersion":1.7,"Producer":"Gotenberg","Subject":"Sample","Title":"Sample","Trapped":"Unknown"} | field | | metadata | {"Author":"Julien Neuhart","Copyright":"Julien Neuhart","CreateDate":"2006-09-18T16:27:50-04:00","Creator":"Gotenberg","Keywords":["first","second"],"Marked":true,"ModDate":"2006-09-18T16:27:50-04:00","PDFVersion":1.7,"Producer":"Gotenberg","Subject":"Sample","Title":"Sample","Trapped":"Unknown"} | field |
| flatten | true | field | | flatten | true | field |
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
| Gotenberg-Output-Filename | foo | header | | Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200 Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf" Then the response header "Content-Type" should be "application/pdf"
Then there should be 1 PDF(s) in the response Then there should be 1 PDF(s) in the response
Then there should be the following file(s) in the response: Then there should be the following file(s) in the response:
| foo.pdf | | foo.pdf |
Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 7 failed rule(s) Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 9 failed rule(s)
Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 2 failed rule(s) Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 2 failed rule(s)
Then the response PDF(s) should be flatten Then the response PDF(s) should be flatten
Then the response PDF(s) should have the "embed_1.xml" file embedded
Then the response PDF(s) should have the "embed_2.xml" file embedded
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/metadata/read" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/pdfengines/metadata/read" endpoint with the following form data and header(s):
| files | teststore/foo.pdf | file | | files | teststore/foo.pdf | file |
Then the response status code should be 200 Then the response status code should be 200
@@ -896,6 +938,7 @@ Feature: /forms/chromium/convert/html
Then the Gotenberg container should log the following entries: Then the Gotenberg container should log the following entries:
| "trace":"forms_chromium_convert_html" | | "trace":"forms_chromium_convert_html" |
@download-from
Scenario: POST /forms/chromium/convert/html (Download From) Scenario: POST /forms/chromium/convert/html (Download From)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a static server Given I have a static server
@@ -905,6 +948,7 @@ Feature: /forms/chromium/convert/html
Then the file request header "X-Foo" should be "bar" Then the file request header "X-Foo" should be "bar"
Then the response header "Content-Type" should be "application/pdf" Then the response header "Content-Type" should be "application/pdf"
@webhook
Scenario: POST /forms/chromium/convert/html (Webhook) Scenario: POST /forms/chromium/convert/html (Webhook)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a webhook server Given I have a webhook server
@@ -942,19 +986,3 @@ Feature: /forms/chromium/convert/html
| files | testdata/page-1-html/index.html | file | | files | testdata/page-1-html/index.html | file |
Then the response status code should be 200 Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf" Then the response header "Content-Type" should be "application/pdf"
@embed
Scenario: POST /forms/chromium/convert/html (Embeds)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
| files | testdata/page-1-html/index.html | file |
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
And the response header "Content-Type" should be "application/pdf"
And there should be 1 PDF(s) in the response
And there should be the following file(s) in the response:
| foo.pdf |
And the "foo.pdf" PDF should have the "embed_1.xml" file embedded in it
And the "foo.pdf" PDF should have the "embed_2.xml" file embedded in it

View File

@@ -1,6 +1,8 @@
# TODO: # TODO:
# 1. JavaScript disabled on some feature. # 1. JavaScript disabled on some feature.
@chromium
@chromium-convert-markdown
Feature: /forms/chromium/convert/markdown Feature: /forms/chromium/convert/markdown
Scenario: POST /forms/chromium/convert/markdown (Default) Scenario: POST /forms/chromium/convert/markdown (Default)
@@ -648,6 +650,7 @@ Feature: /forms/chromium/convert/markdown
Invalid form data: form field 'metadata' is invalid (got 'foo', resulting to unmarshal metadata: invalid character 'o' in literal false (expecting 'a')) Invalid form data: form field 'metadata' is invalid (got 'foo', resulting to unmarshal metadata: invalid character 'o' in literal false (expecting 'a'))
""" """
@split
Scenario: POST /forms/chromium/convert/markdown (Split Intervals) Scenario: POST /forms/chromium/convert/markdown (Split Intervals)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s):
@@ -679,6 +682,8 @@ Feature: /forms/chromium/convert/markdown
""" """
# See https://github.com/gotenberg/gotenberg/issues/1130. # See https://github.com/gotenberg/gotenberg/issues/1130.
@split
@output-filename
Scenario: POST /forms/chromium/convert/markdown (Split Output Filename) Scenario: POST /forms/chromium/convert/markdown (Split Output Filename)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s):
@@ -711,6 +716,7 @@ Feature: /forms/chromium/convert/markdown
Page 3 Page 3
""" """
@split
Scenario: POST /forms/chromium/convert/markdown (Split Pages) Scenario: POST /forms/chromium/convert/markdown (Split Pages)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s):
@@ -737,6 +743,7 @@ Feature: /forms/chromium/convert/markdown
Page 3 Page 3
""" """
@split
Scenario: POST /forms/chromium/convert/markdown (Split Pages & Unify) Scenario: POST /forms/chromium/convert/markdown (Split Pages & Unify)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s):
@@ -763,6 +770,7 @@ Feature: /forms/chromium/convert/markdown
Page 3 Page 3
""" """
@split
Scenario: POST /forms/chromium/convert/markdown (Split Many PDFs - Lot of Pages) Scenario: POST /forms/chromium/convert/markdown (Split Many PDFs - Lot of Pages)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s):
@@ -808,6 +816,7 @@ Feature: /forms/chromium/convert/markdown
Page 12 Page 12
""" """
@convert
Scenario: POST /forms/chromium/convert/markdown (PDF/A-1b & PDF/UA-1) Scenario: POST /forms/chromium/convert/markdown (PDF/A-1b & PDF/UA-1)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s):
@@ -821,6 +830,8 @@ Feature: /forms/chromium/convert/markdown
Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 1 failed rule(s) Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 1 failed rule(s)
Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 3 failed rule(s) Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 3 failed rule(s)
@convert
@split
Scenario: POST /forms/chromium/convert/markdown (Split & PDF/A-1b & PDF/UA-1) Scenario: POST /forms/chromium/convert/markdown (Split & PDF/A-1b & PDF/UA-1)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s):
@@ -856,6 +867,9 @@ Feature: /forms/chromium/convert/markdown
Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 3 failed rule(s) Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 3 failed rule(s)
# See https://github.com/gotenberg/gotenberg/issues/1130. # See https://github.com/gotenberg/gotenberg/issues/1130.
@convert
@split
@output-filename
Scenario: POST /forms/chromium/convert/markdown (Split & PDF/A-1b & PDF/UA-1 & Output Filename) Scenario: POST /forms/chromium/convert/markdown (Split & PDF/A-1b & PDF/UA-1 & Output Filename)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s):
@@ -892,6 +906,7 @@ Feature: /forms/chromium/convert/markdown
Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 1 failed rule(s) Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 1 failed rule(s)
Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 3 failed rule(s) Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 3 failed rule(s)
@metadata
Scenario: POST /forms/chromium/convert/markdown (Metadata) Scenario: POST /forms/chromium/convert/markdown (Metadata)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s):
@@ -928,6 +943,7 @@ Feature: /forms/chromium/convert/markdown
} }
""" """
@flatten
Scenario: POST /forms/chromium/convert/markdown (Flatten) Scenario: POST /forms/chromium/convert/markdown (Flatten)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s):
@@ -939,6 +955,7 @@ Feature: /forms/chromium/convert/markdown
Then there should be 1 PDF(s) in the response Then there should be 1 PDF(s) in the response
Then the response PDF(s) should be flatten Then the response PDF(s) should be flatten
@encrypt
Scenario: POST /forms/chromium/convert/markdown (Encrypt - user password only) Scenario: POST /forms/chromium/convert/markdown (Encrypt - user password only)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s):
@@ -950,6 +967,7 @@ Feature: /forms/chromium/convert/markdown
Then there should be 1 PDF(s) in the response Then there should be 1 PDF(s) in the response
Then the response PDF(s) should be encrypted Then the response PDF(s) should be encrypted
@encrypt
Scenario: POST /forms/chromium/convert/markdown (Encrypt - both user and owner passwords) Scenario: POST /forms/chromium/convert/markdown (Encrypt - both user and owner passwords)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s):
@@ -962,8 +980,29 @@ Feature: /forms/chromium/convert/markdown
Then there should be 1 PDF(s) in the response Then there should be 1 PDF(s) in the response
Then the response PDF(s) should be encrypted Then the response PDF(s) should be encrypted
@embed
Scenario: POST /forms/chromium/convert/markdown (Embeds)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s):
| files | testdata/page-1-markdown/index.html | file |
| files | testdata/page-1-markdown/page_1.md | file |
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf"
Then there should be 1 PDF(s) in the response
Then there should be the following file(s) in the response:
| foo.pdf |
Then the response PDF(s) should have the "embed_1.xml" file embedded
Then the response PDF(s) should have the "embed_2.xml" file embedded
# FIXME: once decrypt is done, add encrypt and check after the content of the PDF. # FIXME: once decrypt is done, add encrypt and check after the content of the PDF.
Scenario: POST /forms/chromium/convert/markdown (PDF/A-1b & PDF/UA-1 & Metadata & Flatten) @convert
@metadata
@flatten
@embed
Scenario: POST /forms/chromium/convert/markdown (PDF/A-1b & PDF/UA-1 & Metadata & Flatten & Embeds)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s):
| files | testdata/page-1-markdown/index.html | file | | files | testdata/page-1-markdown/index.html | file |
@@ -972,15 +1011,19 @@ Feature: /forms/chromium/convert/markdown
| pdfua | true | field | | pdfua | true | field |
| metadata | {"Author":"Julien Neuhart","Copyright":"Julien Neuhart","CreateDate":"2006-09-18T16:27:50-04:00","Creator":"Gotenberg","Keywords":["first","second"],"Marked":true,"ModDate":"2006-09-18T16:27:50-04:00","PDFVersion":1.7,"Producer":"Gotenberg","Subject":"Sample","Title":"Sample","Trapped":"Unknown"} | field | | metadata | {"Author":"Julien Neuhart","Copyright":"Julien Neuhart","CreateDate":"2006-09-18T16:27:50-04:00","Creator":"Gotenberg","Keywords":["first","second"],"Marked":true,"ModDate":"2006-09-18T16:27:50-04:00","PDFVersion":1.7,"Producer":"Gotenberg","Subject":"Sample","Title":"Sample","Trapped":"Unknown"} | field |
| flatten | true | field | | flatten | true | field |
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
| Gotenberg-Output-Filename | foo | header | | Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200 Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf" Then the response header "Content-Type" should be "application/pdf"
Then there should be 1 PDF(s) in the response Then there should be 1 PDF(s) in the response
Then there should be the following file(s) in the response: Then there should be the following file(s) in the response:
| foo.pdf | | foo.pdf |
Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 7 failed rule(s) Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 9 failed rule(s)
Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 2 failed rule(s) Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 2 failed rule(s)
Then the response PDF(s) should be flatten Then the response PDF(s) should be flatten
Then the response PDF(s) should have the "embed_1.xml" file embedded
Then the response PDF(s) should have the "embed_2.xml" file embedded
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/metadata/read" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/pdfengines/metadata/read" endpoint with the following form data and header(s):
| files | teststore/foo.pdf | file | | files | teststore/foo.pdf | file |
Then the response status code should be 200 Then the response status code should be 200
@@ -1025,6 +1068,7 @@ Feature: /forms/chromium/convert/markdown
Then the Gotenberg container should log the following entries: Then the Gotenberg container should log the following entries:
| "trace":"forms_chromium_convert_html" | | "trace":"forms_chromium_convert_html" |
@download-from
Scenario: POST /forms/chromium/convert/markdown (Download From) Scenario: POST /forms/chromium/convert/markdown (Download From)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a static server Given I have a static server
@@ -1035,6 +1079,7 @@ Feature: /forms/chromium/convert/markdown
Then the file request header "X-Foo" should be "bar" Then the file request header "X-Foo" should be "bar"
Then the response header "Content-Type" should be "application/pdf" Then the response header "Content-Type" should be "application/pdf"
@webhook
Scenario: POST /forms/chromium/convert/markdown (Webhook) Scenario: POST /forms/chromium/convert/markdown (Webhook)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a webhook server Given I have a webhook server
@@ -1075,20 +1120,3 @@ Feature: /forms/chromium/convert/markdown
| files | testdata/page-1-markdown/page_1.md | file | | files | testdata/page-1-markdown/page_1.md | file |
Then the response status code should be 200 Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf" Then the response header "Content-Type" should be "application/pdf"
@embed
Scenario: POST /forms/chromium/convert/markdown (Embeds)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s):
| files | testdata/page-1-markdown/index.html | file |
| files | testdata/page-1-markdown/page_1.md | file |
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
And the response header "Content-Type" should be "application/pdf"
And there should be 1 PDF(s) in the response
And there should be the following file(s) in the response:
| foo.pdf |
And the "foo.pdf" PDF should have the "embed_1.xml" file embedded in it
And the "foo.pdf" PDF should have the "embed_2.xml" file embedded in it

View File

@@ -1,6 +1,8 @@
# TODO: # TODO:
# 1. JavaScript disabled on some feature. # 1. JavaScript disabled on some feature.
@chromium
@chromium-convert-url
Feature: /forms/chromium/convert/url Feature: /forms/chromium/convert/url
Scenario: POST /forms/chromium/convert/url (Default) Scenario: POST /forms/chromium/convert/url (Default)
@@ -646,6 +648,7 @@ Feature: /forms/chromium/convert/url
Invalid form data: form field 'metadata' is invalid (got 'foo', resulting to unmarshal metadata: invalid character 'o' in literal false (expecting 'a')) Invalid form data: form field 'metadata' is invalid (got 'foo', resulting to unmarshal metadata: invalid character 'o' in literal false (expecting 'a'))
""" """
@split
Scenario: POST /forms/chromium/convert/url (Split Intervals) Scenario: POST /forms/chromium/convert/url (Split Intervals)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a static server Given I have a static server
@@ -675,6 +678,8 @@ Feature: /forms/chromium/convert/url
""" """
# See https://github.com/gotenberg/gotenberg/issues/1130. # See https://github.com/gotenberg/gotenberg/issues/1130.
@split
@output-filename
Scenario: POST /forms/chromium/convert/url (Split Output Filename) Scenario: POST /forms/chromium/convert/url (Split Output Filename)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a static server Given I have a static server
@@ -705,6 +710,7 @@ Feature: /forms/chromium/convert/url
Page 3 Page 3
""" """
@split
Scenario: POST /forms/chromium/convert/url (Split Pages) Scenario: POST /forms/chromium/convert/url (Split Pages)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a static server Given I have a static server
@@ -729,6 +735,7 @@ Feature: /forms/chromium/convert/url
Page 3 Page 3
""" """
@split
Scenario: POST /forms/chromium/convert/url (Split Pages & Unify) Scenario: POST /forms/chromium/convert/url (Split Pages & Unify)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a static server Given I have a static server
@@ -753,6 +760,7 @@ Feature: /forms/chromium/convert/url
Page 3 Page 3
""" """
@split
Scenario: POST /forms/chromium/convert/url (Split Many PDFs - Lot of Pages) Scenario: POST /forms/chromium/convert/url (Split Many PDFs - Lot of Pages)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a static server Given I have a static server
@@ -787,6 +795,7 @@ Feature: /forms/chromium/convert/url
Page 12 Page 12
""" """
@convert
Scenario: POST /forms/chromium/convert/url (PDF/A-1b & PDF/UA-1) Scenario: POST /forms/chromium/convert/url (PDF/A-1b & PDF/UA-1)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a static server Given I have a static server
@@ -833,6 +842,9 @@ Feature: /forms/chromium/convert/url
Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 3 failed rule(s) Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 3 failed rule(s)
# See https://github.com/gotenberg/gotenberg/issues/1130. # See https://github.com/gotenberg/gotenberg/issues/1130.
@convert
@split
@output-filename
Scenario: POST /forms/chromium/convert/url (Split & PDF/A-1b & PDF/UA-1 & Output Filename) Scenario: POST /forms/chromium/convert/url (Split & PDF/A-1b & PDF/UA-1 & Output Filename)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a static server Given I have a static server
@@ -867,6 +879,7 @@ Feature: /forms/chromium/convert/url
Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 1 failed rule(s) Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 1 failed rule(s)
Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 3 failed rule(s) Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 3 failed rule(s)
@metadata
Scenario: POST /forms/chromium/convert/url (Metadata) Scenario: POST /forms/chromium/convert/url (Metadata)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a static server Given I have a static server
@@ -903,6 +916,7 @@ Feature: /forms/chromium/convert/url
} }
""" """
@flatten
Scenario: POST /forms/chromium/convert/url (Flatten) Scenario: POST /forms/chromium/convert/url (Flatten)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a static server Given I have a static server
@@ -914,6 +928,7 @@ Feature: /forms/chromium/convert/url
Then there should be 1 PDF(s) in the response Then there should be 1 PDF(s) in the response
Then the response PDF(s) should be flatten Then the response PDF(s) should be flatten
@encrypt
Scenario: POST /forms/chromium/convert/url (Encrypt - user password only) Scenario: POST /forms/chromium/convert/url (Encrypt - user password only)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a static server Given I have a static server
@@ -925,6 +940,7 @@ Feature: /forms/chromium/convert/url
Then there should be 1 PDF(s) in the response Then there should be 1 PDF(s) in the response
Then the response PDF(s) should be encrypted Then the response PDF(s) should be encrypted
@encrypt
Scenario: POST /forms/chromium/convert/url (Encrypt - both user and owner passwords) Scenario: POST /forms/chromium/convert/url (Encrypt - both user and owner passwords)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a static server Given I have a static server
@@ -937,7 +953,28 @@ Feature: /forms/chromium/convert/url
Then there should be 1 PDF(s) in the response Then there should be 1 PDF(s) in the response
Then the response PDF(s) should be encrypted Then the response PDF(s) should be encrypted
@embed
Scenario: POST /foo/forms/chromium/convert/url (Embeds)
Given I have a default Gotenberg container
Given I have a static server
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/url" endpoint with the following form data and header(s):
| url | http://host.docker.internal:%d/html/testdata/page-1-html/index.html | field |
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf"
Then there should be 1 PDF(s) in the response
Then there should be the following file(s) in the webhook request:
| foo.pdf |
Then the response PDF(s) should have the "embed_1.xml" file embedded
Then the response PDF(s) should have the "embed_2.xml" file embedded
# FIXME: once decrypt is done, add encrypt and check after the content of the PDF. # FIXME: once decrypt is done, add encrypt and check after the content of the PDF.
@convert
@metadata
@flatten
@embed
Scenario: POST /forms/chromium/convert/url (PDF/A-1b & PDF/UA-1 & Metadata & Flatten) Scenario: POST /forms/chromium/convert/url (PDF/A-1b & PDF/UA-1 & Metadata & Flatten)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a static server Given I have a static server
@@ -947,15 +984,19 @@ Feature: /forms/chromium/convert/url
| pdfua | true | field | | pdfua | true | field |
| metadata | {"Author":"Julien Neuhart","Copyright":"Julien Neuhart","CreateDate":"2006-09-18T16:27:50-04:00","Creator":"Gotenberg","Keywords":["first","second"],"Marked":true,"ModDate":"2006-09-18T16:27:50-04:00","PDFVersion":1.7,"Producer":"Gotenberg","Subject":"Sample","Title":"Sample","Trapped":"Unknown"} | field | | metadata | {"Author":"Julien Neuhart","Copyright":"Julien Neuhart","CreateDate":"2006-09-18T16:27:50-04:00","Creator":"Gotenberg","Keywords":["first","second"],"Marked":true,"ModDate":"2006-09-18T16:27:50-04:00","PDFVersion":1.7,"Producer":"Gotenberg","Subject":"Sample","Title":"Sample","Trapped":"Unknown"} | field |
| flatten | true | field | | flatten | true | field |
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
| Gotenberg-Output-Filename | foo | header | | Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200 Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf" Then the response header "Content-Type" should be "application/pdf"
Then there should be 1 PDF(s) in the response Then there should be 1 PDF(s) in the response
Then there should be the following file(s) in the response: Then there should be the following file(s) in the response:
| foo.pdf | | foo.pdf |
Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 7 failed rule(s) Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 9 failed rule(s)
Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 2 failed rule(s) Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 2 failed rule(s)
Then the response PDF(s) should be flatten Then the response PDF(s) should be flatten
Then the response PDF(s) should have the "embed_1.xml" file embedded
Then the response PDF(s) should have the "embed_2.xml" file embedded
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/metadata/read" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/pdfengines/metadata/read" endpoint with the following form data and header(s):
| files | teststore/foo.pdf | file | | files | teststore/foo.pdf | file |
Then the response status code should be 200 Then the response status code should be 200
@@ -1000,6 +1041,7 @@ Feature: /forms/chromium/convert/url
Then the Gotenberg container should log the following entries: Then the Gotenberg container should log the following entries:
| "trace":"forms_chromium_convert_url" | | "trace":"forms_chromium_convert_url" |
@webhook
Scenario: POST /forms/chromium/convert/url (Webhook) Scenario: POST /forms/chromium/convert/url (Webhook)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a webhook server Given I have a webhook server
@@ -1039,20 +1081,3 @@ Feature: /forms/chromium/convert/url
| url | http://host.docker.internal:%d/html/testdata/page-1-html/index.html | field | | url | http://host.docker.internal:%d/html/testdata/page-1-html/index.html | field |
Then the response status code should be 200 Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf" Then the response header "Content-Type" should be "application/pdf"
@embed
Scenario: POST /foo/forms/chromium/convert/url (Embeds)
Given I have a default Gotenberg container
And I have a static server
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/url" endpoint with the following form data and header(s):
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
| url | http://host.docker.internal:%d/html/testdata/page-1-html/index.html | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
And the response header "Content-Type" should be "application/pdf"
And there should be 1 PDF(s) in the response
And there should be the following file(s) in the webhook request:
| foo.pdf |
And the "foo.pdf" PDF should have the "embed_1.xml" file embedded in it
And the "foo.pdf" PDF should have the "embed_2.xml" file embedded in it

View File

@@ -1,3 +1,4 @@
@debug
Feature: /debug Feature: /debug
Scenario: GET /debug (Disabled) Scenario: GET /debug (Disabled)

View File

@@ -2,6 +2,7 @@
# 1. Check if down for each module. # 1. Check if down for each module.
# 2. Restarting modules do not make health check fail. # 2. Restarting modules do not make health check fail.
@health
Feature: /health Feature: /health
Scenario: GET /health Scenario: GET /health

View File

@@ -1,3 +1,5 @@
@libreoffice
@libreoffice-convert
Feature: /forms/libreoffice/convert Feature: /forms/libreoffice/convert
Scenario: POST /forms/libreoffice/convert (Single Document) Scenario: POST /forms/libreoffice/convert (Single Document)
@@ -272,6 +274,7 @@ Feature: /forms/libreoffice/convert
Invalid form data: form field 'metadata' is invalid (got 'foo', resulting to unmarshal metadata: invalid character 'o' in literal false (expecting 'a')) Invalid form data: form field 'metadata' is invalid (got 'foo', resulting to unmarshal metadata: invalid character 'o' in literal false (expecting 'a'))
""" """
@merge
Scenario: POST /forms/libreoffice/convert (Merge) Scenario: POST /forms/libreoffice/convert (Merge)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
@@ -294,6 +297,8 @@ Feature: /forms/libreoffice/convert
Page 2 Page 2
""" """
@merge
@split
Scenario: POST /forms/libreoffice/convert (Merge & Split) Scenario: POST /forms/libreoffice/convert (Merge & Split)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
@@ -319,6 +324,7 @@ Feature: /forms/libreoffice/convert
Page 2 Page 2
""" """
@split
Scenario: POST /forms/libreoffice/convert (Split Intervals) Scenario: POST /forms/libreoffice/convert (Split Intervals)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
@@ -346,6 +352,7 @@ Feature: /forms/libreoffice/convert
Page 3 Page 3
""" """
@split
Scenario: POST /forms/libreoffice/convert (Split Pages) Scenario: POST /forms/libreoffice/convert (Split Pages)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
@@ -369,6 +376,7 @@ Feature: /forms/libreoffice/convert
Page 3 Page 3
""" """
@split
Scenario: POST /forms/libreoffice/convert (Split Pages & Unify) Scenario: POST /forms/libreoffice/convert (Split Pages & Unify)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
@@ -391,6 +399,7 @@ Feature: /forms/libreoffice/convert
Page 3 Page 3
""" """
@split
Scenario: POST /forms/libreoffice/convert (Split Many PDFs - Lot of Pages) Scenario: POST /forms/libreoffice/convert (Split Many PDFs - Lot of Pages)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
@@ -438,6 +447,7 @@ Feature: /forms/libreoffice/convert
Page 12 Page 12
""" """
@convert
Scenario: POST /forms/libreoffice/convert (PDF/A-1b & PDF/UA-1) Scenario: POST /forms/libreoffice/convert (PDF/A-1b & PDF/UA-1)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
@@ -450,6 +460,8 @@ Feature: /forms/libreoffice/convert
Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 1 failed rule(s) Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 1 failed rule(s)
Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 3 failed rule(s) Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 3 failed rule(s)
@split
@convert
Scenario: POST /forms/libreoffice/convert (Split & PDF/A-1b & PDF/UA-1) Scenario: POST /forms/libreoffice/convert (Split & PDF/A-1b & PDF/UA-1)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
@@ -481,6 +493,7 @@ Feature: /forms/libreoffice/convert
Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 1 failed rule(s) Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 1 failed rule(s)
Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 3 failed rule(s) Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 3 failed rule(s)
@metadata
Scenario: POST /forms/libreoffice/convert (Metadata) Scenario: POST /forms/libreoffice/convert (Metadata)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
@@ -516,6 +529,7 @@ Feature: /forms/libreoffice/convert
} }
""" """
@flatten
Scenario: POST /forms/libreoffice/convert (Flatten) Scenario: POST /forms/libreoffice/convert (Flatten)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
@@ -526,6 +540,7 @@ Feature: /forms/libreoffice/convert
Then there should be 1 PDF(s) in the response Then there should be 1 PDF(s) in the response
Then the response PDF(s) should be flatten Then the response PDF(s) should be flatten
@encrypt
Scenario: POST /forms/libreoffice/convert (Encrypt - user password only) Scenario: POST /forms/libreoffice/convert (Encrypt - user password only)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
@@ -536,6 +551,7 @@ Feature: /forms/libreoffice/convert
Then there should be 1 PDF(s) in the response Then there should be 1 PDF(s) in the response
Then the response PDF(s) should be encrypted Then the response PDF(s) should be encrypted
@encrypt
Scenario: POST /forms/libreoffice/convert (Encrypt - both user and owner passwords) Scenario: POST /forms/libreoffice/convert (Encrypt - both user and owner passwords)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
@@ -547,23 +563,48 @@ Feature: /forms/libreoffice/convert
Then there should be 1 PDF(s) in the response Then there should be 1 PDF(s) in the response
Then the response PDF(s) should be encrypted Then the response PDF(s) should be encrypted
@embed
Scenario: POST /forms/libreoffice/convert (Embeds)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/page_1.docx | file |
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf"
Then there should be 1 PDF(s) in the response
Then there should be the following file(s) in the response:
| foo.pdf |
Then the response PDF(s) should have the "embed_1.xml" file embedded
Then the response PDF(s) should have the "embed_2.xml" file embedded
# FIXME: once decrypt is done, add encrypt and check after the content of the PDF. # FIXME: once decrypt is done, add encrypt and check after the content of the PDF.
Scenario: POST /forms/libreoffice/convert (PDF/A-1b & PDF/UA-1 & Metadata & Flatten) @convert
@metadata
@flatten
@embed
Scenario: POST /forms/libreoffice/convert (PDF/A-1b & PDF/UA-1 & Metadata & Flatten & Embeds)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/page_1.docx | file | | files | testdata/page_1.docx | file |
| pdfa | PDF/A-1b | field | | pdfa | PDF/A-1b | field |
| pdfua | true | field | | pdfua | true | field |
| metadata | {"Author":"Julien Neuhart","Copyright":"Julien Neuhart","CreateDate":"2006-09-18T16:27:50-04:00","Creator":"Gotenberg","Keywords":["first","second"],"Marked":true,"ModDate":"2006-09-18T16:27:50-04:00","PDFVersion":1.7,"Producer":"Gotenberg","Subject":"Sample","Title":"Sample","Trapped":"Unknown"} | field | | metadata | {"Author":"Julien Neuhart","Copyright":"Julien Neuhart","CreateDate":"2006-09-18T16:27:50-04:00","Creator":"Gotenberg","Keywords":["first","second"],"Marked":true,"ModDate":"2006-09-18T16:27:50-04:00","PDFVersion":1.7,"Producer":"Gotenberg","Subject":"Sample","Title":"Sample","Trapped":"Unknown"} | field |
| flatten | true | field |
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
| Gotenberg-Output-Filename | foo | header | | Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200 Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf" Then the response header "Content-Type" should be "application/pdf"
Then there should be 1 PDF(s) in the response Then there should be 1 PDF(s) in the response
Then there should be the following file(s) in the response: Then there should be the following file(s) in the response:
| foo.pdf | | foo.pdf |
Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 7 failed rule(s) Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 10 failed rule(s)
Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 2 failed rule(s) Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 2 failed rule(s)
Then the response PDF(s) should be flatten Then the response PDF(s) should be flatten
Then the response PDF(s) should have the "embed_1.xml" file embedded
Then the response PDF(s) should have the "embed_2.xml" file embedded
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/metadata/read" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/pdfengines/metadata/read" endpoint with the following form data and header(s):
| files | teststore/foo.pdf | file | | files | teststore/foo.pdf | file |
Then the response status code should be 200 Then the response status code should be 200
@@ -606,6 +647,7 @@ Feature: /forms/libreoffice/convert
Then the Gotenberg container should log the following entries: Then the Gotenberg container should log the following entries:
| "trace":"forms_libreoffice_convert" | | "trace":"forms_libreoffice_convert" |
@download-from
Scenario: POST /forms/libreoffice/convert (Download From) Scenario: POST /forms/libreoffice/convert (Download From)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a static server Given I have a static server
@@ -615,6 +657,7 @@ Feature: /forms/libreoffice/convert
Then the file request header "X-Foo" should be "bar" Then the file request header "X-Foo" should be "bar"
Then the response header "Content-Type" should be "application/pdf" Then the response header "Content-Type" should be "application/pdf"
@webhook
Scenario: POST /forms/libreoffice/convert (Webhook) Scenario: POST /forms/libreoffice/convert (Webhook)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a webhook server Given I have a webhook server
@@ -652,19 +695,3 @@ Feature: /forms/libreoffice/convert
| files | testdata/page_1.docx | file | | files | testdata/page_1.docx | file |
Then the response status code should be 200 Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf" Then the response header "Content-Type" should be "application/pdf"
@embed
Scenario: POST /forms/libreoffice/convert (Embeds)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/page_1.docx | file |
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
And the response header "Content-Type" should be "application/pdf"
And there should be 1 PDF(s) in the response
And there should be the following file(s) in the response:
| foo.pdf |
And the "foo.pdf" PDF should have the "embed_1.xml" file embedded in it
And the "foo.pdf" PDF should have the "embed_2.xml" file embedded in it

View File

@@ -1,3 +1,4 @@
@output-filename
Feature: Output Filename Feature: Output Filename
Scenario: Default (Single Output File) Scenario: Default (Single Output File)

View File

@@ -1,6 +1,8 @@
# TODO: # TODO:
# 1. PDF/UA-2. # 1. PDF/UA-2.
@pdfengines
@pdfengines-convert
Feature: /forms/pdfengines/convert Feature: /forms/pdfengines/convert
Scenario: POST /forms/pdfengines/convert (Single PDF/A-1b) Scenario: POST /forms/pdfengines/convert (Single PDF/A-1b)
@@ -115,6 +117,7 @@ Feature: /forms/pdfengines/convert
Then the Gotenberg container should log the following entries: Then the Gotenberg container should log the following entries:
| "trace":"forms_pdfengines_convert" | | "trace":"forms_pdfengines_convert" |
@output-filename
Scenario: POST /forms/pdfengines/convert (Output Filename - Single PDF) Scenario: POST /forms/pdfengines/convert (Output Filename - Single PDF)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/convert" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/pdfengines/convert" endpoint with the following form data and header(s):
@@ -126,6 +129,7 @@ Feature: /forms/pdfengines/convert
Then there should be the following file(s) in the response: Then there should be the following file(s) in the response:
| foo.pdf | | foo.pdf |
@output-filename
Scenario: POST /forms/pdfengines/convert (Output Filename - Many PDFs) Scenario: POST /forms/pdfengines/convert (Output Filename - Many PDFs)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/convert" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/pdfengines/convert" endpoint with the following form data and header(s):
@@ -140,6 +144,7 @@ Feature: /forms/pdfengines/convert
| page_1.pdf | | page_1.pdf |
| page_2.pdf | | page_2.pdf |
@download-from
Scenario: POST /forms/pdfengines/convert (Download From) Scenario: POST /forms/pdfengines/convert (Download From)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a static server Given I have a static server
@@ -150,6 +155,7 @@ Feature: /forms/pdfengines/convert
Then the response status code should be 200 Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf" Then the response header "Content-Type" should be "application/pdf"
@webhook
Scenario: POST /forms/pdfengines/convert (Webhook) Scenario: POST /forms/pdfengines/convert (Webhook)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a webhook server Given I have a webhook server

View File

@@ -1,3 +1,5 @@
@pdfengines
@pdfengines-embed
@embed @embed
Feature: /forms/pdfengines/embed Feature: /forms/pdfengines/embed
@@ -7,26 +9,64 @@ Feature: /forms/pdfengines/embed
| files | testdata/page_1.pdf | file | | files | testdata/page_1.pdf | file |
| embeds | testdata/embed_1.xml | file | | embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file | | embeds | testdata/embed_2.xml | file |
| embeds | testdata/page_2.pdf | file |
Then the response status code should be 200 Then the response status code should be 200
And the response header "Content-Type" should be "application/pdf" Then the response header "Content-Type" should be "application/pdf"
And there should be 1 PDF(s) in the response Then there should be 1 PDF(s) in the response
And there should be the following file(s) in the response: Then there should be the following file(s) in the response:
| page_1.pdf | | page_1.pdf |
And the "page_1.pdf" PDF should have the "embed_1.xml" file embedded in it Then the response PDF(s) should have the "embed_1.xml" file embedded
And the "page_1.pdf" PDF should have the "embed_2.xml" file embedded in it Then the response PDF(s) should have the "embed_2.xml" file embedded
And the "page_1.pdf" PDF should have the "page_2.pdf" file embedded in it
@download-from
Scenario: POST /forms/pdfengines/embed with (Download From) Scenario: POST /forms/pdfengines/embed with (Download From)
Given I have a default Gotenberg container Given I have a default Gotenberg container
And I have a static server Given I have a static server
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/embed" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/pdfengines/embed" endpoint with the following form data and header(s):
| files | testdata/page_1.pdf | file | | files | testdata/page_1.pdf | file |
| downloadFrom | [{"url":"http://host.docker.internal:%d/static/testdata/embed_1.xml", "embedded": true},{"url":"http://host.docker.internal:%d/static/testdata/embed_2.xml", "embedded": false}] | field | | downloadFrom | [{"url":"http://host.docker.internal:%d/static/testdata/embed_1.xml","embedded": true},{"url":"http://host.docker.internal:%d/static/testdata/embed_2.xml","embedded": false}] | field |
Then the response status code should be 200 Then the response status code should be 200
And the response header "Content-Type" should be "application/pdf" Then the response header "Content-Type" should be "application/pdf"
And there should be 1 PDF(s) in the response Then there should be 1 PDF(s) in the response
And there should be the following file(s) in the response: Then there should be the following file(s) in the response:
| page_1.pdf | | page_1.pdf |
And the "page_1.pdf" PDF should have the "embed_1.xml" file embedded in it Then the response PDF(s) should have the "embed_1.xml" file embedded
And the "page_1.pdf" PDF should NOT have the "embed_2.xml" file embedded in it Then the response PDF(s) should NOT have the "embed_2.xml" file embedded
@webhook
Scenario: POST /forms/pdfengines/embed (Webhook)
Given I have a default Gotenberg container
Given I have a webhook server
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/embed" endpoint with the following form data and header(s):
| files | testdata/page_1.pdf | file |
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
| Gotenberg-Webhook-Url | http://host.docker.internal:%d/webhook | header |
| Gotenberg-Webhook-Error-Url | http://host.docker.internal:%d/webhook/error | header |
Then the response status code should be 204
When I wait for the asynchronous request to the webhook
Then the webhook request header "Content-Type" should be "application/pdf"
Then there should be 1 PDF(s) in the webhook request
Then the webhook request PDF(s) should have the "embed_1.xml" file embedded
Then the webhook request PDF(s) should have the "embed_2.xml" file embedded
Scenario: POST /forms/pdfengines/embed (Basic Auth)
Given I have a Gotenberg container with the following environment variable(s):
| API_ENABLE_BASIC_AUTH | true |
| GOTENBERG_API_BASIC_AUTH_USERNAME | foo |
| GOTENBERG_API_BASIC_AUTH_PASSWORD | bar |
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/embed" endpoint with the following form data and header(s):
| files | testdata/page_1.pdf | file |
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
Then the response status code should be 401
Scenario: POST /foo/forms/pdfengines/embed (Root Path)
Given I have a Gotenberg container with the following environment variable(s):
| API_ENABLE_DEBUG_ROUTE | true |
| API_ROOT_PATH | /foo/ |
When I make a "POST" request to Gotenberg at the "/foo/forms/pdfengines/embed" endpoint with the following form data and header(s):
| files | testdata/page_1.pdf | file |
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf"

View File

@@ -1,3 +1,6 @@
@pdfengines
@pdfengines-encrypt
@encrypt
Feature: /forms/pdfengines/encrypt Feature: /forms/pdfengines/encrypt
Scenario: POST /forms/pdfengines/encrypt (default - user password only) Scenario: POST /forms/pdfengines/encrypt (default - user password only)
@@ -132,6 +135,7 @@ Feature: /forms/pdfengines/encrypt
Then the Gotenberg container should log the following entries: Then the Gotenberg container should log the following entries:
| "trace":"forms_pdfengines_encrypt" | | "trace":"forms_pdfengines_encrypt" |
@download-from
Scenario: POST /forms/pdfengines/encrypt (Download From) Scenario: POST /forms/pdfengines/encrypt (Download From)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a static server Given I have a static server
@@ -143,6 +147,7 @@ Feature: /forms/pdfengines/encrypt
Then there should be 1 PDF(s) in the response Then there should be 1 PDF(s) in the response
Then the response PDF(s) should be encrypted Then the response PDF(s) should be encrypted
@webhook
Scenario: POST /forms/pdfengines/encrypt (Webhook) Scenario: POST /forms/pdfengines/encrypt (Webhook)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a webhook server Given I have a webhook server

View File

@@ -1,3 +1,6 @@
@pdfengines
@pdfengines-flatten
@flatten
Feature: /forms/pdfengines/flatten Feature: /forms/pdfengines/flatten
Scenario: POST /forms/pdfengines/flatten (Single PDF) Scenario: POST /forms/pdfengines/flatten (Single PDF)
@@ -48,6 +51,7 @@ Feature: /forms/pdfengines/flatten
Then the Gotenberg container should log the following entries: Then the Gotenberg container should log the following entries:
| "trace":"forms_pdfengines_flatten" | | "trace":"forms_pdfengines_flatten" |
@output-filename
Scenario: POST /forms/pdfengines/flatten (Output Filename - Single PDF) Scenario: POST /forms/pdfengines/flatten (Output Filename - Single PDF)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/flatten" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/pdfengines/flatten" endpoint with the following form data and header(s):
@@ -58,6 +62,7 @@ Feature: /forms/pdfengines/flatten
Then there should be the following file(s) in the response: Then there should be the following file(s) in the response:
| foo.pdf | | foo.pdf |
@output-filename
Scenario: POST /forms/pdfengines/flatten (Output Filename - Many PDFs) Scenario: POST /forms/pdfengines/flatten (Output Filename - Many PDFs)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/flatten" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/pdfengines/flatten" endpoint with the following form data and header(s):
@@ -71,6 +76,7 @@ Feature: /forms/pdfengines/flatten
| page_1.pdf | | page_1.pdf |
| page_2.pdf | | page_2.pdf |
@download-from
Scenario: POST /forms/pdfengines/flatten (Download From) Scenario: POST /forms/pdfengines/flatten (Download From)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a static server Given I have a static server
@@ -81,6 +87,7 @@ Feature: /forms/pdfengines/flatten
Then the response header "Content-Type" should be "application/pdf" Then the response header "Content-Type" should be "application/pdf"
Then the response PDF(s) should be flatten Then the response PDF(s) should be flatten
@webhook
Scenario: POST /forms/pdfengines/flatten (Webhook) Scenario: POST /forms/pdfengines/flatten (Webhook)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a webhook server Given I have a webhook server

View File

@@ -1,3 +1,6 @@
@pdfengines
@pdfengines-encrypt
@merge
Feature: /forms/pdfengines/merge Feature: /forms/pdfengines/merge
Scenario: POST /forms/pdfengines/merge (default) Scenario: POST /forms/pdfengines/merge (default)
@@ -128,6 +131,7 @@ Feature: /forms/pdfengines/merge
Invalid form data: form field 'metadata' is invalid (got 'foo', resulting to unmarshal metadata: invalid character 'o' in literal false (expecting 'a')) Invalid form data: form field 'metadata' is invalid (got 'foo', resulting to unmarshal metadata: invalid character 'o' in literal false (expecting 'a'))
""" """
@convert
Scenario: POST /forms/pdfengines/merge (PDF/A-1b & PDF/UA-1) Scenario: POST /forms/pdfengines/merge (PDF/A-1b & PDF/UA-1)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/merge" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/pdfengines/merge" endpoint with the following form data and header(s):
@@ -153,6 +157,7 @@ Feature: /forms/pdfengines/merge
Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 1 failed rule(s) Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 1 failed rule(s)
Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 3 failed rule(s) Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 3 failed rule(s)
@metadata
Scenario: POST /forms/pdfengines/merge (Metadata) Scenario: POST /forms/pdfengines/merge (Metadata)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/merge" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/pdfengines/merge" endpoint with the following form data and header(s):
@@ -198,6 +203,7 @@ Feature: /forms/pdfengines/merge
} }
""" """
@flatten
Scenario: POST /forms/pdfengines/merge (Flatten) Scenario: POST /forms/pdfengines/merge (Flatten)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/merge" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/pdfengines/merge" endpoint with the following form data and header(s):
@@ -221,6 +227,7 @@ Feature: /forms/pdfengines/merge
""" """
Then the response PDF(s) should be flatten Then the response PDF(s) should be flatten
@encrypt
Scenario: POST /forms/pdfengines/merge (Encrypt - user password only) Scenario: POST /forms/pdfengines/merge (Encrypt - user password only)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/merge" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/pdfengines/merge" endpoint with the following form data and header(s):
@@ -232,6 +239,7 @@ Feature: /forms/pdfengines/merge
Then there should be 1 PDF(s) in the response Then there should be 1 PDF(s) in the response
Then the response PDF(s) should be encrypted Then the response PDF(s) should be encrypted
@encrypt
Scenario: POST /forms/pdfengines/merge (Encrypt - both user and owner passwords) Scenario: POST /forms/pdfengines/merge (Encrypt - both user and owner passwords)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/merge" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/pdfengines/merge" endpoint with the following form data and header(s):
@@ -244,8 +252,25 @@ Feature: /forms/pdfengines/merge
Then there should be 1 PDF(s) in the response Then there should be 1 PDF(s) in the response
Then the response PDF(s) should be encrypted Then the response PDF(s) should be encrypted
@embed
Scenario: POST /foo/forms/pdfengines/merge (Embeds)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/merge" endpoint with the following form data and header(s):
| files | testdata/page_1.pdf | file |
| files | testdata/page_2.pdf | file |
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response PDF(s) should have the "embed_1.xml" file embedded
Then the response PDF(s) should have the "embed_2.xml" file embedded
# FIXME: once decrypt is done, add encrypt and check after the content of the PDF. # FIXME: once decrypt is done, add encrypt and check after the content of the PDF.
Scenario: POST /forms/pdfengines/merge (PDF/A-1b & PDF/UA-1 & Metadata & Flatten) @convert
@metadata
@flatten
@embed
Scenario: POST /forms/pdfengines/merge (PDF/A-1b & PDF/UA-1 & Metadata & Flatten & Embeds)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/merge" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/pdfengines/merge" endpoint with the following form data and header(s):
| files | testdata/page_1.pdf | file | | files | testdata/page_1.pdf | file |
@@ -254,6 +279,8 @@ Feature: /forms/pdfengines/merge
| pdfua | true | field | | pdfua | true | field |
| metadata | {"Author":"Julien Neuhart","Copyright":"Julien Neuhart","CreateDate":"2006-09-18T16:27:50-04:00","Creator":"Gotenberg","Keywords":["first","second"],"Marked":true,"ModDate":"2006-09-18T16:27:50-04:00","PDFVersion":1.7,"Producer":"Gotenberg","Subject":"Sample","Title":"Sample","Trapped":"Unknown"} | field | | metadata | {"Author":"Julien Neuhart","Copyright":"Julien Neuhart","CreateDate":"2006-09-18T16:27:50-04:00","Creator":"Gotenberg","Keywords":["first","second"],"Marked":true,"ModDate":"2006-09-18T16:27:50-04:00","PDFVersion":1.7,"Producer":"Gotenberg","Subject":"Sample","Title":"Sample","Trapped":"Unknown"} | field |
| flatten | true | field | | flatten | true | field |
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
| Gotenberg-Output-Filename | foo | header | | Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200 Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf" Then the response header "Content-Type" should be "application/pdf"
@@ -269,9 +296,11 @@ Feature: /forms/pdfengines/merge
""" """
Page 2 Page 2
""" """
Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 7 failed rule(s) Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 10 failed rule(s)
Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 2 failed rule(s) Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 2 failed rule(s)
Then the response PDF(s) should be flatten Then the response PDF(s) should be flatten
Then the response PDF(s) should have the "embed_1.xml" file embedded
Then the response PDF(s) should have the "embed_2.xml" file embedded
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/metadata/read" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/pdfengines/metadata/read" endpoint with the following form data and header(s):
| files | teststore/foo.pdf | file | | files | teststore/foo.pdf | file |
Then the response status code should be 200 Then the response status code should be 200
@@ -316,6 +345,7 @@ Feature: /forms/pdfengines/merge
Then the Gotenberg container should log the following entries: Then the Gotenberg container should log the following entries:
| "trace":"forms_pdfengines_merge" | | "trace":"forms_pdfengines_merge" |
@download-from
Scenario: POST /forms/pdfengines/merge (Download From) Scenario: POST /forms/pdfengines/merge (Download From)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a static server Given I have a static server
@@ -324,6 +354,7 @@ Feature: /forms/pdfengines/merge
Then the response status code should be 200 Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf" Then the response header "Content-Type" should be "application/pdf"
@webhook
Scenario: POST /forms/pdfengines/merge (Webhook) Scenario: POST /forms/pdfengines/merge (Webhook)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a webhook server Given I have a webhook server
@@ -368,16 +399,3 @@ Feature: /forms/pdfengines/merge
| files | testdata/page_2.pdf | file | | files | testdata/page_2.pdf | file |
Then the response status code should be 200 Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf" Then the response header "Content-Type" should be "application/pdf"
@embed
Scenario: POST /foo/forms/pdfengines/merge (Embeds)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/merge" endpoint with the following form data and header(s):
| files | testdata/page_1.pdf | file |
| files | testdata/page_2.pdf | file |
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
And the "foo.pdf" PDF should have the "embed_1.xml" file embedded in it
And the "foo.pdf" PDF should have the "embed_2.xml" file embedded in it

View File

@@ -1,3 +1,6 @@
@pdfengines
@pdfengines-metadata
@metadata
Feature: /forms/pdfengines/{write|read} Feature: /forms/pdfengines/{write|read}
Scenario: POST /forms/pdfengines/metadata/{write|read} (Single PDF) Scenario: POST /forms/pdfengines/metadata/{write|read} (Single PDF)
@@ -151,6 +154,7 @@ Feature: /forms/pdfengines/{write|read}
Then the Gotenberg container should log the following entries: Then the Gotenberg container should log the following entries:
| "trace":"forms_pdfengines_metadata_read" | | "trace":"forms_pdfengines_metadata_read" |
@output-filename
Scenario: POST /forms/pdfengines/metadata/write (Output Filename - Single PDF) Scenario: POST /forms/pdfengines/metadata/write (Output Filename - Single PDF)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/metadata/write" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/pdfengines/metadata/write" endpoint with the following form data and header(s):
@@ -162,6 +166,7 @@ Feature: /forms/pdfengines/{write|read}
Then there should be the following file(s) in the response: Then there should be the following file(s) in the response:
| foo.pdf | | foo.pdf |
@output-filename
Scenario: POST /forms/pdfengines/metadata/write (Output Filename - Many PDFs) Scenario: POST /forms/pdfengines/metadata/write (Output Filename - Many PDFs)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/metadata/write" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/pdfengines/metadata/write" endpoint with the following form data and header(s):
@@ -176,6 +181,7 @@ Feature: /forms/pdfengines/{write|read}
| page_1.pdf | | page_1.pdf |
| page_2.pdf | | page_2.pdf |
@download-from
Scenario: POST /forms/pdfengines/metadata/write (Download From) Scenario: POST /forms/pdfengines/metadata/write (Download From)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a static server Given I have a static server
@@ -187,6 +193,7 @@ Feature: /forms/pdfengines/{write|read}
Then the response status code should be 200 Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf" Then the response header "Content-Type" should be "application/pdf"
@download-from
Scenario: POST /forms/pdfengines/metadata/read (Download From) Scenario: POST /forms/pdfengines/metadata/read (Download From)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a static server Given I have a static server
@@ -196,6 +203,7 @@ Feature: /forms/pdfengines/{write|read}
Then the response status code should be 200 Then the response status code should be 200
Then the response header "Content-Type" should be "application/json" Then the response header "Content-Type" should be "application/json"
@webhook
Scenario: POST /forms/pdfengines/metadata/write (Webhook) Scenario: POST /forms/pdfengines/metadata/write (Webhook)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a webhook server Given I have a webhook server
@@ -233,6 +241,7 @@ Feature: /forms/pdfengines/{write|read}
} }
""" """
@webhook
Scenario: POST /forms/pdfengines/metadata/read (Webhook) Scenario: POST /forms/pdfengines/metadata/read (Webhook)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a webhook server Given I have a webhook server

View File

@@ -1,3 +1,6 @@
@pdfengines
@pdfengines-split
@split
Feature: /forms/pdfengines/split Feature: /forms/pdfengines/split
Scenario: POST /forms/pdfengines/split (Intervals - Default) Scenario: POST /forms/pdfengines/split (Intervals - Default)
@@ -314,6 +317,7 @@ Feature: /forms/pdfengines/split
Invalid form data: form field 'metadata' is invalid (got 'foo', resulting to unmarshal metadata: invalid character 'o' in literal false (expecting 'a')) Invalid form data: form field 'metadata' is invalid (got 'foo', resulting to unmarshal metadata: invalid character 'o' in literal false (expecting 'a'))
""" """
@convert
Scenario: POST /forms/pdfengines/split (PDF/A-1b & PDF/UA-1) Scenario: POST /forms/pdfengines/split (PDF/A-1b & PDF/UA-1)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/split" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/pdfengines/split" endpoint with the following form data and header(s):
@@ -345,6 +349,7 @@ Feature: /forms/pdfengines/split
Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 1 failed rule(s) Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 1 failed rule(s)
Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 3 failed rule(s) Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 3 failed rule(s)
@metadata
Scenario: POST /forms/pdfengines/split (Metadata) Scenario: POST /forms/pdfengines/split (Metadata)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/split" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/pdfengines/split" endpoint with the following form data and header(s):
@@ -411,6 +416,7 @@ Feature: /forms/pdfengines/split
} }
""" """
@flatten
Scenario: POST /forms/pdfengines/split (Flatten) Scenario: POST /forms/pdfengines/split (Flatten)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/split" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/pdfengines/split" endpoint with the following form data and header(s):
@@ -440,6 +446,7 @@ Feature: /forms/pdfengines/split
""" """
Then the response PDF(s) should be flatten Then the response PDF(s) should be flatten
@encrypt
Scenario: POST /forms/pdfengines/split (Encrypt - user password only) Scenario: POST /forms/pdfengines/split (Encrypt - user password only)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/split" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/pdfengines/split" endpoint with the following form data and header(s):
@@ -452,6 +459,7 @@ Feature: /forms/pdfengines/split
Then there should be 2 PDF(s) in the response Then there should be 2 PDF(s) in the response
Then the response PDF(s) should be encrypted Then the response PDF(s) should be encrypted
@encrypt
Scenario: POST /forms/pdfengines/split (Encrypt - both user and owner passwords) Scenario: POST /forms/pdfengines/split (Encrypt - both user and owner passwords)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/split" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/pdfengines/split" endpoint with the following form data and header(s):
@@ -465,8 +473,30 @@ Feature: /forms/pdfengines/split
Then there should be 2 PDF(s) in the response Then there should be 2 PDF(s) in the response
Then the response PDF(s) should be encrypted Then the response PDF(s) should be encrypted
@embed
Scenario: POST /foo/forms/pdfengines/split (Embeds)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/split" endpoint with the following form data and header(s):
| files | testdata/pages_3.pdf | file |
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
| splitMode | intervals | field |
| splitSpan | 2 | field |
Then the response status code should be 200
And the response header "Content-Type" should be "application/zip"
And there should be 2 PDF(s) in the response
And there should be the following file(s) in the response:
| pages_3_0.pdf |
| pages_3_1.pdf |
Then the response PDF(s) should have the "embed_1.xml" file embedded
Then the response PDF(s) should have the "embed_2.xml" file embedded
# FIXME: once decrypt is done, add encrypt and check after the content of the PDFs. # FIXME: once decrypt is done, add encrypt and check after the content of the PDFs.
Scenario: POST /forms/pdfengines/split (PDF/A-1b & PDF/UA-1 & Metadata & Flatten) @convert
@metadata
@flatten
@embed
Scenario: POST /forms/pdfengines/split (PDF/A-1b & PDF/UA-1 & Metadata & Flatten & Embeds)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/split" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/pdfengines/split" endpoint with the following form data and header(s):
| files | testdata/pages_3.pdf | file | | files | testdata/pages_3.pdf | file |
@@ -476,6 +506,8 @@ Feature: /forms/pdfengines/split
| pdfua | true | field | | pdfua | true | field |
| metadata | {"Author":"Julien Neuhart","Copyright":"Julien Neuhart","CreateDate":"2006-09-18T16:27:50-04:00","Creator":"Gotenberg","Keywords":["first","second"],"Marked":true,"ModDate":"2006-09-18T16:27:50-04:00","PDFVersion":1.7,"Producer":"Gotenberg","Subject":"Sample","Title":"Sample","Trapped":"Unknown"} | field | | metadata | {"Author":"Julien Neuhart","Copyright":"Julien Neuhart","CreateDate":"2006-09-18T16:27:50-04:00","Creator":"Gotenberg","Keywords":["first","second"],"Marked":true,"ModDate":"2006-09-18T16:27:50-04:00","PDFVersion":1.7,"Producer":"Gotenberg","Subject":"Sample","Title":"Sample","Trapped":"Unknown"} | field |
| flatten | true | field | | flatten | true | field |
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
Then the response status code should be 200 Then the response status code should be 200
Then the response header "Content-Type" should be "application/zip" Then the response header "Content-Type" should be "application/zip"
Then there should be 2 PDF(s) in the response Then there should be 2 PDF(s) in the response
@@ -496,9 +528,11 @@ Feature: /forms/pdfengines/split
""" """
Page 3 Page 3
""" """
Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 7 failed rule(s) Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 10 failed rule(s)
Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 2 failed rule(s) Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 2 failed rule(s)
Then the response PDF(s) should be flatten Then the response PDF(s) should be flatten
Then the response PDF(s) should have the "embed_1.xml" file embedded
Then the response PDF(s) should have the "embed_2.xml" file embedded
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/metadata/read" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/pdfengines/metadata/read" endpoint with the following form data and header(s):
| files | teststore/pages_3_0.pdf | file | | files | teststore/pages_3_0.pdf | file |
| files | teststore/pages_3_1.pdf | file | | files | teststore/pages_3_1.pdf | file |
@@ -560,6 +594,7 @@ Feature: /forms/pdfengines/split
Then the Gotenberg container should log the following entries: Then the Gotenberg container should log the following entries:
| "trace":"forms_pdfengines_split" | | "trace":"forms_pdfengines_split" |
@output-filename
Scenario: POST /forms/pdfengines/split (Output Filename - Single PDF) Scenario: POST /forms/pdfengines/split (Output Filename - Single PDF)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/split" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/pdfengines/split" endpoint with the following form data and header(s):
@@ -573,6 +608,7 @@ Feature: /forms/pdfengines/split
Then there should be the following file(s) in the response: Then there should be the following file(s) in the response:
| foo.pdf | | foo.pdf |
@output-filename
Scenario: POST /forms/pdfengines/split (Output Filename - Many PDFs) Scenario: POST /forms/pdfengines/split (Output Filename - Many PDFs)
Given I have a default Gotenberg container Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/split" endpoint with the following form data and header(s): When I make a "POST" request to Gotenberg at the "/forms/pdfengines/split" endpoint with the following form data and header(s):
@@ -587,6 +623,7 @@ Feature: /forms/pdfengines/split
| pages_3_0.pdf | | pages_3_0.pdf |
| pages_3_1.pdf | | pages_3_1.pdf |
@download-from
Scenario: POST /forms/pdfengines/split (Download From) Scenario: POST /forms/pdfengines/split (Download From)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a static server Given I have a static server
@@ -598,6 +635,7 @@ Feature: /forms/pdfengines/split
Then the file request header "X-Foo" should be "bar" Then the file request header "X-Foo" should be "bar"
Then the response header "Content-Type" should be "application/zip" Then the response header "Content-Type" should be "application/zip"
@webhook
Scenario: POST /forms/pdfengines/split (Webhook) Scenario: POST /forms/pdfengines/split (Webhook)
Given I have a default Gotenberg container Given I have a default Gotenberg container
Given I have a webhook server Given I have a webhook server
@@ -650,23 +688,3 @@ Feature: /forms/pdfengines/split
| splitSpan | 2 | field | | splitSpan | 2 | field |
Then the response status code should be 200 Then the response status code should be 200
Then the response header "Content-Type" should be "application/zip" Then the response header "Content-Type" should be "application/zip"
@embed
Scenario: POST /foo/forms/pdfengines/split (Embeds)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/split" endpoint with the following form data and header(s):
| files | testdata/pages_3.pdf | file |
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
| splitMode | intervals | field |
| splitSpan | 2 | field |
Then the response status code should be 200
And the response header "Content-Type" should be "application/zip"
And there should be 2 PDF(s) in the response
And there should be the following file(s) in the response:
| pages_3_0.pdf |
| pages_3_1.pdf |
And the "pages_3_0.pdf" PDF should have the "embed_1.xml" file embedded in it
And the "pages_3_0.pdf" PDF should have the "embed_2.xml" file embedded in it
And the "pages_3_1.pdf" PDF should have the "embed_1.xml" file embedded in it
And the "pages_3_1.pdf" PDF should have the "embed_2.xml" file embedded in it

View File

@@ -2,6 +2,7 @@
# 1. Count restarts. # 1. Count restarts.
# 2. Count queue size. # 2. Count queue size.
@prometheus-metrics
Feature: /prometheus/metrics Feature: /prometheus/metrics
Scenario: GET /prometheus/metrics (Enabled) Scenario: GET /prometheus/metrics (Enabled)

View File

@@ -1,3 +1,4 @@
@root
Feature: / Feature: /
Scenario: GET / Scenario: GET /

View File

@@ -1,3 +1,4 @@
@version
Feature: /version Feature: /version
Scenario: GET /version Scenario: GET /version

View File

@@ -2,6 +2,7 @@
# 1. Other HTTP Methods # 1. Other HTTP Methods
# 2. Errors # 2. Errors
@webhook
Feature: Webhook Feature: Webhook
Scenario: Default Scenario: Default

View File

@@ -735,41 +735,6 @@ func (s *scenario) thePdfShouldBeSetToLandscapeOrientation(ctx context.Context,
return nil return nil
} }
func (s *scenario) thePdfShouldHaveTheFollowingEmbedsInIt(ctx context.Context, name, should string, embed string) error {
path, err := s.getPath(name)
if err != nil {
return fmt.Errorf("get path %q: %w", name, err)
}
invert := should == "should NOT"
cmd := []string{
"verapdf",
"--off",
"--loglevel",
"0",
"--extract",
"embeddedFile",
name,
}
output, err := execCommandInIntegrationToolsContainer(ctx, cmd, path)
if err != nil {
return fmt.Errorf("exec %q: %w", cmd, err)
}
found := strings.Contains(output, fmt.Sprintf("<fileName>%s</fileName>", embed))
if invert && found {
return fmt.Errorf("embed %q found", embed)
}
if !invert && !found {
return fmt.Errorf("embed %q not found", embed)
}
return nil
}
func (s *scenario) thePdfShouldHaveTheFollowingContentAtPage(ctx context.Context, name, kind string, page int, expected *godog.DocString) error { func (s *scenario) thePdfShouldHaveTheFollowingContentAtPage(ctx context.Context, name, kind string, page int, expected *godog.DocString) error {
var path string var path string
if !strings.HasPrefix(name, "*_") { if !strings.HasPrefix(name, "*_") {
@@ -926,6 +891,60 @@ func (s *scenario) thePdfsShouldBeEncrypted(ctx context.Context, kind string, sh
return nil return nil
} }
func (s *scenario) thePdfsShouldHaveEmbeddedFile(ctx context.Context, kind, should, embed string) error {
dirPath := fmt.Sprintf("%s/%s", s.workdir, s.resp.Header().Get("Gotenberg-Trace"))
_, err := os.Stat(dirPath)
if os.IsNotExist(err) {
return fmt.Errorf("directory %q does not exist", dirPath)
}
var paths []string
err = filepath.Walk(dirPath, func(path string, info os.FileInfo, pathErr error) error {
if pathErr != nil {
return pathErr
}
if strings.EqualFold(filepath.Ext(info.Name()), ".pdf") {
paths = append(paths, path)
}
return nil
})
if err != nil {
return fmt.Errorf("walk %q: %w", dirPath, err)
}
invert := should == "should NOT"
for _, path := range paths {
cmd := []string{
"verapdf",
"--off",
"--loglevel",
"0",
"--extract",
"embeddedFile",
filepath.Base(path),
}
output, err := execCommandInIntegrationToolsContainer(ctx, cmd, path)
if err != nil {
return fmt.Errorf("exec %q: %w", cmd, err)
}
found := strings.Contains(output, fmt.Sprintf("<fileName>%s</fileName>", embed))
if invert && found {
return fmt.Errorf("embed %q found", embed)
}
if !invert && !found {
return fmt.Errorf("embed %q not found", embed)
}
}
return nil
}
func InitializeScenario(ctx *godog.ScenarioContext) { func InitializeScenario(ctx *godog.ScenarioContext) {
s := &scenario{} s := &scenario{}
ctx.Before(func(ctx context.Context, sc *godog.Scenario) (context.Context, error) { ctx.Before(func(ctx context.Context, sc *godog.Scenario) (context.Context, error) {
@@ -959,10 +978,10 @@ func InitializeScenario(ctx *godog.ScenarioContext) {
ctx.Then(`^the (response|webhook request) PDF\(s\) should be valid "([^"]*)" with a tolerance of (\d+) failed rule\(s\)$`, s.thePdfsShouldBeValidWithAToleranceOf) ctx.Then(`^the (response|webhook request) PDF\(s\) should be valid "([^"]*)" with a tolerance of (\d+) failed rule\(s\)$`, s.thePdfsShouldBeValidWithAToleranceOf)
ctx.Then(`^the (response|webhook request) PDF\(s\) (should|should NOT) be flatten$`, s.thePdfsShouldBeFlatten) ctx.Then(`^the (response|webhook request) PDF\(s\) (should|should NOT) be flatten$`, s.thePdfsShouldBeFlatten)
ctx.Then(`^the (response|webhook request) PDF\(s\) (should|should NOT) be encrypted`, s.thePdfsShouldBeEncrypted) ctx.Then(`^the (response|webhook request) PDF\(s\) (should|should NOT) be encrypted`, s.thePdfsShouldBeEncrypted)
ctx.Then(`^the (response|webhook request) PDF\(s\) (should|should NOT) have the "([^"]*)" file embedded$`, s.thePdfsShouldHaveEmbeddedFile)
ctx.Then(`^the "([^"]*)" PDF should have (\d+) page\(s\)$`, s.thePdfShouldHavePages) ctx.Then(`^the "([^"]*)" PDF should have (\d+) page\(s\)$`, s.thePdfShouldHavePages)
ctx.Then(`^the "([^"]*)" PDF (should|should NOT) be set to landscape orientation$`, s.thePdfShouldBeSetToLandscapeOrientation) ctx.Then(`^the "([^"]*)" PDF (should|should NOT) be set to landscape orientation$`, s.thePdfShouldBeSetToLandscapeOrientation)
ctx.Then(`^the "([^"]*)" PDF (should|should NOT) have the following content at page (\d+):$`, s.thePdfShouldHaveTheFollowingContentAtPage) ctx.Then(`^the "([^"]*)" PDF (should|should NOT) have the following content at page (\d+):$`, s.thePdfShouldHaveTheFollowingContentAtPage)
ctx.Then(`^the "([^"]*)" PDF (should|should NOT) have the "([^"]*)" file embedded in it$`, s.thePdfShouldHaveTheFollowingEmbedsInIt)
ctx.After(func(ctx context.Context, sc *godog.Scenario, err error) (context.Context, error) { ctx.After(func(ctx context.Context, sc *godog.Scenario, err error) (context.Context, error) {
if s.gotenbergContainer != nil { if s.gotenbergContainer != nil {
errTerminate := s.gotenbergContainer.Terminate(ctx, testcontainers.StopTimeout(0)) errTerminate := s.gotenbergContainer.Terminate(ctx, testcontainers.StopTimeout(0))