Cucumber step definitions for the Jellyfin media server, for webship-js, a BDD browser automation harness built on Playwright and Cucumber-js.
A media server is used in the browser: a person signs in, finds a movie or an album, plays it, searches, keeps favorites; its admin gives an app an API key. The steps do all of that in the server's own web client, check that what plays really plays, and keep every password, session token and key out of their words, their messages, their failures and the reports:
- signing in: as the server's admin, or as an account a scenario makes through the API (deleted at its end); signing out;
- browsing: the libraries on the home page, an item opened by its title, an album's tracks, a search;
- playing: a movie or an album played, and checked to play from the server's own stream (its time moving on, the now-playing bar naming the track); playback stopped;
- favorites: an item added (removed again at the scenario's end), and the account's favorites read back;
- API keys: one made through the dashboard's dialog (revoked at the scenario's end); the API's answer with it, and its refusal without a key;
- keeping to itself: no request from the page outside the server's address, no metadata fetched from the internet for a library, no plugin repository; and the server's activity log.
No step phrase names the platform: a scenario reads When I open the item "Webship Tones" on the media server and
Then the media server should be playing the track "Tone 220 Hz".
- Node.js 24 or newer.
- webship-js 2.0.20 or newer.
- A Jellyfin server with its setup wizard done, and its admin's name and password. Jellyfin 12.4 and 10.11.11 are the two lines this pack is proven on.
npm install --save-dev @webship-js/jellyfin-stepsList its step definitions in cucumber.js, after webship-js's own, and give it the admin's password from the
environment:
require: [
'node_modules/webship-js/tests/step-definitions/**/*.js',
'node_modules/@webship-js/jellyfin-steps/tests/step-definitions/**/*.js',
'tests/step-definitions/**/*.js',
],
worldParameters: {
launchUrl: 'http://127.0.0.1:8096',
jellyfin: {
adminUser: process.env.JELLYFIN_ADMIN_USER || 'webship-admin',
adminPassword: process.env.JELLYFIN_ADMIN_PASSWORD,
},
},Feature: Watching
Scenario: A movie plays, and nothing is asked of another site
Given I am signed in to the media server as its admin
When I open the item "Webship Colour Bars (2026)" on the media server
And I press play on the media server
Then the media server should be playing the video "Webship Colour Bars (2026)"
When I stop playback on the media server
Then the media server should have sent no request outside its addressgit clone https://github.com/webship/jellyfin-steps && cd jellyfin-steps
npm ci && npx playwright install chromium
export JELLYFIN_ADMIN_PASSWORD="$(openssl rand -base64 18)"
bash .github/scripts/build-demo.sh 12.4 # http://127.0.0.1:8760 (10.11.11: http://127.0.0.1:8762)
npx cucumber-js # LINE=10.11.11 for the other line
npm run test:must-fail
bash .github/scripts/remove-demo.sh 12.4The demo is the official image of the line, by its digest:
| Line | Image |
|---|---|
| 12.4 | docker.io/jellyfin/jellyfin@sha256:fea863d0cd9ec445985d9c75fc6ed64e38a1d2766cf0c250a33d553f4fc1b771 |
| 10.11.11 | docker.io/jellyfin/jellyfin@sha256:aefb67e6a7ff1debdd154a78a7bbb780fd0c873d8639210a7f6a2016ad2b35db |
It runs as your user, capped at 1 GB. Its admin is made through the server's setup wizard with the password from the
environment, never from a command line (it refuses to start without one). Its media is made at the build by the image's
own ffmpeg from its built-in generators (demo/make-media.sh, no network, nothing downloaded and nothing shipped): two
10-second test-pattern movies with a tone, "Webship Colour Bars (2026)" and "Webship Test Circles (2026)", and the
album "Webship Tones" by "Webship", three 8-second tagged tones; 1.3 MB in all.
Jellyfin reaches out to other sites by default. The demo turns every such request off, so the suite can check that not one goes out:
- metadata and artwork: both libraries are added with no metadata downloader (TheMovieDb, The Open Movie Database, MusicBrainz, TheAudioDB) and only the image fetchers that read the media itself (Embedded Image Extractor, Screen Grabber, Image Extractor);
- the plugin repository: emptied, and the "Update Plugins" task has no trigger; nor does TheMovieDb's "Refresh upcoming and missing episodes";
- remote access: off in the setup wizard;
- the web client's players that load a script from another site: Google Cast's sender (
chromecastPlayer, from www.gstatic.com) and YouTube's player for trailers (youtubePlayer). The demo mounts the web client'sconfig.jsonwithout them (demo/web-config.pymakes it from the image's own), so casting and trailers are off.
For real media, turn metadata back on per library: Dashboard, Libraries, the library's "Manage library", then tick the
metadata downloaders and image fetchers you want. Turn the plugin repository back on under Dashboard, Plugins, Manage
Repositories. For casting and trailers, put chromecastPlayer/plugin and youtubePlayer/plugin back in the web
client's config.json (the Webship Workspace's plugin has a setting for it).
The two libraries are added without a scan, then scanned once. When a second library is added while the first one's scan still runs, its own scan is skipped and it stays empty until the next scan: the reason the music once stayed unlisted during the exploration.
Three features, eight scenarios: signing in and out (the admin; an account made for the scenario, listed on the Users page), watching and listening (a movie played from the server's own stream; an album's tracks listed and its first track played; a search; a favorite of an account's own), and administering (an API key made in the dashboard opens the API, and nothing opens it without one; no library fetches from the internet and no plugin repository is listed). Every browsing scenario ends by checking that the page sent no request outside the server's address.
Twelve must-fail scenarios check that each assertion fails when it should, with its message and a hint; two of them run
against an address nothing answers. The check then scans their output, their JSON and HTML reports, and every file the
runs left (screenshots, videos, attachments) for the admin's password, a session token (Token="…", "AccessToken"), a
stream's key (api_key=, ApiKey=) and the client's header (MediaBrowser Client=), and fails on any trace or HAR
file.
worldParameters.jellyfin in cucumber.js:
| Setting | Default | What it is |
|---|---|---|
adminUser |
webship-admin |
The admin's name (JELLYFIN_ADMIN_USER). |
adminPassword |
none | The admin's password, from the environment (JELLYFIN_ADMIN_PASSWORD); never in a feature. |
24 step definitions; each has five examples in its JSDoc block.
Given I am signed in to the media server as its adminGiven I am signed in to the media server as "<name>": an account the scenario made.When I sign out of the media serverGiven the media server has a user "<name>": made through the API with a random password kept in memory; deleted at the scenario's end.Then the media server should list the user "<name>": the dashboard's Users page.
Then I should see the library "<name>" on the media server's homeWhen I open the item "<title>" on the media server: a movie keeps its year,"Webship Colour Bars (2026)".Then the media server's album should list the track "<title>"When I press play on the media serverThen the media server should be playing the video "<title>"/should be playing the track "<title>"When I stop playback on the media serverWhen I search the media server for "<text>"Then the media server's search should show "<title>"When I add the item to the media server's favorites: removed again at the scenario's end.Then the media server should have "<title>" among my favorites
When I create the API key "<app>" on the media server: through the dashboard's dialog; revoked at the scenario's end.Then the media server should list the API key "<app>"Then the media server's API should answer with the key "<app>"/should refuse a request without a keyThen the media server should have sent no request outside its addressThen the media server's library "<name>" should fetch no metadata from the internetThen the media server's plugin repository list should be emptyThen the media server's activity should show "<text>"
The admin's password comes from the environment. An account a scenario makes gets a random password that lives in
memory for that scenario; an API key a scenario makes is read back into memory and revoked at its end. A password is
set into the login form's password field by its id from memory, never typed through a step's words. No step shows a
secret: failures and messages replace passwords, tokens, keys and the MediaBrowser … Token="…" header with ….
Jellyfin puts the session's token in addresses: a stream's api_key= / ApiKey=, and its WebSocket's
/socket?ApiKey=. Three places could carry them out, and the pack closes each:
- a failed request: Playwright's error for a request that gets no answer carries the request's call log, its Authorization header among it. The pack catches every such error and rethrows its first line only, secrets replaced.
- the browser's errors: when the WebSocket fails (as a session ends), the browser logs its address, token and all, and webship-js prints its error list as it is. The pack strips every secret from that list after each step and before webship-js reports it (until webship-js does it itself: webship/webship-js#707).
- traces and HAR files would keep every address. The pack never turns either on, and the must-fail check fails on any it finds.
Nothing a later run sees: every account, API key, favorite and play a scenario makes is undone at its end, even when it fails. The server's activity log keeps its entries, as it does for every visit.
The suite runs in webship-js's fail mode with nothing let through for the whole suite. The web client logs errors of
its own at a few moments, and each step allows only its moment's, then counts them in the report:
- the Users page, as it loads and as it is left (12.4):
Unexpected null referencefrom itsusers.<hash>.chunk.js; - signing out: the 401s of the page's requests still under way as the session ends, and the failure of its WebSocket;
- from the first item page a scenario opens to its end (10.11): the 404 of
<address>/web/null, the artwork of an item that has none (the demo's album), which the web client asks for as the page draws and again as it redraws; - from signing in to the scenario's end (10.11): the home page's own "TypeError: this.getItemsHtml is not a function", now and then as its sections load;
- while the admin is signed in (10.11), step by step: "Failed to execute 'showNotification' on 'ServiceWorkerRegistration': No notification permission has been granted for this origin.", the server's notices to an admin (an API key made, say) that the web client shows through its service worker, which the browser of a run has no permission for. A step that begins or ends with another account signed in, or none, does not allow it.
The last ones come late, after the step that caused them: the pack allows them after each step and once more at the scenario's end, after its own cleanup, before webship-js reports the browser's errors. Any other browser error, or one of these outside its moment, fails the scenario.
Jellyfin is GPL-2.0; its web client is GPL-2.0 too, and the image's ffmpeg (jellyfin-ffmpeg) is a GPL build. This pack only pulls the official image at the run and never redistributes it; it carries no code of Jellyfin.
None. Every phrase says "the media server". Checked before the release against the 71 published packs and the Meilisearch, Express, Superset, Flask and Vaultwarden packs: no example or feature step of this pack matches another pack's definition, and no step of theirs matches one of this pack's.
From the exploration and the runs on both lines:
- The API's header: 12.4 takes the client's name, device and token in
Authorization: MediaBrowser Client="…", Device="…", DeviceId="…", Version="…", Token="…";X-Emby-Authorizationanswers 400. 10.11.11 takes the same. - A library added during another's scan is not scanned (see above): add libraries without a scan, then scan once.
- The web client loads Google Cast's sender from www.gstatic.com as an item's page opens, in Chromium; YouTube's
player loads for trailers. Both are plugins of the web client's
config.json. - Direct play: the demo's movies (H.264 and AAC in MP4) play as they are,
/Videos/<id>/stream.mp4?Static=true; the tones play from/Audio/<id>/universal. - Signing out: 12.4's header holds a "User Menu" with "Sign Out" (its user preferences page keeps a hidden one). The step opens that menu, or the drawer menu where an older web client keeps "Sign Out".
- Measured (1 GB cap): about 180 MiB idle; a peak of 387 MiB through the suite on 12.4; the suite in about a minute.
npm run test:examples # every example of every step matches its own definition only; every feature step one
npm run test:paths # a feature or a scenario named on the command line runs alone
npx cucumber-js --dry-runCI, for each line (12.4 and 10.11.11), builds the demo and runs the suite twice and then the must-fail assertions.
MIT. The pack carries no code of Jellyfin: the demo pulls the official image at the run.
The logo is Simple Icons' Jellyfin icon (icons/jellyfin.svg of simple-icons 16.39.0, CC0-1.0), in the colour the set
lists for it (#00A4DC); its path is unmodified. It names the media server the pack tests. It is not covered by this
package's licence.