@hmcts/media-viewer 4.2.34 → 4.2.37-5161
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.
- package/.yarn/install-state.gz +0 -0
- package/README.md +146 -19
- package/fesm2022/hmcts-media-viewer.mjs +253 -253
- package/package.json +2 -2
- package/package.tgz +0 -0
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/README.md
CHANGED
|
@@ -122,19 +122,141 @@ Viewer and AAT-backed proxy configuration while keeping the browser at
|
|
|
122
122
|
the opt-in external-service contracts for those live service probes. The lightweight
|
|
123
123
|
route and health check remains available as `yarn smoke:local:aat`.
|
|
124
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`.
|
|
246
|
+
|
|
125
247
|
### 5. Run Playwright tests
|
|
126
|
-
Media Viewer
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
coverage should be added under `playwright_tests/`.
|
|
248
|
+
Media Viewer uses the Playwright runner and reporting shape used in MC and MO.
|
|
249
|
+
The CodeceptJS and Protractor/Cucumber runners are retired. New browser coverage
|
|
250
|
+
belongs under `playwright_tests/`.
|
|
130
251
|
|
|
131
252
|
Current Playwright lanes:
|
|
132
253
|
|
|
133
254
|
| Lane | Config/project | Command | Scope |
|
|
134
255
|
| --- | --- | --- | --- |
|
|
135
256
|
| 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. |
|
|
136
|
-
| Migrated functional | `playwright.config.ts`, project `functional` | `yarn test:playwright:functional` |
|
|
257
|
+
| Migrated functional | `playwright.config.ts`, project `functional` | `yarn test:playwright:functional` | 84 default fixture-backed browser contracts across 13 feature files, with 86 discoverable when the two EXUI-5124 image-annotation contracts are explicitly included. Multimedia coverage is Chromium-only; external AAT/CCD contracts are separate diagnostics and are not migration assurance. See [`playwright_tests/functional/README.md`](playwright_tests/functional/README.md). |
|
|
137
258
|
| 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. |
|
|
259
|
+
| Cross-browser smoke | `playwright.config.ts`, projects `smoke-firefox` and `smoke-webkit` | `yarn test:crossbrowser` | Runs the same readiness contract in Firefox and WebKit and publishes separate JUnit/Odhín output under `functional-output/tests/playwright-crossbrowser`. |
|
|
138
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. |
|
|
139
261
|
|
|
140
262
|
The current migration slice is deliberately separated from smoke: smoke proves
|
|
@@ -152,10 +274,10 @@ route mocks. Tests must not depend on execution order or share mutable
|
|
|
152
274
|
documents; mutation-heavy AAT journeys must provision a document per test or
|
|
153
275
|
reset it before reuse.
|
|
154
276
|
|
|
155
|
-
Install
|
|
277
|
+
Install the Playwright browsers once before local runs when the browser cache is empty:
|
|
156
278
|
|
|
157
279
|
```
|
|
158
|
-
yarn test:setup:playwright-install-
|
|
280
|
+
yarn test:setup:playwright-install-browsers
|
|
159
281
|
```
|
|
160
282
|
|
|
161
283
|
Run the smoke project against a running standalone demo app. Start the app in
|
|
@@ -169,12 +291,16 @@ Then run the smoke in another terminal:
|
|
|
169
291
|
|
|
170
292
|
```
|
|
171
293
|
yarn test:playwright:smoke
|
|
294
|
+
# unified Playwright accessibility pack (Axe, WAVE-like, screen-reader-like)
|
|
295
|
+
yarn test:a11y
|
|
296
|
+
# Firefox and WebKit smoke gate
|
|
297
|
+
yarn test:crossbrowser
|
|
172
298
|
```
|
|
173
299
|
|
|
174
300
|
Override the smoke document and case id with `MV_SMOKE_PDF_DOCUMENT_URL` and
|
|
175
301
|
`MV_SMOKE_CASE_ID`. `yarn test:smoke` and `yarn test:local:aat` run the
|
|
176
302
|
Playwright smoke, so the standalone and local-AAT PDF loading journeys no longer
|
|
177
|
-
|
|
303
|
+
use only the Playwright projects.
|
|
178
304
|
|
|
179
305
|
The lane wrapper commands write Playwright evidence under `functional-output/tests`:
|
|
180
306
|
|
|
@@ -183,6 +309,8 @@ The lane wrapper commands write Playwright evidence under `functional-output/tes
|
|
|
183
309
|
| Viewer support | `functional-output/tests/playwright-support/odhin-report/xui-playwright-support.html` | `functional-output/tests/playwright-support/playwright-support-junit.xml` | `functional-output/tests/playwright-support/test-results` |
|
|
184
310
|
| Smoke | `functional-output/tests/playwright-smoke/odhin-report/xui-playwright-smoke.html` | `functional-output/tests/playwright-smoke/playwright-smoke-junit.xml` | `functional-output/tests/playwright-smoke/test-results` |
|
|
185
311
|
| Migrated functional | `functional-output/tests/playwright-functional/odhin-report/xui-playwright-functional.html` | `functional-output/tests/playwright-functional/playwright-functional-junit.xml` | `functional-output/tests/playwright-functional/test-results` |
|
|
312
|
+
| Accessibility | `functional-output/tests/playwright-accessibility/odhin-report/xui-playwright-accessibility.html` | `functional-output/tests/playwright-accessibility/playwright-accessibility-junit.xml` | `functional-output/tests/playwright-accessibility/test-results` |
|
|
313
|
+
| Cross-browser smoke | `functional-output/tests/playwright-crossbrowser/odhin-report/xui-playwright-crossbrowser.html` | `functional-output/tests/playwright-crossbrowser/playwright-crossbrowser-junit.xml` | `functional-output/tests/playwright-crossbrowser/test-results` |
|
|
186
314
|
|
|
187
315
|
Those are the default lane-specific paths. CNP keeps preview and AAT viewer
|
|
188
316
|
support evidence separate under `functional-output/tests/playwright-support/preview`
|
|
@@ -214,9 +342,10 @@ Reporting behavior follows the MC/MO pattern:
|
|
|
214
342
|
HTML Publisher links.
|
|
215
343
|
|
|
216
344
|
The Jenkins `YarnBuilder` performs its immutable dependency install before the
|
|
217
|
-
first setup task. The pipeline
|
|
218
|
-
|
|
219
|
-
`PLAYWRIGHT_SKIP_INSTALL=true` so Playwright
|
|
345
|
+
first setup task. The pipeline installs Puppeteer Chrome for Karma and the
|
|
346
|
+
functional preflight, then installs Chromium into the workspace-local
|
|
347
|
+
`PLAYWRIGHT_BROWSERS_PATH` and sets `PLAYWRIGHT_SKIP_INSTALL=true` so Playwright
|
|
348
|
+
lanes do not reinstall it.
|
|
220
349
|
|
|
221
350
|
Useful overrides:
|
|
222
351
|
- `PLAYWRIGHT_BASE_URL` or `TEST_URL`: target application URL, default `http://localhost:3000/`
|
|
@@ -262,10 +391,6 @@ Migration boundaries:
|
|
|
262
391
|
- Put new native Playwright specs under `playwright_tests/`.
|
|
263
392
|
- Keep screen interactions and reusable locators in page objects under
|
|
264
393
|
`playwright_tests/pages/`; keep assertions visible in specs.
|
|
265
|
-
- Historical CodeceptJS scenarios are retained as source traceability only;
|
|
266
|
-
their executable pipeline routing is retired once the mapped Playwright
|
|
267
|
-
contract is selected by default or is represented by a discoverable,
|
|
268
|
-
ticketed product-defect contract.
|
|
269
394
|
- Add stable report output paths for every new Playwright lane so Jenkins can
|
|
270
395
|
publish Odhín and JUnit and archive failure diagnostics without bespoke stage
|
|
271
396
|
logic.
|
|
@@ -485,7 +610,9 @@ The list of exceptions thrown by the Media Viewer are as follows:
|
|
|
485
610
|
- HttpErrorResponse
|
|
486
611
|
- PasswordException
|
|
487
612
|
|
|
488
|
-
##
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
613
|
+
## Legacy browser tests
|
|
614
|
+
|
|
615
|
+
The CodeceptJS and Protractor/Cucumber runners were retired as part of the
|
|
616
|
+
Playwright migration. Migration closure was recorded in PR #82; the active
|
|
617
|
+
browser test source is now Playwright. Use the Playwright commands above for
|
|
618
|
+
supported browser tests. No recurring legacy-parity test is retained.
|