There are 3 updates.
 
 
XWiki Platform / cid:jira-generated-image-avatar-d9769753-1e0a-47bf-bf4b-2f4cfd505e6b XWIKI-25214 Open

Add test APIs to wait for a document to be saved in the background

 
View issue   ยท   Add comment
 

3 updates

 
cid:jira-generated-image-avatar-7f42eaec-21a7-49ed-bf34-0d8b6c0efa0a Changes by Vincent Massol on 08/Oct/26 12:48
 
Summary: Add test APIs to wait for the BlockNote auto-save and for a new document version over REST to be saved in the background
Version: 18.4.6
Description: Functional tests that check something happening saved in the background (e.g. by an editor's auto-save) have to wait for it, and today they do so with {{getDriver()}} calls in the test class (raising the driver timeout, polling with {{waitUntilCondition}}), which breaks the page-object boundary: the test shouldn't need to know how long to wait or how to poll.

Add
test APIs that do the waiting themselves:
*
{{TestUtils.RestTestUtils#waitForNewVersion(reference, version, timeout)}}: wait for a document to move past a given version, polling it over REST (so it works whichever browser tab, if any, saves it), and return the new version. It throws a {{TimeoutException}} otherwise, which also lets a test check that no new version is created.
* {{BlockNoteEditor#waitForAutoSave
Example: the BlockNote auto-save tests
( )}} and {{ BlockNoteEditor#isAutoSavedWithinNextInterval() AutoSaveIT }} : ). They use this API, plus page-object methods that wait for / watch the auto-save , with timeouts derived from the configured interval set through ( {{ setAutoSaveInterval BlockNoteEditor#waitForAutoSave ()}} .

and {{ AutoSaveIT BlockNoteEditor#isAutoSavedWithinNextInterval() }} is the first user: it ), and no longer calls call {{getDriver()}}.