From b3c06fb8aedcd1c4ac84a01c17eaa6f7e1400232 Mon Sep 17 00:00:00 2001 From: Julien Neuhart Date: Fri, 14 Aug 2026 12:00:57 +0200 Subject: [PATCH] test(chromium): cover thenable waitForExpression --- .../features/chromium_convert_html.feature | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/integration/features/chromium_convert_html.feature b/test/integration/features/chromium_convert_html.feature index 2513845e..1de00be0 100644 --- a/test/integration/features/chromium_convert_html.feature +++ b/test/integration/features/chromium_convert_html.feature @@ -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):