@verdaccio/e2e-ui 2.8.0 → 2.9.0
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/README.md +13 -8
- package/build/cjs/features.cjs +5 -0
- package/build/cjs/features.cjs.map +1 -1
- package/build/cjs/index.cjs +3 -0
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/testIds.cjs +2 -0
- package/build/cjs/testIds.cjs.map +1 -1
- package/build/cjs/tests/index.cjs +2 -0
- package/build/cjs/tests/provenance.cjs +134 -0
- package/build/cjs/tests/provenance.cjs.map +1 -0
- package/build/esm/features.js +5 -0
- package/build/esm/features.js.map +1 -1
- package/build/esm/index.js +3 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/testIds.js +2 -0
- package/build/esm/testIds.js.map +1 -1
- package/build/esm/tests/index.js +2 -1
- package/build/esm/tests/provenance.js +134 -0
- package/build/esm/tests/provenance.js.map +1 -0
- package/build/features.d.ts +12 -0
- package/build/index.d.ts +1 -1
- package/build/testIds.d.ts +4 -0
- package/build/tests/index.d.ts +1 -0
- package/build/tests/provenance.d.ts +13 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -52,14 +52,15 @@ homeTests(config);
|
|
|
52
52
|
|
|
53
53
|
## Available suites
|
|
54
54
|
|
|
55
|
-
| Export
|
|
56
|
-
|
|
|
57
|
-
| `homeTests`
|
|
58
|
-
| `signinTests`
|
|
59
|
-
| `layoutTests`
|
|
60
|
-
| `searchTests`
|
|
61
|
-
| `settingsTests`
|
|
62
|
-
| `publishTests`
|
|
55
|
+
| Export | Covers |
|
|
56
|
+
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
57
|
+
| `homeTests` | Empty-registry landing page, help card, 404 |
|
|
58
|
+
| `signinTests` | Login dialog, greeting, logout |
|
|
59
|
+
| `layoutTests` | `/-/static/ui-options.js` health, header chrome, footer |
|
|
60
|
+
| `searchTests` | Search input, query fires, empty state, clear |
|
|
61
|
+
| `settingsTests` | Settings dialog, language picker, language switch |
|
|
62
|
+
| `publishTests` | Publishes via `cy.task`, asserts readme / sidebar / tabs |
|
|
63
|
+
| `provenanceTests` | "Provenance" sidebar chip + dialog for versions carrying `dist.attestations` / `dist.signatures` (9.x, behind `features.provenance.sidebarSection`) |
|
|
63
64
|
|
|
64
65
|
## Configuration
|
|
65
66
|
|
|
@@ -82,6 +83,10 @@ inherit from `DEFAULT_TEST_IDS` / `DEFAULT_SELECTORS`.
|
|
|
82
83
|
compatibility with Verdaccio 6.x. Enable it when testing Verdaccio 7.x or 9.x
|
|
83
84
|
builds that support Web UI bearer tokens on protected package tarball routes.
|
|
84
85
|
|
|
86
|
+
`features.provenance.sidebarSection` is disabled by default: the "Provenance"
|
|
87
|
+
sidebar section ships with the 9.x UI (verdaccio/verdaccio#6447). Enable it on
|
|
88
|
+
master and on 7.x once it consumes that `@verdaccio/ui-theme`.
|
|
89
|
+
|
|
85
90
|
## `publishPackage` task
|
|
86
91
|
|
|
87
92
|
Publishes a throwaway package so downstream specs have something to assert on.
|
package/build/cjs/features.cjs
CHANGED
|
@@ -57,6 +57,7 @@ var DEFAULT_FEATURES = {
|
|
|
57
57
|
versionLink: false,
|
|
58
58
|
settingsPublishTab: false
|
|
59
59
|
},
|
|
60
|
+
provenance: { sidebarSection: false },
|
|
60
61
|
changePassword: {
|
|
61
62
|
happyPath: true,
|
|
62
63
|
validation: true,
|
|
@@ -122,6 +123,10 @@ function mergeFeatures(defaults, overrides) {
|
|
|
122
123
|
...defaults.homeDetailUx,
|
|
123
124
|
...overrides.homeDetailUx
|
|
124
125
|
},
|
|
126
|
+
provenance: {
|
|
127
|
+
...defaults.provenance,
|
|
128
|
+
...overrides.provenance
|
|
129
|
+
},
|
|
125
130
|
changePassword: {
|
|
126
131
|
...defaults.changePassword,
|
|
127
132
|
...overrides.changePassword
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features.cjs","names":[],"sources":["../../src/features.ts"],"sourcesContent":["import type { DeepPartial } from './testIds';\n\n/**\n * Per-test feature flags for enabling/disabling individual test cases\n * in the e2e-ui suites.\n *\n * The Verdaccio UI behaves differently across branches — search result\n * payload shape differs between the `/-/v1/search` and\n * `/-/verdaccio/data/search/*` endpoints, the language picker was\n * added in a specific minor, etc. Rather than forking the suite per\n * branch, consumers can disable individual tests via\n * `createRegistryConfig({ features: { … } })`.\n *\n * Most flags default to `true` (test runs). Compatibility probes for\n * unreleased server behavior may default to `false`; enable them in\n * consumers that run against a Verdaccio build with the feature.\n * A disabled flag converts the test into a Mocha `it.skip` call — the\n * suite still reports the test but marks it as pending.\n */\nexport interface Features {\n search: {\n /**\n * Whether to run the \"results dropdown renders a matching\n * package\" test. Disable on builds where the search result shape\n * or the Autocomplete rendering differs from the default assumption.\n */\n resultsDropdown: boolean;\n /**\n * Whether to run the \"clicking a result navigates to detail\" test.\n * Depends on the Autocomplete `onSelectItem` → router wiring.\n */\n resultClickNavigation: boolean;\n };\n home: {\n /**\n * Whether to run the `with a published package` sub-block inside\n * `homeTests` (publishes a throwaway package and asserts it\n * renders in the package list).\n */\n publishedPackageRendering: boolean;\n };\n settings: {\n /**\n * Whether to run the \"change language via card click\" test.\n * Depends on the `LanguageSwitch` component layout and its\n * translation sentinels (\"Translations\", \"German\"). Skip on\n * builds that lag behind the upstream translation file.\n */\n languageSwitcher: boolean;\n /**\n * Whether to assert that dates follow the selected language\n * (dayjs locale). Released UIs never load the dayjs locale, so\n * relative dates stay English in every language (fixed in\n * verdaccio/verdaccio#6210) — probe.\n */\n localizedDates: boolean;\n };\n signin: {\n /**\n * Whether to run the three validation tests (disabled submit\n * button, invalid credentials error banner). Depends on the\n * current yup schema and the hard-coded \"Invalid username or\n * password\" error string.\n */\n validationTests: boolean;\n };\n layout: {\n /**\n * Whether to run the dark/light theme switch test. Depends on\n * `web.showThemeSwitch` (defaults to true in ui-theme) and the\n * `header--button--light` / `header--button--dark` testids.\n */\n themeSwitch: boolean;\n };\n publish: {\n /**\n * Whether to run the \"tarball download button fires a GET\" test.\n * Depends on `web.showDownloadTarball` (defaults to true) and\n * the published package manifest having a valid `dist.tarball`.\n */\n downloadTarball: boolean;\n /**\n * Whether to run the private package tarball download tests from\n * the Web UI package list and sidebar.\n *\n * Enable only on Verdaccio builds that accept Web UI bearer tokens\n * on protected npm package/tarball routes. Verdaccio 6.x currently\n * returns HTTP 401 for this flow; the regression is tracked in\n * verdaccio/verdaccio#5765.\n */\n privateDownloadTarball: boolean;\n /**\n * Whether to run the \"raw viewer dialog opens + closes\" test.\n * Depends on `web.showRaw` (defaults to true).\n */\n rawViewer: boolean;\n };\n detail: {\n /**\n * Whether to run the \"visiting /v/<version> pins that version\" test\n * (asserts the sidebar request carries `?v=<version>`).\n */\n versionPinned: boolean;\n /**\n * Whether to run the wire-format test for scoped packages: the UI\n * must request `/-/verdaccio/data/sidebar/@scope/name` with the `@`\n * and `/` literal (npm registry convention), never `%40`-encoded.\n * Pins the regression caught by these suites in\n * verdaccio/verdaccio#6210.\n */\n scopedWireFormat: boolean;\n /**\n * Whether to run the \"nonexistent version renders Not Found\" test.\n * Requires the server to answer 404 for unknown `?v=` values\n * (verdaccio/verdaccio#6210); released lines silently fall back to\n * `latest`, so this defaults to `false` as a probe.\n */\n versionNotFound: boolean;\n /**\n * Whether to run the \"versions tab shows the CURRENT package after\n * SPA navigation\" test. The detail routes reuse one mounted\n * component, and released UIs cache the previous package's versions\n * in local state (fixed in verdaccio/verdaccio#6210) — defaults to\n * `false` as a probe.\n */\n staleVersionsNavigation: boolean;\n };\n manifestRendering: {\n /**\n * Whether to run the string-form manifest tests: `repository`,\n * `funding` and `bugs` in their string/array forms are valid npm\n * and must render (fixed in verdaccio/verdaccio#6210) — probe.\n */\n stringForms: boolean;\n /**\n * Whether to assert gravatar avatars render on the detail sidebar.\n * Released UIs read `avatar` while the sidebar endpoint sends\n * `_avatar` (fixed in verdaccio/verdaccio#6210) — probe.\n */\n gravatarAvatars: boolean;\n /**\n * Whether to assert contributors without email don't collapse into\n * one (fixed in verdaccio/verdaccio#6210) — probe.\n */\n developersWithoutEmail: boolean;\n };\n session: {\n /**\n * Whether to assert that an expired token in localStorage boots the\n * UI logged out (header shows the login button). Holds on every\n * released line.\n */\n expiredTokenLoggedOut: boolean;\n /**\n * Whether to assert the expired token is also PURGED from\n * localStorage on boot — otherwise the api client keeps attaching\n * it (fixed in verdaccio/verdaccio#6210) — probe.\n */\n expiredTokenPurged: boolean;\n };\n failureModes: {\n /**\n * Whether to run the \"backend 5xx on the package list must not\n * render the empty-registry onboarding\" test. Holds on every line\n * (a 5xx carries an HTTP code the UI always treated as an error).\n */\n homeServerError: boolean;\n /**\n * Whether to run the network-failure variant (request never\n * reaches the server). Released UIs treat a network failure as an\n * empty registry and show the onboarding card\n * (verdaccio/verdaccio#6210 fixes it), so this defaults to `false`\n * as a probe.\n */\n homeNetworkError: boolean;\n /**\n * Whether to run the \"5xx on the detail page renders an error\n * state instead of a blank page\" test. Requires the generic error\n * page from verdaccio/verdaccio#6210; released UIs render blank,\n * so this defaults to `false` as a probe.\n */\n detailErrorState: boolean;\n /**\n * Whether to run the \"search 5xx shows an error, not 'no results\n * found'\" test. The error state ships with verdaccio/verdaccio#6210\n * — probe.\n */\n searchError: boolean;\n /**\n * Whether to run the \"failed tarball download shows an error\n * snackbar\" test — clicking download and having nothing happen sent\n * users retrying blindly (fixed in verdaccio/verdaccio#6210) — probe.\n */\n downloadError: boolean;\n };\n i18n: {\n /**\n * Whether to scan the home and detail pages for raw i18n keys\n * (visible text like `sidebar.detail.version`). Holds on every\n * released line — these pages ship fully translated.\n */\n noRawKeysCorePages: boolean;\n /**\n * Whether to scan the security pages (login dialog, /-/web/login,\n * add-user, change-password) for raw i18n keys. The whole\n * `security.*` namespace is missing from every published ui-theme\n * bundle (fixed in verdaccio/verdaccio#6210), so this defaults to\n * `false` as a probe.\n */\n noRawKeysSecurityPages: boolean;\n };\n signup: {\n /**\n * Whether to run the create-user happy path (fill the form on\n * /-/web/add-user, submit, land on the success page) and assert\n * the wire contract: `PUT /-/verdaccio/sec/signup` with a 36-char\n * `sessionId`. Requires the server flag `createUser: true` AND the\n * fixed signup form from verdaccio/verdaccio#6210 — every\n * published ui-theme posts to a URL that only serves the SPA, so\n * this defaults to `false` as a probe.\n */\n happyPath: boolean;\n /**\n * Whether to run the client-side validation tests on the add-user\n * form (invalid email shows a message, url-unsafe username blocks\n * submit). Same requirements as `happyPath`.\n */\n validation: boolean;\n };\n homeDetailUx: {\n /**\n * Whether to run the home toolbar tests: filter narrows the list and\n * lives in `?q=`, `?scope=` restores the scope, no-match message.\n * Ships with the 9.x home toolbar — probe, defaults to `false`.\n */\n homeToolbar: boolean;\n /**\n * Whether to assert the package page tab lives in `?tab=` (click\n * writes it, a link opens it, readme removes it) — probe.\n */\n detailTabInUrl: boolean;\n /**\n * Whether to assert the step-by-step welcome card (setup tabs per\n * package manager, `.npmrc` tab, uplinks note) — probe.\n */\n welcomeGuide: boolean;\n /**\n * Whether to assert the sidebar install box lists `bun` and the\n * `.npmrc` registry line. Needs `bun` in `web.pkgManagers` (default\n * on 9.x) — probe.\n */\n installBunAndNpmrc: boolean;\n /**\n * Whether to assert that a copy button confirms the copy (its\n * accessible name switches to \"Copied\") — probe.\n */\n copyFeedback: boolean;\n /**\n * Whether to assert search results are grouped by origin and a\n * locally published package lands in the \"published here\" group.\n * Needs `web.showUplinks` (default true) — probe.\n */\n searchGrouping: boolean;\n /**\n * Whether to assert that the version on each home list item links\n * to its version page `/-/web/detail/<name>/v/<version>` — probe.\n */\n versionLink: boolean;\n /**\n * Whether to assert the settings dialog has a \"Publishing\" tab with\n * the welcome guide, so it stays reachable once packages exist — probe.\n */\n settingsPublishTab: boolean;\n };\n changePassword: {\n /**\n * Whether to run the happy-path test (submit valid change,\n * expect navigation to the success page, then restore the\n * original password in `after()`).\n *\n * The suite targets /-/web/change-password, which renders only\n * when the server is configured with `flags.changePassword: true`.\n * Disable on registries that do not enable the flag.\n *\n * Also disable on **published verdaccio 6.x** (all lines through\n * 6.5.0): the reset_password handler in\n * `verdaccio/build/api/web/api/user.js` ships with an inverted\n * conditional — `validatePassword(...) === false` gates the\n * `auth.changePassword(...)` call, so a *valid* new password\n * always returns HTTP 400 (`PASSWORD_VALIDATION`). The bug is\n * fixed on the development branch but has not been released\n * in any 6.x tag, so the happy path cannot succeed against an\n * `npm install verdaccio@6` runtime.\n */\n happyPath: boolean;\n /**\n * Whether to run the client-side validation tests (submit button\n * stays disabled while fields are empty / mismatched confirm).\n * Depends on the yup `changePasswordSchema`.\n */\n validation: boolean;\n /**\n * Whether to run the \"wrong old password shows error banner\" test.\n * Depends on the server rejecting the call and the onSubmit catch\n * block surfacing `\"Failed to change password\"` via\n * `LoginDialogFormError`.\n */\n wrongOldPassword: boolean;\n };\n}\n\n/** Defaults: all flags on. */\nexport const DEFAULT_FEATURES: Features = {\n search: {\n resultsDropdown: true,\n resultClickNavigation: true,\n },\n home: {\n publishedPackageRendering: true,\n },\n settings: {\n languageSwitcher: true,\n localizedDates: false,\n },\n signin: {\n validationTests: true,\n },\n layout: {\n themeSwitch: true,\n },\n publish: {\n downloadTarball: true,\n privateDownloadTarball: false,\n rawViewer: true,\n },\n detail: {\n versionPinned: true,\n scopedWireFormat: true,\n versionNotFound: false,\n staleVersionsNavigation: false,\n },\n manifestRendering: {\n stringForms: false,\n gravatarAvatars: false,\n developersWithoutEmail: false,\n },\n session: {\n expiredTokenLoggedOut: true,\n expiredTokenPurged: false,\n },\n failureModes: {\n homeServerError: true,\n homeNetworkError: false,\n detailErrorState: false,\n searchError: false,\n downloadError: false,\n },\n i18n: {\n noRawKeysCorePages: true,\n noRawKeysSecurityPages: false,\n },\n signup: {\n happyPath: false,\n validation: false,\n },\n homeDetailUx: {\n homeToolbar: false,\n detailTabInUrl: false,\n welcomeGuide: false,\n installBunAndNpmrc: false,\n copyFeedback: false,\n searchGrouping: false,\n versionLink: false,\n settingsPublishTab: false,\n },\n changePassword: {\n happyPath: true,\n validation: true,\n wrongOldPassword: true,\n },\n};\n\n/**\n * Merge user overrides into the default feature flags. Per-section,\n * one level deep — matching the style of `mergeTestIds`.\n */\nexport function mergeFeatures(defaults: Features, overrides?: DeepPartial<Features>): Features {\n if (!overrides) return defaults;\n return {\n search: { ...defaults.search, ...overrides.search },\n home: { ...defaults.home, ...overrides.home },\n settings: { ...defaults.settings, ...overrides.settings },\n signin: { ...defaults.signin, ...overrides.signin },\n layout: { ...defaults.layout, ...overrides.layout },\n publish: { ...defaults.publish, ...overrides.publish },\n detail: { ...defaults.detail, ...overrides.detail },\n manifestRendering: { ...defaults.manifestRendering, ...overrides.manifestRendering },\n session: { ...defaults.session, ...overrides.session },\n failureModes: { ...defaults.failureModes, ...overrides.failureModes },\n i18n: { ...defaults.i18n, ...overrides.i18n },\n signup: { ...defaults.signup, ...overrides.signup },\n homeDetailUx: { ...defaults.homeDetailUx, ...overrides.homeDetailUx },\n changePassword: { ...defaults.changePassword, ...overrides.changePassword },\n };\n}\n\n/**\n * Helper that returns either `it` or `it.skip` depending on an\n * enabled flag. Usage:\n *\n * maybeIt(features.search.resultsDropdown)('…', () => { … });\n */\nexport function maybeIt(enabled: boolean): Mocha.TestFunction | Mocha.PendingTestFunction {\n return enabled ? it : it.skip;\n}\n"],"mappings":";;AAwTA,IAAa,mBAA6B;CACxC,QAAQ;EACN,iBAAiB;EACjB,uBAAuB;CACzB;CACA,MAAM,EACJ,2BAA2B,KAC7B;CACA,UAAU;EACR,kBAAkB;EAClB,gBAAgB;CAClB;CACA,QAAQ,EACN,iBAAiB,KACnB;CACA,QAAQ,EACN,aAAa,KACf;CACA,SAAS;EACP,iBAAiB;EACjB,wBAAwB;EACxB,WAAW;CACb;CACA,QAAQ;EACN,eAAe;EACf,kBAAkB;EAClB,iBAAiB;EACjB,yBAAyB;CAC3B;CACA,mBAAmB;EACjB,aAAa;EACb,iBAAiB;EACjB,wBAAwB;CAC1B;CACA,SAAS;EACP,uBAAuB;EACvB,oBAAoB;CACtB;CACA,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AAgB,QAAQ,SAAkE;CACxF,OAAO,UAAU,KAAK,GAAG;AAC3B"}
|
|
1
|
+
{"version":3,"file":"features.cjs","names":[],"sources":["../../src/features.ts"],"sourcesContent":["import type { DeepPartial } from './testIds';\n\n/**\n * Per-test feature flags for enabling/disabling individual test cases\n * in the e2e-ui suites.\n *\n * The Verdaccio UI behaves differently across branches — search result\n * payload shape differs between the `/-/v1/search` and\n * `/-/verdaccio/data/search/*` endpoints, the language picker was\n * added in a specific minor, etc. Rather than forking the suite per\n * branch, consumers can disable individual tests via\n * `createRegistryConfig({ features: { … } })`.\n *\n * Most flags default to `true` (test runs). Compatibility probes for\n * unreleased server behavior may default to `false`; enable them in\n * consumers that run against a Verdaccio build with the feature.\n * A disabled flag converts the test into a Mocha `it.skip` call — the\n * suite still reports the test but marks it as pending.\n */\nexport interface Features {\n search: {\n /**\n * Whether to run the \"results dropdown renders a matching\n * package\" test. Disable on builds where the search result shape\n * or the Autocomplete rendering differs from the default assumption.\n */\n resultsDropdown: boolean;\n /**\n * Whether to run the \"clicking a result navigates to detail\" test.\n * Depends on the Autocomplete `onSelectItem` → router wiring.\n */\n resultClickNavigation: boolean;\n };\n home: {\n /**\n * Whether to run the `with a published package` sub-block inside\n * `homeTests` (publishes a throwaway package and asserts it\n * renders in the package list).\n */\n publishedPackageRendering: boolean;\n };\n settings: {\n /**\n * Whether to run the \"change language via card click\" test.\n * Depends on the `LanguageSwitch` component layout and its\n * translation sentinels (\"Translations\", \"German\"). Skip on\n * builds that lag behind the upstream translation file.\n */\n languageSwitcher: boolean;\n /**\n * Whether to assert that dates follow the selected language\n * (dayjs locale). Released UIs never load the dayjs locale, so\n * relative dates stay English in every language (fixed in\n * verdaccio/verdaccio#6210) — probe.\n */\n localizedDates: boolean;\n };\n signin: {\n /**\n * Whether to run the three validation tests (disabled submit\n * button, invalid credentials error banner). Depends on the\n * current yup schema and the hard-coded \"Invalid username or\n * password\" error string.\n */\n validationTests: boolean;\n };\n layout: {\n /**\n * Whether to run the dark/light theme switch test. Depends on\n * `web.showThemeSwitch` (defaults to true in ui-theme) and the\n * `header--button--light` / `header--button--dark` testids.\n */\n themeSwitch: boolean;\n };\n publish: {\n /**\n * Whether to run the \"tarball download button fires a GET\" test.\n * Depends on `web.showDownloadTarball` (defaults to true) and\n * the published package manifest having a valid `dist.tarball`.\n */\n downloadTarball: boolean;\n /**\n * Whether to run the private package tarball download tests from\n * the Web UI package list and sidebar.\n *\n * Enable only on Verdaccio builds that accept Web UI bearer tokens\n * on protected npm package/tarball routes. Verdaccio 6.x currently\n * returns HTTP 401 for this flow; the regression is tracked in\n * verdaccio/verdaccio#5765.\n */\n privateDownloadTarball: boolean;\n /**\n * Whether to run the \"raw viewer dialog opens + closes\" test.\n * Depends on `web.showRaw` (defaults to true).\n */\n rawViewer: boolean;\n };\n detail: {\n /**\n * Whether to run the \"visiting /v/<version> pins that version\" test\n * (asserts the sidebar request carries `?v=<version>`).\n */\n versionPinned: boolean;\n /**\n * Whether to run the wire-format test for scoped packages: the UI\n * must request `/-/verdaccio/data/sidebar/@scope/name` with the `@`\n * and `/` literal (npm registry convention), never `%40`-encoded.\n * Pins the regression caught by these suites in\n * verdaccio/verdaccio#6210.\n */\n scopedWireFormat: boolean;\n /**\n * Whether to run the \"nonexistent version renders Not Found\" test.\n * Requires the server to answer 404 for unknown `?v=` values\n * (verdaccio/verdaccio#6210); released lines silently fall back to\n * `latest`, so this defaults to `false` as a probe.\n */\n versionNotFound: boolean;\n /**\n * Whether to run the \"versions tab shows the CURRENT package after\n * SPA navigation\" test. The detail routes reuse one mounted\n * component, and released UIs cache the previous package's versions\n * in local state (fixed in verdaccio/verdaccio#6210) — defaults to\n * `false` as a probe.\n */\n staleVersionsNavigation: boolean;\n };\n manifestRendering: {\n /**\n * Whether to run the string-form manifest tests: `repository`,\n * `funding` and `bugs` in their string/array forms are valid npm\n * and must render (fixed in verdaccio/verdaccio#6210) — probe.\n */\n stringForms: boolean;\n /**\n * Whether to assert gravatar avatars render on the detail sidebar.\n * Released UIs read `avatar` while the sidebar endpoint sends\n * `_avatar` (fixed in verdaccio/verdaccio#6210) — probe.\n */\n gravatarAvatars: boolean;\n /**\n * Whether to assert contributors without email don't collapse into\n * one (fixed in verdaccio/verdaccio#6210) — probe.\n */\n developersWithoutEmail: boolean;\n };\n session: {\n /**\n * Whether to assert that an expired token in localStorage boots the\n * UI logged out (header shows the login button). Holds on every\n * released line.\n */\n expiredTokenLoggedOut: boolean;\n /**\n * Whether to assert the expired token is also PURGED from\n * localStorage on boot — otherwise the api client keeps attaching\n * it (fixed in verdaccio/verdaccio#6210) — probe.\n */\n expiredTokenPurged: boolean;\n };\n failureModes: {\n /**\n * Whether to run the \"backend 5xx on the package list must not\n * render the empty-registry onboarding\" test. Holds on every line\n * (a 5xx carries an HTTP code the UI always treated as an error).\n */\n homeServerError: boolean;\n /**\n * Whether to run the network-failure variant (request never\n * reaches the server). Released UIs treat a network failure as an\n * empty registry and show the onboarding card\n * (verdaccio/verdaccio#6210 fixes it), so this defaults to `false`\n * as a probe.\n */\n homeNetworkError: boolean;\n /**\n * Whether to run the \"5xx on the detail page renders an error\n * state instead of a blank page\" test. Requires the generic error\n * page from verdaccio/verdaccio#6210; released UIs render blank,\n * so this defaults to `false` as a probe.\n */\n detailErrorState: boolean;\n /**\n * Whether to run the \"search 5xx shows an error, not 'no results\n * found'\" test. The error state ships with verdaccio/verdaccio#6210\n * — probe.\n */\n searchError: boolean;\n /**\n * Whether to run the \"failed tarball download shows an error\n * snackbar\" test — clicking download and having nothing happen sent\n * users retrying blindly (fixed in verdaccio/verdaccio#6210) — probe.\n */\n downloadError: boolean;\n };\n i18n: {\n /**\n * Whether to scan the home and detail pages for raw i18n keys\n * (visible text like `sidebar.detail.version`). Holds on every\n * released line — these pages ship fully translated.\n */\n noRawKeysCorePages: boolean;\n /**\n * Whether to scan the security pages (login dialog, /-/web/login,\n * add-user, change-password) for raw i18n keys. The whole\n * `security.*` namespace is missing from every published ui-theme\n * bundle (fixed in verdaccio/verdaccio#6210), so this defaults to\n * `false` as a probe.\n */\n noRawKeysSecurityPages: boolean;\n };\n signup: {\n /**\n * Whether to run the create-user happy path (fill the form on\n * /-/web/add-user, submit, land on the success page) and assert\n * the wire contract: `PUT /-/verdaccio/sec/signup` with a 36-char\n * `sessionId`. Requires the server flag `createUser: true` AND the\n * fixed signup form from verdaccio/verdaccio#6210 — every\n * published ui-theme posts to a URL that only serves the SPA, so\n * this defaults to `false` as a probe.\n */\n happyPath: boolean;\n /**\n * Whether to run the client-side validation tests on the add-user\n * form (invalid email shows a message, url-unsafe username blocks\n * submit). Same requirements as `happyPath`.\n */\n validation: boolean;\n };\n homeDetailUx: {\n /**\n * Whether to run the home toolbar tests: filter narrows the list and\n * lives in `?q=`, `?scope=` restores the scope, no-match message.\n * Ships with the 9.x home toolbar — probe, defaults to `false`.\n */\n homeToolbar: boolean;\n /**\n * Whether to assert the package page tab lives in `?tab=` (click\n * writes it, a link opens it, readme removes it) — probe.\n */\n detailTabInUrl: boolean;\n /**\n * Whether to assert the step-by-step welcome card (setup tabs per\n * package manager, `.npmrc` tab, uplinks note) — probe.\n */\n welcomeGuide: boolean;\n /**\n * Whether to assert the sidebar install box lists `bun` and the\n * `.npmrc` registry line. Needs `bun` in `web.pkgManagers` (default\n * on 9.x) — probe.\n */\n installBunAndNpmrc: boolean;\n /**\n * Whether to assert that a copy button confirms the copy (its\n * accessible name switches to \"Copied\") — probe.\n */\n copyFeedback: boolean;\n /**\n * Whether to assert search results are grouped by origin and a\n * locally published package lands in the \"published here\" group.\n * Needs `web.showUplinks` (default true) — probe.\n */\n searchGrouping: boolean;\n /**\n * Whether to assert that the version on each home list item links\n * to its version page `/-/web/detail/<name>/v/<version>` — probe.\n */\n versionLink: boolean;\n /**\n * Whether to assert the settings dialog has a \"Publishing\" tab with\n * the welcome guide, so it stays reachable once packages exist — probe.\n */\n settingsPublishTab: boolean;\n };\n provenance: {\n /**\n * Whether to run the \"Provenance\" sidebar section tests: a version\n * carrying `dist.attestations` or `dist.signatures` shows a chip\n * under \"Distribution\" that opens a dialog with the statement type,\n * the signing key ids and a link to the attestation bundle, and the\n * build details are only requested when the server announces the\n * endpoint (`capabilities.provenance`). Ships with 9.x\n * (verdaccio/verdaccio#6447) — probe, defaults to `false`.\n */\n sidebarSection: boolean;\n };\n changePassword: {\n /**\n * Whether to run the happy-path test (submit valid change,\n * expect navigation to the success page, then restore the\n * original password in `after()`).\n *\n * The suite targets /-/web/change-password, which renders only\n * when the server is configured with `flags.changePassword: true`.\n * Disable on registries that do not enable the flag.\n *\n * Also disable on **published verdaccio 6.x** (all lines through\n * 6.5.0): the reset_password handler in\n * `verdaccio/build/api/web/api/user.js` ships with an inverted\n * conditional — `validatePassword(...) === false` gates the\n * `auth.changePassword(...)` call, so a *valid* new password\n * always returns HTTP 400 (`PASSWORD_VALIDATION`). The bug is\n * fixed on the development branch but has not been released\n * in any 6.x tag, so the happy path cannot succeed against an\n * `npm install verdaccio@6` runtime.\n */\n happyPath: boolean;\n /**\n * Whether to run the client-side validation tests (submit button\n * stays disabled while fields are empty / mismatched confirm).\n * Depends on the yup `changePasswordSchema`.\n */\n validation: boolean;\n /**\n * Whether to run the \"wrong old password shows error banner\" test.\n * Depends on the server rejecting the call and the onSubmit catch\n * block surfacing `\"Failed to change password\"` via\n * `LoginDialogFormError`.\n */\n wrongOldPassword: boolean;\n };\n}\n\n/** Defaults: all flags on. */\nexport const DEFAULT_FEATURES: Features = {\n search: {\n resultsDropdown: true,\n resultClickNavigation: true,\n },\n home: {\n publishedPackageRendering: true,\n },\n settings: {\n languageSwitcher: true,\n localizedDates: false,\n },\n signin: {\n validationTests: true,\n },\n layout: {\n themeSwitch: true,\n },\n publish: {\n downloadTarball: true,\n privateDownloadTarball: false,\n rawViewer: true,\n },\n detail: {\n versionPinned: true,\n scopedWireFormat: true,\n versionNotFound: false,\n staleVersionsNavigation: false,\n },\n manifestRendering: {\n stringForms: false,\n gravatarAvatars: false,\n developersWithoutEmail: false,\n },\n session: {\n expiredTokenLoggedOut: true,\n expiredTokenPurged: false,\n },\n failureModes: {\n homeServerError: true,\n homeNetworkError: false,\n detailErrorState: false,\n searchError: false,\n downloadError: false,\n },\n i18n: {\n noRawKeysCorePages: true,\n noRawKeysSecurityPages: false,\n },\n signup: {\n happyPath: false,\n validation: false,\n },\n homeDetailUx: {\n homeToolbar: false,\n detailTabInUrl: false,\n welcomeGuide: false,\n installBunAndNpmrc: false,\n copyFeedback: false,\n searchGrouping: false,\n versionLink: false,\n settingsPublishTab: false,\n },\n provenance: {\n sidebarSection: false,\n },\n changePassword: {\n happyPath: true,\n validation: true,\n wrongOldPassword: true,\n },\n};\n\n/**\n * Merge user overrides into the default feature flags. Per-section,\n * one level deep — matching the style of `mergeTestIds`.\n */\nexport function mergeFeatures(defaults: Features, overrides?: DeepPartial<Features>): Features {\n if (!overrides) return defaults;\n return {\n search: { ...defaults.search, ...overrides.search },\n home: { ...defaults.home, ...overrides.home },\n settings: { ...defaults.settings, ...overrides.settings },\n signin: { ...defaults.signin, ...overrides.signin },\n layout: { ...defaults.layout, ...overrides.layout },\n publish: { ...defaults.publish, ...overrides.publish },\n detail: { ...defaults.detail, ...overrides.detail },\n manifestRendering: { ...defaults.manifestRendering, ...overrides.manifestRendering },\n session: { ...defaults.session, ...overrides.session },\n failureModes: { ...defaults.failureModes, ...overrides.failureModes },\n i18n: { ...defaults.i18n, ...overrides.i18n },\n signup: { ...defaults.signup, ...overrides.signup },\n homeDetailUx: { ...defaults.homeDetailUx, ...overrides.homeDetailUx },\n provenance: { ...defaults.provenance, ...overrides.provenance },\n changePassword: { ...defaults.changePassword, ...overrides.changePassword },\n };\n}\n\n/**\n * Helper that returns either `it` or `it.skip` depending on an\n * enabled flag. Usage:\n *\n * maybeIt(features.search.resultsDropdown)('…', () => { … });\n */\nexport function maybeIt(enabled: boolean): Mocha.TestFunction | Mocha.PendingTestFunction {\n return enabled ? it : it.skip;\n}\n"],"mappings":";;AAoUA,IAAa,mBAA6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G,SAAS;GAAQ,GAAG,UAAU;EAAO;EAClD,mBAAmB;GAAE,GAAG,SAAS;GAAmB,GAAG,UAAU;EAAkB;EACnF,SAAS;GAAE,GAAG,SAAS;GAAS,GAAG,UAAU;EAAQ;EACrD,cAAc;GAAE,GAAG,SAAS;GAAc,GAAG,UAAU;EAAa;EACpE,MAAM;GAAE,GAAG,SAAS;GAAM,GAAG,UAAU;EAAK;EAC5C,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;EAClD,cAAc;GAAE,GAAG,SAAS;GAAc,GAAG,UAAU;EAAa;EACpE,YAAY;GAAE,GAAG,SAAS;GAAY,GAAG,UAAU;EAAW;EAC9D,gBAAgB;GAAE,GAAG,SAAS;GAAgB,GAAG,UAAU;EAAe;CAC5E;AACF;;;;;;;AAQA,SAAgB,QAAQ,SAAkE;CACxF,OAAO,UAAU,KAAK,GAAG;AAC3B"}
|
package/build/cjs/index.cjs
CHANGED
|
@@ -16,6 +16,7 @@ const require_signup = require("./tests/signup.cjs");
|
|
|
16
16
|
const require_manifest_rendering = require("./tests/manifest-rendering.cjs");
|
|
17
17
|
const require_session = require("./tests/session.cjs");
|
|
18
18
|
const require_home_detail_ux = require("./tests/home-detail-ux.cjs");
|
|
19
|
+
const require_provenance = require("./tests/provenance.cjs");
|
|
19
20
|
require("./tests/index.cjs");
|
|
20
21
|
let fs = require("fs");
|
|
21
22
|
//#region src/index.ts
|
|
@@ -177,6 +178,7 @@ function registerAllTests(config) {
|
|
|
177
178
|
require_session.sessionTests(config);
|
|
178
179
|
require_signup.signupTests(config);
|
|
179
180
|
require_home_detail_ux.homeDetailUxTests(config);
|
|
181
|
+
require_provenance.provenanceTests(config);
|
|
180
182
|
require_change_password.changePasswordTests(config);
|
|
181
183
|
}
|
|
182
184
|
//#endregion
|
|
@@ -194,6 +196,7 @@ exports.i18nKeyTests = require_i18n_keys.i18nKeyTests;
|
|
|
194
196
|
exports.layoutTests = require_layout.layoutTests;
|
|
195
197
|
exports.manifestRenderingTests = require_manifest_rendering.manifestRenderingTests;
|
|
196
198
|
exports.maybeIt = require_features.maybeIt;
|
|
199
|
+
exports.provenanceTests = require_provenance.provenanceTests;
|
|
197
200
|
exports.publishPackage = require_publish.publishPackage;
|
|
198
201
|
exports.publishTests = require_publish$1.publishTests;
|
|
199
202
|
exports.registerAllTests = registerAllTests;
|
package/build/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/index.ts"],"sourcesContent":["import { appendFileSync } from 'fs';\n\nimport { DEFAULT_FEATURES, mergeFeatures } from './features';\nimport {\n PublishPackageResult,\n PublishPackageTaskInput,\n UnpublishPackageInput,\n UnpublishPackageResult,\n cleanupPublished,\n publishPackage,\n unpublishPackage,\n} from './tasks';\nimport { DEFAULT_SELECTORS, DEFAULT_TEST_IDS, mergeSelectors, mergeTestIds } from './testIds';\n// Re-export for convenience\nimport {\n changePasswordTests,\n detailTests,\n failureModeTests,\n homeDetailUxTests,\n homeTests,\n i18nKeyTests,\n layoutTests,\n manifestRenderingTests,\n publishTests,\n searchTests,\n sessionTests,\n settingsTests,\n signinTests,\n signupTests,\n} from './tests';\nimport { RegistryConfig, RegistryTaskResult, VerdaccioUiOptions } from './types';\n\nexport type { RegistryConfig, RegistryTaskResult, VerdaccioUiOptions } from './types';\nexport type {\n PublishPackageInput,\n PublishPackageTaskInput,\n PublishPackageResult,\n UnpublishPackageInput,\n UnpublishPackageResult,\n} from './tasks';\nexport type { DeepPartial, Selectors, TestIds } from './testIds';\nexport type { Features } from './features';\nexport { DEFAULT_SELECTORS, DEFAULT_TEST_IDS } from './testIds';\nexport { DEFAULT_FEATURES, maybeIt } from './features';\nexport { publishPackage, cleanupPublished, unpublishPackage } from './tasks';\nexport {\n homeTests,\n signinTests,\n publishTests,\n searchTests,\n settingsTests,\n layoutTests,\n changePasswordTests,\n detailTests,\n failureModeTests,\n i18nKeyTests,\n manifestRenderingTests,\n sessionTests,\n signupTests,\n homeDetailUxTests,\n} from './tests';\n\n/**\n * Build a full RegistryConfig from user-provided options with defaults.\n *\n * `testIds` and `selectors` are deep-merged per section with the\n * defaults in `./testIds`. Consumers targeting a non-default Verdaccio\n * build can override just the fields that drifted:\n *\n * createRegistryConfig({\n * registryUrl: 'http://localhost:4873',\n * testIds: {\n * header: { settingsTooltip: 'my-new-settings-btn' },\n * },\n * });\n */\nexport function createRegistryConfig(options: VerdaccioUiOptions): RegistryConfig {\n const url = new URL(options.registryUrl);\n return {\n registryUrl: options.registryUrl,\n port: options.port ?? (parseInt(url.port, 10) || 4873),\n credentials: options.credentials ?? { user: 'test', password: 'test' },\n title: options.title ?? 'Verdaccio',\n testIds: mergeTestIds(DEFAULT_TEST_IDS, options.testIds),\n selectors: mergeSelectors(DEFAULT_SELECTORS, options.selectors),\n features: mergeFeatures(DEFAULT_FEATURES, options.features),\n };\n}\n\n/**\n * Register Verdaccio Cypress tasks in setupNodeEvents.\n *\n * Usage in cypress.config.ts:\n * import { setupVerdaccioTasks } from '@verdaccio/e2e-ui';\n *\n * export default defineConfig({\n * e2e: {\n * setupNodeEvents(on) {\n * setupVerdaccioTasks(on, { registryUrl: 'http://localhost:4873' });\n * },\n * },\n * });\n */\nexport function setupVerdaccioTasks(on: Cypress.PluginEvents, options: VerdaccioUiOptions): void {\n const config = createRegistryConfig(options);\n\n // GitHub Actions Step Summary\n on('after:run', (results) => {\n const summaryFile = process.env.GITHUB_STEP_SUMMARY;\n if (!summaryFile || !results || !('runs' in results)) return;\n\n const cypressResults = results as CypressCommandLine.CypressRunResult;\n const lines: string[] = [];\n\n lines.push('## UI E2E Test Results\\n');\n lines.push('| Spec | Tests | Passing | Failing | Pending | Duration |');\n lines.push('|------|-------|---------|---------|---------|----------|');\n\n for (const run of cypressResults.runs) {\n const specName = run.spec.relative || run.spec.name;\n const stats = run.stats;\n const icon = stats.failures > 0 ? '❌' : '✅';\n const dur = stats.duration ? `${(stats.duration / 1000).toFixed(1)}s` : '-';\n lines.push(\n `| ${icon} ${specName} | ${stats.tests} | ${stats.passes} | ${stats.failures} | ${stats.pending} | ${dur} |`\n );\n }\n\n lines.push('');\n const totals = cypressResults.totalTests ?? 0;\n const passed = cypressResults.totalPassed ?? 0;\n const failed = cypressResults.totalFailed ?? 0;\n const pending = cypressResults.totalPending ?? 0;\n const emoji = failed > 0 ? '❌' : '✅';\n lines.push(\n `${emoji} **${passed} passed**, **${failed} failed**, **${pending} pending** (${totals} total)\\n`\n );\n\n appendFileSync(summaryFile, lines.join('\\n'));\n });\n\n on('task', {\n registry(): RegistryTaskResult {\n return {\n registryUrl: config.registryUrl,\n port: config.port,\n };\n },\n /**\n * Publish a throwaway package to the registry.\n *\n * Usage from a Cypress spec:\n *\n * cy.task('publishPackage', { pkgName: '@verdaccio/pkg-scoped' });\n *\n * Any field not provided falls back to the values configured here\n * (registryUrl, credentials). The task returns a PublishPackageResult.\n */\n async publishPackage(input: PublishPackageTaskInput): Promise<PublishPackageResult> {\n return publishPackage({\n registryUrl: input.registryUrl ?? config.registryUrl,\n credentials: input.credentials ?? config.credentials,\n pkgName: input.pkgName,\n version: input.version,\n dependencies: input.dependencies,\n devDependencies: input.devDependencies,\n manifest: input.manifest,\n unique: input.unique,\n });\n },\n /**\n * Remove a temp project folder returned by a previous publishPackage\n * call. Returns null (Cypress tasks must return something serializable).\n *\n * cy.task('cleanupPublished', result.tempFolder);\n */\n async cleanupPublished(tempFolder: string): Promise<null> {\n await cleanupPublished(tempFolder);\n return null;\n },\n /**\n * Unpublish a package from the registry so the next test starts\n * from a clean slate. Accepts either a package name or a full input\n * object (to reuse a prior tempFolder's token).\n *\n * cy.task('unpublishPackage', '@verdaccio/pkg-scoped');\n * cy.task('unpublishPackage', { pkgName, tempFolder });\n */\n async unpublishPackage(\n input:\n | string\n | (Omit<UnpublishPackageInput, 'registryUrl'> & {\n registryUrl?: string;\n })\n ): Promise<UnpublishPackageResult> {\n const normalized =\n typeof input === 'string'\n ? { pkgName: input, registryUrl: config.registryUrl }\n : { ...input, registryUrl: input.registryUrl ?? config.registryUrl };\n return unpublishPackage(normalized);\n },\n });\n}\n\n/**\n * Register all Verdaccio UI tests.\n *\n * Usage in a spec file:\n * import { registerAllTests, createRegistryConfig } from '@verdaccio/e2e-ui';\n *\n * const config = createRegistryConfig({ registryUrl: 'http://localhost:4873' });\n * registerAllTests(config);\n *\n * Or pick individual suites:\n * import { homeTests, signinTests } from '@verdaccio/e2e-ui';\n *\n * const config = createRegistryConfig({ registryUrl: 'http://localhost:4873' });\n * homeTests(config);\n * signinTests(config);\n */\nexport function registerAllTests(config: RegistryConfig): void {\n homeTests(config);\n signinTests(config);\n layoutTests(config);\n searchTests(config);\n settingsTests(config);\n publishTests(config);\n detailTests(config);\n failureModeTests(config);\n i18nKeyTests(config);\n manifestRenderingTests(config);\n sessionTests(config);\n signupTests(config);\n homeDetailUxTests(config);\n changePasswordTests(config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4EA,SAAgB,qBAAqB,SAA6C;CAChF,MAAM,MAAM,IAAI,IAAI,QAAQ,WAAW;CACvC,OAAO;EACL,aAAa,QAAQ;EACrB,MAAM,QAAQ,SAAS,SAAS,IAAI,MAAM,EAAE,KAAK;EACjD,aAAa,QAAQ,eAAe;GAAE,MAAM;GAAQ,UAAU;EAAO;EACrE,OAAO,QAAQ,SAAS;EACxB,SAAS,gBAAA,aAAa,gBAAA,kBAAkB,QAAQ,OAAO;EACvD,WAAW,gBAAA,eAAe,gBAAA,mBAAmB,QAAQ,SAAS;EAC9D,UAAU,iBAAA,cAAc,iBAAA,kBAAkB,QAAQ,QAAQ;CAC5D;AACF;;;;;;;;;;;;;;;AAgBA,SAAgB,oBAAoB,IAA0B,SAAmC;CAC/F,MAAM,SAAS,qBAAqB,OAAO;CAG3C,GAAG,cAAc,YAAY;EAC3B,MAAM,cAAc,QAAQ,IAAI;EAChC,IAAI,CAAC,eAAe,CAAC,WAAW,EAA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AAiB,YAAmC;GACxD,MAAM,gBAAA,iBAAiB,UAAU;GACjC,OAAO;EACT;;;;;;;;;EASA,MAAM,iBACJ,OAKiC;GACjC,MAAM,aACJ,OAAO,UAAU,WACb;IAAE,SAAS;IAAO,aAAa,OAAO;GAAY,IAClD;IAAE,GAAG;IAAO,aAAa,MAAM,eAAe,OAAO;GAAY;GACvE,OAAO,gBAAA,iBAAiB,UAAU;EACpC;CACF,CAAC;AACH;;;;;;;;;;;;;;;;;AAkBA,SAAgB,iBAAiB,QAA8B;CAC7D,aAAA,UAAU,MAAM;CAChB,eAAA,YAAY,MAAM;CAClB,eAAA,YAAY,MAAM;CAClB,eAAA,YAAY,MAAM;CAClB,iBAAA,cAAc,MAAM;CACpB,kBAAA,aAAa,MAAM;CACnB,eAAA,YAAY,MAAM;CAClB,sBAAA,iBAAiB,MAAM;CACvB,kBAAA,aAAa,MAAM;CACnB,2BAAA,uBAAuB,MAAM;CAC7B,gBAAA,aAAa,MAAM;CACnB,eAAA,YAAY,MAAM;CAClB,uBAAA,kBAAkB,MAAM;CACxB,wBAAA,oBAAoB,MAAM;AAC5B"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/index.ts"],"sourcesContent":["import { appendFileSync } from 'fs';\n\nimport { DEFAULT_FEATURES, mergeFeatures } from './features';\nimport {\n PublishPackageResult,\n PublishPackageTaskInput,\n UnpublishPackageInput,\n UnpublishPackageResult,\n cleanupPublished,\n publishPackage,\n unpublishPackage,\n} from './tasks';\nimport { DEFAULT_SELECTORS, DEFAULT_TEST_IDS, mergeSelectors, mergeTestIds } from './testIds';\n// Re-export for convenience\nimport {\n changePasswordTests,\n detailTests,\n failureModeTests,\n homeDetailUxTests,\n homeTests,\n i18nKeyTests,\n layoutTests,\n manifestRenderingTests,\n provenanceTests,\n publishTests,\n searchTests,\n sessionTests,\n settingsTests,\n signinTests,\n signupTests,\n} from './tests';\nimport { RegistryConfig, RegistryTaskResult, VerdaccioUiOptions } from './types';\n\nexport type { RegistryConfig, RegistryTaskResult, VerdaccioUiOptions } from './types';\nexport type {\n PublishPackageInput,\n PublishPackageTaskInput,\n PublishPackageResult,\n UnpublishPackageInput,\n UnpublishPackageResult,\n} from './tasks';\nexport type { DeepPartial, Selectors, TestIds } from './testIds';\nexport type { Features } from './features';\nexport { DEFAULT_SELECTORS, DEFAULT_TEST_IDS } from './testIds';\nexport { DEFAULT_FEATURES, maybeIt } from './features';\nexport { publishPackage, cleanupPublished, unpublishPackage } from './tasks';\nexport {\n homeTests,\n signinTests,\n publishTests,\n searchTests,\n settingsTests,\n layoutTests,\n changePasswordTests,\n detailTests,\n failureModeTests,\n i18nKeyTests,\n manifestRenderingTests,\n sessionTests,\n signupTests,\n homeDetailUxTests,\n provenanceTests,\n} from './tests';\n\n/**\n * Build a full RegistryConfig from user-provided options with defaults.\n *\n * `testIds` and `selectors` are deep-merged per section with the\n * defaults in `./testIds`. Consumers targeting a non-default Verdaccio\n * build can override just the fields that drifted:\n *\n * createRegistryConfig({\n * registryUrl: 'http://localhost:4873',\n * testIds: {\n * header: { settingsTooltip: 'my-new-settings-btn' },\n * },\n * });\n */\nexport function createRegistryConfig(options: VerdaccioUiOptions): RegistryConfig {\n const url = new URL(options.registryUrl);\n return {\n registryUrl: options.registryUrl,\n port: options.port ?? (parseInt(url.port, 10) || 4873),\n credentials: options.credentials ?? { user: 'test', password: 'test' },\n title: options.title ?? 'Verdaccio',\n testIds: mergeTestIds(DEFAULT_TEST_IDS, options.testIds),\n selectors: mergeSelectors(DEFAULT_SELECTORS, options.selectors),\n features: mergeFeatures(DEFAULT_FEATURES, options.features),\n };\n}\n\n/**\n * Register Verdaccio Cypress tasks in setupNodeEvents.\n *\n * Usage in cypress.config.ts:\n * import { setupVerdaccioTasks } from '@verdaccio/e2e-ui';\n *\n * export default defineConfig({\n * e2e: {\n * setupNodeEvents(on) {\n * setupVerdaccioTasks(on, { registryUrl: 'http://localhost:4873' });\n * },\n * },\n * });\n */\nexport function setupVerdaccioTasks(on: Cypress.PluginEvents, options: VerdaccioUiOptions): void {\n const config = createRegistryConfig(options);\n\n // GitHub Actions Step Summary\n on('after:run', (results) => {\n const summaryFile = process.env.GITHUB_STEP_SUMMARY;\n if (!summaryFile || !results || !('runs' in results)) return;\n\n const cypressResults = results as CypressCommandLine.CypressRunResult;\n const lines: string[] = [];\n\n lines.push('## UI E2E Test Results\\n');\n lines.push('| Spec | Tests | Passing | Failing | Pending | Duration |');\n lines.push('|------|-------|---------|---------|---------|----------|');\n\n for (const run of cypressResults.runs) {\n const specName = run.spec.relative || run.spec.name;\n const stats = run.stats;\n const icon = stats.failures > 0 ? '❌' : '✅';\n const dur = stats.duration ? `${(stats.duration / 1000).toFixed(1)}s` : '-';\n lines.push(\n `| ${icon} ${specName} | ${stats.tests} | ${stats.passes} | ${stats.failures} | ${stats.pending} | ${dur} |`\n );\n }\n\n lines.push('');\n const totals = cypressResults.totalTests ?? 0;\n const passed = cypressResults.totalPassed ?? 0;\n const failed = cypressResults.totalFailed ?? 0;\n const pending = cypressResults.totalPending ?? 0;\n const emoji = failed > 0 ? '❌' : '✅';\n lines.push(\n `${emoji} **${passed} passed**, **${failed} failed**, **${pending} pending** (${totals} total)\\n`\n );\n\n appendFileSync(summaryFile, lines.join('\\n'));\n });\n\n on('task', {\n registry(): RegistryTaskResult {\n return {\n registryUrl: config.registryUrl,\n port: config.port,\n };\n },\n /**\n * Publish a throwaway package to the registry.\n *\n * Usage from a Cypress spec:\n *\n * cy.task('publishPackage', { pkgName: '@verdaccio/pkg-scoped' });\n *\n * Any field not provided falls back to the values configured here\n * (registryUrl, credentials). The task returns a PublishPackageResult.\n */\n async publishPackage(input: PublishPackageTaskInput): Promise<PublishPackageResult> {\n return publishPackage({\n registryUrl: input.registryUrl ?? config.registryUrl,\n credentials: input.credentials ?? config.credentials,\n pkgName: input.pkgName,\n version: input.version,\n dependencies: input.dependencies,\n devDependencies: input.devDependencies,\n manifest: input.manifest,\n unique: input.unique,\n });\n },\n /**\n * Remove a temp project folder returned by a previous publishPackage\n * call. Returns null (Cypress tasks must return something serializable).\n *\n * cy.task('cleanupPublished', result.tempFolder);\n */\n async cleanupPublished(tempFolder: string): Promise<null> {\n await cleanupPublished(tempFolder);\n return null;\n },\n /**\n * Unpublish a package from the registry so the next test starts\n * from a clean slate. Accepts either a package name or a full input\n * object (to reuse a prior tempFolder's token).\n *\n * cy.task('unpublishPackage', '@verdaccio/pkg-scoped');\n * cy.task('unpublishPackage', { pkgName, tempFolder });\n */\n async unpublishPackage(\n input:\n | string\n | (Omit<UnpublishPackageInput, 'registryUrl'> & {\n registryUrl?: string;\n })\n ): Promise<UnpublishPackageResult> {\n const normalized =\n typeof input === 'string'\n ? { pkgName: input, registryUrl: config.registryUrl }\n : { ...input, registryUrl: input.registryUrl ?? config.registryUrl };\n return unpublishPackage(normalized);\n },\n });\n}\n\n/**\n * Register all Verdaccio UI tests.\n *\n * Usage in a spec file:\n * import { registerAllTests, createRegistryConfig } from '@verdaccio/e2e-ui';\n *\n * const config = createRegistryConfig({ registryUrl: 'http://localhost:4873' });\n * registerAllTests(config);\n *\n * Or pick individual suites:\n * import { homeTests, signinTests } from '@verdaccio/e2e-ui';\n *\n * const config = createRegistryConfig({ registryUrl: 'http://localhost:4873' });\n * homeTests(config);\n * signinTests(config);\n */\nexport function registerAllTests(config: RegistryConfig): void {\n homeTests(config);\n signinTests(config);\n layoutTests(config);\n searchTests(config);\n settingsTests(config);\n publishTests(config);\n detailTests(config);\n failureModeTests(config);\n i18nKeyTests(config);\n manifestRenderingTests(config);\n sessionTests(config);\n signupTests(config);\n homeDetailUxTests(config);\n provenanceTests(config);\n changePasswordTests(config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EA,SAAgB,qBAAqB,SAA6C;CAChF,MAAM,MAAM,IAAI,IAAI,QAAQ,WAAW;CACvC,OAAO;EACL,aAAa,QAAQ;EACrB,MAAM,QAAQ,SAAS,SAAS,IAAI,MAAM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var DEFAULT_TEST_IDS = {
|
|
|
55
55
|
installBun: "installListItem-bun",
|
|
56
56
|
installNpmrc: "install-npmrc",
|
|
57
57
|
installNpmrcCopy: "installNpmrc",
|
|
58
|
+
provenanceBadge: "provenance-badge",
|
|
59
|
+
provenanceDialog: "registryInfo--dialog",
|
|
58
60
|
readmeTab: "readme-tab",
|
|
59
61
|
keywordList: "keyword-list",
|
|
60
62
|
dependenciesTab: "dependencies-tab",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testIds.cjs","names":[],"sources":["../../src/testIds.ts"],"sourcesContent":["/**\n * Configurable DOM selectors used by the e2e-ui test suites.\n *\n * The Verdaccio UI is a moving target — data-testids can and do change\n * between majors — so every selector referenced by a test lives here\n * and can be overridden by consumers of `@verdaccio/e2e-ui` via\n * `createRegistryConfig({ testIds, selectors })`.\n *\n * The defaults below match Verdaccio 6.x as of the last time we audited\n * the ui-components source. If a selector moves, override just the\n * affected field instead of forking the suite.\n */\n\n/**\n * Map of data-testid values used by the test suites, grouped by UI\n * section. Each field holds the bare testid string (no `data-testid=\"…\"`\n * wrapping) — the test helpers pass it through `cy.getByTestId(...)`.\n */\nexport interface TestIds {\n home: {\n /** Help card shown on the empty-registry landing page. */\n helpCard: string;\n /** 404 \"not found\" container. */\n notFound: string;\n /** Filter / scope / sort bar above the package list (9.x). */\n packageListToolbar: string;\n /** Text filter input inside the toolbar. */\n packageListFilter: string;\n /** Native input of the scope select (only with more than one scope). */\n packageListScope: string;\n /** Message shown when the filter matches no package. */\n packageListNoMatch: string;\n /** Prefix of the welcome card setup tabs: `<prefix><manager>`. */\n helpSetupTabPrefix: string;\n /** Note on the welcome card explaining cached uplink packages. */\n helpUplinksNote: string;\n /** Step list of the publishing guide, in the welcome card and the settings (9.x). */\n helpGuide: string;\n };\n header: {\n /** Outermost `<NavBar>` element. */\n container: string;\n /** Inner wrapper inside the nav bar. */\n innerNavBar: string;\n /** Right-side action cluster wrapper. */\n right: string;\n /** Wrapper around the header search input. */\n searchContainer: string;\n /** Default SVG Verdaccio logo. */\n defaultLogo: string;\n /** Custom (user-provided) logo image. */\n customLogo: string;\n /** \"Login\" button shown when logged out. */\n loginButton: string;\n /** Gear icon that opens the settings dialog. */\n settingsTooltip: string;\n /** \"Publishing\" tab of the settings dialog (9.x). */\n settingsPublishTab: string;\n /** Panel of the \"Publishing\" tab (9.x). */\n settingsPublishPanel: string;\n /** Info icon that opens the registry info dialog. */\n infoTooltip: string;\n /**\n * Theme switch button shown while in LIGHT mode (clicking it\n * flips to dark). The underlying component swaps between this\n * and `themeSwitchDark` based on `isDarkMode`.\n */\n themeSwitchLight: string;\n /** Theme switch button shown while in DARK mode. */\n themeSwitchDark: string;\n /** Menu icon shown after login (opens the logged-in menu). */\n logInDialogIcon: string;\n /** \"Log out\" entry inside the logged-in menu. */\n logOutDialogIcon: string;\n /** \"Hi <username>\" label inside the logged-in menu. */\n greetingsLabel: string;\n };\n footer: {\n /** Outer footer wrapper. */\n container: string;\n /** \"Powered by\" version text on the right side of the footer. */\n version: string;\n };\n login: {\n /** Login dialog container (the MUI Dialog root). */\n dialog: string;\n /** DialogContent wrapper inside the login dialog. */\n dialogContent: string;\n /**\n * Error banner shown inside the login dialog when the server\n * rejects credentials (or any other `errors.root` message the form\n * sets). Renders inside the `LoginDialogFormError` component.\n */\n error: string;\n };\n package: {\n /** Wrapper around the list of packages on the home page. */\n itemList: string;\n /** Package name link in the package list (home + search results). */\n title: string;\n /** Version link of a package list item, to its version page (9.x). */\n versionLink: string;\n /** Readme container on the package detail page. */\n readme: string;\n /** Sidebar container on the package detail page. */\n sidebar: string;\n /** Install commands section list. */\n installList: string;\n /** Individual install line for npm. */\n installNpm: string;\n /** Individual install line for yarn. */\n installYarn: string;\n /** Individual install line for pnpm. */\n installPnpm: string;\n /** Individual install line for bun (9.x). */\n installBun: string;\n /** `.npmrc` registry line below the install commands (9.x). */\n installNpmrc: string;\n /** Copy button of the `.npmrc` registry line. */\n installNpmrcCopy: string;\n /** Tab that shows the readme. */\n readmeTab: string;\n /** Keyword list below the install section. */\n keywordList: string;\n /** Tab that reveals the dependencies view. */\n dependenciesTab: string;\n /** Dependencies list wrapper (one entry per dep). */\n dependencies: string;\n /** Tab that reveals the versions view. */\n versionsTab: string;\n /** \"latest\" tag row inside the versions view. */\n tagLatest: string;\n /** Tab that reveals the uplinks view. */\n uplinksTab: string;\n /** Empty-state message when the package has no uplinks. */\n noUplinks: string;\n /** Action-bar tarball download FAB. */\n downloadTarballBtn: string;\n /** Package list tarball download button. */\n downloadTarball: string;\n /** Action-bar \"view raw manifest\" FAB. */\n rawBtn: string;\n /** Full-screen dialog that opens when `rawBtn` is clicked. */\n rawViewerDialog: string;\n /** Close button inside the raw viewer dialog. */\n closeRawViewer: string;\n };\n search: {\n /** Prefix of the origin group headers: `<prefix>private|cached|remote`. */\n groupPrefix: string;\n /** Prefix of the origin icon on each result: `<prefix>private|...`. */\n originPrefix: string;\n };\n errors: {\n /**\n * Generic error page shown when a data request fails without a\n * specific status (5xx, network failure). Added by\n * verdaccio/verdaccio#6210 — only present on builds with that fix.\n */\n genericError: string;\n };\n}\n\n/**\n * CSS selectors (not data-testids) used by the test suites. These are\n * things like form-field IDs and framework-specific class names that\n * Verdaccio's UI exposes as plain selectors rather than testids.\n */\nexport interface Selectors {\n /** Class applied to the parsed README markdown body. */\n markdownBody: string;\n loginDialog: {\n /** Username text input inside the login dialog. */\n usernameInput: string;\n /** Password text input inside the login dialog. */\n passwordInput: string;\n /** Submit button inside the login dialog. */\n submitButton: string;\n };\n signup: {\n /** Username input on /-/web/add-user (shares ids with the login form). */\n usernameInput: string;\n /** Password input on /-/web/add-user. */\n passwordInput: string;\n /** Email input on /-/web/add-user (only email-typed input on the page). */\n emailInput: string;\n /** Submit button on /-/web/add-user. */\n submitButton: string;\n };\n}\n\n/**\n * Defaults matching Verdaccio 6.x (bundled ui-theme@9.0.0-next-9.x).\n * Overridable via `createRegistryConfig({ testIds: { ... } })`.\n */\nexport const DEFAULT_TEST_IDS: TestIds = {\n home: {\n helpCard: 'help-card',\n notFound: '404',\n packageListToolbar: 'package-list-toolbar',\n packageListFilter: 'package-list-filter',\n packageListScope: 'package-list-scope',\n packageListNoMatch: 'package-list-no-match',\n helpSetupTabPrefix: 'help-setup-',\n helpUplinksNote: 'help-uplinks-note',\n helpGuide: 'help-guide',\n },\n header: {\n container: 'header',\n innerNavBar: 'inner-nav-bar',\n right: 'header-right',\n searchContainer: 'search-container',\n defaultLogo: 'default-logo',\n customLogo: 'custom-logo',\n loginButton: 'header--button-login',\n settingsTooltip: 'header--tooltip-settings',\n settingsPublishTab: 'settings-publish-tab',\n settingsPublishPanel: 'settings-publish',\n infoTooltip: 'header--tooltip-info',\n themeSwitchLight: 'header--button--light',\n themeSwitchDark: 'header--button--dark',\n logInDialogIcon: 'logInDialogIcon',\n logOutDialogIcon: 'logOutDialogIcon',\n greetingsLabel: 'greetings-label',\n },\n footer: {\n container: 'footer',\n version: 'version-footer',\n },\n login: {\n dialog: 'login--dialog',\n dialogContent: 'dialogContentLogin',\n error: 'error',\n },\n package: {\n itemList: 'package-item-list',\n title: 'package-title',\n versionLink: 'package-version-link',\n readme: 'readme',\n sidebar: 'sidebar',\n installList: 'installList',\n installNpm: 'installListItem-npm',\n installYarn: 'installListItem-yarn',\n installPnpm: 'installListItem-pnpm',\n installBun: 'installListItem-bun',\n installNpmrc: 'install-npmrc',\n installNpmrcCopy: 'installNpmrc',\n readmeTab: 'readme-tab',\n keywordList: 'keyword-list',\n dependenciesTab: 'dependencies-tab',\n dependencies: 'dependencies',\n versionsTab: 'versions-tab',\n tagLatest: 'tag-latest',\n uplinksTab: 'uplinks-tab',\n noUplinks: 'no-uplinks',\n downloadTarballBtn: 'download-tarball-btn',\n downloadTarball: 'download-tarball',\n rawBtn: 'raw-btn',\n rawViewerDialog: 'rawViewer--dialog',\n closeRawViewer: 'close-raw-viewer',\n },\n search: {\n groupPrefix: 'search-group-',\n originPrefix: 'search-origin-',\n },\n errors: {\n genericError: 'generic-error',\n },\n};\n\n/**\n * Defaults for non-testid CSS selectors. Overridable via\n * `createRegistryConfig({ selectors: { ... } })`.\n */\nexport const DEFAULT_SELECTORS: Selectors = {\n markdownBody: '.markdown-body',\n loginDialog: {\n usernameInput: '#login--dialog-username',\n passwordInput: '#login--dialog-password',\n submitButton: '#login--dialog-button-submit',\n },\n signup: {\n usernameInput: '#login--dialog-username',\n passwordInput: '#login--dialog-password',\n emailInput: 'input[type=\"email\"]',\n submitButton: 'button[type=\"submit\"]',\n },\n};\n\n/** Deep-partial helper — every field of a nested object becomes optional. */\nexport type DeepPartial<T> = {\n [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];\n};\n\n/**\n * Merge user overrides into the default testIds map. Merging is\n * per-section (one level deep): `overrides.header` replaces individual\n * fields under `defaults.header` without touching `defaults.footer`.\n * The shape is fixed and small, so we enumerate sections by hand\n * rather than relying on a recursive generic merger.\n */\nexport function mergeTestIds(defaults: TestIds, overrides?: DeepPartial<TestIds>): TestIds {\n if (!overrides) return defaults;\n return {\n home: { ...defaults.home, ...overrides.home },\n header: { ...defaults.header, ...overrides.header },\n footer: { ...defaults.footer, ...overrides.footer },\n login: { ...defaults.login, ...overrides.login },\n package: { ...defaults.package, ...overrides.package },\n search: { ...defaults.search, ...overrides.search },\n errors: { ...defaults.errors, ...overrides.errors },\n };\n}\n\n/** Same idea as `mergeTestIds`, for the CSS-selector block. */\nexport function mergeSelectors(defaults: Selectors, overrides?: DeepPartial<Selectors>): Selectors {\n if (!overrides) return defaults;\n return {\n markdownBody: overrides.markdownBody ?? defaults.markdownBody,\n loginDialog: { ...defaults.loginDialog, ...overrides.loginDialog },\n signup: { ...defaults.signup, ...overrides.signup },\n };\n}\n"],"mappings":";;;;;AAmMA,IAAa,mBAA4B;CACvC,MAAM;EACJ,UAAU;EACV,UAAU;EACV,oBAAoB;EACpB,mBAAmB;EACnB,kBAAkB;EAClB,oBAAoB;EACpB,oBAAoB;EACpB,iBAA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AAQ;EACrD,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;EAClD,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;CACpD;AACF;;AAGA,SAAgB,eAAe,UAAqB,WAA+C;CACjG,IAAI,CAAC,WAAW,OAAO;CACvB,OAAO;EACL,cAAc,UAAU,gBAAgB,SAAS;EACjD,aAAa;GAAE,GAAG,SAAS;GAAa,GAAG,UAAU;EAAY;EACjE,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;CACpD;AACF"}
|
|
1
|
+
{"version":3,"file":"testIds.cjs","names":[],"sources":["../../src/testIds.ts"],"sourcesContent":["/**\n * Configurable DOM selectors used by the e2e-ui test suites.\n *\n * The Verdaccio UI is a moving target — data-testids can and do change\n * between majors — so every selector referenced by a test lives here\n * and can be overridden by consumers of `@verdaccio/e2e-ui` via\n * `createRegistryConfig({ testIds, selectors })`.\n *\n * The defaults below match Verdaccio 6.x as of the last time we audited\n * the ui-components source. If a selector moves, override just the\n * affected field instead of forking the suite.\n */\n\n/**\n * Map of data-testid values used by the test suites, grouped by UI\n * section. Each field holds the bare testid string (no `data-testid=\"…\"`\n * wrapping) — the test helpers pass it through `cy.getByTestId(...)`.\n */\nexport interface TestIds {\n home: {\n /** Help card shown on the empty-registry landing page. */\n helpCard: string;\n /** 404 \"not found\" container. */\n notFound: string;\n /** Filter / scope / sort bar above the package list (9.x). */\n packageListToolbar: string;\n /** Text filter input inside the toolbar. */\n packageListFilter: string;\n /** Native input of the scope select (only with more than one scope). */\n packageListScope: string;\n /** Message shown when the filter matches no package. */\n packageListNoMatch: string;\n /** Prefix of the welcome card setup tabs: `<prefix><manager>`. */\n helpSetupTabPrefix: string;\n /** Note on the welcome card explaining cached uplink packages. */\n helpUplinksNote: string;\n /** Step list of the publishing guide, in the welcome card and the settings (9.x). */\n helpGuide: string;\n };\n header: {\n /** Outermost `<NavBar>` element. */\n container: string;\n /** Inner wrapper inside the nav bar. */\n innerNavBar: string;\n /** Right-side action cluster wrapper. */\n right: string;\n /** Wrapper around the header search input. */\n searchContainer: string;\n /** Default SVG Verdaccio logo. */\n defaultLogo: string;\n /** Custom (user-provided) logo image. */\n customLogo: string;\n /** \"Login\" button shown when logged out. */\n loginButton: string;\n /** Gear icon that opens the settings dialog. */\n settingsTooltip: string;\n /** \"Publishing\" tab of the settings dialog (9.x). */\n settingsPublishTab: string;\n /** Panel of the \"Publishing\" tab (9.x). */\n settingsPublishPanel: string;\n /** Info icon that opens the registry info dialog. */\n infoTooltip: string;\n /**\n * Theme switch button shown while in LIGHT mode (clicking it\n * flips to dark). The underlying component swaps between this\n * and `themeSwitchDark` based on `isDarkMode`.\n */\n themeSwitchLight: string;\n /** Theme switch button shown while in DARK mode. */\n themeSwitchDark: string;\n /** Menu icon shown after login (opens the logged-in menu). */\n logInDialogIcon: string;\n /** \"Log out\" entry inside the logged-in menu. */\n logOutDialogIcon: string;\n /** \"Hi <username>\" label inside the logged-in menu. */\n greetingsLabel: string;\n };\n footer: {\n /** Outer footer wrapper. */\n container: string;\n /** \"Powered by\" version text on the right side of the footer. */\n version: string;\n };\n login: {\n /** Login dialog container (the MUI Dialog root). */\n dialog: string;\n /** DialogContent wrapper inside the login dialog. */\n dialogContent: string;\n /**\n * Error banner shown inside the login dialog when the server\n * rejects credentials (or any other `errors.root` message the form\n * sets). Renders inside the `LoginDialogFormError` component.\n */\n error: string;\n };\n package: {\n /** Wrapper around the list of packages on the home page. */\n itemList: string;\n /** Package name link in the package list (home + search results). */\n title: string;\n /** Version link of a package list item, to its version page (9.x). */\n versionLink: string;\n /** Readme container on the package detail page. */\n readme: string;\n /** Sidebar container on the package detail page. */\n sidebar: string;\n /** Install commands section list. */\n installList: string;\n /** Individual install line for npm. */\n installNpm: string;\n /** Individual install line for yarn. */\n installYarn: string;\n /** Individual install line for pnpm. */\n installPnpm: string;\n /** Individual install line for bun (9.x). */\n installBun: string;\n /** `.npmrc` registry line below the install commands (9.x). */\n installNpmrc: string;\n /** Copy button of the `.npmrc` registry line. */\n installNpmrcCopy: string;\n /** Chip of the \"Provenance\" sidebar section that opens the provenance dialog (9.x). */\n provenanceBadge: string;\n /** Root of the provenance dialog (shares the registry info dialog container). */\n provenanceDialog: string;\n /** Tab that shows the readme. */\n readmeTab: string;\n /** Keyword list below the install section. */\n keywordList: string;\n /** Tab that reveals the dependencies view. */\n dependenciesTab: string;\n /** Dependencies list wrapper (one entry per dep). */\n dependencies: string;\n /** Tab that reveals the versions view. */\n versionsTab: string;\n /** \"latest\" tag row inside the versions view. */\n tagLatest: string;\n /** Tab that reveals the uplinks view. */\n uplinksTab: string;\n /** Empty-state message when the package has no uplinks. */\n noUplinks: string;\n /** Action-bar tarball download FAB. */\n downloadTarballBtn: string;\n /** Package list tarball download button. */\n downloadTarball: string;\n /** Action-bar \"view raw manifest\" FAB. */\n rawBtn: string;\n /** Full-screen dialog that opens when `rawBtn` is clicked. */\n rawViewerDialog: string;\n /** Close button inside the raw viewer dialog. */\n closeRawViewer: string;\n };\n search: {\n /** Prefix of the origin group headers: `<prefix>private|cached|remote`. */\n groupPrefix: string;\n /** Prefix of the origin icon on each result: `<prefix>private|...`. */\n originPrefix: string;\n };\n errors: {\n /**\n * Generic error page shown when a data request fails without a\n * specific status (5xx, network failure). Added by\n * verdaccio/verdaccio#6210 — only present on builds with that fix.\n */\n genericError: string;\n };\n}\n\n/**\n * CSS selectors (not data-testids) used by the test suites. These are\n * things like form-field IDs and framework-specific class names that\n * Verdaccio's UI exposes as plain selectors rather than testids.\n */\nexport interface Selectors {\n /** Class applied to the parsed README markdown body. */\n markdownBody: string;\n loginDialog: {\n /** Username text input inside the login dialog. */\n usernameInput: string;\n /** Password text input inside the login dialog. */\n passwordInput: string;\n /** Submit button inside the login dialog. */\n submitButton: string;\n };\n signup: {\n /** Username input on /-/web/add-user (shares ids with the login form). */\n usernameInput: string;\n /** Password input on /-/web/add-user. */\n passwordInput: string;\n /** Email input on /-/web/add-user (only email-typed input on the page). */\n emailInput: string;\n /** Submit button on /-/web/add-user. */\n submitButton: string;\n };\n}\n\n/**\n * Defaults matching Verdaccio 6.x (bundled ui-theme@9.0.0-next-9.x).\n * Overridable via `createRegistryConfig({ testIds: { ... } })`.\n */\nexport const DEFAULT_TEST_IDS: TestIds = {\n home: {\n helpCard: 'help-card',\n notFound: '404',\n packageListToolbar: 'package-list-toolbar',\n packageListFilter: 'package-list-filter',\n packageListScope: 'package-list-scope',\n packageListNoMatch: 'package-list-no-match',\n helpSetupTabPrefix: 'help-setup-',\n helpUplinksNote: 'help-uplinks-note',\n helpGuide: 'help-guide',\n },\n header: {\n container: 'header',\n innerNavBar: 'inner-nav-bar',\n right: 'header-right',\n searchContainer: 'search-container',\n defaultLogo: 'default-logo',\n customLogo: 'custom-logo',\n loginButton: 'header--button-login',\n settingsTooltip: 'header--tooltip-settings',\n settingsPublishTab: 'settings-publish-tab',\n settingsPublishPanel: 'settings-publish',\n infoTooltip: 'header--tooltip-info',\n themeSwitchLight: 'header--button--light',\n themeSwitchDark: 'header--button--dark',\n logInDialogIcon: 'logInDialogIcon',\n logOutDialogIcon: 'logOutDialogIcon',\n greetingsLabel: 'greetings-label',\n },\n footer: {\n container: 'footer',\n version: 'version-footer',\n },\n login: {\n dialog: 'login--dialog',\n dialogContent: 'dialogContentLogin',\n error: 'error',\n },\n package: {\n itemList: 'package-item-list',\n title: 'package-title',\n versionLink: 'package-version-link',\n readme: 'readme',\n sidebar: 'sidebar',\n installList: 'installList',\n installNpm: 'installListItem-npm',\n installYarn: 'installListItem-yarn',\n installPnpm: 'installListItem-pnpm',\n installBun: 'installListItem-bun',\n installNpmrc: 'install-npmrc',\n installNpmrcCopy: 'installNpmrc',\n provenanceBadge: 'provenance-badge',\n provenanceDialog: 'registryInfo--dialog',\n readmeTab: 'readme-tab',\n keywordList: 'keyword-list',\n dependenciesTab: 'dependencies-tab',\n dependencies: 'dependencies',\n versionsTab: 'versions-tab',\n tagLatest: 'tag-latest',\n uplinksTab: 'uplinks-tab',\n noUplinks: 'no-uplinks',\n downloadTarballBtn: 'download-tarball-btn',\n downloadTarball: 'download-tarball',\n rawBtn: 'raw-btn',\n rawViewerDialog: 'rawViewer--dialog',\n closeRawViewer: 'close-raw-viewer',\n },\n search: {\n groupPrefix: 'search-group-',\n originPrefix: 'search-origin-',\n },\n errors: {\n genericError: 'generic-error',\n },\n};\n\n/**\n * Defaults for non-testid CSS selectors. Overridable via\n * `createRegistryConfig({ selectors: { ... } })`.\n */\nexport const DEFAULT_SELECTORS: Selectors = {\n markdownBody: '.markdown-body',\n loginDialog: {\n usernameInput: '#login--dialog-username',\n passwordInput: '#login--dialog-password',\n submitButton: '#login--dialog-button-submit',\n },\n signup: {\n usernameInput: '#login--dialog-username',\n passwordInput: '#login--dialog-password',\n emailInput: 'input[type=\"email\"]',\n submitButton: 'button[type=\"submit\"]',\n },\n};\n\n/** Deep-partial helper — every field of a nested object becomes optional. */\nexport type DeepPartial<T> = {\n [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];\n};\n\n/**\n * Merge user overrides into the default testIds map. Merging is\n * per-section (one level deep): `overrides.header` replaces individual\n * fields under `defaults.header` without touching `defaults.footer`.\n * The shape is fixed and small, so we enumerate sections by hand\n * rather than relying on a recursive generic merger.\n */\nexport function mergeTestIds(defaults: TestIds, overrides?: DeepPartial<TestIds>): TestIds {\n if (!overrides) return defaults;\n return {\n home: { ...defaults.home, ...overrides.home },\n header: { ...defaults.header, ...overrides.header },\n footer: { ...defaults.footer, ...overrides.footer },\n login: { ...defaults.login, ...overrides.login },\n package: { ...defaults.package, ...overrides.package },\n search: { ...defaults.search, ...overrides.search },\n errors: { ...defaults.errors, ...overrides.errors },\n };\n}\n\n/** Same idea as `mergeTestIds`, for the CSS-selector block. */\nexport function mergeSelectors(defaults: Selectors, overrides?: DeepPartial<Selectors>): Selectors {\n if (!overrides) return defaults;\n return {\n markdownBody: overrides.markdownBody ?? defaults.markdownBody,\n loginDialog: { ...defaults.loginDialog, ...overrides.loginDialog },\n signup: { ...defaults.signup, ...overrides.signup },\n };\n}\n"],"mappings":";;;;;AAuMA,IAAa,mBAA4B;CACvC,MAAM;EACJ,UAAU;EACV,UAAU;EACV,oBAAoB;EACpB,mBAAmB;EACnB,kBAAkB;EAClB,oBAAoB;EACpB,oBAAoB;EACpB,iBAAiB;EACjB,WAAW;CACb;CACA,QAAQ;EACN,WAAW;EACX,aAAa;EACb,OAAO;EACP,iBAAiB;EACjB,aAAa;EACb,YAAY;EACZ,aAAa;EACb,iBAAiB;EACjB,oBAAoB;EACpB,sBAAsB;EACtB,aAAa;EACb,kBAAkB;EAClB,iBAAiB;EACjB,iBAAiB;EACjB,kBAAkB;EAClB,gBAAgB;CAClB;CACA,QAAQ;EACN,WAAW;EACX,SAAS;CACX;CACA,OAAO;EACL,QAAQ;EACR,eAAe;EACf,OAAO;CACT;CACA,SAAS;EACP,UAAU;EACV,OAAO;EACP,aAAa;EACb,QAAQ;EACR,SAAS;EACT,aAAa;EACb,YAAY;EACZ,aAAa;EACb,aAAa;EACb,YAAY;EACZ,cAAc;EACd,kBAAkB;EAClB,iBAAiB;EACjB,kBAAkB;EAClB,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,cAAc;EACd,aAAa;EACb,WAAW;EACX,YAAY;EACZ,WAAW;EACX,oBAAoB;EACpB,iBAAiB;EACjB,QAAQ;EACR,iBAAiB;EACjB,gBAAgB;CAClB;CACA,QAAQ;EACN,aAAa;EACb,cAAc;CAChB;CACA,QAAQ,EACN,cAAc,gBAChB;AACF;;;;;AAMA,IAAa,oBAA+B;CAC1C,cAAc;CACd,aAAa;EACX,eAAe;EACf,eAAe;EACf,cAAc;CAChB;CACA,QAAQ;EACN,eAAe;EACf,eAAe;EACf,YAAY;EACZ,cAAc;CAChB;AACF;;;;;;;;AAcA,SAAgB,aAAa,UAAmB,WAA2C;CACzF,IAAI,CAAC,WAAW,OAAO;CACvB,OAAO;EACL,MAAM;GAAE,GAAG,SAAS;GAAM,GAAG,UAAU;EAAK;EAC5C,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;EAClD,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;EAClD,OAAO;GAAE,GAAG,SAAS;GAAO,GAAG,UAAU;EAAM;EAC/C,SAAS;GAAE,GAAG,SAAS;GAAS,GAAG,UAAU;EAAQ;EACrD,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;EAClD,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;CACpD;AACF;;AAGA,SAAgB,eAAe,UAAqB,WAA+C;CACjG,IAAI,CAAC,WAAW,OAAO;CACvB,OAAO;EACL,cAAc,UAAU,gBAAgB,SAAS;EACjD,aAAa;GAAE,GAAG,SAAS;GAAa,GAAG,UAAU;EAAY;EACjE,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;CACpD;AACF"}
|
|
@@ -12,6 +12,7 @@ const require_signup = require("./signup.cjs");
|
|
|
12
12
|
const require_manifest_rendering = require("./manifest-rendering.cjs");
|
|
13
13
|
const require_session = require("./session.cjs");
|
|
14
14
|
const require_home_detail_ux = require("./home-detail-ux.cjs");
|
|
15
|
+
const require_provenance = require("./provenance.cjs");
|
|
15
16
|
exports.changePasswordTests = require_change_password.changePasswordTests;
|
|
16
17
|
exports.detailTests = require_detail.detailTests;
|
|
17
18
|
exports.failureModeTests = require_failure_modes.failureModeTests;
|
|
@@ -20,6 +21,7 @@ exports.homeTests = require_home.homeTests;
|
|
|
20
21
|
exports.i18nKeyTests = require_i18n_keys.i18nKeyTests;
|
|
21
22
|
exports.layoutTests = require_layout.layoutTests;
|
|
22
23
|
exports.manifestRenderingTests = require_manifest_rendering.manifestRenderingTests;
|
|
24
|
+
exports.provenanceTests = require_provenance.provenanceTests;
|
|
23
25
|
exports.publishTests = require_publish.publishTests;
|
|
24
26
|
exports.searchTests = require_search.searchTests;
|
|
25
27
|
exports.sessionTests = require_session.sessionTests;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
const require_features = require("../features.cjs");
|
|
2
|
+
//#region src/tests/provenance.ts
|
|
3
|
+
/**
|
|
4
|
+
* "Provenance" sidebar section (9.x, verdaccio/verdaccio#6447).
|
|
5
|
+
*
|
|
6
|
+
* registry.npmjs.org attaches `dist.signatures` and `dist.attestations` to
|
|
7
|
+
* every version it signs; the UI shows them without verifying anything in
|
|
8
|
+
* the browser. The fixtures below publish those fields themselves (npm keeps
|
|
9
|
+
* extra `dist` fields on publish), so the suite runs offline and does not
|
|
10
|
+
* need an uplink. The build details come from the registry only when it
|
|
11
|
+
* announces the endpoint, so against this fixture the dialog ends at the
|
|
12
|
+
* summary.
|
|
13
|
+
*/
|
|
14
|
+
function provenanceTests(config) {
|
|
15
|
+
const { features } = config;
|
|
16
|
+
const { package: pkg } = config.testIds;
|
|
17
|
+
const attestations = {
|
|
18
|
+
url: "https://registry.npmjs.org/-/npm/v1/attestations/e2e-provenance@1.0.0",
|
|
19
|
+
provenance: { predicateType: "https://slsa.dev/provenance/v1" }
|
|
20
|
+
};
|
|
21
|
+
const signatures = [{
|
|
22
|
+
keyid: "SHA256:e2e-fixture-key",
|
|
23
|
+
sig: "MEUCIQDe2e"
|
|
24
|
+
}];
|
|
25
|
+
describe("provenance", () => {
|
|
26
|
+
describe("with provenance metadata", () => {
|
|
27
|
+
const pkgName = "@verdaccio/provenance-fixture";
|
|
28
|
+
let tempFolder = null;
|
|
29
|
+
beforeEach(() => {
|
|
30
|
+
cy.task("publishPackage", {
|
|
31
|
+
pkgName,
|
|
32
|
+
version: "1.0.0",
|
|
33
|
+
unique: true,
|
|
34
|
+
manifest: { dist: {
|
|
35
|
+
signatures,
|
|
36
|
+
attestations
|
|
37
|
+
} }
|
|
38
|
+
}).then((result) => {
|
|
39
|
+
tempFolder = result?.tempFolder ?? null;
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
afterEach(() => {
|
|
43
|
+
cy.task("unpublishPackage", {
|
|
44
|
+
pkgName,
|
|
45
|
+
tempFolder: tempFolder ?? void 0
|
|
46
|
+
});
|
|
47
|
+
if (tempFolder) cy.task("cleanupPublished", tempFolder);
|
|
48
|
+
tempFolder = null;
|
|
49
|
+
});
|
|
50
|
+
require_features.maybeIt(features.provenance.sidebarSection)("should show the provenance chip and open the dialog with the summary", () => {
|
|
51
|
+
cy.intercept("GET", `/-/verdaccio/data/sidebar/${pkgName}*`).as("sidebar");
|
|
52
|
+
cy.intercept("GET", `/-/verdaccio/data/package/provenance/${pkgName}*`).as("details");
|
|
53
|
+
cy.visit(`${config.registryUrl}/-/web/detail/${pkgName}`);
|
|
54
|
+
cy.wait("@sidebar", { timeout: 1e4 });
|
|
55
|
+
cy.getByTestId(pkg.provenanceBadge).scrollIntoView().should("be.visible").and("contain.text", "Provenance").and("contain.text", "SLSA v1");
|
|
56
|
+
cy.getByTestId(pkg.provenanceBadge).click();
|
|
57
|
+
cy.getByTestId(pkg.provenanceDialog).should("be.visible");
|
|
58
|
+
cy.getByTestId(pkg.provenanceDialog).within(() => {
|
|
59
|
+
cy.contains(`${pkgName}@`);
|
|
60
|
+
cy.contains("SLSA v1");
|
|
61
|
+
cy.contains(signatures[0].keyid);
|
|
62
|
+
cy.contains("registry.npmjs.org/-/npm/v1/attestations/e2e-provenance@1.0.0").should("have.attr", "href", attestations.url);
|
|
63
|
+
cy.contains("cryptographic verification has not been performed");
|
|
64
|
+
});
|
|
65
|
+
cy.wait("@details", { timeout: 1e4 }).then((interception) => {
|
|
66
|
+
expect(interception.response?.statusCode).to.equal(404);
|
|
67
|
+
});
|
|
68
|
+
cy.getByTestId(pkg.provenanceDialog).should("not.contain.text", "Built on");
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
describe("with a registry signature only", () => {
|
|
72
|
+
const pkgName = "@verdaccio/signature-fixture";
|
|
73
|
+
let tempFolder = null;
|
|
74
|
+
beforeEach(() => {
|
|
75
|
+
cy.task("publishPackage", {
|
|
76
|
+
pkgName,
|
|
77
|
+
version: "1.0.0",
|
|
78
|
+
unique: true,
|
|
79
|
+
manifest: { dist: { signatures } }
|
|
80
|
+
}).then((result) => {
|
|
81
|
+
tempFolder = result?.tempFolder ?? null;
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
afterEach(() => {
|
|
85
|
+
cy.task("unpublishPackage", {
|
|
86
|
+
pkgName,
|
|
87
|
+
tempFolder: tempFolder ?? void 0
|
|
88
|
+
});
|
|
89
|
+
if (tempFolder) cy.task("cleanupPublished", tempFolder);
|
|
90
|
+
tempFolder = null;
|
|
91
|
+
});
|
|
92
|
+
require_features.maybeIt(features.provenance.sidebarSection)("should show the registry signature chip without requesting build details", () => {
|
|
93
|
+
cy.intercept("GET", `/-/verdaccio/data/package/provenance/${pkgName}*`).as("details");
|
|
94
|
+
cy.visit(`${config.registryUrl}/-/web/detail/${pkgName}`);
|
|
95
|
+
cy.getByTestId(pkg.provenanceBadge).scrollIntoView().should("be.visible").and("contain.text", "Registry signature");
|
|
96
|
+
cy.getByTestId(pkg.provenanceBadge).click();
|
|
97
|
+
cy.getByTestId(pkg.provenanceDialog).within(() => {
|
|
98
|
+
cy.contains(signatures[0].keyid);
|
|
99
|
+
});
|
|
100
|
+
cy.get("@details.all").should("have.length", 0);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
describe("without provenance metadata", () => {
|
|
104
|
+
const pkgName = "@verdaccio/plain-fixture";
|
|
105
|
+
let tempFolder = null;
|
|
106
|
+
beforeEach(() => {
|
|
107
|
+
cy.task("publishPackage", {
|
|
108
|
+
pkgName,
|
|
109
|
+
version: "1.0.0",
|
|
110
|
+
unique: true
|
|
111
|
+
}).then((result) => {
|
|
112
|
+
tempFolder = result?.tempFolder ?? null;
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
afterEach(() => {
|
|
116
|
+
cy.task("unpublishPackage", {
|
|
117
|
+
pkgName,
|
|
118
|
+
tempFolder: tempFolder ?? void 0
|
|
119
|
+
});
|
|
120
|
+
if (tempFolder) cy.task("cleanupPublished", tempFolder);
|
|
121
|
+
tempFolder = null;
|
|
122
|
+
});
|
|
123
|
+
require_features.maybeIt(features.provenance.sidebarSection)("should not render the section", () => {
|
|
124
|
+
cy.visit(`${config.registryUrl}/-/web/detail/${pkgName}`);
|
|
125
|
+
cy.getByTestId(pkg.sidebar).should("be.visible");
|
|
126
|
+
cy.getByTestId(pkg.provenanceBadge).should("not.exist");
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
exports.provenanceTests = provenanceTests;
|
|
133
|
+
|
|
134
|
+
//# sourceMappingURL=provenance.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provenance.cjs","names":[],"sources":["../../../src/tests/provenance.ts"],"sourcesContent":["/// <reference types=\"cypress\" />\nimport { maybeIt } from '../features';\nimport { RegistryConfig } from '../types';\n\n/**\n * \"Provenance\" sidebar section (9.x, verdaccio/verdaccio#6447).\n *\n * registry.npmjs.org attaches `dist.signatures` and `dist.attestations` to\n * every version it signs; the UI shows them without verifying anything in\n * the browser. The fixtures below publish those fields themselves (npm keeps\n * extra `dist` fields on publish), so the suite runs offline and does not\n * need an uplink. The build details come from the registry only when it\n * announces the endpoint, so against this fixture the dialog ends at the\n * summary.\n */\nexport function provenanceTests(config: RegistryConfig) {\n const { features } = config;\n const { package: pkg } = config.testIds;\n\n const attestations = {\n url: 'https://registry.npmjs.org/-/npm/v1/attestations/e2e-provenance@1.0.0',\n provenance: { predicateType: 'https://slsa.dev/provenance/v1' },\n };\n const signatures = [{ keyid: 'SHA256:e2e-fixture-key', sig: 'MEUCIQDe2e' }];\n\n describe('provenance', () => {\n describe('with provenance metadata', () => {\n const pkgName = '@verdaccio/provenance-fixture';\n let tempFolder: string | null = null;\n\n beforeEach(() => {\n cy.task('publishPackage', {\n pkgName,\n version: '1.0.0',\n unique: true,\n manifest: { dist: { signatures, attestations } },\n }).then((result) => {\n tempFolder = result?.tempFolder ?? null;\n });\n });\n\n afterEach(() => {\n cy.task('unpublishPackage', { pkgName, tempFolder: tempFolder ?? undefined });\n if (tempFolder) {\n cy.task('cleanupPublished', tempFolder);\n }\n tempFolder = null;\n });\n\n maybeIt(features.provenance.sidebarSection)(\n 'should show the provenance chip and open the dialog with the summary',\n () => {\n cy.intercept('GET', `/-/verdaccio/data/sidebar/${pkgName}*`).as('sidebar');\n cy.intercept('GET', `/-/verdaccio/data/package/provenance/${pkgName}*`).as('details');\n\n cy.visit(`${config.registryUrl}/-/web/detail/${pkgName}`);\n cy.wait('@sidebar', { timeout: 10000 });\n\n // the sidebar scrolls on its own; bring the chip into its viewport first\n cy.getByTestId(pkg.provenanceBadge)\n .scrollIntoView()\n .should('be.visible')\n .and('contain.text', 'Provenance')\n .and('contain.text', 'SLSA v1');\n\n cy.getByTestId(pkg.provenanceBadge).click();\n cy.getByTestId(pkg.provenanceDialog).should('be.visible');\n cy.getByTestId(pkg.provenanceDialog).within(() => {\n cy.contains(`${pkgName}@`);\n cy.contains('SLSA v1');\n cy.contains(signatures[0].keyid);\n cy.contains('registry.npmjs.org/-/npm/v1/attestations/e2e-provenance@1.0.0').should(\n 'have.attr',\n 'href',\n attestations.url\n );\n cy.contains('cryptographic verification has not been performed');\n });\n\n // the build details are asked for only once the dialog is open; this\n // fixture has no uplink holding the bundle, so the registry answers 404\n // and the dialog keeps the summary\n cy.wait('@details', { timeout: 10000 }).then((interception: any) => {\n expect(interception.response?.statusCode).to.equal(404);\n });\n cy.getByTestId(pkg.provenanceDialog).should('not.contain.text', 'Built on');\n }\n );\n });\n\n describe('with a registry signature only', () => {\n const pkgName = '@verdaccio/signature-fixture';\n let tempFolder: string | null = null;\n\n beforeEach(() => {\n cy.task('publishPackage', {\n pkgName,\n version: '1.0.0',\n unique: true,\n manifest: { dist: { signatures } },\n }).then((result) => {\n tempFolder = result?.tempFolder ?? null;\n });\n });\n\n afterEach(() => {\n cy.task('unpublishPackage', { pkgName, tempFolder: tempFolder ?? undefined });\n if (tempFolder) {\n cy.task('cleanupPublished', tempFolder);\n }\n tempFolder = null;\n });\n\n maybeIt(features.provenance.sidebarSection)(\n 'should show the registry signature chip without requesting build details',\n () => {\n cy.intercept('GET', `/-/verdaccio/data/package/provenance/${pkgName}*`).as('details');\n\n cy.visit(`${config.registryUrl}/-/web/detail/${pkgName}`);\n\n cy.getByTestId(pkg.provenanceBadge)\n .scrollIntoView()\n .should('be.visible')\n .and('contain.text', 'Registry signature');\n cy.getByTestId(pkg.provenanceBadge).click();\n cy.getByTestId(pkg.provenanceDialog).within(() => {\n cy.contains(signatures[0].keyid);\n });\n // no attestation, so the dialog never asks the registry for build details\n cy.get('@details.all').should('have.length', 0);\n }\n );\n });\n\n describe('without provenance metadata', () => {\n const pkgName = '@verdaccio/plain-fixture';\n let tempFolder: string | null = null;\n\n beforeEach(() => {\n cy.task('publishPackage', { pkgName, version: '1.0.0', unique: true }).then((result) => {\n tempFolder = result?.tempFolder ?? null;\n });\n });\n\n afterEach(() => {\n cy.task('unpublishPackage', { pkgName, tempFolder: tempFolder ?? undefined });\n if (tempFolder) {\n cy.task('cleanupPublished', tempFolder);\n }\n tempFolder = null;\n });\n\n maybeIt(features.provenance.sidebarSection)('should not render the section', () => {\n cy.visit(`${config.registryUrl}/-/web/detail/${pkgName}`);\n cy.getByTestId(pkg.sidebar).should('be.visible');\n cy.getByTestId(pkg.provenanceBadge).should('not.exist');\n });\n });\n });\n}\n"],"mappings":";;;;;;;;;;;;;AAeA,SAAgB,gBAAgB,QAAwB;CACtD,MAAM,EAAE,aAAa;CACrB,MAAM,EAAE,SAAS,QAAQ,OAAO;CAEhC,MAAM,eAAe;EACnB,KAAK;EACL,YAAY,EAAE,eAAe,iCAAiC;CAChE;CACA,MAAM,aAAa,CAAC;EAAE,OAAO;EAA0B,KAAK;CAAa,CAAC;CAE1E,SAAS,oBAAoB;EAC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AS;KAAS,QAAQ;IAAK,CAAC,CAAC,CAAC,MAAM,WAAW;KACtF,aAAa,QAAQ,cAAc;IACrC,CAAC;GACH,CAAC;GAED,gBAAgB;IACd,GAAG,KAAK,oBAAoB;KAAE;KAAS,YAAY,cAAc,KAAA;IAAU,CAAC;IAC5E,IAAI,YACF,GAAG,KAAK,oBAAoB,UAAU;IAExC,aAAa;GACf,CAAC;GAED,iBAAA,QAAQ,SAAS,WAAW,cAAc,CAAC,CAAC,uCAAuC;IACjF,GAAG,MAAM,GAAG,OAAO,YAAY,gBAAgB,SAAS;IACxD,GAAG,YAAY,IAAI,OAAO,CAAC,CAAC,OAAO,YAAY;IAC/C,GAAG,YAAY,IAAI,eAAe,CAAC,CAAC,OAAO,WAAW;GACxD,CAAC;EACH,CAAC;CACH,CAAC;AACH"}
|
package/build/esm/features.js
CHANGED
|
@@ -57,6 +57,7 @@ var DEFAULT_FEATURES = {
|
|
|
57
57
|
versionLink: false,
|
|
58
58
|
settingsPublishTab: false
|
|
59
59
|
},
|
|
60
|
+
provenance: { sidebarSection: false },
|
|
60
61
|
changePassword: {
|
|
61
62
|
happyPath: true,
|
|
62
63
|
validation: true,
|
|
@@ -122,6 +123,10 @@ function mergeFeatures(defaults, overrides) {
|
|
|
122
123
|
...defaults.homeDetailUx,
|
|
123
124
|
...overrides.homeDetailUx
|
|
124
125
|
},
|
|
126
|
+
provenance: {
|
|
127
|
+
...defaults.provenance,
|
|
128
|
+
...overrides.provenance
|
|
129
|
+
},
|
|
125
130
|
changePassword: {
|
|
126
131
|
...defaults.changePassword,
|
|
127
132
|
...overrides.changePassword
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features.js","names":[],"sources":["../../src/features.ts"],"sourcesContent":["import type { DeepPartial } from './testIds';\n\n/**\n * Per-test feature flags for enabling/disabling individual test cases\n * in the e2e-ui suites.\n *\n * The Verdaccio UI behaves differently across branches — search result\n * payload shape differs between the `/-/v1/search` and\n * `/-/verdaccio/data/search/*` endpoints, the language picker was\n * added in a specific minor, etc. Rather than forking the suite per\n * branch, consumers can disable individual tests via\n * `createRegistryConfig({ features: { … } })`.\n *\n * Most flags default to `true` (test runs). Compatibility probes for\n * unreleased server behavior may default to `false`; enable them in\n * consumers that run against a Verdaccio build with the feature.\n * A disabled flag converts the test into a Mocha `it.skip` call — the\n * suite still reports the test but marks it as pending.\n */\nexport interface Features {\n search: {\n /**\n * Whether to run the \"results dropdown renders a matching\n * package\" test. Disable on builds where the search result shape\n * or the Autocomplete rendering differs from the default assumption.\n */\n resultsDropdown: boolean;\n /**\n * Whether to run the \"clicking a result navigates to detail\" test.\n * Depends on the Autocomplete `onSelectItem` → router wiring.\n */\n resultClickNavigation: boolean;\n };\n home: {\n /**\n * Whether to run the `with a published package` sub-block inside\n * `homeTests` (publishes a throwaway package and asserts it\n * renders in the package list).\n */\n publishedPackageRendering: boolean;\n };\n settings: {\n /**\n * Whether to run the \"change language via card click\" test.\n * Depends on the `LanguageSwitch` component layout and its\n * translation sentinels (\"Translations\", \"German\"). Skip on\n * builds that lag behind the upstream translation file.\n */\n languageSwitcher: boolean;\n /**\n * Whether to assert that dates follow the selected language\n * (dayjs locale). Released UIs never load the dayjs locale, so\n * relative dates stay English in every language (fixed in\n * verdaccio/verdaccio#6210) — probe.\n */\n localizedDates: boolean;\n };\n signin: {\n /**\n * Whether to run the three validation tests (disabled submit\n * button, invalid credentials error banner). Depends on the\n * current yup schema and the hard-coded \"Invalid username or\n * password\" error string.\n */\n validationTests: boolean;\n };\n layout: {\n /**\n * Whether to run the dark/light theme switch test. Depends on\n * `web.showThemeSwitch` (defaults to true in ui-theme) and the\n * `header--button--light` / `header--button--dark` testids.\n */\n themeSwitch: boolean;\n };\n publish: {\n /**\n * Whether to run the \"tarball download button fires a GET\" test.\n * Depends on `web.showDownloadTarball` (defaults to true) and\n * the published package manifest having a valid `dist.tarball`.\n */\n downloadTarball: boolean;\n /**\n * Whether to run the private package tarball download tests from\n * the Web UI package list and sidebar.\n *\n * Enable only on Verdaccio builds that accept Web UI bearer tokens\n * on protected npm package/tarball routes. Verdaccio 6.x currently\n * returns HTTP 401 for this flow; the regression is tracked in\n * verdaccio/verdaccio#5765.\n */\n privateDownloadTarball: boolean;\n /**\n * Whether to run the \"raw viewer dialog opens + closes\" test.\n * Depends on `web.showRaw` (defaults to true).\n */\n rawViewer: boolean;\n };\n detail: {\n /**\n * Whether to run the \"visiting /v/<version> pins that version\" test\n * (asserts the sidebar request carries `?v=<version>`).\n */\n versionPinned: boolean;\n /**\n * Whether to run the wire-format test for scoped packages: the UI\n * must request `/-/verdaccio/data/sidebar/@scope/name` with the `@`\n * and `/` literal (npm registry convention), never `%40`-encoded.\n * Pins the regression caught by these suites in\n * verdaccio/verdaccio#6210.\n */\n scopedWireFormat: boolean;\n /**\n * Whether to run the \"nonexistent version renders Not Found\" test.\n * Requires the server to answer 404 for unknown `?v=` values\n * (verdaccio/verdaccio#6210); released lines silently fall back to\n * `latest`, so this defaults to `false` as a probe.\n */\n versionNotFound: boolean;\n /**\n * Whether to run the \"versions tab shows the CURRENT package after\n * SPA navigation\" test. The detail routes reuse one mounted\n * component, and released UIs cache the previous package's versions\n * in local state (fixed in verdaccio/verdaccio#6210) — defaults to\n * `false` as a probe.\n */\n staleVersionsNavigation: boolean;\n };\n manifestRendering: {\n /**\n * Whether to run the string-form manifest tests: `repository`,\n * `funding` and `bugs` in their string/array forms are valid npm\n * and must render (fixed in verdaccio/verdaccio#6210) — probe.\n */\n stringForms: boolean;\n /**\n * Whether to assert gravatar avatars render on the detail sidebar.\n * Released UIs read `avatar` while the sidebar endpoint sends\n * `_avatar` (fixed in verdaccio/verdaccio#6210) — probe.\n */\n gravatarAvatars: boolean;\n /**\n * Whether to assert contributors without email don't collapse into\n * one (fixed in verdaccio/verdaccio#6210) — probe.\n */\n developersWithoutEmail: boolean;\n };\n session: {\n /**\n * Whether to assert that an expired token in localStorage boots the\n * UI logged out (header shows the login button). Holds on every\n * released line.\n */\n expiredTokenLoggedOut: boolean;\n /**\n * Whether to assert the expired token is also PURGED from\n * localStorage on boot — otherwise the api client keeps attaching\n * it (fixed in verdaccio/verdaccio#6210) — probe.\n */\n expiredTokenPurged: boolean;\n };\n failureModes: {\n /**\n * Whether to run the \"backend 5xx on the package list must not\n * render the empty-registry onboarding\" test. Holds on every line\n * (a 5xx carries an HTTP code the UI always treated as an error).\n */\n homeServerError: boolean;\n /**\n * Whether to run the network-failure variant (request never\n * reaches the server). Released UIs treat a network failure as an\n * empty registry and show the onboarding card\n * (verdaccio/verdaccio#6210 fixes it), so this defaults to `false`\n * as a probe.\n */\n homeNetworkError: boolean;\n /**\n * Whether to run the \"5xx on the detail page renders an error\n * state instead of a blank page\" test. Requires the generic error\n * page from verdaccio/verdaccio#6210; released UIs render blank,\n * so this defaults to `false` as a probe.\n */\n detailErrorState: boolean;\n /**\n * Whether to run the \"search 5xx shows an error, not 'no results\n * found'\" test. The error state ships with verdaccio/verdaccio#6210\n * — probe.\n */\n searchError: boolean;\n /**\n * Whether to run the \"failed tarball download shows an error\n * snackbar\" test — clicking download and having nothing happen sent\n * users retrying blindly (fixed in verdaccio/verdaccio#6210) — probe.\n */\n downloadError: boolean;\n };\n i18n: {\n /**\n * Whether to scan the home and detail pages for raw i18n keys\n * (visible text like `sidebar.detail.version`). Holds on every\n * released line — these pages ship fully translated.\n */\n noRawKeysCorePages: boolean;\n /**\n * Whether to scan the security pages (login dialog, /-/web/login,\n * add-user, change-password) for raw i18n keys. The whole\n * `security.*` namespace is missing from every published ui-theme\n * bundle (fixed in verdaccio/verdaccio#6210), so this defaults to\n * `false` as a probe.\n */\n noRawKeysSecurityPages: boolean;\n };\n signup: {\n /**\n * Whether to run the create-user happy path (fill the form on\n * /-/web/add-user, submit, land on the success page) and assert\n * the wire contract: `PUT /-/verdaccio/sec/signup` with a 36-char\n * `sessionId`. Requires the server flag `createUser: true` AND the\n * fixed signup form from verdaccio/verdaccio#6210 — every\n * published ui-theme posts to a URL that only serves the SPA, so\n * this defaults to `false` as a probe.\n */\n happyPath: boolean;\n /**\n * Whether to run the client-side validation tests on the add-user\n * form (invalid email shows a message, url-unsafe username blocks\n * submit). Same requirements as `happyPath`.\n */\n validation: boolean;\n };\n homeDetailUx: {\n /**\n * Whether to run the home toolbar tests: filter narrows the list and\n * lives in `?q=`, `?scope=` restores the scope, no-match message.\n * Ships with the 9.x home toolbar — probe, defaults to `false`.\n */\n homeToolbar: boolean;\n /**\n * Whether to assert the package page tab lives in `?tab=` (click\n * writes it, a link opens it, readme removes it) — probe.\n */\n detailTabInUrl: boolean;\n /**\n * Whether to assert the step-by-step welcome card (setup tabs per\n * package manager, `.npmrc` tab, uplinks note) — probe.\n */\n welcomeGuide: boolean;\n /**\n * Whether to assert the sidebar install box lists `bun` and the\n * `.npmrc` registry line. Needs `bun` in `web.pkgManagers` (default\n * on 9.x) — probe.\n */\n installBunAndNpmrc: boolean;\n /**\n * Whether to assert that a copy button confirms the copy (its\n * accessible name switches to \"Copied\") — probe.\n */\n copyFeedback: boolean;\n /**\n * Whether to assert search results are grouped by origin and a\n * locally published package lands in the \"published here\" group.\n * Needs `web.showUplinks` (default true) — probe.\n */\n searchGrouping: boolean;\n /**\n * Whether to assert that the version on each home list item links\n * to its version page `/-/web/detail/<name>/v/<version>` — probe.\n */\n versionLink: boolean;\n /**\n * Whether to assert the settings dialog has a \"Publishing\" tab with\n * the welcome guide, so it stays reachable once packages exist — probe.\n */\n settingsPublishTab: boolean;\n };\n changePassword: {\n /**\n * Whether to run the happy-path test (submit valid change,\n * expect navigation to the success page, then restore the\n * original password in `after()`).\n *\n * The suite targets /-/web/change-password, which renders only\n * when the server is configured with `flags.changePassword: true`.\n * Disable on registries that do not enable the flag.\n *\n * Also disable on **published verdaccio 6.x** (all lines through\n * 6.5.0): the reset_password handler in\n * `verdaccio/build/api/web/api/user.js` ships with an inverted\n * conditional — `validatePassword(...) === false` gates the\n * `auth.changePassword(...)` call, so a *valid* new password\n * always returns HTTP 400 (`PASSWORD_VALIDATION`). The bug is\n * fixed on the development branch but has not been released\n * in any 6.x tag, so the happy path cannot succeed against an\n * `npm install verdaccio@6` runtime.\n */\n happyPath: boolean;\n /**\n * Whether to run the client-side validation tests (submit button\n * stays disabled while fields are empty / mismatched confirm).\n * Depends on the yup `changePasswordSchema`.\n */\n validation: boolean;\n /**\n * Whether to run the \"wrong old password shows error banner\" test.\n * Depends on the server rejecting the call and the onSubmit catch\n * block surfacing `\"Failed to change password\"` via\n * `LoginDialogFormError`.\n */\n wrongOldPassword: boolean;\n };\n}\n\n/** Defaults: all flags on. */\nexport const DEFAULT_FEATURES: Features = {\n search: {\n resultsDropdown: true,\n resultClickNavigation: true,\n },\n home: {\n publishedPackageRendering: true,\n },\n settings: {\n languageSwitcher: true,\n localizedDates: false,\n },\n signin: {\n validationTests: true,\n },\n layout: {\n themeSwitch: true,\n },\n publish: {\n downloadTarball: true,\n privateDownloadTarball: false,\n rawViewer: true,\n },\n detail: {\n versionPinned: true,\n scopedWireFormat: true,\n versionNotFound: false,\n staleVersionsNavigation: false,\n },\n manifestRendering: {\n stringForms: false,\n gravatarAvatars: false,\n developersWithoutEmail: false,\n },\n session: {\n expiredTokenLoggedOut: true,\n expiredTokenPurged: false,\n },\n failureModes: {\n homeServerError: true,\n homeNetworkError: false,\n detailErrorState: false,\n searchError: false,\n downloadError: false,\n },\n i18n: {\n noRawKeysCorePages: true,\n noRawKeysSecurityPages: false,\n },\n signup: {\n happyPath: false,\n validation: false,\n },\n homeDetailUx: {\n homeToolbar: false,\n detailTabInUrl: false,\n welcomeGuide: false,\n installBunAndNpmrc: false,\n copyFeedback: false,\n searchGrouping: false,\n versionLink: false,\n settingsPublishTab: false,\n },\n changePassword: {\n happyPath: true,\n validation: true,\n wrongOldPassword: true,\n },\n};\n\n/**\n * Merge user overrides into the default feature flags. Per-section,\n * one level deep — matching the style of `mergeTestIds`.\n */\nexport function mergeFeatures(defaults: Features, overrides?: DeepPartial<Features>): Features {\n if (!overrides) return defaults;\n return {\n search: { ...defaults.search, ...overrides.search },\n home: { ...defaults.home, ...overrides.home },\n settings: { ...defaults.settings, ...overrides.settings },\n signin: { ...defaults.signin, ...overrides.signin },\n layout: { ...defaults.layout, ...overrides.layout },\n publish: { ...defaults.publish, ...overrides.publish },\n detail: { ...defaults.detail, ...overrides.detail },\n manifestRendering: { ...defaults.manifestRendering, ...overrides.manifestRendering },\n session: { ...defaults.session, ...overrides.session },\n failureModes: { ...defaults.failureModes, ...overrides.failureModes },\n i18n: { ...defaults.i18n, ...overrides.i18n },\n signup: { ...defaults.signup, ...overrides.signup },\n homeDetailUx: { ...defaults.homeDetailUx, ...overrides.homeDetailUx },\n changePassword: { ...defaults.changePassword, ...overrides.changePassword },\n };\n}\n\n/**\n * Helper that returns either `it` or `it.skip` depending on an\n * enabled flag. Usage:\n *\n * maybeIt(features.search.resultsDropdown)('…', () => { … });\n */\nexport function maybeIt(enabled: boolean): Mocha.TestFunction | Mocha.PendingTestFunction {\n return enabled ? it : it.skip;\n}\n"],"mappings":";;AAwTA,IAAa,mBAA6B;CACxC,QAAQ;EACN,iBAAiB;EACjB,uBAAuB;CACzB;CACA,MAAM,EACJ,2BAA2B,KAC7B;CACA,UAAU;EACR,kBAAkB;EAClB,gBAAgB;CAClB;CACA,QAAQ,EACN,iBAAiB,KACnB;CACA,QAAQ,EACN,aAAa,KACf;CACA,SAAS;EACP,iBAAiB;EACjB,wBAAwB;EACxB,WAAW;CACb;CACA,QAAQ;EACN,eAAe;EACf,kBAAkB;EAClB,iBAAiB;EACjB,yBAAyB;CAC3B;CACA,mBAAmB;EACjB,aAAa;EACb,iBAAiB;EACjB,wBAAwB;CAC1B;CACA,SAAS;EACP,uBAAuB;EACvB,oBAAoB;CACtB;CACA,cAAc;EACZ,iBAAiB;EACjB,kBAAkB;EAClB,kBAAkB;EAClB,aAAa;EACb,eAAe;CACjB;CACA,MAAM;EACJ,oBAAoB;EACpB,wBAAwB;CAC1B;CACA,QAAQ;EACN,WAAW;EACX,YAAY;CACd;CACA,cAAc;EACZ,aAAa;EACb,gBAAgB;EAChB,cAAc;EACd,oBAAoB;EACpB,cAAc;EACd,gBAAgB;EAChB,aAAa;EACb,oBAAoB;CACtB;CACA,gBAAgB;EACd,WAAW;EACX,YAAY;EACZ,kBAAkB;CACpB;AACF;;;;;AAMA,SAAgB,cAAc,UAAoB,WAA6C;CAC7F,IAAI,CAAC,WAAW,OAAO;CACvB,OAAO;EACL,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;EAClD,MAAM;GAAE,GAAG,SAAS;GAAM,GAAG,UAAU;EAAK;EAC5C,UAAU;GAAE,GAAG,SAAS;GAAU,GAAG,UAAU;EAAS;EACxD,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;EAClD,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;EAClD,SAAS;GAAE,GAAG,SAAS;GAAS,GAAG,UAAU;EAAQ;EACrD,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;EAClD,mBAAmB;GAAE,GAAG,SAAS;GAAmB,GAAG,UAAU;EAAkB;EACnF,SAAS;GAAE,GAAG,SAAS;GAAS,GAAG,UAAU;EAAQ;EACrD,cAAc;GAAE,GAAG,SAAS;GAAc,GAAG,UAAU;EAAa;EACpE,MAAM;GAAE,GAAG,SAAS;GAAM,GAAG,UAAU;EAAK;EAC5C,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;EAClD,cAAc;GAAE,GAAG,SAAS;GAAc,GAAG,UAAU;EAAa;EACpE,gBAAgB;GAAE,GAAG,SAAS;GAAgB,GAAG,UAAU;EAAe;CAC5E;AACF;;;;;;;AAQA,SAAgB,QAAQ,SAAkE;CACxF,OAAO,UAAU,KAAK,GAAG;AAC3B"}
|
|
1
|
+
{"version":3,"file":"features.js","names":[],"sources":["../../src/features.ts"],"sourcesContent":["import type { DeepPartial } from './testIds';\n\n/**\n * Per-test feature flags for enabling/disabling individual test cases\n * in the e2e-ui suites.\n *\n * The Verdaccio UI behaves differently across branches — search result\n * payload shape differs between the `/-/v1/search` and\n * `/-/verdaccio/data/search/*` endpoints, the language picker was\n * added in a specific minor, etc. Rather than forking the suite per\n * branch, consumers can disable individual tests via\n * `createRegistryConfig({ features: { … } })`.\n *\n * Most flags default to `true` (test runs). Compatibility probes for\n * unreleased server behavior may default to `false`; enable them in\n * consumers that run against a Verdaccio build with the feature.\n * A disabled flag converts the test into a Mocha `it.skip` call — the\n * suite still reports the test but marks it as pending.\n */\nexport interface Features {\n search: {\n /**\n * Whether to run the \"results dropdown renders a matching\n * package\" test. Disable on builds where the search result shape\n * or the Autocomplete rendering differs from the default assumption.\n */\n resultsDropdown: boolean;\n /**\n * Whether to run the \"clicking a result navigates to detail\" test.\n * Depends on the Autocomplete `onSelectItem` → router wiring.\n */\n resultClickNavigation: boolean;\n };\n home: {\n /**\n * Whether to run the `with a published package` sub-block inside\n * `homeTests` (publishes a throwaway package and asserts it\n * renders in the package list).\n */\n publishedPackageRendering: boolean;\n };\n settings: {\n /**\n * Whether to run the \"change language via card click\" test.\n * Depends on the `LanguageSwitch` component layout and its\n * translation sentinels (\"Translations\", \"German\"). Skip on\n * builds that lag behind the upstream translation file.\n */\n languageSwitcher: boolean;\n /**\n * Whether to assert that dates follow the selected language\n * (dayjs locale). Released UIs never load the dayjs locale, so\n * relative dates stay English in every language (fixed in\n * verdaccio/verdaccio#6210) — probe.\n */\n localizedDates: boolean;\n };\n signin: {\n /**\n * Whether to run the three validation tests (disabled submit\n * button, invalid credentials error banner). Depends on the\n * current yup schema and the hard-coded \"Invalid username or\n * password\" error string.\n */\n validationTests: boolean;\n };\n layout: {\n /**\n * Whether to run the dark/light theme switch test. Depends on\n * `web.showThemeSwitch` (defaults to true in ui-theme) and the\n * `header--button--light` / `header--button--dark` testids.\n */\n themeSwitch: boolean;\n };\n publish: {\n /**\n * Whether to run the \"tarball download button fires a GET\" test.\n * Depends on `web.showDownloadTarball` (defaults to true) and\n * the published package manifest having a valid `dist.tarball`.\n */\n downloadTarball: boolean;\n /**\n * Whether to run the private package tarball download tests from\n * the Web UI package list and sidebar.\n *\n * Enable only on Verdaccio builds that accept Web UI bearer tokens\n * on protected npm package/tarball routes. Verdaccio 6.x currently\n * returns HTTP 401 for this flow; the regression is tracked in\n * verdaccio/verdaccio#5765.\n */\n privateDownloadTarball: boolean;\n /**\n * Whether to run the \"raw viewer dialog opens + closes\" test.\n * Depends on `web.showRaw` (defaults to true).\n */\n rawViewer: boolean;\n };\n detail: {\n /**\n * Whether to run the \"visiting /v/<version> pins that version\" test\n * (asserts the sidebar request carries `?v=<version>`).\n */\n versionPinned: boolean;\n /**\n * Whether to run the wire-format test for scoped packages: the UI\n * must request `/-/verdaccio/data/sidebar/@scope/name` with the `@`\n * and `/` literal (npm registry convention), never `%40`-encoded.\n * Pins the regression caught by these suites in\n * verdaccio/verdaccio#6210.\n */\n scopedWireFormat: boolean;\n /**\n * Whether to run the \"nonexistent version renders Not Found\" test.\n * Requires the server to answer 404 for unknown `?v=` values\n * (verdaccio/verdaccio#6210); released lines silently fall back to\n * `latest`, so this defaults to `false` as a probe.\n */\n versionNotFound: boolean;\n /**\n * Whether to run the \"versions tab shows the CURRENT package after\n * SPA navigation\" test. The detail routes reuse one mounted\n * component, and released UIs cache the previous package's versions\n * in local state (fixed in verdaccio/verdaccio#6210) — defaults to\n * `false` as a probe.\n */\n staleVersionsNavigation: boolean;\n };\n manifestRendering: {\n /**\n * Whether to run the string-form manifest tests: `repository`,\n * `funding` and `bugs` in their string/array forms are valid npm\n * and must render (fixed in verdaccio/verdaccio#6210) — probe.\n */\n stringForms: boolean;\n /**\n * Whether to assert gravatar avatars render on the detail sidebar.\n * Released UIs read `avatar` while the sidebar endpoint sends\n * `_avatar` (fixed in verdaccio/verdaccio#6210) — probe.\n */\n gravatarAvatars: boolean;\n /**\n * Whether to assert contributors without email don't collapse into\n * one (fixed in verdaccio/verdaccio#6210) — probe.\n */\n developersWithoutEmail: boolean;\n };\n session: {\n /**\n * Whether to assert that an expired token in localStorage boots the\n * UI logged out (header shows the login button). Holds on every\n * released line.\n */\n expiredTokenLoggedOut: boolean;\n /**\n * Whether to assert the expired token is also PURGED from\n * localStorage on boot — otherwise the api client keeps attaching\n * it (fixed in verdaccio/verdaccio#6210) — probe.\n */\n expiredTokenPurged: boolean;\n };\n failureModes: {\n /**\n * Whether to run the \"backend 5xx on the package list must not\n * render the empty-registry onboarding\" test. Holds on every line\n * (a 5xx carries an HTTP code the UI always treated as an error).\n */\n homeServerError: boolean;\n /**\n * Whether to run the network-failure variant (request never\n * reaches the server). Released UIs treat a network failure as an\n * empty registry and show the onboarding card\n * (verdaccio/verdaccio#6210 fixes it), so this defaults to `false`\n * as a probe.\n */\n homeNetworkError: boolean;\n /**\n * Whether to run the \"5xx on the detail page renders an error\n * state instead of a blank page\" test. Requires the generic error\n * page from verdaccio/verdaccio#6210; released UIs render blank,\n * so this defaults to `false` as a probe.\n */\n detailErrorState: boolean;\n /**\n * Whether to run the \"search 5xx shows an error, not 'no results\n * found'\" test. The error state ships with verdaccio/verdaccio#6210\n * — probe.\n */\n searchError: boolean;\n /**\n * Whether to run the \"failed tarball download shows an error\n * snackbar\" test — clicking download and having nothing happen sent\n * users retrying blindly (fixed in verdaccio/verdaccio#6210) — probe.\n */\n downloadError: boolean;\n };\n i18n: {\n /**\n * Whether to scan the home and detail pages for raw i18n keys\n * (visible text like `sidebar.detail.version`). Holds on every\n * released line — these pages ship fully translated.\n */\n noRawKeysCorePages: boolean;\n /**\n * Whether to scan the security pages (login dialog, /-/web/login,\n * add-user, change-password) for raw i18n keys. The whole\n * `security.*` namespace is missing from every published ui-theme\n * bundle (fixed in verdaccio/verdaccio#6210), so this defaults to\n * `false` as a probe.\n */\n noRawKeysSecurityPages: boolean;\n };\n signup: {\n /**\n * Whether to run the create-user happy path (fill the form on\n * /-/web/add-user, submit, land on the success page) and assert\n * the wire contract: `PUT /-/verdaccio/sec/signup` with a 36-char\n * `sessionId`. Requires the server flag `createUser: true` AND the\n * fixed signup form from verdaccio/verdaccio#6210 — every\n * published ui-theme posts to a URL that only serves the SPA, so\n * this defaults to `false` as a probe.\n */\n happyPath: boolean;\n /**\n * Whether to run the client-side validation tests on the add-user\n * form (invalid email shows a message, url-unsafe username blocks\n * submit). Same requirements as `happyPath`.\n */\n validation: boolean;\n };\n homeDetailUx: {\n /**\n * Whether to run the home toolbar tests: filter narrows the list and\n * lives in `?q=`, `?scope=` restores the scope, no-match message.\n * Ships with the 9.x home toolbar — probe, defaults to `false`.\n */\n homeToolbar: boolean;\n /**\n * Whether to assert the package page tab lives in `?tab=` (click\n * writes it, a link opens it, readme removes it) — probe.\n */\n detailTabInUrl: boolean;\n /**\n * Whether to assert the step-by-step welcome card (setup tabs per\n * package manager, `.npmrc` tab, uplinks note) — probe.\n */\n welcomeGuide: boolean;\n /**\n * Whether to assert the sidebar install box lists `bun` and the\n * `.npmrc` registry line. Needs `bun` in `web.pkgManagers` (default\n * on 9.x) — probe.\n */\n installBunAndNpmrc: boolean;\n /**\n * Whether to assert that a copy button confirms the copy (its\n * accessible name switches to \"Copied\") — probe.\n */\n copyFeedback: boolean;\n /**\n * Whether to assert search results are grouped by origin and a\n * locally published package lands in the \"published here\" group.\n * Needs `web.showUplinks` (default true) — probe.\n */\n searchGrouping: boolean;\n /**\n * Whether to assert that the version on each home list item links\n * to its version page `/-/web/detail/<name>/v/<version>` — probe.\n */\n versionLink: boolean;\n /**\n * Whether to assert the settings dialog has a \"Publishing\" tab with\n * the welcome guide, so it stays reachable once packages exist — probe.\n */\n settingsPublishTab: boolean;\n };\n provenance: {\n /**\n * Whether to run the \"Provenance\" sidebar section tests: a version\n * carrying `dist.attestations` or `dist.signatures` shows a chip\n * under \"Distribution\" that opens a dialog with the statement type,\n * the signing key ids and a link to the attestation bundle, and the\n * build details are only requested when the server announces the\n * endpoint (`capabilities.provenance`). Ships with 9.x\n * (verdaccio/verdaccio#6447) — probe, defaults to `false`.\n */\n sidebarSection: boolean;\n };\n changePassword: {\n /**\n * Whether to run the happy-path test (submit valid change,\n * expect navigation to the success page, then restore the\n * original password in `after()`).\n *\n * The suite targets /-/web/change-password, which renders only\n * when the server is configured with `flags.changePassword: true`.\n * Disable on registries that do not enable the flag.\n *\n * Also disable on **published verdaccio 6.x** (all lines through\n * 6.5.0): the reset_password handler in\n * `verdaccio/build/api/web/api/user.js` ships with an inverted\n * conditional — `validatePassword(...) === false` gates the\n * `auth.changePassword(...)` call, so a *valid* new password\n * always returns HTTP 400 (`PASSWORD_VALIDATION`). The bug is\n * fixed on the development branch but has not been released\n * in any 6.x tag, so the happy path cannot succeed against an\n * `npm install verdaccio@6` runtime.\n */\n happyPath: boolean;\n /**\n * Whether to run the client-side validation tests (submit button\n * stays disabled while fields are empty / mismatched confirm).\n * Depends on the yup `changePasswordSchema`.\n */\n validation: boolean;\n /**\n * Whether to run the \"wrong old password shows error banner\" test.\n * Depends on the server rejecting the call and the onSubmit catch\n * block surfacing `\"Failed to change password\"` via\n * `LoginDialogFormError`.\n */\n wrongOldPassword: boolean;\n };\n}\n\n/** Defaults: all flags on. */\nexport const DEFAULT_FEATURES: Features = {\n search: {\n resultsDropdown: true,\n resultClickNavigation: true,\n },\n home: {\n publishedPackageRendering: true,\n },\n settings: {\n languageSwitcher: true,\n localizedDates: false,\n },\n signin: {\n validationTests: true,\n },\n layout: {\n themeSwitch: true,\n },\n publish: {\n downloadTarball: true,\n privateDownloadTarball: false,\n rawViewer: true,\n },\n detail: {\n versionPinned: true,\n scopedWireFormat: true,\n versionNotFound: false,\n staleVersionsNavigation: false,\n },\n manifestRendering: {\n stringForms: false,\n gravatarAvatars: false,\n developersWithoutEmail: false,\n },\n session: {\n expiredTokenLoggedOut: true,\n expiredTokenPurged: false,\n },\n failureModes: {\n homeServerError: true,\n homeNetworkError: false,\n detailErrorState: false,\n searchError: false,\n downloadError: false,\n },\n i18n: {\n noRawKeysCorePages: true,\n noRawKeysSecurityPages: false,\n },\n signup: {\n happyPath: false,\n validation: false,\n },\n homeDetailUx: {\n homeToolbar: false,\n detailTabInUrl: false,\n welcomeGuide: false,\n installBunAndNpmrc: false,\n copyFeedback: false,\n searchGrouping: false,\n versionLink: false,\n settingsPublishTab: false,\n },\n provenance: {\n sidebarSection: false,\n },\n changePassword: {\n happyPath: true,\n validation: true,\n wrongOldPassword: true,\n },\n};\n\n/**\n * Merge user overrides into the default feature flags. Per-section,\n * one level deep — matching the style of `mergeTestIds`.\n */\nexport function mergeFeatures(defaults: Features, overrides?: DeepPartial<Features>): Features {\n if (!overrides) return defaults;\n return {\n search: { ...defaults.search, ...overrides.search },\n home: { ...defaults.home, ...overrides.home },\n settings: { ...defaults.settings, ...overrides.settings },\n signin: { ...defaults.signin, ...overrides.signin },\n layout: { ...defaults.layout, ...overrides.layout },\n publish: { ...defaults.publish, ...overrides.publish },\n detail: { ...defaults.detail, ...overrides.detail },\n manifestRendering: { ...defaults.manifestRendering, ...overrides.manifestRendering },\n session: { ...defaults.session, ...overrides.session },\n failureModes: { ...defaults.failureModes, ...overrides.failureModes },\n i18n: { ...defaults.i18n, ...overrides.i18n },\n signup: { ...defaults.signup, ...overrides.signup },\n homeDetailUx: { ...defaults.homeDetailUx, ...overrides.homeDetailUx },\n provenance: { ...defaults.provenance, ...overrides.provenance },\n changePassword: { ...defaults.changePassword, ...overrides.changePassword },\n };\n}\n\n/**\n * Helper that returns either `it` or `it.skip` depending on an\n * enabled flag. Usage:\n *\n * maybeIt(features.search.resultsDropdown)('…', () => { … });\n */\nexport function maybeIt(enabled: boolean): Mocha.TestFunction | Mocha.PendingTestFunction {\n return enabled ? it : it.skip;\n}\n"],"mappings":";;AAoUA,IAAa,mBAA6B;CACxC,QAAQ;EACN,iBAAiB;EACjB,uBAAuB;CACzB;CACA,MAAM,EACJ,2BAA2B,KAC7B;CACA,UAAU;EACR,kBAAkB;EAClB,gBAAgB;CAClB;CACA,QAAQ,EACN,iBAAiB,KACnB;CACA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AAE,GAAG,SAAS;GAAc,GAAG,UAAU;EAAa;EACpE,MAAM;GAAE,GAAG,SAAS;GAAM,GAAG,UAAU;EAAK;EAC5C,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;EAClD,cAAc;GAAE,GAAG,SAAS;GAAc,GAAG,UAAU;EAAa;EACpE,YAAY;GAAE,GAAG,SAAS;GAAY,GAAG,UAAU;EAAW;EAC9D,gBAAgB;GAAE,GAAG,SAAS;GAAgB,GAAG,UAAU;EAAe;CAC5E;AACF;;;;;;;AAQA,SAAgB,QAAQ,SAAkE;CACxF,OAAO,UAAU,KAAK,GAAG;AAC3B"}
|
package/build/esm/index.js
CHANGED
|
@@ -15,6 +15,7 @@ import { signupTests } from "./tests/signup.js";
|
|
|
15
15
|
import { manifestRenderingTests } from "./tests/manifest-rendering.js";
|
|
16
16
|
import { sessionTests } from "./tests/session.js";
|
|
17
17
|
import { homeDetailUxTests } from "./tests/home-detail-ux.js";
|
|
18
|
+
import { provenanceTests } from "./tests/provenance.js";
|
|
18
19
|
import "./tests/index.js";
|
|
19
20
|
import { appendFileSync } from "fs";
|
|
20
21
|
//#region src/index.ts
|
|
@@ -176,9 +177,10 @@ function registerAllTests(config) {
|
|
|
176
177
|
sessionTests(config);
|
|
177
178
|
signupTests(config);
|
|
178
179
|
homeDetailUxTests(config);
|
|
180
|
+
provenanceTests(config);
|
|
179
181
|
changePasswordTests(config);
|
|
180
182
|
}
|
|
181
183
|
//#endregion
|
|
182
|
-
export { DEFAULT_FEATURES, DEFAULT_SELECTORS, DEFAULT_TEST_IDS, changePasswordTests, cleanupPublished, createRegistryConfig, detailTests, failureModeTests, homeDetailUxTests, homeTests, i18nKeyTests, layoutTests, manifestRenderingTests, maybeIt, publishPackage, publishTests, registerAllTests, searchTests, sessionTests, settingsTests, setupVerdaccioTasks, signinTests, signupTests, unpublishPackage };
|
|
184
|
+
export { DEFAULT_FEATURES, DEFAULT_SELECTORS, DEFAULT_TEST_IDS, changePasswordTests, cleanupPublished, createRegistryConfig, detailTests, failureModeTests, homeDetailUxTests, homeTests, i18nKeyTests, layoutTests, manifestRenderingTests, maybeIt, provenanceTests, publishPackage, publishTests, registerAllTests, searchTests, sessionTests, settingsTests, setupVerdaccioTasks, signinTests, signupTests, unpublishPackage };
|
|
183
185
|
|
|
184
186
|
//# sourceMappingURL=index.js.map
|
package/build/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["import { appendFileSync } from 'fs';\n\nimport { DEFAULT_FEATURES, mergeFeatures } from './features';\nimport {\n PublishPackageResult,\n PublishPackageTaskInput,\n UnpublishPackageInput,\n UnpublishPackageResult,\n cleanupPublished,\n publishPackage,\n unpublishPackage,\n} from './tasks';\nimport { DEFAULT_SELECTORS, DEFAULT_TEST_IDS, mergeSelectors, mergeTestIds } from './testIds';\n// Re-export for convenience\nimport {\n changePasswordTests,\n detailTests,\n failureModeTests,\n homeDetailUxTests,\n homeTests,\n i18nKeyTests,\n layoutTests,\n manifestRenderingTests,\n publishTests,\n searchTests,\n sessionTests,\n settingsTests,\n signinTests,\n signupTests,\n} from './tests';\nimport { RegistryConfig, RegistryTaskResult, VerdaccioUiOptions } from './types';\n\nexport type { RegistryConfig, RegistryTaskResult, VerdaccioUiOptions } from './types';\nexport type {\n PublishPackageInput,\n PublishPackageTaskInput,\n PublishPackageResult,\n UnpublishPackageInput,\n UnpublishPackageResult,\n} from './tasks';\nexport type { DeepPartial, Selectors, TestIds } from './testIds';\nexport type { Features } from './features';\nexport { DEFAULT_SELECTORS, DEFAULT_TEST_IDS } from './testIds';\nexport { DEFAULT_FEATURES, maybeIt } from './features';\nexport { publishPackage, cleanupPublished, unpublishPackage } from './tasks';\nexport {\n homeTests,\n signinTests,\n publishTests,\n searchTests,\n settingsTests,\n layoutTests,\n changePasswordTests,\n detailTests,\n failureModeTests,\n i18nKeyTests,\n manifestRenderingTests,\n sessionTests,\n signupTests,\n homeDetailUxTests,\n} from './tests';\n\n/**\n * Build a full RegistryConfig from user-provided options with defaults.\n *\n * `testIds` and `selectors` are deep-merged per section with the\n * defaults in `./testIds`. Consumers targeting a non-default Verdaccio\n * build can override just the fields that drifted:\n *\n * createRegistryConfig({\n * registryUrl: 'http://localhost:4873',\n * testIds: {\n * header: { settingsTooltip: 'my-new-settings-btn' },\n * },\n * });\n */\nexport function createRegistryConfig(options: VerdaccioUiOptions): RegistryConfig {\n const url = new URL(options.registryUrl);\n return {\n registryUrl: options.registryUrl,\n port: options.port ?? (parseInt(url.port, 10) || 4873),\n credentials: options.credentials ?? { user: 'test', password: 'test' },\n title: options.title ?? 'Verdaccio',\n testIds: mergeTestIds(DEFAULT_TEST_IDS, options.testIds),\n selectors: mergeSelectors(DEFAULT_SELECTORS, options.selectors),\n features: mergeFeatures(DEFAULT_FEATURES, options.features),\n };\n}\n\n/**\n * Register Verdaccio Cypress tasks in setupNodeEvents.\n *\n * Usage in cypress.config.ts:\n * import { setupVerdaccioTasks } from '@verdaccio/e2e-ui';\n *\n * export default defineConfig({\n * e2e: {\n * setupNodeEvents(on) {\n * setupVerdaccioTasks(on, { registryUrl: 'http://localhost:4873' });\n * },\n * },\n * });\n */\nexport function setupVerdaccioTasks(on: Cypress.PluginEvents, options: VerdaccioUiOptions): void {\n const config = createRegistryConfig(options);\n\n // GitHub Actions Step Summary\n on('after:run', (results) => {\n const summaryFile = process.env.GITHUB_STEP_SUMMARY;\n if (!summaryFile || !results || !('runs' in results)) return;\n\n const cypressResults = results as CypressCommandLine.CypressRunResult;\n const lines: string[] = [];\n\n lines.push('## UI E2E Test Results\\n');\n lines.push('| Spec | Tests | Passing | Failing | Pending | Duration |');\n lines.push('|------|-------|---------|---------|---------|----------|');\n\n for (const run of cypressResults.runs) {\n const specName = run.spec.relative || run.spec.name;\n const stats = run.stats;\n const icon = stats.failures > 0 ? '❌' : '✅';\n const dur = stats.duration ? `${(stats.duration / 1000).toFixed(1)}s` : '-';\n lines.push(\n `| ${icon} ${specName} | ${stats.tests} | ${stats.passes} | ${stats.failures} | ${stats.pending} | ${dur} |`\n );\n }\n\n lines.push('');\n const totals = cypressResults.totalTests ?? 0;\n const passed = cypressResults.totalPassed ?? 0;\n const failed = cypressResults.totalFailed ?? 0;\n const pending = cypressResults.totalPending ?? 0;\n const emoji = failed > 0 ? '❌' : '✅';\n lines.push(\n `${emoji} **${passed} passed**, **${failed} failed**, **${pending} pending** (${totals} total)\\n`\n );\n\n appendFileSync(summaryFile, lines.join('\\n'));\n });\n\n on('task', {\n registry(): RegistryTaskResult {\n return {\n registryUrl: config.registryUrl,\n port: config.port,\n };\n },\n /**\n * Publish a throwaway package to the registry.\n *\n * Usage from a Cypress spec:\n *\n * cy.task('publishPackage', { pkgName: '@verdaccio/pkg-scoped' });\n *\n * Any field not provided falls back to the values configured here\n * (registryUrl, credentials). The task returns a PublishPackageResult.\n */\n async publishPackage(input: PublishPackageTaskInput): Promise<PublishPackageResult> {\n return publishPackage({\n registryUrl: input.registryUrl ?? config.registryUrl,\n credentials: input.credentials ?? config.credentials,\n pkgName: input.pkgName,\n version: input.version,\n dependencies: input.dependencies,\n devDependencies: input.devDependencies,\n manifest: input.manifest,\n unique: input.unique,\n });\n },\n /**\n * Remove a temp project folder returned by a previous publishPackage\n * call. Returns null (Cypress tasks must return something serializable).\n *\n * cy.task('cleanupPublished', result.tempFolder);\n */\n async cleanupPublished(tempFolder: string): Promise<null> {\n await cleanupPublished(tempFolder);\n return null;\n },\n /**\n * Unpublish a package from the registry so the next test starts\n * from a clean slate. Accepts either a package name or a full input\n * object (to reuse a prior tempFolder's token).\n *\n * cy.task('unpublishPackage', '@verdaccio/pkg-scoped');\n * cy.task('unpublishPackage', { pkgName, tempFolder });\n */\n async unpublishPackage(\n input:\n | string\n | (Omit<UnpublishPackageInput, 'registryUrl'> & {\n registryUrl?: string;\n })\n ): Promise<UnpublishPackageResult> {\n const normalized =\n typeof input === 'string'\n ? { pkgName: input, registryUrl: config.registryUrl }\n : { ...input, registryUrl: input.registryUrl ?? config.registryUrl };\n return unpublishPackage(normalized);\n },\n });\n}\n\n/**\n * Register all Verdaccio UI tests.\n *\n * Usage in a spec file:\n * import { registerAllTests, createRegistryConfig } from '@verdaccio/e2e-ui';\n *\n * const config = createRegistryConfig({ registryUrl: 'http://localhost:4873' });\n * registerAllTests(config);\n *\n * Or pick individual suites:\n * import { homeTests, signinTests } from '@verdaccio/e2e-ui';\n *\n * const config = createRegistryConfig({ registryUrl: 'http://localhost:4873' });\n * homeTests(config);\n * signinTests(config);\n */\nexport function registerAllTests(config: RegistryConfig): void {\n homeTests(config);\n signinTests(config);\n layoutTests(config);\n searchTests(config);\n settingsTests(config);\n publishTests(config);\n detailTests(config);\n failureModeTests(config);\n i18nKeyTests(config);\n manifestRenderingTests(config);\n sessionTests(config);\n signupTests(config);\n homeDetailUxTests(config);\n changePasswordTests(config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4EA,SAAgB,qBAAqB,SAA6C;CAChF,MAAM,MAAM,IAAI,IAAI,QAAQ,WAAW;CACvC,OAAO;EACL,aAAa,QAAQ;EACrB,MAAM,QAAQ,SAAS,SAAS,IAAI,MAAM,EAAE,KAAK;EACjD,aAAa,QAAQ,eAAe;GAAE,MAAM;GAAQ,UAAU;EAAO;EACrE,OAAO,QAAQ,SAAS;EACxB,SAAS,aAAa,kBAAkB,QAAQ,OAAO;EACvD,WAAW,eAAe,mBAAmB,QAAQ,SAAS;EAC9D,UAAU,cAAc,kBAAkB,QAAQ,QAAQ;CAC5D;AACF;;;;;;;;;;;;;;;AAgBA,SAAgB,oBAAoB,IAA0B,SAAmC;CAC/F,MAAM,SAAS,qBAAqB,OAAO;CAG3C,GAAG,cAAc,YAAY;EAC3B,MAAM,cAAc,QAAQ,IAAI;EAChC,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,UAAU,UAAU;EAEtD,MAAM,iBAAiB;EACvB,MAAM,Q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J,OAKiC;GACjC,MAAM,aACJ,OAAO,UAAU,WACb;IAAE,SAAS;IAAO,aAAa,OAAO;GAAY,IAClD;IAAE,GAAG;IAAO,aAAa,MAAM,eAAe,OAAO;GAAY;GACvE,OAAO,iBAAiB,UAAU;EACpC;CACF,CAAC;AACH;;;;;;;;;;;;;;;;;AAkBA,SAAgB,iBAAiB,QAA8B;CAC7D,UAAU,MAAM;CAChB,YAAY,MAAM;CAClB,YAAY,MAAM;CAClB,YAAY,MAAM;CAClB,cAAc,MAAM;CACpB,aAAa,MAAM;CACnB,YAAY,MAAM;CAClB,iBAAiB,MAAM;CACvB,aAAa,MAAM;CACnB,uBAAuB,MAAM;CAC7B,aAAa,MAAM;CACnB,YAAY,MAAM;CAClB,kBAAkB,MAAM;CACxB,oBAAoB,MAAM;AAC5B"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["import { appendFileSync } from 'fs';\n\nimport { DEFAULT_FEATURES, mergeFeatures } from './features';\nimport {\n PublishPackageResult,\n PublishPackageTaskInput,\n UnpublishPackageInput,\n UnpublishPackageResult,\n cleanupPublished,\n publishPackage,\n unpublishPackage,\n} from './tasks';\nimport { DEFAULT_SELECTORS, DEFAULT_TEST_IDS, mergeSelectors, mergeTestIds } from './testIds';\n// Re-export for convenience\nimport {\n changePasswordTests,\n detailTests,\n failureModeTests,\n homeDetailUxTests,\n homeTests,\n i18nKeyTests,\n layoutTests,\n manifestRenderingTests,\n provenanceTests,\n publishTests,\n searchTests,\n sessionTests,\n settingsTests,\n signinTests,\n signupTests,\n} from './tests';\nimport { RegistryConfig, RegistryTaskResult, VerdaccioUiOptions } from './types';\n\nexport type { RegistryConfig, RegistryTaskResult, VerdaccioUiOptions } from './types';\nexport type {\n PublishPackageInput,\n PublishPackageTaskInput,\n PublishPackageResult,\n UnpublishPackageInput,\n UnpublishPackageResult,\n} from './tasks';\nexport type { DeepPartial, Selectors, TestIds } from './testIds';\nexport type { Features } from './features';\nexport { DEFAULT_SELECTORS, DEFAULT_TEST_IDS } from './testIds';\nexport { DEFAULT_FEATURES, maybeIt } from './features';\nexport { publishPackage, cleanupPublished, unpublishPackage } from './tasks';\nexport {\n homeTests,\n signinTests,\n publishTests,\n searchTests,\n settingsTests,\n layoutTests,\n changePasswordTests,\n detailTests,\n failureModeTests,\n i18nKeyTests,\n manifestRenderingTests,\n sessionTests,\n signupTests,\n homeDetailUxTests,\n provenanceTests,\n} from './tests';\n\n/**\n * Build a full RegistryConfig from user-provided options with defaults.\n *\n * `testIds` and `selectors` are deep-merged per section with the\n * defaults in `./testIds`. Consumers targeting a non-default Verdaccio\n * build can override just the fields that drifted:\n *\n * createRegistryConfig({\n * registryUrl: 'http://localhost:4873',\n * testIds: {\n * header: { settingsTooltip: 'my-new-settings-btn' },\n * },\n * });\n */\nexport function createRegistryConfig(options: VerdaccioUiOptions): RegistryConfig {\n const url = new URL(options.registryUrl);\n return {\n registryUrl: options.registryUrl,\n port: options.port ?? (parseInt(url.port, 10) || 4873),\n credentials: options.credentials ?? { user: 'test', password: 'test' },\n title: options.title ?? 'Verdaccio',\n testIds: mergeTestIds(DEFAULT_TEST_IDS, options.testIds),\n selectors: mergeSelectors(DEFAULT_SELECTORS, options.selectors),\n features: mergeFeatures(DEFAULT_FEATURES, options.features),\n };\n}\n\n/**\n * Register Verdaccio Cypress tasks in setupNodeEvents.\n *\n * Usage in cypress.config.ts:\n * import { setupVerdaccioTasks } from '@verdaccio/e2e-ui';\n *\n * export default defineConfig({\n * e2e: {\n * setupNodeEvents(on) {\n * setupVerdaccioTasks(on, { registryUrl: 'http://localhost:4873' });\n * },\n * },\n * });\n */\nexport function setupVerdaccioTasks(on: Cypress.PluginEvents, options: VerdaccioUiOptions): void {\n const config = createRegistryConfig(options);\n\n // GitHub Actions Step Summary\n on('after:run', (results) => {\n const summaryFile = process.env.GITHUB_STEP_SUMMARY;\n if (!summaryFile || !results || !('runs' in results)) return;\n\n const cypressResults = results as CypressCommandLine.CypressRunResult;\n const lines: string[] = [];\n\n lines.push('## UI E2E Test Results\\n');\n lines.push('| Spec | Tests | Passing | Failing | Pending | Duration |');\n lines.push('|------|-------|---------|---------|---------|----------|');\n\n for (const run of cypressResults.runs) {\n const specName = run.spec.relative || run.spec.name;\n const stats = run.stats;\n const icon = stats.failures > 0 ? '❌' : '✅';\n const dur = stats.duration ? `${(stats.duration / 1000).toFixed(1)}s` : '-';\n lines.push(\n `| ${icon} ${specName} | ${stats.tests} | ${stats.passes} | ${stats.failures} | ${stats.pending} | ${dur} |`\n );\n }\n\n lines.push('');\n const totals = cypressResults.totalTests ?? 0;\n const passed = cypressResults.totalPassed ?? 0;\n const failed = cypressResults.totalFailed ?? 0;\n const pending = cypressResults.totalPending ?? 0;\n const emoji = failed > 0 ? '❌' : '✅';\n lines.push(\n `${emoji} **${passed} passed**, **${failed} failed**, **${pending} pending** (${totals} total)\\n`\n );\n\n appendFileSync(summaryFile, lines.join('\\n'));\n });\n\n on('task', {\n registry(): RegistryTaskResult {\n return {\n registryUrl: config.registryUrl,\n port: config.port,\n };\n },\n /**\n * Publish a throwaway package to the registry.\n *\n * Usage from a Cypress spec:\n *\n * cy.task('publishPackage', { pkgName: '@verdaccio/pkg-scoped' });\n *\n * Any field not provided falls back to the values configured here\n * (registryUrl, credentials). The task returns a PublishPackageResult.\n */\n async publishPackage(input: PublishPackageTaskInput): Promise<PublishPackageResult> {\n return publishPackage({\n registryUrl: input.registryUrl ?? config.registryUrl,\n credentials: input.credentials ?? config.credentials,\n pkgName: input.pkgName,\n version: input.version,\n dependencies: input.dependencies,\n devDependencies: input.devDependencies,\n manifest: input.manifest,\n unique: input.unique,\n });\n },\n /**\n * Remove a temp project folder returned by a previous publishPackage\n * call. Returns null (Cypress tasks must return something serializable).\n *\n * cy.task('cleanupPublished', result.tempFolder);\n */\n async cleanupPublished(tempFolder: string): Promise<null> {\n await cleanupPublished(tempFolder);\n return null;\n },\n /**\n * Unpublish a package from the registry so the next test starts\n * from a clean slate. Accepts either a package name or a full input\n * object (to reuse a prior tempFolder's token).\n *\n * cy.task('unpublishPackage', '@verdaccio/pkg-scoped');\n * cy.task('unpublishPackage', { pkgName, tempFolder });\n */\n async unpublishPackage(\n input:\n | string\n | (Omit<UnpublishPackageInput, 'registryUrl'> & {\n registryUrl?: string;\n })\n ): Promise<UnpublishPackageResult> {\n const normalized =\n typeof input === 'string'\n ? { pkgName: input, registryUrl: config.registryUrl }\n : { ...input, registryUrl: input.registryUrl ?? config.registryUrl };\n return unpublishPackage(normalized);\n },\n });\n}\n\n/**\n * Register all Verdaccio UI tests.\n *\n * Usage in a spec file:\n * import { registerAllTests, createRegistryConfig } from '@verdaccio/e2e-ui';\n *\n * const config = createRegistryConfig({ registryUrl: 'http://localhost:4873' });\n * registerAllTests(config);\n *\n * Or pick individual suites:\n * import { homeTests, signinTests } from '@verdaccio/e2e-ui';\n *\n * const config = createRegistryConfig({ registryUrl: 'http://localhost:4873' });\n * homeTests(config);\n * signinTests(config);\n */\nexport function registerAllTests(config: RegistryConfig): void {\n homeTests(config);\n signinTests(config);\n layoutTests(config);\n searchTests(config);\n settingsTests(config);\n publishTests(config);\n detailTests(config);\n failureModeTests(config);\n i18nKeyTests(config);\n manifestRenderingTests(config);\n sessionTests(config);\n signupTests(config);\n homeDetailUxTests(config);\n provenanceTests(config);\n changePasswordTests(config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EA,SAAgB,qBAAqB,SAA6C;CAChF,MAAM,MAAM,IAAI,IAAI,QAAQ,WAAW;CACvC,OAAO;EACL,aAAa,QAAQ;EACrB,MAAM,QAAQ,SAAS,SAAS,IAAI,MAAM,EAAE,KAAK;EACjD,aAAa,QAAQ,eAAe;GAAE,MAAM;GAAQ,UAAU;EAAO;EACrE,OAAO,QAAQ,SAAS;EACxB,SAAS,aAAa,kBAAkB,QAAQ,OAAO;EACvD,WAAW,eAAe,mBAAmB,QAAQ,SAAS;EAC9D,UAAU,cAAc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eAAe,OAAO;IACzC,aAAa,MAAM,eAAe,OAAO;IACzC,SAAS,MAAM;IACf,SAAS,MAAM;IACf,cAAc,MAAM;IACpB,iBAAiB,MAAM;IACvB,UAAU,MAAM;IAChB,QAAQ,MAAM;GAChB,CAAC;EACH;;;;;;;EAOA,MAAM,iBAAiB,YAAmC;GACxD,MAAM,iBAAiB,UAAU;GACjC,OAAO;EACT;;;;;;;;;EASA,MAAM,iBACJ,OAKiC;GACjC,MAAM,aACJ,OAAO,UAAU,WACb;IAAE,SAAS;IAAO,aAAa,OAAO;GAAY,IAClD;IAAE,GAAG;IAAO,aAAa,MAAM,eAAe,OAAO;GAAY;GACvE,OAAO,iBAAiB,UAAU;EACpC;CACF,CAAC;AACH;;;;;;;;;;;;;;;;;AAkBA,SAAgB,iBAAiB,QAA8B;CAC7D,UAAU,MAAM;CAChB,YAAY,MAAM;CAClB,YAAY,MAAM;CAClB,YAAY,MAAM;CAClB,cAAc,MAAM;CACpB,aAAa,MAAM;CACnB,YAAY,MAAM;CAClB,iBAAiB,MAAM;CACvB,aAAa,MAAM;CACnB,uBAAuB,MAAM;CAC7B,aAAa,MAAM;CACnB,YAAY,MAAM;CAClB,kBAAkB,MAAM;CACxB,gBAAgB,MAAM;CACtB,oBAAoB,MAAM;AAC5B"}
|
package/build/esm/testIds.js
CHANGED
|
@@ -55,6 +55,8 @@ var DEFAULT_TEST_IDS = {
|
|
|
55
55
|
installBun: "installListItem-bun",
|
|
56
56
|
installNpmrc: "install-npmrc",
|
|
57
57
|
installNpmrcCopy: "installNpmrc",
|
|
58
|
+
provenanceBadge: "provenance-badge",
|
|
59
|
+
provenanceDialog: "registryInfo--dialog",
|
|
58
60
|
readmeTab: "readme-tab",
|
|
59
61
|
keywordList: "keyword-list",
|
|
60
62
|
dependenciesTab: "dependencies-tab",
|
package/build/esm/testIds.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testIds.js","names":[],"sources":["../../src/testIds.ts"],"sourcesContent":["/**\n * Configurable DOM selectors used by the e2e-ui test suites.\n *\n * The Verdaccio UI is a moving target — data-testids can and do change\n * between majors — so every selector referenced by a test lives here\n * and can be overridden by consumers of `@verdaccio/e2e-ui` via\n * `createRegistryConfig({ testIds, selectors })`.\n *\n * The defaults below match Verdaccio 6.x as of the last time we audited\n * the ui-components source. If a selector moves, override just the\n * affected field instead of forking the suite.\n */\n\n/**\n * Map of data-testid values used by the test suites, grouped by UI\n * section. Each field holds the bare testid string (no `data-testid=\"…\"`\n * wrapping) — the test helpers pass it through `cy.getByTestId(...)`.\n */\nexport interface TestIds {\n home: {\n /** Help card shown on the empty-registry landing page. */\n helpCard: string;\n /** 404 \"not found\" container. */\n notFound: string;\n /** Filter / scope / sort bar above the package list (9.x). */\n packageListToolbar: string;\n /** Text filter input inside the toolbar. */\n packageListFilter: string;\n /** Native input of the scope select (only with more than one scope). */\n packageListScope: string;\n /** Message shown when the filter matches no package. */\n packageListNoMatch: string;\n /** Prefix of the welcome card setup tabs: `<prefix><manager>`. */\n helpSetupTabPrefix: string;\n /** Note on the welcome card explaining cached uplink packages. */\n helpUplinksNote: string;\n /** Step list of the publishing guide, in the welcome card and the settings (9.x). */\n helpGuide: string;\n };\n header: {\n /** Outermost `<NavBar>` element. */\n container: string;\n /** Inner wrapper inside the nav bar. */\n innerNavBar: string;\n /** Right-side action cluster wrapper. */\n right: string;\n /** Wrapper around the header search input. */\n searchContainer: string;\n /** Default SVG Verdaccio logo. */\n defaultLogo: string;\n /** Custom (user-provided) logo image. */\n customLogo: string;\n /** \"Login\" button shown when logged out. */\n loginButton: string;\n /** Gear icon that opens the settings dialog. */\n settingsTooltip: string;\n /** \"Publishing\" tab of the settings dialog (9.x). */\n settingsPublishTab: string;\n /** Panel of the \"Publishing\" tab (9.x). */\n settingsPublishPanel: string;\n /** Info icon that opens the registry info dialog. */\n infoTooltip: string;\n /**\n * Theme switch button shown while in LIGHT mode (clicking it\n * flips to dark). The underlying component swaps between this\n * and `themeSwitchDark` based on `isDarkMode`.\n */\n themeSwitchLight: string;\n /** Theme switch button shown while in DARK mode. */\n themeSwitchDark: string;\n /** Menu icon shown after login (opens the logged-in menu). */\n logInDialogIcon: string;\n /** \"Log out\" entry inside the logged-in menu. */\n logOutDialogIcon: string;\n /** \"Hi <username>\" label inside the logged-in menu. */\n greetingsLabel: string;\n };\n footer: {\n /** Outer footer wrapper. */\n container: string;\n /** \"Powered by\" version text on the right side of the footer. */\n version: string;\n };\n login: {\n /** Login dialog container (the MUI Dialog root). */\n dialog: string;\n /** DialogContent wrapper inside the login dialog. */\n dialogContent: string;\n /**\n * Error banner shown inside the login dialog when the server\n * rejects credentials (or any other `errors.root` message the form\n * sets). Renders inside the `LoginDialogFormError` component.\n */\n error: string;\n };\n package: {\n /** Wrapper around the list of packages on the home page. */\n itemList: string;\n /** Package name link in the package list (home + search results). */\n title: string;\n /** Version link of a package list item, to its version page (9.x). */\n versionLink: string;\n /** Readme container on the package detail page. */\n readme: string;\n /** Sidebar container on the package detail page. */\n sidebar: string;\n /** Install commands section list. */\n installList: string;\n /** Individual install line for npm. */\n installNpm: string;\n /** Individual install line for yarn. */\n installYarn: string;\n /** Individual install line for pnpm. */\n installPnpm: string;\n /** Individual install line for bun (9.x). */\n installBun: string;\n /** `.npmrc` registry line below the install commands (9.x). */\n installNpmrc: string;\n /** Copy button of the `.npmrc` registry line. */\n installNpmrcCopy: string;\n /** Tab that shows the readme. */\n readmeTab: string;\n /** Keyword list below the install section. */\n keywordList: string;\n /** Tab that reveals the dependencies view. */\n dependenciesTab: string;\n /** Dependencies list wrapper (one entry per dep). */\n dependencies: string;\n /** Tab that reveals the versions view. */\n versionsTab: string;\n /** \"latest\" tag row inside the versions view. */\n tagLatest: string;\n /** Tab that reveals the uplinks view. */\n uplinksTab: string;\n /** Empty-state message when the package has no uplinks. */\n noUplinks: string;\n /** Action-bar tarball download FAB. */\n downloadTarballBtn: string;\n /** Package list tarball download button. */\n downloadTarball: string;\n /** Action-bar \"view raw manifest\" FAB. */\n rawBtn: string;\n /** Full-screen dialog that opens when `rawBtn` is clicked. */\n rawViewerDialog: string;\n /** Close button inside the raw viewer dialog. */\n closeRawViewer: string;\n };\n search: {\n /** Prefix of the origin group headers: `<prefix>private|cached|remote`. */\n groupPrefix: string;\n /** Prefix of the origin icon on each result: `<prefix>private|...`. */\n originPrefix: string;\n };\n errors: {\n /**\n * Generic error page shown when a data request fails without a\n * specific status (5xx, network failure). Added by\n * verdaccio/verdaccio#6210 — only present on builds with that fix.\n */\n genericError: string;\n };\n}\n\n/**\n * CSS selectors (not data-testids) used by the test suites. These are\n * things like form-field IDs and framework-specific class names that\n * Verdaccio's UI exposes as plain selectors rather than testids.\n */\nexport interface Selectors {\n /** Class applied to the parsed README markdown body. */\n markdownBody: string;\n loginDialog: {\n /** Username text input inside the login dialog. */\n usernameInput: string;\n /** Password text input inside the login dialog. */\n passwordInput: string;\n /** Submit button inside the login dialog. */\n submitButton: string;\n };\n signup: {\n /** Username input on /-/web/add-user (shares ids with the login form). */\n usernameInput: string;\n /** Password input on /-/web/add-user. */\n passwordInput: string;\n /** Email input on /-/web/add-user (only email-typed input on the page). */\n emailInput: string;\n /** Submit button on /-/web/add-user. */\n submitButton: string;\n };\n}\n\n/**\n * Defaults matching Verdaccio 6.x (bundled ui-theme@9.0.0-next-9.x).\n * Overridable via `createRegistryConfig({ testIds: { ... } })`.\n */\nexport const DEFAULT_TEST_IDS: TestIds = {\n home: {\n helpCard: 'help-card',\n notFound: '404',\n packageListToolbar: 'package-list-toolbar',\n packageListFilter: 'package-list-filter',\n packageListScope: 'package-list-scope',\n packageListNoMatch: 'package-list-no-match',\n helpSetupTabPrefix: 'help-setup-',\n helpUplinksNote: 'help-uplinks-note',\n helpGuide: 'help-guide',\n },\n header: {\n container: 'header',\n innerNavBar: 'inner-nav-bar',\n right: 'header-right',\n searchContainer: 'search-container',\n defaultLogo: 'default-logo',\n customLogo: 'custom-logo',\n loginButton: 'header--button-login',\n settingsTooltip: 'header--tooltip-settings',\n settingsPublishTab: 'settings-publish-tab',\n settingsPublishPanel: 'settings-publish',\n infoTooltip: 'header--tooltip-info',\n themeSwitchLight: 'header--button--light',\n themeSwitchDark: 'header--button--dark',\n logInDialogIcon: 'logInDialogIcon',\n logOutDialogIcon: 'logOutDialogIcon',\n greetingsLabel: 'greetings-label',\n },\n footer: {\n container: 'footer',\n version: 'version-footer',\n },\n login: {\n dialog: 'login--dialog',\n dialogContent: 'dialogContentLogin',\n error: 'error',\n },\n package: {\n itemList: 'package-item-list',\n title: 'package-title',\n versionLink: 'package-version-link',\n readme: 'readme',\n sidebar: 'sidebar',\n installList: 'installList',\n installNpm: 'installListItem-npm',\n installYarn: 'installListItem-yarn',\n installPnpm: 'installListItem-pnpm',\n installBun: 'installListItem-bun',\n installNpmrc: 'install-npmrc',\n installNpmrcCopy: 'installNpmrc',\n readmeTab: 'readme-tab',\n keywordList: 'keyword-list',\n dependenciesTab: 'dependencies-tab',\n dependencies: 'dependencies',\n versionsTab: 'versions-tab',\n tagLatest: 'tag-latest',\n uplinksTab: 'uplinks-tab',\n noUplinks: 'no-uplinks',\n downloadTarballBtn: 'download-tarball-btn',\n downloadTarball: 'download-tarball',\n rawBtn: 'raw-btn',\n rawViewerDialog: 'rawViewer--dialog',\n closeRawViewer: 'close-raw-viewer',\n },\n search: {\n groupPrefix: 'search-group-',\n originPrefix: 'search-origin-',\n },\n errors: {\n genericError: 'generic-error',\n },\n};\n\n/**\n * Defaults for non-testid CSS selectors. Overridable via\n * `createRegistryConfig({ selectors: { ... } })`.\n */\nexport const DEFAULT_SELECTORS: Selectors = {\n markdownBody: '.markdown-body',\n loginDialog: {\n usernameInput: '#login--dialog-username',\n passwordInput: '#login--dialog-password',\n submitButton: '#login--dialog-button-submit',\n },\n signup: {\n usernameInput: '#login--dialog-username',\n passwordInput: '#login--dialog-password',\n emailInput: 'input[type=\"email\"]',\n submitButton: 'button[type=\"submit\"]',\n },\n};\n\n/** Deep-partial helper — every field of a nested object becomes optional. */\nexport type DeepPartial<T> = {\n [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];\n};\n\n/**\n * Merge user overrides into the default testIds map. Merging is\n * per-section (one level deep): `overrides.header` replaces individual\n * fields under `defaults.header` without touching `defaults.footer`.\n * The shape is fixed and small, so we enumerate sections by hand\n * rather than relying on a recursive generic merger.\n */\nexport function mergeTestIds(defaults: TestIds, overrides?: DeepPartial<TestIds>): TestIds {\n if (!overrides) return defaults;\n return {\n home: { ...defaults.home, ...overrides.home },\n header: { ...defaults.header, ...overrides.header },\n footer: { ...defaults.footer, ...overrides.footer },\n login: { ...defaults.login, ...overrides.login },\n package: { ...defaults.package, ...overrides.package },\n search: { ...defaults.search, ...overrides.search },\n errors: { ...defaults.errors, ...overrides.errors },\n };\n}\n\n/** Same idea as `mergeTestIds`, for the CSS-selector block. */\nexport function mergeSelectors(defaults: Selectors, overrides?: DeepPartial<Selectors>): Selectors {\n if (!overrides) return defaults;\n return {\n markdownBody: overrides.markdownBody ?? defaults.markdownBody,\n loginDialog: { ...defaults.loginDialog, ...overrides.loginDialog },\n signup: { ...defaults.signup, ...overrides.signup },\n };\n}\n"],"mappings":";;;;;AAmMA,IAAa,mBAA4B;CACvC,MAAM;EACJ,UAAU;EACV,UAAU;EACV,oBAAoB;EACpB,mBAAmB;EACnB,kBAAkB;EAClB,oBAAoB;EACpB,oBAAoB;EACpB,iBAAiB;EACjB,WAAW;CACb;CACA,QAAQ;EACN,WAAW;EACX,aAAa;EACb,OAAO;EACP,iBAAiB;EACjB,aAAa;EACb,YAAY;EACZ,aAAa;EACb,iBAAiB;EACjB,oBAAoB;EACpB,sBAAsB;EACtB,aAAa;EACb,kBAAkB;EAClB,iBAAiB;EACjB,iBAAiB;EACjB,kBAAkB;EAClB,gBAAgB;CAClB;CACA,QAAQ;EACN,WAAW;EACX,SAAS;CACX;CACA,OAAO;EACL,QAAQ;EACR,eAAe;EACf,OAAO;CACT;CACA,SAAS;EACP,UAAU;EACV,OAAO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
|
1
|
+
{"version":3,"file":"testIds.js","names":[],"sources":["../../src/testIds.ts"],"sourcesContent":["/**\n * Configurable DOM selectors used by the e2e-ui test suites.\n *\n * The Verdaccio UI is a moving target — data-testids can and do change\n * between majors — so every selector referenced by a test lives here\n * and can be overridden by consumers of `@verdaccio/e2e-ui` via\n * `createRegistryConfig({ testIds, selectors })`.\n *\n * The defaults below match Verdaccio 6.x as of the last time we audited\n * the ui-components source. If a selector moves, override just the\n * affected field instead of forking the suite.\n */\n\n/**\n * Map of data-testid values used by the test suites, grouped by UI\n * section. Each field holds the bare testid string (no `data-testid=\"…\"`\n * wrapping) — the test helpers pass it through `cy.getByTestId(...)`.\n */\nexport interface TestIds {\n home: {\n /** Help card shown on the empty-registry landing page. */\n helpCard: string;\n /** 404 \"not found\" container. */\n notFound: string;\n /** Filter / scope / sort bar above the package list (9.x). */\n packageListToolbar: string;\n /** Text filter input inside the toolbar. */\n packageListFilter: string;\n /** Native input of the scope select (only with more than one scope). */\n packageListScope: string;\n /** Message shown when the filter matches no package. */\n packageListNoMatch: string;\n /** Prefix of the welcome card setup tabs: `<prefix><manager>`. */\n helpSetupTabPrefix: string;\n /** Note on the welcome card explaining cached uplink packages. */\n helpUplinksNote: string;\n /** Step list of the publishing guide, in the welcome card and the settings (9.x). */\n helpGuide: string;\n };\n header: {\n /** Outermost `<NavBar>` element. */\n container: string;\n /** Inner wrapper inside the nav bar. */\n innerNavBar: string;\n /** Right-side action cluster wrapper. */\n right: string;\n /** Wrapper around the header search input. */\n searchContainer: string;\n /** Default SVG Verdaccio logo. */\n defaultLogo: string;\n /** Custom (user-provided) logo image. */\n customLogo: string;\n /** \"Login\" button shown when logged out. */\n loginButton: string;\n /** Gear icon that opens the settings dialog. */\n settingsTooltip: string;\n /** \"Publishing\" tab of the settings dialog (9.x). */\n settingsPublishTab: string;\n /** Panel of the \"Publishing\" tab (9.x). */\n settingsPublishPanel: string;\n /** Info icon that opens the registry info dialog. */\n infoTooltip: string;\n /**\n * Theme switch button shown while in LIGHT mode (clicking it\n * flips to dark). The underlying component swaps between this\n * and `themeSwitchDark` based on `isDarkMode`.\n */\n themeSwitchLight: string;\n /** Theme switch button shown while in DARK mode. */\n themeSwitchDark: string;\n /** Menu icon shown after login (opens the logged-in menu). */\n logInDialogIcon: string;\n /** \"Log out\" entry inside the logged-in menu. */\n logOutDialogIcon: string;\n /** \"Hi <username>\" label inside the logged-in menu. */\n greetingsLabel: string;\n };\n footer: {\n /** Outer footer wrapper. */\n container: string;\n /** \"Powered by\" version text on the right side of the footer. */\n version: string;\n };\n login: {\n /** Login dialog container (the MUI Dialog root). */\n dialog: string;\n /** DialogContent wrapper inside the login dialog. */\n dialogContent: string;\n /**\n * Error banner shown inside the login dialog when the server\n * rejects credentials (or any other `errors.root` message the form\n * sets). Renders inside the `LoginDialogFormError` component.\n */\n error: string;\n };\n package: {\n /** Wrapper around the list of packages on the home page. */\n itemList: string;\n /** Package name link in the package list (home + search results). */\n title: string;\n /** Version link of a package list item, to its version page (9.x). */\n versionLink: string;\n /** Readme container on the package detail page. */\n readme: string;\n /** Sidebar container on the package detail page. */\n sidebar: string;\n /** Install commands section list. */\n installList: string;\n /** Individual install line for npm. */\n installNpm: string;\n /** Individual install line for yarn. */\n installYarn: string;\n /** Individual install line for pnpm. */\n installPnpm: string;\n /** Individual install line for bun (9.x). */\n installBun: string;\n /** `.npmrc` registry line below the install commands (9.x). */\n installNpmrc: string;\n /** Copy button of the `.npmrc` registry line. */\n installNpmrcCopy: string;\n /** Chip of the \"Provenance\" sidebar section that opens the provenance dialog (9.x). */\n provenanceBadge: string;\n /** Root of the provenance dialog (shares the registry info dialog container). */\n provenanceDialog: string;\n /** Tab that shows the readme. */\n readmeTab: string;\n /** Keyword list below the install section. */\n keywordList: string;\n /** Tab that reveals the dependencies view. */\n dependenciesTab: string;\n /** Dependencies list wrapper (one entry per dep). */\n dependencies: string;\n /** Tab that reveals the versions view. */\n versionsTab: string;\n /** \"latest\" tag row inside the versions view. */\n tagLatest: string;\n /** Tab that reveals the uplinks view. */\n uplinksTab: string;\n /** Empty-state message when the package has no uplinks. */\n noUplinks: string;\n /** Action-bar tarball download FAB. */\n downloadTarballBtn: string;\n /** Package list tarball download button. */\n downloadTarball: string;\n /** Action-bar \"view raw manifest\" FAB. */\n rawBtn: string;\n /** Full-screen dialog that opens when `rawBtn` is clicked. */\n rawViewerDialog: string;\n /** Close button inside the raw viewer dialog. */\n closeRawViewer: string;\n };\n search: {\n /** Prefix of the origin group headers: `<prefix>private|cached|remote`. */\n groupPrefix: string;\n /** Prefix of the origin icon on each result: `<prefix>private|...`. */\n originPrefix: string;\n };\n errors: {\n /**\n * Generic error page shown when a data request fails without a\n * specific status (5xx, network failure). Added by\n * verdaccio/verdaccio#6210 — only present on builds with that fix.\n */\n genericError: string;\n };\n}\n\n/**\n * CSS selectors (not data-testids) used by the test suites. These are\n * things like form-field IDs and framework-specific class names that\n * Verdaccio's UI exposes as plain selectors rather than testids.\n */\nexport interface Selectors {\n /** Class applied to the parsed README markdown body. */\n markdownBody: string;\n loginDialog: {\n /** Username text input inside the login dialog. */\n usernameInput: string;\n /** Password text input inside the login dialog. */\n passwordInput: string;\n /** Submit button inside the login dialog. */\n submitButton: string;\n };\n signup: {\n /** Username input on /-/web/add-user (shares ids with the login form). */\n usernameInput: string;\n /** Password input on /-/web/add-user. */\n passwordInput: string;\n /** Email input on /-/web/add-user (only email-typed input on the page). */\n emailInput: string;\n /** Submit button on /-/web/add-user. */\n submitButton: string;\n };\n}\n\n/**\n * Defaults matching Verdaccio 6.x (bundled ui-theme@9.0.0-next-9.x).\n * Overridable via `createRegistryConfig({ testIds: { ... } })`.\n */\nexport const DEFAULT_TEST_IDS: TestIds = {\n home: {\n helpCard: 'help-card',\n notFound: '404',\n packageListToolbar: 'package-list-toolbar',\n packageListFilter: 'package-list-filter',\n packageListScope: 'package-list-scope',\n packageListNoMatch: 'package-list-no-match',\n helpSetupTabPrefix: 'help-setup-',\n helpUplinksNote: 'help-uplinks-note',\n helpGuide: 'help-guide',\n },\n header: {\n container: 'header',\n innerNavBar: 'inner-nav-bar',\n right: 'header-right',\n searchContainer: 'search-container',\n defaultLogo: 'default-logo',\n customLogo: 'custom-logo',\n loginButton: 'header--button-login',\n settingsTooltip: 'header--tooltip-settings',\n settingsPublishTab: 'settings-publish-tab',\n settingsPublishPanel: 'settings-publish',\n infoTooltip: 'header--tooltip-info',\n themeSwitchLight: 'header--button--light',\n themeSwitchDark: 'header--button--dark',\n logInDialogIcon: 'logInDialogIcon',\n logOutDialogIcon: 'logOutDialogIcon',\n greetingsLabel: 'greetings-label',\n },\n footer: {\n container: 'footer',\n version: 'version-footer',\n },\n login: {\n dialog: 'login--dialog',\n dialogContent: 'dialogContentLogin',\n error: 'error',\n },\n package: {\n itemList: 'package-item-list',\n title: 'package-title',\n versionLink: 'package-version-link',\n readme: 'readme',\n sidebar: 'sidebar',\n installList: 'installList',\n installNpm: 'installListItem-npm',\n installYarn: 'installListItem-yarn',\n installPnpm: 'installListItem-pnpm',\n installBun: 'installListItem-bun',\n installNpmrc: 'install-npmrc',\n installNpmrcCopy: 'installNpmrc',\n provenanceBadge: 'provenance-badge',\n provenanceDialog: 'registryInfo--dialog',\n readmeTab: 'readme-tab',\n keywordList: 'keyword-list',\n dependenciesTab: 'dependencies-tab',\n dependencies: 'dependencies',\n versionsTab: 'versions-tab',\n tagLatest: 'tag-latest',\n uplinksTab: 'uplinks-tab',\n noUplinks: 'no-uplinks',\n downloadTarballBtn: 'download-tarball-btn',\n downloadTarball: 'download-tarball',\n rawBtn: 'raw-btn',\n rawViewerDialog: 'rawViewer--dialog',\n closeRawViewer: 'close-raw-viewer',\n },\n search: {\n groupPrefix: 'search-group-',\n originPrefix: 'search-origin-',\n },\n errors: {\n genericError: 'generic-error',\n },\n};\n\n/**\n * Defaults for non-testid CSS selectors. Overridable via\n * `createRegistryConfig({ selectors: { ... } })`.\n */\nexport const DEFAULT_SELECTORS: Selectors = {\n markdownBody: '.markdown-body',\n loginDialog: {\n usernameInput: '#login--dialog-username',\n passwordInput: '#login--dialog-password',\n submitButton: '#login--dialog-button-submit',\n },\n signup: {\n usernameInput: '#login--dialog-username',\n passwordInput: '#login--dialog-password',\n emailInput: 'input[type=\"email\"]',\n submitButton: 'button[type=\"submit\"]',\n },\n};\n\n/** Deep-partial helper — every field of a nested object becomes optional. */\nexport type DeepPartial<T> = {\n [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];\n};\n\n/**\n * Merge user overrides into the default testIds map. Merging is\n * per-section (one level deep): `overrides.header` replaces individual\n * fields under `defaults.header` without touching `defaults.footer`.\n * The shape is fixed and small, so we enumerate sections by hand\n * rather than relying on a recursive generic merger.\n */\nexport function mergeTestIds(defaults: TestIds, overrides?: DeepPartial<TestIds>): TestIds {\n if (!overrides) return defaults;\n return {\n home: { ...defaults.home, ...overrides.home },\n header: { ...defaults.header, ...overrides.header },\n footer: { ...defaults.footer, ...overrides.footer },\n login: { ...defaults.login, ...overrides.login },\n package: { ...defaults.package, ...overrides.package },\n search: { ...defaults.search, ...overrides.search },\n errors: { ...defaults.errors, ...overrides.errors },\n };\n}\n\n/** Same idea as `mergeTestIds`, for the CSS-selector block. */\nexport function mergeSelectors(defaults: Selectors, overrides?: DeepPartial<Selectors>): Selectors {\n if (!overrides) return defaults;\n return {\n markdownBody: overrides.markdownBody ?? defaults.markdownBody,\n loginDialog: { ...defaults.loginDialog, ...overrides.loginDialog },\n signup: { ...defaults.signup, ...overrides.signup },\n };\n}\n"],"mappings":";;;;;AAuMA,IAAa,mBAA4B;CACvC,MAAM;EACJ,UAAU;EACV,UAAU;EACV,oBAAoB;EACpB,mBAAmB;EACnB,kBAAkB;EAClB,oBAAoB;EACpB,oBAAoB;EACpB,iBAAiB;EACjB,WAAW;CACb;CACA,QAAQ;EACN,WAAW;EACX,aAAa;EACb,OAAO;EACP,iBAAiB;EACjB,aAAa;EACb,YAAY;EACZ,aAAa;EACb,iBAAiB;EACjB,oBAAoB;EACpB,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;CACpD;AACF;;AAGA,SAAgB,eAAe,UAAqB,WAA+C;CACjG,IAAI,CAAC,WAAW,OAAO;CACvB,OAAO;EACL,cAAc,UAAU,gBAAgB,SAAS;EACjD,aAAa;GAAE,GAAG,SAAS;GAAa,GAAG,UAAU;EAAY;EACjE,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;CACpD;AACF"}
|
package/build/esm/tests/index.js
CHANGED
|
@@ -12,4 +12,5 @@ import { signupTests } from "./signup.js";
|
|
|
12
12
|
import { manifestRenderingTests } from "./manifest-rendering.js";
|
|
13
13
|
import { sessionTests } from "./session.js";
|
|
14
14
|
import { homeDetailUxTests } from "./home-detail-ux.js";
|
|
15
|
-
|
|
15
|
+
import { provenanceTests } from "./provenance.js";
|
|
16
|
+
export { changePasswordTests, detailTests, failureModeTests, homeDetailUxTests, homeTests, i18nKeyTests, layoutTests, manifestRenderingTests, provenanceTests, publishTests, searchTests, sessionTests, settingsTests, signinTests, signupTests };
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { maybeIt } from "../features.js";
|
|
2
|
+
//#region src/tests/provenance.ts
|
|
3
|
+
/**
|
|
4
|
+
* "Provenance" sidebar section (9.x, verdaccio/verdaccio#6447).
|
|
5
|
+
*
|
|
6
|
+
* registry.npmjs.org attaches `dist.signatures` and `dist.attestations` to
|
|
7
|
+
* every version it signs; the UI shows them without verifying anything in
|
|
8
|
+
* the browser. The fixtures below publish those fields themselves (npm keeps
|
|
9
|
+
* extra `dist` fields on publish), so the suite runs offline and does not
|
|
10
|
+
* need an uplink. The build details come from the registry only when it
|
|
11
|
+
* announces the endpoint, so against this fixture the dialog ends at the
|
|
12
|
+
* summary.
|
|
13
|
+
*/
|
|
14
|
+
function provenanceTests(config) {
|
|
15
|
+
const { features } = config;
|
|
16
|
+
const { package: pkg } = config.testIds;
|
|
17
|
+
const attestations = {
|
|
18
|
+
url: "https://registry.npmjs.org/-/npm/v1/attestations/e2e-provenance@1.0.0",
|
|
19
|
+
provenance: { predicateType: "https://slsa.dev/provenance/v1" }
|
|
20
|
+
};
|
|
21
|
+
const signatures = [{
|
|
22
|
+
keyid: "SHA256:e2e-fixture-key",
|
|
23
|
+
sig: "MEUCIQDe2e"
|
|
24
|
+
}];
|
|
25
|
+
describe("provenance", () => {
|
|
26
|
+
describe("with provenance metadata", () => {
|
|
27
|
+
const pkgName = "@verdaccio/provenance-fixture";
|
|
28
|
+
let tempFolder = null;
|
|
29
|
+
beforeEach(() => {
|
|
30
|
+
cy.task("publishPackage", {
|
|
31
|
+
pkgName,
|
|
32
|
+
version: "1.0.0",
|
|
33
|
+
unique: true,
|
|
34
|
+
manifest: { dist: {
|
|
35
|
+
signatures,
|
|
36
|
+
attestations
|
|
37
|
+
} }
|
|
38
|
+
}).then((result) => {
|
|
39
|
+
tempFolder = result?.tempFolder ?? null;
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
afterEach(() => {
|
|
43
|
+
cy.task("unpublishPackage", {
|
|
44
|
+
pkgName,
|
|
45
|
+
tempFolder: tempFolder ?? void 0
|
|
46
|
+
});
|
|
47
|
+
if (tempFolder) cy.task("cleanupPublished", tempFolder);
|
|
48
|
+
tempFolder = null;
|
|
49
|
+
});
|
|
50
|
+
maybeIt(features.provenance.sidebarSection)("should show the provenance chip and open the dialog with the summary", () => {
|
|
51
|
+
cy.intercept("GET", `/-/verdaccio/data/sidebar/${pkgName}*`).as("sidebar");
|
|
52
|
+
cy.intercept("GET", `/-/verdaccio/data/package/provenance/${pkgName}*`).as("details");
|
|
53
|
+
cy.visit(`${config.registryUrl}/-/web/detail/${pkgName}`);
|
|
54
|
+
cy.wait("@sidebar", { timeout: 1e4 });
|
|
55
|
+
cy.getByTestId(pkg.provenanceBadge).scrollIntoView().should("be.visible").and("contain.text", "Provenance").and("contain.text", "SLSA v1");
|
|
56
|
+
cy.getByTestId(pkg.provenanceBadge).click();
|
|
57
|
+
cy.getByTestId(pkg.provenanceDialog).should("be.visible");
|
|
58
|
+
cy.getByTestId(pkg.provenanceDialog).within(() => {
|
|
59
|
+
cy.contains(`${pkgName}@`);
|
|
60
|
+
cy.contains("SLSA v1");
|
|
61
|
+
cy.contains(signatures[0].keyid);
|
|
62
|
+
cy.contains("registry.npmjs.org/-/npm/v1/attestations/e2e-provenance@1.0.0").should("have.attr", "href", attestations.url);
|
|
63
|
+
cy.contains("cryptographic verification has not been performed");
|
|
64
|
+
});
|
|
65
|
+
cy.wait("@details", { timeout: 1e4 }).then((interception) => {
|
|
66
|
+
expect(interception.response?.statusCode).to.equal(404);
|
|
67
|
+
});
|
|
68
|
+
cy.getByTestId(pkg.provenanceDialog).should("not.contain.text", "Built on");
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
describe("with a registry signature only", () => {
|
|
72
|
+
const pkgName = "@verdaccio/signature-fixture";
|
|
73
|
+
let tempFolder = null;
|
|
74
|
+
beforeEach(() => {
|
|
75
|
+
cy.task("publishPackage", {
|
|
76
|
+
pkgName,
|
|
77
|
+
version: "1.0.0",
|
|
78
|
+
unique: true,
|
|
79
|
+
manifest: { dist: { signatures } }
|
|
80
|
+
}).then((result) => {
|
|
81
|
+
tempFolder = result?.tempFolder ?? null;
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
afterEach(() => {
|
|
85
|
+
cy.task("unpublishPackage", {
|
|
86
|
+
pkgName,
|
|
87
|
+
tempFolder: tempFolder ?? void 0
|
|
88
|
+
});
|
|
89
|
+
if (tempFolder) cy.task("cleanupPublished", tempFolder);
|
|
90
|
+
tempFolder = null;
|
|
91
|
+
});
|
|
92
|
+
maybeIt(features.provenance.sidebarSection)("should show the registry signature chip without requesting build details", () => {
|
|
93
|
+
cy.intercept("GET", `/-/verdaccio/data/package/provenance/${pkgName}*`).as("details");
|
|
94
|
+
cy.visit(`${config.registryUrl}/-/web/detail/${pkgName}`);
|
|
95
|
+
cy.getByTestId(pkg.provenanceBadge).scrollIntoView().should("be.visible").and("contain.text", "Registry signature");
|
|
96
|
+
cy.getByTestId(pkg.provenanceBadge).click();
|
|
97
|
+
cy.getByTestId(pkg.provenanceDialog).within(() => {
|
|
98
|
+
cy.contains(signatures[0].keyid);
|
|
99
|
+
});
|
|
100
|
+
cy.get("@details.all").should("have.length", 0);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
describe("without provenance metadata", () => {
|
|
104
|
+
const pkgName = "@verdaccio/plain-fixture";
|
|
105
|
+
let tempFolder = null;
|
|
106
|
+
beforeEach(() => {
|
|
107
|
+
cy.task("publishPackage", {
|
|
108
|
+
pkgName,
|
|
109
|
+
version: "1.0.0",
|
|
110
|
+
unique: true
|
|
111
|
+
}).then((result) => {
|
|
112
|
+
tempFolder = result?.tempFolder ?? null;
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
afterEach(() => {
|
|
116
|
+
cy.task("unpublishPackage", {
|
|
117
|
+
pkgName,
|
|
118
|
+
tempFolder: tempFolder ?? void 0
|
|
119
|
+
});
|
|
120
|
+
if (tempFolder) cy.task("cleanupPublished", tempFolder);
|
|
121
|
+
tempFolder = null;
|
|
122
|
+
});
|
|
123
|
+
maybeIt(features.provenance.sidebarSection)("should not render the section", () => {
|
|
124
|
+
cy.visit(`${config.registryUrl}/-/web/detail/${pkgName}`);
|
|
125
|
+
cy.getByTestId(pkg.sidebar).should("be.visible");
|
|
126
|
+
cy.getByTestId(pkg.provenanceBadge).should("not.exist");
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
export { provenanceTests };
|
|
133
|
+
|
|
134
|
+
//# sourceMappingURL=provenance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provenance.js","names":[],"sources":["../../../src/tests/provenance.ts"],"sourcesContent":["/// <reference types=\"cypress\" />\nimport { maybeIt } from '../features';\nimport { RegistryConfig } from '../types';\n\n/**\n * \"Provenance\" sidebar section (9.x, verdaccio/verdaccio#6447).\n *\n * registry.npmjs.org attaches `dist.signatures` and `dist.attestations` to\n * every version it signs; the UI shows them without verifying anything in\n * the browser. The fixtures below publish those fields themselves (npm keeps\n * extra `dist` fields on publish), so the suite runs offline and does not\n * need an uplink. The build details come from the registry only when it\n * announces the endpoint, so against this fixture the dialog ends at the\n * summary.\n */\nexport function provenanceTests(config: RegistryConfig) {\n const { features } = config;\n const { package: pkg } = config.testIds;\n\n const attestations = {\n url: 'https://registry.npmjs.org/-/npm/v1/attestations/e2e-provenance@1.0.0',\n provenance: { predicateType: 'https://slsa.dev/provenance/v1' },\n };\n const signatures = [{ keyid: 'SHA256:e2e-fixture-key', sig: 'MEUCIQDe2e' }];\n\n describe('provenance', () => {\n describe('with provenance metadata', () => {\n const pkgName = '@verdaccio/provenance-fixture';\n let tempFolder: string | null = null;\n\n beforeEach(() => {\n cy.task('publishPackage', {\n pkgName,\n version: '1.0.0',\n unique: true,\n manifest: { dist: { signatures, attestations } },\n }).then((result) => {\n tempFolder = result?.tempFolder ?? null;\n });\n });\n\n afterEach(() => {\n cy.task('unpublishPackage', { pkgName, tempFolder: tempFolder ?? undefined });\n if (tempFolder) {\n cy.task('cleanupPublished', tempFolder);\n }\n tempFolder = null;\n });\n\n maybeIt(features.provenance.sidebarSection)(\n 'should show the provenance chip and open the dialog with the summary',\n () => {\n cy.intercept('GET', `/-/verdaccio/data/sidebar/${pkgName}*`).as('sidebar');\n cy.intercept('GET', `/-/verdaccio/data/package/provenance/${pkgName}*`).as('details');\n\n cy.visit(`${config.registryUrl}/-/web/detail/${pkgName}`);\n cy.wait('@sidebar', { timeout: 10000 });\n\n // the sidebar scrolls on its own; bring the chip into its viewport first\n cy.getByTestId(pkg.provenanceBadge)\n .scrollIntoView()\n .should('be.visible')\n .and('contain.text', 'Provenance')\n .and('contain.text', 'SLSA v1');\n\n cy.getByTestId(pkg.provenanceBadge).click();\n cy.getByTestId(pkg.provenanceDialog).should('be.visible');\n cy.getByTestId(pkg.provenanceDialog).within(() => {\n cy.contains(`${pkgName}@`);\n cy.contains('SLSA v1');\n cy.contains(signatures[0].keyid);\n cy.contains('registry.npmjs.org/-/npm/v1/attestations/e2e-provenance@1.0.0').should(\n 'have.attr',\n 'href',\n attestations.url\n );\n cy.contains('cryptographic verification has not been performed');\n });\n\n // the build details are asked for only once the dialog is open; this\n // fixture has no uplink holding the bundle, so the registry answers 404\n // and the dialog keeps the summary\n cy.wait('@details', { timeout: 10000 }).then((interception: any) => {\n expect(interception.response?.statusCode).to.equal(404);\n });\n cy.getByTestId(pkg.provenanceDialog).should('not.contain.text', 'Built on');\n }\n );\n });\n\n describe('with a registry signature only', () => {\n const pkgName = '@verdaccio/signature-fixture';\n let tempFolder: string | null = null;\n\n beforeEach(() => {\n cy.task('publishPackage', {\n pkgName,\n version: '1.0.0',\n unique: true,\n manifest: { dist: { signatures } },\n }).then((result) => {\n tempFolder = result?.tempFolder ?? null;\n });\n });\n\n afterEach(() => {\n cy.task('unpublishPackage', { pkgName, tempFolder: tempFolder ?? undefined });\n if (tempFolder) {\n cy.task('cleanupPublished', tempFolder);\n }\n tempFolder = null;\n });\n\n maybeIt(features.provenance.sidebarSection)(\n 'should show the registry signature chip without requesting build details',\n () => {\n cy.intercept('GET', `/-/verdaccio/data/package/provenance/${pkgName}*`).as('details');\n\n cy.visit(`${config.registryUrl}/-/web/detail/${pkgName}`);\n\n cy.getByTestId(pkg.provenanceBadge)\n .scrollIntoView()\n .should('be.visible')\n .and('contain.text', 'Registry signature');\n cy.getByTestId(pkg.provenanceBadge).click();\n cy.getByTestId(pkg.provenanceDialog).within(() => {\n cy.contains(signatures[0].keyid);\n });\n // no attestation, so the dialog never asks the registry for build details\n cy.get('@details.all').should('have.length', 0);\n }\n );\n });\n\n describe('without provenance metadata', () => {\n const pkgName = '@verdaccio/plain-fixture';\n let tempFolder: string | null = null;\n\n beforeEach(() => {\n cy.task('publishPackage', { pkgName, version: '1.0.0', unique: true }).then((result) => {\n tempFolder = result?.tempFolder ?? null;\n });\n });\n\n afterEach(() => {\n cy.task('unpublishPackage', { pkgName, tempFolder: tempFolder ?? undefined });\n if (tempFolder) {\n cy.task('cleanupPublished', tempFolder);\n }\n tempFolder = null;\n });\n\n maybeIt(features.provenance.sidebarSection)('should not render the section', () => {\n cy.visit(`${config.registryUrl}/-/web/detail/${pkgName}`);\n cy.getByTestId(pkg.sidebar).should('be.visible');\n cy.getByTestId(pkg.provenanceBadge).should('not.exist');\n });\n });\n });\n}\n"],"mappings":";;;;;;;;;;;;;AAeA,SAAgB,gBAAgB,QAAwB;CACtD,MAAM,EAAE,aAAa;CACrB,MAAM,EAAE,SAAS,QAAQ,OAAO;CAEhC,MAAM,eAAe;EACnB,KAAK;EACL,YAAY,EAAE,eAAe,iCAAiC;CAChE;CACA,MAAM,aAAa,CAAC;EAAE,OAAO;EAA0B,KAAK;CAAa,CAAC;CAE1E,SAAS,oBAAoB;EAC3B,SAAS,kCAAkC;GACzC,MAAM,UAAU;GAChB,IAAI,aAA4B;GAEhC,iBAAiB;IACf,GAAG,KAAK,kBAAkB;KACxB;KACA,SAAS;KACT,QAAQ;KACR,UAAU,EAAE,MAAM;MAAE;MAAY;KAAa,EAAE;IACjD,CAAC,CAAC,CAAC,MAAM,WAAW;KAClB,aAAa,QAAQ,cAAc;IACrC,CAAC;GACH,CAAC;GAED,gBAAgB;IACd,GAAG,KAAK,oBAAoB;KAAE;KAAS,YAAY,cAAc,KAAA;IAAU,CAAC;IAC5E,IAAI,YACF,GAAG,KAAK,oBAAoB,UAAU;IAExC,aAAa;GACf,CAAC;GAED,QAAQ,SAAS,WAAW,cAAc,CAAC,CACzC,8EACM;IACJ,GAAG,UAAU,OAAO,6BAA6B,QAAQ,EAAE,CAAC,CAAC,GAAG,SAAS;IACzE,GAAG,UAAU,OAAO,wCAAwC,QAAQ,EAAE,CAAC,CAAC,GAAG,SAAS;IAEpF,GAAG,MAAM,GAAG,OAAO,YAAY,gBAAgB,SAAS;IACxD,GAAG,KAAK,YAAY,EAAE,SAAS,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AAQ,EAAE,CAAC,CAAC,GAAG,SAAS;IAEpF,GAAG,MAAM,GAAG,OAAO,YAAY,gBAAgB,SAAS;IAExD,GAAG,YAAY,IAAI,eAAe,CAAC,CAChC,eAAe,CAAC,CAChB,OAAO,YAAY,CAAC,CACpB,IAAI,gBAAgB,oBAAoB;IAC3C,GAAG,YAAY,IAAI,eAAe,CAAC,CAAC,MAAM;IAC1C,GAAG,YAAY,IAAI,gBAAgB,CAAC,CAAC,aAAa;KAChD,GAAG,SAAS,WAAW,EAAE,CAAC,KAAK;IACjC,CAAC;IAED,GAAG,IAAI,cAAc,CAAC,CAAC,OAAO,eAAe,CAAC;GAChD,CACF;EACF,CAAC;EAED,SAAS,qCAAqC;GAC5C,MAAM,UAAU;GAChB,IAAI,aAA4B;GAEhC,iBAAiB;IACf,GAAG,KAAK,kBAAkB;KAAE;KAAS,SAAS;KAAS,QAAQ;IAAK,CAAC,CAAC,CAAC,MAAM,WAAW;KACtF,aAAa,QAAQ,cAAc;IACrC,CAAC;GACH,CAAC;GAED,gBAAgB;IACd,GAAG,KAAK,oBAAoB;KAAE;KAAS,YAAY,cAAc,KAAA;IAAU,CAAC;IAC5E,IAAI,YACF,GAAG,KAAK,oBAAoB,UAAU;IAExC,aAAa;GACf,CAAC;GAED,QAAQ,SAAS,WAAW,cAAc,CAAC,CAAC,uCAAuC;IACjF,GAAG,MAAM,GAAG,OAAO,YAAY,gBAAgB,SAAS;IACxD,GAAG,YAAY,IAAI,OAAO,CAAC,CAAC,OAAO,YAAY;IAC/C,GAAG,YAAY,IAAI,eAAe,CAAC,CAAC,OAAO,WAAW;GACxD,CAAC;EACH,CAAC;CACH,CAAC;AACH"}
|
package/build/features.d.ts
CHANGED
|
@@ -271,6 +271,18 @@ export interface Features {
|
|
|
271
271
|
*/
|
|
272
272
|
settingsPublishTab: boolean;
|
|
273
273
|
};
|
|
274
|
+
provenance: {
|
|
275
|
+
/**
|
|
276
|
+
* Whether to run the "Provenance" sidebar section tests: a version
|
|
277
|
+
* carrying `dist.attestations` or `dist.signatures` shows a chip
|
|
278
|
+
* under "Distribution" that opens a dialog with the statement type,
|
|
279
|
+
* the signing key ids and a link to the attestation bundle, and the
|
|
280
|
+
* build details are only requested when the server announces the
|
|
281
|
+
* endpoint (`capabilities.provenance`). Ships with 9.x
|
|
282
|
+
* (verdaccio/verdaccio#6447) — probe, defaults to `false`.
|
|
283
|
+
*/
|
|
284
|
+
sidebarSection: boolean;
|
|
285
|
+
};
|
|
274
286
|
changePassword: {
|
|
275
287
|
/**
|
|
276
288
|
* Whether to run the happy-path test (submit valid change,
|
package/build/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type { Features } from './features';
|
|
|
6
6
|
export { DEFAULT_SELECTORS, DEFAULT_TEST_IDS } from './testIds';
|
|
7
7
|
export { DEFAULT_FEATURES, maybeIt } from './features';
|
|
8
8
|
export { publishPackage, cleanupPublished, unpublishPackage } from './tasks';
|
|
9
|
-
export { homeTests, signinTests, publishTests, searchTests, settingsTests, layoutTests, changePasswordTests, detailTests, failureModeTests, i18nKeyTests, manifestRenderingTests, sessionTests, signupTests, homeDetailUxTests, } from './tests';
|
|
9
|
+
export { homeTests, signinTests, publishTests, searchTests, settingsTests, layoutTests, changePasswordTests, detailTests, failureModeTests, i18nKeyTests, manifestRenderingTests, sessionTests, signupTests, homeDetailUxTests, provenanceTests, } from './tests';
|
|
10
10
|
/**
|
|
11
11
|
* Build a full RegistryConfig from user-provided options with defaults.
|
|
12
12
|
*
|
package/build/testIds.d.ts
CHANGED
|
@@ -117,6 +117,10 @@ export interface TestIds {
|
|
|
117
117
|
installNpmrc: string;
|
|
118
118
|
/** Copy button of the `.npmrc` registry line. */
|
|
119
119
|
installNpmrcCopy: string;
|
|
120
|
+
/** Chip of the "Provenance" sidebar section that opens the provenance dialog (9.x). */
|
|
121
|
+
provenanceBadge: string;
|
|
122
|
+
/** Root of the provenance dialog (shares the registry info dialog container). */
|
|
123
|
+
provenanceDialog: string;
|
|
120
124
|
/** Tab that shows the readme. */
|
|
121
125
|
readmeTab: string;
|
|
122
126
|
/** Keyword list below the install section. */
|
package/build/tests/index.d.ts
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RegistryConfig } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* "Provenance" sidebar section (9.x, verdaccio/verdaccio#6447).
|
|
4
|
+
*
|
|
5
|
+
* registry.npmjs.org attaches `dist.signatures` and `dist.attestations` to
|
|
6
|
+
* every version it signs; the UI shows them without verifying anything in
|
|
7
|
+
* the browser. The fixtures below publish those fields themselves (npm keeps
|
|
8
|
+
* extra `dist` fields on publish), so the suite runs offline and does not
|
|
9
|
+
* need an uplink. The build details come from the registry only when it
|
|
10
|
+
* announces the endpoint, so against this fixture the dialog ends at the
|
|
11
|
+
* summary.
|
|
12
|
+
*/
|
|
13
|
+
export declare function provenanceTests(config: RegistryConfig): void;
|