Testing Overview
UpDoc uses Playwright for end-to-end testing. All tests run against a live UpDoc.TestSite instance and exercise the full stack — from backoffice UI interactions through API calls to database persistence.
For Playwright setup, configuration, and how to run tests, see Tooling → Playwright.
Test Inventory
Section titled “Test Inventory”4 spec files, 26 tests total.
| Test | Spec File | Tests | What It Covers |
|---|---|---|---|
| Create from Source UI | create-from-source.spec.ts | 4 | Collection button, blueprint picker, full PDF→document flow, content preview |
| PDF to Document Verification | document-verification.spec.ts | 3 ×3 PDFs | API verification of created document fields, blocks, markdown cleanup |
| Transform Rules Rendering | transformed-view.spec.ts | 5 | Workflow editor: ungrouped/grouped rule display in Transformed tab |
| BlockKey Reconciliation | blockkey-reconciliation.spec.ts | 14 | contentTypeKey model, bridge resilience, reconciliation, validation, orphan indicators |
Test PDFs
Section titled “Test PDFs”Test PDFs are stored in the Umbraco media library under a PDF folder:
| Content | Used By | |
|---|---|---|
updoc-test-01.pdf | Dresden, Leipzig & Meißen | Create from Source UI, PDF to Document, BlockKey Reconciliation |
updoc-test-02.pdf | Historic Houses & Heritage of Suffolk | Create from Source UI, PDF to Document |
updoc-test-03.pdf | Moorish Treasures of Andalucía (has OPTIONAL section) | PDF to Document |
Shared Helpers
Section titled “Shared Helpers”Several helper functions are duplicated across spec files. These handle common UI interactions and API calls.
UI Helpers
Section titled “UI Helpers”selectBlueprint(page, docTypeName, blueprintName?) — Navigates the two-step blueprint picker dialog:
- Wait for dialog visible
- Click document type button (e.g., “Group Tour”)
- Wait 500ms for step 2 to render
- Click blueprint button (defaults to same name as doc type)
selectPdf(page, pdfName) — Selects a PDF from the media picker:
- Click “Choose” button in source modal
- Wait for “Choose media” heading
- Double-click “PDF” folder to navigate into it
- Click the
uui-card-mediamatching the PDF name - Click “Choose” in the media picker footer
API Helpers
Section titled “API Helpers”Tests use page.evaluate() to make authenticated API calls from within the browser context, reading the auth token from localStorage:
apiGet(page, path)— GET request, returns parsed JSONapiPut(page, path)— PUT request, no bodyapiPutBody(page, path, body?)— PUT request with optional bodyapiPutJson(page, path, body)— PUT request with JSON body, returns parsed JSONapiPost(page, path)— POST request, returns parsed JSON
Document Helpers
Section titled “Document Helpers”getFieldValue(doc, alias)— Extracts a string field value from a document’svaluesarraygetBlockContainerBlocks(doc, containerAlias)— ExtractscontentDatablocks from a Block Grid or Block List propertyfindBlockByTitle(blocks, titleValue)— Finds a block whosefeaturePropertyFeatureTitlecontains the given textgetBlockProperty(block, alias)— Extracts a property value from a block’svaluesarray
Assertion Helpers
Section titled “Assertion Helpers”assertNoMarkdown(value, fieldName)— Asserts no heading prefix (#) or bold markers (**) in textassertRichTextHasHtml(value, fieldName)— Asserts an RTE object hasmarkupcontaining HTML tags and no raw heading prefixes
Safety Helpers
Section titled “Safety Helpers”PROTECTED_IDS— Set of node GUIDs that must never be deleted (Home, collection nodes)trashDocument(page, docId)— Moves a document to recycle bin, with protected ID check
Known Issues
Section titled “Known Issues”- Duplicated helpers —
selectBlueprint,selectPdf, and API helpers are copy-pasted across spec files. Should be extracted to a shared module. - Cleanup gaps —
document-verification.spec.tsandblockkey-reconciliation.spec.tshave cleanup viaafterEach.create-from-source.spec.tsdoes not — test documents accumulate. - Site must be running — all tests require UpDoc.TestSite to be running.
- Hardcoded workflow alias —
blockkey-reconciliation.spec.tsusestailoredTourPdfas the test workflow.