@hmcts/media-viewer 4.2.33 → 4.2.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
package/README.md CHANGED
@@ -116,10 +116,133 @@ For browser-level proof that the standalone viewer is using AAT-backed services,
116
116
  yarn test:local:aat
117
117
  ```
118
118
 
119
- This opens `http://localhost:3000/#/media-viewer`, loads
120
- `/documents/<MV_SMOKE_PDF_DOCUMENT_ID>/binary`, and waits for the rendered PDF viewer
121
- and first page. If `MV_SMOKE_PDF_DOCUMENT_ID` is blank, the smoke uses the demo app's
122
- default AAT PDF document id.
119
+ This executes the Functional Playwright contracts against the local standalone Media
120
+ Viewer and AAT-backed proxy configuration while keeping the browser at
121
+ `http://localhost:3000/`. It does not create CCD cases or DM Store documents; use
122
+ the opt-in external-service contracts for those live service probes. The lightweight
123
+ route and health check remains available as `yarn smoke:local:aat`.
124
+
125
+ ### Test a local `em-icp-api` change
126
+
127
+ The standalone app reaches ICP through its local API. Keep the other services on AAT,
128
+ but override only `ICP_API_URL` in the ignored `.env` file:
129
+
130
+ ```
131
+ ICP_API_URL=http://localhost:8080
132
+ ```
133
+
134
+ Create an isolated worktree for the ICP branch under test. The example below uses
135
+ PR #1546 and leaves the normal ICP checkout untouched:
136
+
137
+ ```
138
+ cd ../em-icp-api
139
+ git fetch origin pull/1546/head
140
+ git worktree add --detach /private/tmp/em-icp-pr1546-validation FETCH_HEAD
141
+ cd /private/tmp/em-icp-pr1546-validation
142
+ yarn install --immutable
143
+ docker compose -f docker-compose.yml up -d redis
144
+ ```
145
+
146
+ Its `config/local-dev.yaml` is ignored by `em-icp-api`; create it and configure the
147
+ AAT IdAM URL, local Redis and AAT Web PubSub client URL:
148
+
149
+ ```yaml
150
+ idam:
151
+ url: https://idam-api.aat.platform.hmcts.net
152
+ redis:
153
+ host: localhost
154
+ port: 6379
155
+ useTLS: "false"
156
+ icp:
157
+ wsUrl: wss://em-icp-webpubsub.aat.platform.hmcts.net/client/hubs/localhub
158
+ ```
159
+
160
+ Check that the active Azure identity can read the approved secret without printing its
161
+ value:
162
+
163
+ ```
164
+ az keyvault secret show \
165
+ --vault-name em-icp-aat \
166
+ --name em-icp-web-pubsub-primary-connection-string \
167
+ --query id -o tsv
168
+ ```
169
+
170
+ Immediately before starting ICP, load the connection string into `NODE_CONFIG` only for
171
+ that process. This command does not echo or write the secret to disk:
172
+
173
+ ```
174
+ local_webpubsub_secret="$(az keyvault secret show \
175
+ --vault-name em-icp-aat \
176
+ --name em-icp-web-pubsub-primary-connection-string \
177
+ --query value -o tsv)"
178
+ export NODE_CONFIG="$(LOCAL_WEBPUBSUB_SECRET="$local_webpubsub_secret" node -e 'console.log(JSON.stringify({secrets: {"em-icp": {"em-icp-web-pubsub-primary-connection-string": process.env.LOCAL_WEBPUBSUB_SECRET}}}))')"
179
+ unset local_webpubsub_secret
180
+ ```
181
+
182
+ For Web PubSub callback testing, make the following local-only edits in the ICP
183
+ checkout before starting it. The API currently hard-codes the deployed `Hub`/`hub`
184
+ names in three places, whereas the tunnel uses `localhub`; do not commit these edits
185
+ with the change being tested:
186
+
187
+ ```
188
+ app.ts: new WebPubSubServiceClient(primaryConnectionstring, "localhub")
189
+ app.ts: new WebPubSubEventHandler("localhub", ...)
190
+ api/routes/sessions.ts: new WebPubSubServiceClient(primaryConnectionstring, "localhub")
191
+ ```
192
+
193
+ Then start ICP and check its health:
194
+
195
+ ```
196
+ yarn start:local
197
+ curl -fsS http://localhost:8080/health
198
+ yarn test:unit
199
+ ```
200
+
201
+ Then tunnel the AAT Web PubSub hub to the local ICP process in another terminal. Use
202
+ the AAT Web PubSub endpoint and keep the upstream HTTP URL local:
203
+
204
+ ```
205
+ npx --yes --package @azure/web-pubsub-tunnel-tool awps-tunnel run \
206
+ --hub localhub \
207
+ --endpoint https://em-icp-webpubsub-aat.webpubsub.azure.com \
208
+ --upstream http://localhost:8080 \
209
+ -s 1c4f0704-a29e-403d-b719-b90c34ef14c9 \
210
+ -g em-icp-aat
211
+ ```
212
+
213
+ The tunnel needs an authenticated Azure identity that can read the AAT hub settings.
214
+ If it reports `403` after resolving the subscription and resource group, obtain the
215
+ required AAT Web PubSub access policy or RBAC permission; that is an Azure access
216
+ blocker, not a local ICP or Media Viewer failure.
217
+
218
+ Then start Media Viewer from its repository. Populate the ignored AAT `.env` if it
219
+ does not already contain the approved AAT settings, then set the ICP override:
220
+
221
+ ```
222
+ cd ../rpx-xui-media-viewer
223
+ yarn env:populate:aat
224
+ # In .env set:
225
+ # ICP_API_URL=http://localhost:8080
226
+ yarn start:aat
227
+ ```
228
+
229
+ Open `http://localhost:3000/#/media-viewer`, then run the browser regression lane:
230
+
231
+ ```
232
+ PLAYWRIGHT_REPORTERS=list yarn test:local:aat
233
+ ```
234
+
235
+ This setup tests local ICP code with AAT authentication and Web PubSub; it does not
236
+ recreate the complete retired `em-showcase` Docker stack. The validation run recorded
237
+ 19 passing ICP unit tests and 71 passing Media Viewer tests.
238
+
239
+ Current ICP source warning: `api/routes/sessions.ts` logs the primary Web PubSub
240
+ connection string. Do not make an authenticated `/icp/sessions/...` request with a
241
+ real secret until that log statement is removed; this is a source-security blocker,
242
+ not a Media Viewer setup failure.
243
+
244
+ Stop the local processes with `Ctrl+C`, then clean up Redis from the ICP worktree with
245
+ `docker compose -f docker-compose.yml down`.
123
246
 
124
247
  ### 5. Run Playwright tests
125
248
  Media Viewer is starting its Playwright migration with the same runner and
@@ -132,17 +255,17 @@ Current Playwright lanes:
132
255
  | Lane | Config/project | Command | Scope |
133
256
  | --- | --- | --- | --- |
134
257
  | Standalone smoke | `playwright.config.ts`, project `smoke` | `yarn test:playwright:smoke` or `yarn test:smoke` | One readiness contract: loads a standalone PDF and proves the rendered viewer, first page and canvas are usable. |
135
- | Migrated functional | `playwright.config.ts`, project `functional` | `yarn test:playwright:functional` | 56 behaviour tests across 12 explicit feature files; one bookmarks reorder test is intentionally skipped pending [EXUI-5097](https://tools.hmcts.net/jira/browse/EXUI-5097). See [`playwright_tests/functional/README.md`](playwright_tests/functional/README.md). |
258
+ | Migrated functional | `playwright.config.ts`, project `functional` | `yarn test:playwright:functional` | 74 fixture-backed browser contracts across 13 feature files, including separate failed PDF/image rendered-state diagnostics. Two additional image-annotation create contracts are discoverable, ticketed against [EXUI-5124](https://tools.hmcts.net/jira/browse/EXUI-5124), and excluded from the default selection because the current product does not persist an image draw-box annotation. See [`playwright_tests/functional/README.md`](playwright_tests/functional/README.md). |
259
+ | External service diagnostics | `playwright.config.ts`, opt-in project `external-service-contracts` | `yarn test:playwright:external-service-contracts` | Optional live AAT CCD/DM Store/annotation probes for a deliberate environment investigation. The default command executes 6 non-defect service contracts; four CCD browser-route contracts tagged against [EXUI-5122](https://tools.hmcts.net/jira/browse/EXUI-5122) and [EXUI-5123](https://tools.hmcts.net/jira/browse/EXUI-5123) remain discoverable but are excluded by default. Use `PLAYWRIGHT_INCLUDE_KNOWN_DEFECTS=true` to discover and execute all 10. They are never part of normal PR assurance. |
136
260
  | Viewer support | `playwright.config.ts`, project `support` | `yarn test:playwright:support` | Proves the reusable PDF, image and unsupported-media fixtures, component objects and response diagnostics. |
137
261
 
138
262
  The current migration slice is deliberately separated from smoke: smoke proves
139
- the application is ready, functional proves user-facing viewer behaviour, and
140
- support proves the reusable automation contracts. There is no API or mocked
141
- integration project in this slice because the migrated contracts are browser
142
- rendering and interaction behaviour owned by the standalone viewer. Every
143
- Playwright Odhín report also includes a capability inventory showing covered,
144
- partially covered and legacy-only Media Viewer areas, with the remaining
145
- assurance gap for each capability.
263
+ the application is ready, functional proves user-facing viewer behaviour and
264
+ its deterministic Viewer/service request-response contracts, and support proves
265
+ the reusable automation contracts. External service diagnostics
266
+ are opt-in and never gate a standalone Media Viewer change. Every Playwright Odhín report includes a capability
267
+ inventory that states whether each contract is selected by default or is a
268
+ discoverable, ticketed product-defect contract.
146
269
 
147
270
  The Playwright config runs tests fully in parallel with seven workers by
148
271
  default. Set `FUNCTIONAL_TESTS_WORKERS` to a positive integer (up to 64) for an
@@ -261,8 +384,10 @@ Migration boundaries:
261
384
  - Put new native Playwright specs under `playwright_tests/`.
262
385
  - Keep screen interactions and reusable locators in page objects under
263
386
  `playwright_tests/pages/`; keep assertions visible in specs.
264
- - Keep legacy Protractor and CodeceptJS coverage until replacement coverage and
265
- Jenkins evidence are agreed.
387
+ - Historical CodeceptJS scenarios are retained as source traceability only;
388
+ their executable pipeline routing is retired once the mapped Playwright
389
+ contract is selected by default or is represented by a discoverable,
390
+ ticketed product-defect contract.
266
391
  - Add stable report output paths for every new Playwright lane so Jenkins can
267
392
  publish Odhín and JUnit and archive failure diagnostics without bespoke stage
268
393
  logic.
@@ -270,67 +395,26 @@ Migration boundaries:
270
395
  an error page, blank page, wrong route or service-down page as a valid ready
271
396
  signal.
272
397
 
273
- ### 6. Create isolated AAT test documents
274
- For mutation-heavy functional tests, do not share one document across parallel tests.
275
- Create fresh AAT DM Store documents through the local API proxy while `yarn start:aat`
276
- is running:
277
-
278
- ```
279
- yarn local-aat:documents -- --pdf-count 7 --image-count 1 --output .local-aat-documents.env
280
- ```
281
-
282
- This writes:
283
- - `MV_SMOKE_PDF_DOCUMENT_ID`
284
- - `MV_SMOKE_IMAGE_DOCUMENT_ID`
285
- - `MV_FUNCTIONAL_PDF_DOCUMENT_IDS`
286
- - `MV_FUNCTIONAL_IMAGE_DOCUMENT_IDS`
287
-
288
- The upload path mirrors em-showcase: multipart `files`, `classification=PUBLIC`,
289
- and civil/probate metadata are posted to `/documents`.
290
-
291
- ### 7. Run isolated local functional tests
292
- With `yarn start:aat` still running, execute the functional groups with separate
293
- documents and separate reports:
294
-
295
- ```
296
- yarn test:functional:local:isolated
297
- ```
298
-
299
- By default this creates fresh documents, runs up to three feature files at a time,
300
- and writes reports under `functional-output/local-isolated/`. Override with:
301
- - `MV_LOCAL_PARALLEL_MAX_JOBS=1` to run the same isolated groups serially
302
- - `MV_CREATE_LOCAL_AAT_DOCS=false` to reuse IDs from `.local-aat-documents.env`
303
- - `E2E_PARALLEL_OUTPUT_ROOT=<path>` to change report location
304
-
305
- Each feature writes its own report directory, including:
306
- - `mv-e2e-result.html`
307
- - `mv-e2e-result.json`
308
- - `result.xml`
309
-
310
- The validated local AAT sequence is:
398
+ ### 6. Run local Playwright lanes
399
+ `yarn test:local:aat` is the standalone smoke lane; it does not create a CCD
400
+ case or DM Store document. Run the fixture-backed Functional lane locally with:
311
401
 
312
402
  ```
313
- yarn check:aat-config
314
- yarn start:aat
315
- yarn smoke:local:aat
316
- yarn test:local:aat
317
- yarn test:functional:local:isolated
403
+ yarn test:playwright:functional
318
404
  ```
319
405
 
320
- Expected `test:functional:local:isolated` feature groups:
321
- - `redact`
322
- - `imageViewerAnnotationsAndComments`
323
-
324
- For the strongest isolation proof, make each scenario upload and use its own document:
406
+ The default local suite is standalone: it needs neither AAT credentials nor
407
+ shared CCD, DM Store or annotation-service state. External service diagnostics
408
+ are deliberately opt-in and must not be used as normal migration assurance. The
409
+ external command runs 6 contracts by default; `PLAYWRIGHT_INCLUDE_KNOWN_DEFECTS=true`
410
+ runs the full 10-contract inventory, including the four ticketed CCD browser defects.
411
+ Known product-defect contracts are not skipped: they remain discoverable and
412
+ run only when explicitly selected:
325
413
 
326
414
  ```
327
- yarn test:functional:local:self-contained
415
+ PLAYWRIGHT_INCLUDE_KNOWN_DEFECTS=true yarn test:playwright:functional -- --grep @defect-EXUI-5124
328
416
  ```
329
417
 
330
- This is slower because it creates a fresh AAT DM Store document for each scenario, but
331
- it is the best local check when diagnosing interference between bookmarks,
332
- annotations, comments, and redactions.
333
-
334
418
  ### Useful overrides
335
419
  Most developers should use the defaults from `.env.example`. Override only when you are deliberately testing a different endpoint or registered client setting.
336
420
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hmcts/media-viewer",
3
- "version": "4.2.33",
3
+ "version": "4.2.36",
4
4
  "description": "Media Viewer",
5
5
  "keywords": [
6
6
  "Angular",
@@ -23,7 +23,7 @@
23
23
  "pdfjs-dist": "^4.10.38",
24
24
  "socket.io-client": "^4.8.0",
25
25
  "tslib": "^2.3.0",
26
- "uuid": "^11.0.3"
26
+ "uuid": "^11.1.1"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "@angular/animations": "^20.0.0",
package/package.tgz CHANGED
Binary file