test(chromium): cover thenable waitForExpression

This commit is contained in:
Julien Neuhart
2026-08-14 12:00:57 +02:00
parent f90684e165
commit b3c06fb8ae

View File

@@ -213,6 +213,26 @@ Feature: /forms/chromium/convert/html
Wait delay > 2 seconds or expression window globalVar === 'ready' returns true.
"""
# A thenable (async) expression is awaited and its resolved value gates the
# print. Without awaiting, the Promise object never evaluates to true and the
# request would time out. See https://github.com/gotenberg/gotenberg/pull/1617.
Scenario: POST /forms/chromium/convert/html (Wait For Thenable Expression)
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/feature-rich-html/index.html | file |
| waitForExpression | (async () => window.globalVar === 'ready')() | field |
| 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 "foo.pdf" PDF should have 1 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Wait delay > 2 seconds or expression window globalVar === 'ready' returns true.
"""
Scenario: POST /forms/chromium/convert/html (rAF / ResizeObserver / IntersectionObserver fire with waitForExpression)
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):