@verdaccio/e2e-ui 2.7.0 → 2.8.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/build/cjs/features.cjs +14 -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 +23 -1
- package/build/cjs/testIds.cjs.map +1 -1
- package/build/cjs/tests/change-password.cjs +20 -6
- package/build/cjs/tests/change-password.cjs.map +1 -1
- package/build/cjs/tests/home-detail-ux.cjs +166 -0
- package/build/cjs/tests/home-detail-ux.cjs.map +1 -0
- package/build/cjs/tests/index.cjs +2 -0
- package/build/cjs/tests/publish.cjs +1 -1
- package/build/cjs/tests/publish.cjs.map +1 -1
- package/build/cjs/tests/settings.cjs +5 -2
- package/build/cjs/tests/settings.cjs.map +1 -1
- package/build/esm/features.js +14 -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 +23 -1
- package/build/esm/testIds.js.map +1 -1
- package/build/esm/tests/change-password.js +20 -6
- package/build/esm/tests/change-password.js.map +1 -1
- package/build/esm/tests/home-detail-ux.js +166 -0
- package/build/esm/tests/home-detail-ux.js.map +1 -0
- package/build/esm/tests/index.js +2 -1
- package/build/esm/tests/publish.js +1 -1
- package/build/esm/tests/publish.js.map +1 -1
- package/build/esm/tests/settings.js +5 -2
- package/build/esm/tests/settings.js.map +1 -1
- package/build/features.d.ts +45 -0
- package/build/index.d.ts +1 -1
- package/build/testIds.d.ts +34 -0
- package/build/tests/home-detail-ux.d.ts +10 -0
- package/build/tests/index.d.ts +1 -0
- package/package.json +1 -1
package/build/cjs/features.cjs
CHANGED
|
@@ -47,6 +47,16 @@ var DEFAULT_FEATURES = {
|
|
|
47
47
|
happyPath: false,
|
|
48
48
|
validation: false
|
|
49
49
|
},
|
|
50
|
+
homeDetailUx: {
|
|
51
|
+
homeToolbar: false,
|
|
52
|
+
detailTabInUrl: false,
|
|
53
|
+
welcomeGuide: false,
|
|
54
|
+
installBunAndNpmrc: false,
|
|
55
|
+
copyFeedback: false,
|
|
56
|
+
searchGrouping: false,
|
|
57
|
+
versionLink: false,
|
|
58
|
+
settingsPublishTab: false
|
|
59
|
+
},
|
|
50
60
|
changePassword: {
|
|
51
61
|
happyPath: true,
|
|
52
62
|
validation: true,
|
|
@@ -108,6 +118,10 @@ function mergeFeatures(defaults, overrides) {
|
|
|
108
118
|
...defaults.signup,
|
|
109
119
|
...overrides.signup
|
|
110
120
|
},
|
|
121
|
+
homeDetailUx: {
|
|
122
|
+
...defaults.homeDetailUx,
|
|
123
|
+
...overrides.homeDetailUx
|
|
124
|
+
},
|
|
111
125
|
changePassword: {
|
|
112
126
|
...defaults.changePassword,
|
|
113
127
|
...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 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 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 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":";;AA2QA,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,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,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.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,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"}
|
package/build/cjs/index.cjs
CHANGED
|
@@ -15,6 +15,7 @@ const require_i18n_keys = require("./tests/i18n-keys.cjs");
|
|
|
15
15
|
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
|
+
const require_home_detail_ux = require("./tests/home-detail-ux.cjs");
|
|
18
19
|
require("./tests/index.cjs");
|
|
19
20
|
let fs = require("fs");
|
|
20
21
|
//#region src/index.ts
|
|
@@ -175,6 +176,7 @@ function registerAllTests(config) {
|
|
|
175
176
|
require_manifest_rendering.manifestRenderingTests(config);
|
|
176
177
|
require_session.sessionTests(config);
|
|
177
178
|
require_signup.signupTests(config);
|
|
179
|
+
require_home_detail_ux.homeDetailUxTests(config);
|
|
178
180
|
require_change_password.changePasswordTests(config);
|
|
179
181
|
}
|
|
180
182
|
//#endregion
|
|
@@ -186,6 +188,7 @@ exports.cleanupPublished = require_publish.cleanupPublished;
|
|
|
186
188
|
exports.createRegistryConfig = createRegistryConfig;
|
|
187
189
|
exports.detailTests = require_detail.detailTests;
|
|
188
190
|
exports.failureModeTests = require_failure_modes.failureModeTests;
|
|
191
|
+
exports.homeDetailUxTests = require_home_detail_ux.homeDetailUxTests;
|
|
189
192
|
exports.homeTests = require_home.homeTests;
|
|
190
193
|
exports.i18nKeyTests = require_i18n_keys.i18nKeyTests;
|
|
191
194
|
exports.layoutTests = require_layout.layoutTests;
|
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 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} 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 changePasswordTests(config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0EA,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;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Aa,OAAO;IACpB,MAAM,OAAO;GACf;EACF;;;;;;;;;;;EAWA,MAAM,eAAe,OAA+D;GAClF,OAAO,gBAAA,eAAe;IACpB,aAAa,MAAM,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,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,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 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);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vB,kBAAA,aAAa,MAAM;CACnB,2BAAA,uBAAuB,MAAM;CAC7B,gBAAA,aAAa,MAAM;CACnB,eAAA,YAAY,MAAM;CAClB,uBAAA,kBAAkB,MAAM;CACxB,wBAAA,oBAAoB,MAAM;AAC5B"}
|
package/build/cjs/testIds.cjs
CHANGED
|
@@ -6,7 +6,14 @@
|
|
|
6
6
|
var DEFAULT_TEST_IDS = {
|
|
7
7
|
home: {
|
|
8
8
|
helpCard: "help-card",
|
|
9
|
-
notFound: "404"
|
|
9
|
+
notFound: "404",
|
|
10
|
+
packageListToolbar: "package-list-toolbar",
|
|
11
|
+
packageListFilter: "package-list-filter",
|
|
12
|
+
packageListScope: "package-list-scope",
|
|
13
|
+
packageListNoMatch: "package-list-no-match",
|
|
14
|
+
helpSetupTabPrefix: "help-setup-",
|
|
15
|
+
helpUplinksNote: "help-uplinks-note",
|
|
16
|
+
helpGuide: "help-guide"
|
|
10
17
|
},
|
|
11
18
|
header: {
|
|
12
19
|
container: "header",
|
|
@@ -17,6 +24,8 @@ var DEFAULT_TEST_IDS = {
|
|
|
17
24
|
customLogo: "custom-logo",
|
|
18
25
|
loginButton: "header--button-login",
|
|
19
26
|
settingsTooltip: "header--tooltip-settings",
|
|
27
|
+
settingsPublishTab: "settings-publish-tab",
|
|
28
|
+
settingsPublishPanel: "settings-publish",
|
|
20
29
|
infoTooltip: "header--tooltip-info",
|
|
21
30
|
themeSwitchLight: "header--button--light",
|
|
22
31
|
themeSwitchDark: "header--button--dark",
|
|
@@ -36,12 +45,17 @@ var DEFAULT_TEST_IDS = {
|
|
|
36
45
|
package: {
|
|
37
46
|
itemList: "package-item-list",
|
|
38
47
|
title: "package-title",
|
|
48
|
+
versionLink: "package-version-link",
|
|
39
49
|
readme: "readme",
|
|
40
50
|
sidebar: "sidebar",
|
|
41
51
|
installList: "installList",
|
|
42
52
|
installNpm: "installListItem-npm",
|
|
43
53
|
installYarn: "installListItem-yarn",
|
|
44
54
|
installPnpm: "installListItem-pnpm",
|
|
55
|
+
installBun: "installListItem-bun",
|
|
56
|
+
installNpmrc: "install-npmrc",
|
|
57
|
+
installNpmrcCopy: "installNpmrc",
|
|
58
|
+
readmeTab: "readme-tab",
|
|
45
59
|
keywordList: "keyword-list",
|
|
46
60
|
dependenciesTab: "dependencies-tab",
|
|
47
61
|
dependencies: "dependencies",
|
|
@@ -55,6 +69,10 @@ var DEFAULT_TEST_IDS = {
|
|
|
55
69
|
rawViewerDialog: "rawViewer--dialog",
|
|
56
70
|
closeRawViewer: "close-raw-viewer"
|
|
57
71
|
},
|
|
72
|
+
search: {
|
|
73
|
+
groupPrefix: "search-group-",
|
|
74
|
+
originPrefix: "search-origin-"
|
|
75
|
+
},
|
|
58
76
|
errors: { genericError: "generic-error" }
|
|
59
77
|
};
|
|
60
78
|
/**
|
|
@@ -105,6 +123,10 @@ function mergeTestIds(defaults, overrides) {
|
|
|
105
123
|
...defaults.package,
|
|
106
124
|
...overrides.package
|
|
107
125
|
},
|
|
126
|
+
search: {
|
|
127
|
+
...defaults.search,
|
|
128
|
+
...overrides.search
|
|
129
|
+
},
|
|
108
130
|
errors: {
|
|
109
131
|
...defaults.errors,
|
|
110
132
|
...overrides.errors
|
|
@@ -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 };\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 /** 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 /** 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 /** 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 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 },\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 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 readme: 'readme',\n sidebar: 'sidebar',\n installList: 'installList',\n installNpm: 'installListItem-npm',\n installYarn: 'installListItem-yarn',\n installPnpm: 'installListItem-pnpm',\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 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 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":";;;;;AAiKA,IAAa,mBAA4B;CACvC,MAAM;EACJ,UAAU;EACV,UAAU;CACZ;CACA,QAAQ;EACN,WAAW;EACX,aAAa;EACb,OAAO;EACP,iBAAiB;EACjB,aAAa;EACb,YAAY;EACZ,aAAa;EACb,iBAAiB;EACjB,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,QAAQ;EACR,SAAS;EACT,aAAa;EACb,YAAY;EACZ,aAAa;EACb,aAAa;EACb,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,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;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 /** 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;EACP,aAAa;EACb,QAAQ;EACR,SAAS;EACT,aAAa;EACb,YAAY;EACZ,aAAa;EACb,aAAa;EACb,YAAY;EACZ,cAAc;EACd,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"}
|
|
@@ -31,6 +31,13 @@ function changePasswordTests(config) {
|
|
|
31
31
|
const { header, login } = config.testIds;
|
|
32
32
|
const { loginDialog } = config.selectors;
|
|
33
33
|
const { features } = config;
|
|
34
|
+
const typeUsernameIfPresent = (user) => {
|
|
35
|
+
cy.get("input[name=\"oldPassword\"]").should("exist");
|
|
36
|
+
cy.get("form").then(($form) => {
|
|
37
|
+
const $username = $form.find("input[name=\"username\"]");
|
|
38
|
+
if ($username.length) cy.wrap($username).type(user);
|
|
39
|
+
});
|
|
40
|
+
};
|
|
34
41
|
describe("change password", () => {
|
|
35
42
|
const CHANGE_PASSWORD_PATH = "/-/web/change-password";
|
|
36
43
|
const { user, password } = config.credentials;
|
|
@@ -84,7 +91,7 @@ function changePasswordTests(config) {
|
|
|
84
91
|
});
|
|
85
92
|
cy.wait("@signChangePwdRestore").its("response.statusCode").should("eq", 200);
|
|
86
93
|
cy.visit(CHANGE_PASSWORD_PATH);
|
|
87
|
-
|
|
94
|
+
typeUsernameIfPresent(user);
|
|
88
95
|
cy.get("input[name=\"oldPassword\"]").type(currentPassword);
|
|
89
96
|
cy.get("input[name=\"newPassword\"]").type(password);
|
|
90
97
|
cy.get("input[name=\"confirmPassword\"]").type(password);
|
|
@@ -95,27 +102,34 @@ function changePasswordTests(config) {
|
|
|
95
102
|
cy.get("form button[type=\"submit\"]").should("be.disabled");
|
|
96
103
|
});
|
|
97
104
|
require_features.maybeIt(features.changePassword.validation)("should keep submit disabled when new and confirm passwords mismatch", () => {
|
|
98
|
-
|
|
105
|
+
typeUsernameIfPresent(user);
|
|
99
106
|
cy.get("input[name=\"oldPassword\"]").type(currentPassword);
|
|
100
107
|
cy.get("input[name=\"newPassword\"]").type("newSecretPass123");
|
|
101
108
|
cy.get("input[name=\"confirmPassword\"]").type("different-value");
|
|
102
109
|
cy.get("form button[type=\"submit\"]").should("be.disabled");
|
|
103
110
|
});
|
|
104
|
-
require_features.maybeIt(features.changePassword.wrongOldPassword)("should show an error
|
|
111
|
+
require_features.maybeIt(features.changePassword.wrongOldPassword)("should show an error when the old password is wrong", () => {
|
|
105
112
|
cy.intercept("PUT", "/-/verdaccio/sec/reset_password").as("reset");
|
|
106
|
-
|
|
113
|
+
typeUsernameIfPresent(user);
|
|
107
114
|
cy.get("input[name=\"oldPassword\"]").type("definitely-wrong-xyz");
|
|
108
115
|
cy.get("input[name=\"newPassword\"]").type("newSecretPass123");
|
|
109
116
|
cy.get("input[name=\"confirmPassword\"]").type("newSecretPass123");
|
|
110
117
|
cy.get("form button[type=\"submit\"]").should("not.be.disabled").click();
|
|
111
118
|
cy.wait("@reset").its("response.statusCode").should("not.eq", 200);
|
|
112
|
-
cy.
|
|
119
|
+
cy.get("form", { timeout: 5e3 }).should(($form) => {
|
|
120
|
+
const $banner = $form.find(`[data-testid="${login.error}"]`);
|
|
121
|
+
const $invalidField = $form.find("input[name=\"oldPassword\"][aria-invalid=\"true\"]");
|
|
122
|
+
expect($banner.length + $invalidField.length, "error shown").to.be.greaterThan(0);
|
|
123
|
+
const message = $banner.length ? $banner.text() : $invalidField.closest(".MuiFormControl-root").find(".MuiFormHelperText-root").text();
|
|
124
|
+
expect(message.trim()).to.not.be.empty;
|
|
125
|
+
expect(message).to.not.contain("Cannot PUT");
|
|
126
|
+
});
|
|
113
127
|
cy.location("pathname").should("include", CHANGE_PASSWORD_PATH);
|
|
114
128
|
});
|
|
115
129
|
require_features.maybeIt(features.changePassword.happyPath)("should change the password and navigate to the success page", () => {
|
|
116
130
|
const newPassword = `${currentPassword}-rotated`;
|
|
117
131
|
cy.intercept("PUT", "/-/verdaccio/sec/reset_password").as("reset");
|
|
118
|
-
|
|
132
|
+
typeUsernameIfPresent(user);
|
|
119
133
|
cy.get("input[name=\"oldPassword\"]").type(currentPassword);
|
|
120
134
|
cy.get("input[name=\"newPassword\"]").type(newPassword);
|
|
121
135
|
cy.get("input[name=\"confirmPassword\"]").type(newPassword);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"change-password.cjs","names":[],"sources":["../../../src/tests/change-password.ts"],"sourcesContent":["/// <reference types=\"cypress\" />\nimport { maybeIt } from '../features';\nimport { RegistryConfig } from '../types';\n\n/**\n * Tests for the Change Password page at /-/web/change-password.\n *\n * The page renders only when the server is started with\n * `flags.changePassword: true` (otherwise the React component\n * redirects to `/` on mount). Each test logs in first, navigates\n * directly to the page, and drives the form.\n *\n * Selector strategy: the ChangePassword form does not ship stable\n * `id`/testid attributes on its inputs, but every field is registered\n * via react-hook-form's `register('<name>')`, which sets a stable\n * `name` attribute on the underlying `<input>`. The labels themselves\n * are `t('security.changePassword.*')` calls — when the i18n bundle\n * hasn't finished loading (or isn't loaded at all on this route), MUI\n * renders the literal i18n key as the label, so any selector that\n * matches on visible label text silently misses every field and the\n * form stays empty (which would also make the mismatch test \"pass\"\n * for the wrong reason: the submit button is disabled because the\n * form is empty, not because yup rejected the mismatch).\n *\n * The stable, i18n-independent contract from ChangePassword.tsx is:\n * register('username') → input[name=\"username\"]\n * register('oldPassword') → input[name=\"oldPassword\"]\n * register('newPassword') → input[name=\"newPassword\"]\n * register('confirmPassword') → input[name=\"confirmPassword\"]\n * submit button → form button[type=\"submit\"]\n */\nexport function changePasswordTests(config: RegistryConfig) {\n const { header, login } = config.testIds;\n const { loginDialog } = config.selectors;\n const { features } = config;\n\n // The wrongOldPassword banner text differs across verdaccio lines: older\n // published ui-theme shows a hardcoded \"Failed to change password\", while\n // current master surfaces the server message (\"internal server error\") or\n // the i18n fallback (\"Unable to change password\") via authErrorMessage. The\n // contract this test pins is \"a non-empty error banner appears, not\n // silence\", so it asserts visibility + non-empty text rather than an exact\n // string. The Express \"Cannot PUT\" 404 body is the one text that must never\n // appear — that means the reset_password route was not registered (the\n // server was started without flags.changePassword).\n\n describe('change password', () => {\n const CHANGE_PASSWORD_PATH = '/-/web/change-password';\n const { user, password } = config.credentials;\n\n /**\n * Tests mutate the user's password. We track the \"current\" value\n * across tests so the `after()` hook can restore the original,\n * leaving the registry in the same state other suites assume.\n */\n let currentPassword = password;\n\n /**\n * Capability check. The ChangePassword page's `useEffect` redirects\n * to `/` whenever `configuration.flags.changePassword` is not truthy\n * — which is the case on any registry that either (a) didn't set\n * `flags.changePassword: true` in its config, or (b) runs a\n * verdaccio build whose middleware doesn't yet propagate the flag\n * into `__VERDACCIO_BASENAME_UI_OPTIONS` (older `verdaccio:6`\n * tagged images fall in this bucket).\n *\n * In either case the suite has nothing to exercise, so skip the\n * whole describe with a clear reason rather than burning five\n * seconds per test on cy.contains timeouts.\n */\n before(function () {\n cy.visit(config.registryUrl);\n cy.window().then((win) => {\n const opts = (win as any).__VERDACCIO_BASENAME_UI_OPTIONS;\n const enabled = !!opts?.flags?.changePassword;\n if (!enabled) {\n // eslint-disable-next-line no-console\n console.warn(\n '[change-password] server did not advertise flags.changePassword=true ' +\n '— skipping suite. ui-options.flags: ' +\n JSON.stringify(opts?.flags ?? {})\n );\n this.skip();\n }\n });\n });\n\n beforeEach(() => {\n // Intercept the login POST and wait on it explicitly instead of\n // leaning on a visual sentinel — mirrors the pattern used by\n // signinTests and avoids a race between cy.login's fire-and-forget\n // submit and the next cy.visit.\n cy.intercept('POST', '/-/verdaccio/sec/login').as('signChangePwd');\n cy.visit(config.registryUrl);\n cy.login(user, currentPassword, {\n loginButton: header.loginButton,\n ...loginDialog,\n });\n cy.wait('@signChangePwd').its('response.statusCode').should('eq', 200);\n\n cy.visit(CHANGE_PASSWORD_PATH);\n // If flags.changePassword is off server-side, the component's\n // useEffect redirects to `/` and this assertion times out — which\n // is the correct signal that the registry is misconfigured.\n // Use the stable `type=\"submit\"` selector so the assertion is\n // independent of whether the i18n bundle has resolved by now.\n cy.get('form button[type=\"submit\"]', { timeout: 5000 }).should('be.visible');\n });\n\n after(() => {\n // Restore the original password so subsequent spec files\n // (and retries) can still log in with `config.credentials`.\n if (currentPassword === password) return;\n cy.intercept('POST', '/-/verdaccio/sec/login').as('signChangePwdRestore');\n cy.visit(config.registryUrl);\n cy.login(user, currentPassword, {\n loginButton: header.loginButton,\n ...loginDialog,\n });\n cy.wait('@signChangePwdRestore').its('response.statusCode').should('eq', 200);\n cy.visit(CHANGE_PASSWORD_PATH);\n cy.get('input[name=\"username\"]').type(user);\n cy.get('input[name=\"oldPassword\"]').type(currentPassword);\n cy.get('input[name=\"newPassword\"]').type(password);\n cy.get('input[name=\"confirmPassword\"]').type(password);\n cy.get('form button[type=\"submit\"]').click();\n currentPassword = password;\n });\n\n // ── Validation (client-side yup) ─────────────────────────────\n\n maybeIt(features.changePassword.validation)(\n 'should disable the submit button while the form is empty',\n () => {\n cy.get('form button[type=\"submit\"]').should('be.disabled');\n }\n );\n\n maybeIt(features.changePassword.validation)(\n 'should keep submit disabled when new and confirm passwords mismatch',\n () => {\n cy.get('input[name=\"username\"]').type(user);\n cy.get('input[name=\"oldPassword\"]').type(currentPassword);\n cy.get('input[name=\"newPassword\"]').type('newSecretPass123');\n cy.get('input[name=\"confirmPassword\"]').type('different-value');\n // yup schema rejects mismatch → isValid stays false → button disabled.\n cy.get('form button[type=\"submit\"]').should('be.disabled');\n }\n );\n\n // ── Server error path ────────────────────────────────────────\n\n maybeIt(features.changePassword.wrongOldPassword)(\n 'should show an error banner when the old password is wrong',\n () => {\n cy.intercept('PUT', '/-/verdaccio/sec/reset_password').as('reset');\n cy.get('input[name=\"username\"]').type(user);\n cy.get('input[name=\"oldPassword\"]').type('definitely-wrong-xyz');\n cy.get('input[name=\"newPassword\"]').type('newSecretPass123');\n cy.get('input[name=\"confirmPassword\"]').type('newSecretPass123');\n cy.get('form button[type=\"submit\"]').should('not.be.disabled').click();\n // Server rejects the wrong password (the route exists → not a 404).\n cy.wait('@reset').its('response.statusCode').should('not.eq', 200);\n // onSubmit's catch sets errors.root → rendered via LoginDialogFormError.\n // Assert a non-empty banner (not silence), text-agnostic across lines,\n // but never the raw \"Cannot PUT\" 404 (route missing).\n cy.getByTestId(login.error, { timeout: 5000 })\n .should('be.visible')\n .and('not.contain.text', 'Cannot PUT')\n .invoke('text')\n .then((text) => expect(text.trim()).to.not.be.empty);\n // Still on the change-password page so the user can retry.\n cy.location('pathname').should('include', CHANGE_PASSWORD_PATH);\n }\n );\n\n // ── Happy path (mutates state; keeps `currentPassword` in sync) ─\n\n maybeIt(features.changePassword.happyPath)(\n 'should change the password and navigate to the success page',\n () => {\n const newPassword = `${currentPassword}-rotated`;\n cy.intercept('PUT', '/-/verdaccio/sec/reset_password').as('reset');\n\n cy.get('input[name=\"username\"]').type(user);\n cy.get('input[name=\"oldPassword\"]').type(currentPassword);\n cy.get('input[name=\"newPassword\"]').type(newPassword);\n cy.get('input[name=\"confirmPassword\"]').type(newPassword);\n cy.get('form button[type=\"submit\"]').should('not.be.disabled').click();\n\n cy.wait('@reset').its('response.statusCode').should('eq', 200);\n // Post-submit the component navigates to Route.SUCCESS with a\n // messageType query param. Assert the pathname; the message text\n // is i18n-driven and out of scope for this selector layer.\n cy.location('pathname', { timeout: 5000 }).should('include', '/-/web/success');\n\n // Track the rotation so `after()` can restore it.\n currentPassword = newPassword;\n }\n );\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,SAAgB,oBAAoB,QAAwB;CAC1D,MAAM,EAAE,QAAQ,UAAU,OAAO;CACjC,MAAM,EAAE,gBAAgB,OAAO;CAC/B,MAAM,EAAE,aAAa;CAYrB,SAAS,yBAAyB;EAChC,MAAM,uBAAuB;EAC7B,MAAM,EAAE,MAAM,aAAa,OAAO;;;;;;EAOlC,IAAI,kBAAkB;;;;;;;;;;;;;;EAetB,OAAO,WAAY;GACjB,GAAG,MAAM,OAAO,WAAW;GAC3B,GAAG,OAAO,CAAC,CAAC,MAAM,QAAQ;IACxB,MAAM,OAAQ,IAAY;IAE1B,IAAI,CAAC,CADY,CAAC,MAAM,OAAO,gBACjB;KAEZ,QAAQ,KACN,8GAEE,KAAK,UAAU,MAAM,SAAS,CAAC,CAAC,CACpC;KACA,KAAK,KAAK;IACZ;GACF,CAAC;EACH,CAAC;EAED,iBAAiB;GAKf,GAAG,UAAU,QAAQ,wBAAwB,CAAC,CAAC,GAAG,eAAe;GACjE,GAAG,MAAM,OAAO,WAAW;GAC3B,GAAG,MAAM,MAAM,iBAAiB;IAC9B,aAAa,OAAO;IACpB,GAAG;GACL,CAAC;GACD,GAAG,KAAK,gBAAgB,CAAC,CAAC,IAAI,qBAAqB,CAAC,CAAC,OAAO,MAAM,GAAG;GAErE,GAAG,MAAM,oBAAoB;GAM7B,GAAG,IAAI,gCAA8B,EAAE,SAAS,IAAK,CAAC,CAAC,CAAC,OAAO,YAAY;EAC7E,CAAC;EAED,YAAY;GAGV,IAAI,oBAAoB,UAAU;GAClC,GAAG,UAAU,QAAQ,wBAAwB,CAAC,CAAC,GAAG,sBAAsB;GACxE,GAAG,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,CAAC,CAAC,KAAK,kBAAkB;GAC/D,GAAG,IAAI,8BAA4B,CAAC,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM;GAErE,GAAG,KAAK,QAAQ,CAAC,CAAC,IAAI,qBAAqB,CAAC,CAAC,OAAO,UAAU,GAAG;GAIjE,GAAG,YAAY,MAAM,OAAO,EAAE,SAAS,IAAK,CAAC,CAAC,CAC3C,OAAO,YAAY,CAAC,CACpB,IAAI,oBAAoB,YAAY,CAAC,CACrC,OAAO,MAAM,CAAC,CACd,MAAM,SAAS,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,KAAK;GAErD,GAAG,SAAS,UAAU,CAAC,CAAC,OAAO,WAAW,oBAAoB;EAChE,CACF;EAIA,iBAAA,QAAQ,SAAS,eAAe,SAAS,CAAC,CACxC,qEACM;GACJ,MAAM,cAAc,GAAG,gBAAgB;GACvC,GAAG,UAAU,OAAO,iCAAiC,CAAC,CAAC,GAAG,OAAO;GAEjE,GAAG,IAAI,0BAAwB,CAAC,CAAC,KAAK,IAAI;GAC1C,GAAG,IAAI,6BAA2B,CAAC,CAAC,KAAK,eAAe;GACxD,GAAG,IAAI,6BAA2B,CAAC,CAAC,KAAK,WAAW;GACpD,GAAG,IAAI,iCAA+B,CAAC,CAAC,KAAK,WAAW;GACxD,GAAG,IAAI,8BAA4B,CAAC,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM;GAErE,GAAG,KAAK,QAAQ,CAAC,CAAC,IAAI,qBAAqB,CAAC,CAAC,OAAO,MAAM,GAAG;GAI7D,GAAG,SAAS,YAAY,EAAE,SAAS,IAAK,CAAC,CAAC,CAAC,OAAO,WAAW,gBAAgB;GAG7E,kBAAkB;EACpB,CACF;CACF,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"change-password.cjs","names":[],"sources":["../../../src/tests/change-password.ts"],"sourcesContent":["/// <reference types=\"cypress\" />\nimport { maybeIt } from '../features';\nimport { RegistryConfig } from '../types';\n\n/**\n * Tests for the Change Password page at /-/web/change-password.\n *\n * The page renders only when the server is started with\n * `flags.changePassword: true` (otherwise the React component\n * redirects to `/` on mount). Each test logs in first, navigates\n * directly to the page, and drives the form.\n *\n * Selector strategy: the ChangePassword form does not ship stable\n * `id`/testid attributes on its inputs, but every field is registered\n * via react-hook-form's `register('<name>')`, which sets a stable\n * `name` attribute on the underlying `<input>`. The labels themselves\n * are `t('security.changePassword.*')` calls — when the i18n bundle\n * hasn't finished loading (or isn't loaded at all on this route), MUI\n * renders the literal i18n key as the label, so any selector that\n * matches on visible label text silently misses every field and the\n * form stays empty (which would also make the mismatch test \"pass\"\n * for the wrong reason: the submit button is disabled because the\n * form is empty, not because yup rejected the mismatch).\n *\n * The stable, i18n-independent contract from ChangePassword.tsx is:\n * register('username') → input[name=\"username\"]\n * register('oldPassword') → input[name=\"oldPassword\"]\n * register('newPassword') → input[name=\"newPassword\"]\n * register('confirmPassword') → input[name=\"confirmPassword\"]\n * submit button → form button[type=\"submit\"]\n */\nexport function changePasswordTests(config: RegistryConfig) {\n const { header, login } = config.testIds;\n const { loginDialog } = config.selectors;\n const { features } = config;\n\n // The wrongOldPassword banner text differs across verdaccio lines: older\n // published ui-theme shows a hardcoded \"Failed to change password\", while\n // current master surfaces the server message (\"internal server error\") or\n // the i18n fallback (\"Unable to change password\") via authErrorMessage. The\n // contract this test pins is \"a non-empty error banner appears, not\n // silence\", so it asserts visibility + non-empty text rather than an exact\n // string. The Express \"Cannot PUT\" 404 body is the one text that must never\n // appear — that means the reset_password route was not registered (the\n // server was started without flags.changePassword).\n\n // the form asks for the username only on released UIs; 9.x takes it from the session\n const typeUsernameIfPresent = (user: string) => {\n cy.get('input[name=\"oldPassword\"]').should('exist');\n cy.get('form').then(($form) => {\n const $username = $form.find('input[name=\"username\"]');\n if ($username.length) cy.wrap($username).type(user);\n });\n };\n\n describe('change password', () => {\n const CHANGE_PASSWORD_PATH = '/-/web/change-password';\n const { user, password } = config.credentials;\n\n /**\n * Tests mutate the user's password. We track the \"current\" value\n * across tests so the `after()` hook can restore the original,\n * leaving the registry in the same state other suites assume.\n */\n let currentPassword = password;\n\n /**\n * Capability check. The ChangePassword page's `useEffect` redirects\n * to `/` whenever `configuration.flags.changePassword` is not truthy\n * — which is the case on any registry that either (a) didn't set\n * `flags.changePassword: true` in its config, or (b) runs a\n * verdaccio build whose middleware doesn't yet propagate the flag\n * into `__VERDACCIO_BASENAME_UI_OPTIONS` (older `verdaccio:6`\n * tagged images fall in this bucket).\n *\n * In either case the suite has nothing to exercise, so skip the\n * whole describe with a clear reason rather than burning five\n * seconds per test on cy.contains timeouts.\n */\n before(function () {\n cy.visit(config.registryUrl);\n cy.window().then((win) => {\n const opts = (win as any).__VERDACCIO_BASENAME_UI_OPTIONS;\n const enabled = !!opts?.flags?.changePassword;\n if (!enabled) {\n // eslint-disable-next-line no-console\n console.warn(\n '[change-password] server did not advertise flags.changePassword=true ' +\n '— skipping suite. ui-options.flags: ' +\n JSON.stringify(opts?.flags ?? {})\n );\n this.skip();\n }\n });\n });\n\n beforeEach(() => {\n // Intercept the login POST and wait on it explicitly instead of\n // leaning on a visual sentinel — mirrors the pattern used by\n // signinTests and avoids a race between cy.login's fire-and-forget\n // submit and the next cy.visit.\n cy.intercept('POST', '/-/verdaccio/sec/login').as('signChangePwd');\n cy.visit(config.registryUrl);\n cy.login(user, currentPassword, {\n loginButton: header.loginButton,\n ...loginDialog,\n });\n cy.wait('@signChangePwd').its('response.statusCode').should('eq', 200);\n\n cy.visit(CHANGE_PASSWORD_PATH);\n // If flags.changePassword is off server-side, the component's\n // useEffect redirects to `/` and this assertion times out — which\n // is the correct signal that the registry is misconfigured.\n // Use the stable `type=\"submit\"` selector so the assertion is\n // independent of whether the i18n bundle has resolved by now.\n cy.get('form button[type=\"submit\"]', { timeout: 5000 }).should('be.visible');\n });\n\n after(() => {\n // Restore the original password so subsequent spec files\n // (and retries) can still log in with `config.credentials`.\n if (currentPassword === password) return;\n cy.intercept('POST', '/-/verdaccio/sec/login').as('signChangePwdRestore');\n cy.visit(config.registryUrl);\n cy.login(user, currentPassword, {\n loginButton: header.loginButton,\n ...loginDialog,\n });\n cy.wait('@signChangePwdRestore').its('response.statusCode').should('eq', 200);\n cy.visit(CHANGE_PASSWORD_PATH);\n typeUsernameIfPresent(user);\n cy.get('input[name=\"oldPassword\"]').type(currentPassword);\n cy.get('input[name=\"newPassword\"]').type(password);\n cy.get('input[name=\"confirmPassword\"]').type(password);\n cy.get('form button[type=\"submit\"]').click();\n currentPassword = password;\n });\n\n // ── Validation (client-side yup) ─────────────────────────────\n\n maybeIt(features.changePassword.validation)(\n 'should disable the submit button while the form is empty',\n () => {\n cy.get('form button[type=\"submit\"]').should('be.disabled');\n }\n );\n\n maybeIt(features.changePassword.validation)(\n 'should keep submit disabled when new and confirm passwords mismatch',\n () => {\n typeUsernameIfPresent(user);\n cy.get('input[name=\"oldPassword\"]').type(currentPassword);\n cy.get('input[name=\"newPassword\"]').type('newSecretPass123');\n cy.get('input[name=\"confirmPassword\"]').type('different-value');\n // yup schema rejects mismatch → isValid stays false → button disabled.\n cy.get('form button[type=\"submit\"]').should('be.disabled');\n }\n );\n\n // ── Server error path ────────────────────────────────────────\n\n maybeIt(features.changePassword.wrongOldPassword)(\n 'should show an error when the old password is wrong',\n () => {\n cy.intercept('PUT', '/-/verdaccio/sec/reset_password').as('reset');\n typeUsernameIfPresent(user);\n cy.get('input[name=\"oldPassword\"]').type('definitely-wrong-xyz');\n cy.get('input[name=\"newPassword\"]').type('newSecretPass123');\n cy.get('input[name=\"confirmPassword\"]').type('newSecretPass123');\n cy.get('form button[type=\"submit\"]').should('not.be.disabled').click();\n // Server rejects the wrong password (the route exists → not a 404).\n cy.wait('@reset').its('response.statusCode').should('not.eq', 200);\n // onSubmit's catch sets errors.root → rendered via LoginDialogFormError.\n // Assert a non-empty banner (not silence), text-agnostic across lines,\n // but never the raw \"Cannot PUT\" 404 (route missing).\n // released UIs show a banner; 9.x flags the old password field instead\n cy.get('form', { timeout: 5000 }).should(($form) => {\n const $banner = $form.find(`[data-testid=\"${login.error}\"]`);\n const $invalidField = $form.find('input[name=\"oldPassword\"][aria-invalid=\"true\"]');\n expect($banner.length + $invalidField.length, 'error shown').to.be.greaterThan(0);\n const message = $banner.length\n ? $banner.text()\n : $invalidField.closest('.MuiFormControl-root').find('.MuiFormHelperText-root').text();\n expect(message.trim()).to.not.be.empty;\n expect(message).to.not.contain('Cannot PUT');\n });\n // Still on the change-password page so the user can retry.\n cy.location('pathname').should('include', CHANGE_PASSWORD_PATH);\n }\n );\n\n // ── Happy path (mutates state; keeps `currentPassword` in sync) ─\n\n maybeIt(features.changePassword.happyPath)(\n 'should change the password and navigate to the success page',\n () => {\n const newPassword = `${currentPassword}-rotated`;\n cy.intercept('PUT', '/-/verdaccio/sec/reset_password').as('reset');\n\n typeUsernameIfPresent(user);\n cy.get('input[name=\"oldPassword\"]').type(currentPassword);\n cy.get('input[name=\"newPassword\"]').type(newPassword);\n cy.get('input[name=\"confirmPassword\"]').type(newPassword);\n cy.get('form button[type=\"submit\"]').should('not.be.disabled').click();\n\n cy.wait('@reset').its('response.statusCode').should('eq', 200);\n // Post-submit the component navigates to Route.SUCCESS with a\n // messageType query param. Assert the pathname; the message text\n // is i18n-driven and out of scope for this selector layer.\n cy.location('pathname', { timeout: 5000 }).should('include', '/-/web/success');\n\n // Track the rotation so `after()` can restore it.\n currentPassword = newPassword;\n }\n );\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,SAAgB,oBAAoB,QAAwB;CAC1D,MAAM,EAAE,QAAQ,UAAU,OAAO;CACjC,MAAM,EAAE,gBAAgB,OAAO;CAC/B,MAAM,EAAE,aAAa;CAarB,MAAM,yBAAyB,SAAiB;EAC9C,GAAG,IAAI,6BAA2B,CAAC,CAAC,OAAO,OAAO;EAClD,GAAG,IAAI,MAAM,CAAC,CAAC,MAAM,UAAU;GAC7B,MAAM,YAAY,MAAM,KAAK,0B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,oDAAgD;IACjF,OAAO,QAAQ,SAAS,cAAc,QAAQ,aAAa,CAAC,CAAC,GAAG,GAAG,YAAY,CAAC;IAChF,MAAM,UAAU,QAAQ,SACpB,QAAQ,KAAK,IACb,cAAc,QAAQ,sBAAsB,CAAC,CAAC,KAAK,yBAAyB,CAAC,CAAC,KAAK;IACvF,OAAO,QAAQ,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG;IACjC,OAAO,OAAO,CAAC,CAAC,GAAG,IAAI,QAAQ,YAAY;GAC7C,CAAC;GAED,GAAG,SAAS,UAAU,CAAC,CAAC,OAAO,WAAW,oBAAoB;EAChE,CACF;EAIA,iBAAA,QAAQ,SAAS,eAAe,SAAS,CAAC,CACxC,qEACM;GACJ,MAAM,cAAc,GAAG,gBAAgB;GACvC,GAAG,UAAU,OAAO,iCAAiC,CAAC,CAAC,GAAG,OAAO;GAEjE,sBAAsB,IAAI;GAC1B,GAAG,IAAI,6BAA2B,CAAC,CAAC,KAAK,eAAe;GACxD,GAAG,IAAI,6BAA2B,CAAC,CAAC,KAAK,WAAW;GACpD,GAAG,IAAI,iCAA+B,CAAC,CAAC,KAAK,WAAW;GACxD,GAAG,IAAI,8BAA4B,CAAC,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM;GAErE,GAAG,KAAK,QAAQ,CAAC,CAAC,IAAI,qBAAqB,CAAC,CAAC,OAAO,MAAM,GAAG;GAI7D,GAAG,SAAS,YAAY,EAAE,SAAS,IAAK,CAAC,CAAC,CAAC,OAAO,WAAW,gBAAgB;GAG7E,kBAAkB;EACpB,CACF;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
const require_features = require("../features.cjs");
|
|
2
|
+
//#region src/tests/home-detail-ux.ts
|
|
3
|
+
/**
|
|
4
|
+
* Home and package page UX that ships with the 9.x web UI: the package
|
|
5
|
+
* list toolbar, the tab in the address, the welcome guide, the install
|
|
6
|
+
* box (bun and `.npmrc`), copy feedback and search grouped by origin.
|
|
7
|
+
*
|
|
8
|
+
* Every test is a probe (flag defaults to `false`): released lines do
|
|
9
|
+
* not have these features yet.
|
|
10
|
+
*/
|
|
11
|
+
function homeDetailUxTests(config) {
|
|
12
|
+
const { features } = config;
|
|
13
|
+
const flags = features.homeDetailUx;
|
|
14
|
+
const { header, home, package: pkg, search } = config.testIds;
|
|
15
|
+
describe("home and detail ux", () => {
|
|
16
|
+
describe("with an empty registry", () => {
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
cy.intercept("GET", "/-/verdaccio/data/packages").as("pkgs");
|
|
19
|
+
cy.visit(config.registryUrl);
|
|
20
|
+
cy.wait("@pkgs");
|
|
21
|
+
});
|
|
22
|
+
require_features.maybeIt(flags.welcomeGuide)("should guide the first publish with a setup tab per package manager", () => {
|
|
23
|
+
cy.getByTestId(home.helpCard, { timeout: 1e4 }).should("be.visible");
|
|
24
|
+
cy.getByTestId(home.helpCard).contains("No Package Published Yet.");
|
|
25
|
+
cy.getByTestId(home.helpCard).contains(`npm adduser --registry ${config.registryUrl}`);
|
|
26
|
+
cy.getByTestId(home.helpCard).contains(`npm publish --registry ${config.registryUrl}`);
|
|
27
|
+
cy.getByTestId(`${home.helpSetupTabPrefix}npm`).should("be.visible");
|
|
28
|
+
cy.getByTestId(home.helpCard).contains(`npm config set registry ${config.registryUrl}`);
|
|
29
|
+
cy.get(`[data-testid="${home.helpSetupTabPrefix}.npmrc"]`).click();
|
|
30
|
+
cy.getByTestId(home.helpCard).contains(`registry=${config.registryUrl}`);
|
|
31
|
+
cy.getByTestId(home.helpUplinksNote).should("be.visible");
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
describe("with packages from two scopes", () => {
|
|
35
|
+
const scopedPkg = "@verdaccio/ux-toolbar-fixture";
|
|
36
|
+
const unscopedPkg = "ux-toolbar-unscoped-fixture";
|
|
37
|
+
const tempFolders = [];
|
|
38
|
+
before(() => {
|
|
39
|
+
if (!flags.homeToolbar) return;
|
|
40
|
+
[scopedPkg, unscopedPkg].forEach((pkgName) => {
|
|
41
|
+
cy.task("publishPackage", {
|
|
42
|
+
pkgName,
|
|
43
|
+
version: "1.0.0",
|
|
44
|
+
unique: true
|
|
45
|
+
}).then((r) => {
|
|
46
|
+
if (r?.tempFolder) tempFolders.push(r.tempFolder);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
after(() => {
|
|
51
|
+
if (!flags.homeToolbar) return;
|
|
52
|
+
[scopedPkg, unscopedPkg].forEach((pkgName) => cy.task("unpublishPackage", pkgName));
|
|
53
|
+
cy.then(() => tempFolders.forEach((folder) => cy.task("cleanupPublished", folder)));
|
|
54
|
+
});
|
|
55
|
+
beforeEach(() => {
|
|
56
|
+
cy.intercept("GET", "/-/verdaccio/data/packages").as("pkgs");
|
|
57
|
+
});
|
|
58
|
+
require_features.maybeIt(flags.homeToolbar)("should filter the list and keep the filter in ?q=", () => {
|
|
59
|
+
cy.visit(config.registryUrl);
|
|
60
|
+
cy.wait("@pkgs");
|
|
61
|
+
cy.getByTestId(home.packageListToolbar, { timeout: 1e4 }).should("be.visible");
|
|
62
|
+
cy.getByTestId(pkg.title).should("have.length", 2);
|
|
63
|
+
cy.getByTestId(home.packageListFilter).type("unscoped", { delay: 20 });
|
|
64
|
+
cy.getByTestId(pkg.title).should("have.length", 1).and("contain", unscopedPkg);
|
|
65
|
+
cy.location("search").should("eq", "?q=unscoped");
|
|
66
|
+
cy.reload();
|
|
67
|
+
cy.getByTestId(home.packageListFilter, { timeout: 1e4 }).should("have.value", "unscoped");
|
|
68
|
+
cy.getByTestId(pkg.title).should("have.length", 1);
|
|
69
|
+
});
|
|
70
|
+
require_features.maybeIt(flags.homeToolbar)("should restore the scope from ?scope=", () => {
|
|
71
|
+
cy.visit(`${config.registryUrl}/?scope=@verdaccio`);
|
|
72
|
+
cy.wait("@pkgs");
|
|
73
|
+
cy.getByTestId(home.packageListScope, { timeout: 1e4 }).should("have.value", "@verdaccio");
|
|
74
|
+
cy.getByTestId(pkg.title).should("have.length", 1).and("contain", scopedPkg);
|
|
75
|
+
});
|
|
76
|
+
require_features.maybeIt(flags.homeToolbar)("should say nothing matches instead of showing the onboarding card", () => {
|
|
77
|
+
cy.visit(`${config.registryUrl}/?q=no-package-matches-this`);
|
|
78
|
+
cy.wait("@pkgs");
|
|
79
|
+
cy.getByTestId(home.packageListNoMatch, { timeout: 1e4 }).should("be.visible");
|
|
80
|
+
cy.getByTestId(home.helpCard).should("not.exist");
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
describe("with a published package", () => {
|
|
84
|
+
const pkgName = "@verdaccio/ux-detail-fixture";
|
|
85
|
+
const detailUrl = `${config.registryUrl}/-/web/detail/${pkgName}`;
|
|
86
|
+
const needsPackage = flags.detailTabInUrl || flags.installBunAndNpmrc || flags.copyFeedback || flags.searchGrouping || flags.versionLink || flags.settingsPublishTab;
|
|
87
|
+
let tempFolder = null;
|
|
88
|
+
let version = "1.0.0";
|
|
89
|
+
before(() => {
|
|
90
|
+
if (!needsPackage) return;
|
|
91
|
+
cy.task("publishPackage", {
|
|
92
|
+
pkgName,
|
|
93
|
+
version: "1.0.0",
|
|
94
|
+
dependencies: { debug: "4.0.0" },
|
|
95
|
+
unique: true
|
|
96
|
+
}).then((result) => {
|
|
97
|
+
tempFolder = result?.tempFolder ?? null;
|
|
98
|
+
version = result?.version ?? version;
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
after(() => {
|
|
102
|
+
if (!needsPackage) return;
|
|
103
|
+
cy.task("unpublishPackage", {
|
|
104
|
+
pkgName,
|
|
105
|
+
tempFolder: tempFolder ?? void 0
|
|
106
|
+
});
|
|
107
|
+
cy.then(() => {
|
|
108
|
+
if (tempFolder) cy.task("cleanupPublished", tempFolder);
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
require_features.maybeIt(flags.settingsPublishTab)("should keep the publishing guide in the settings once packages exist", () => {
|
|
112
|
+
cy.visit(config.registryUrl);
|
|
113
|
+
cy.getByTestId(pkg.itemList, { timeout: 1e4 }).should("exist");
|
|
114
|
+
cy.getByTestId(header.settingsTooltip).click();
|
|
115
|
+
cy.getByTestId(header.settingsPublishTab).click();
|
|
116
|
+
cy.getByTestId(header.settingsPublishPanel).within(() => {
|
|
117
|
+
cy.getByTestId(home.helpGuide).should("be.visible");
|
|
118
|
+
cy.contains(`npm publish --registry ${config.registryUrl}`).scrollIntoView().should("be.visible");
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
require_features.maybeIt(flags.versionLink)("should open the version page from the home list", () => {
|
|
122
|
+
cy.visit(config.registryUrl);
|
|
123
|
+
cy.contains(`[data-testid="${pkg.itemList}"]`, pkgName, { timeout: 1e4 }).find(`[data-testid="${pkg.versionLink}"]`).click();
|
|
124
|
+
cy.location("pathname").should("eq", `/-/web/detail/${pkgName}/v/${version}`);
|
|
125
|
+
cy.getByTestId(pkg.sidebar, { timeout: 1e4 }).contains(version);
|
|
126
|
+
});
|
|
127
|
+
require_features.maybeIt(flags.detailTabInUrl)("should keep the selected tab in ?tab=", () => {
|
|
128
|
+
cy.visit(detailUrl);
|
|
129
|
+
cy.getByTestId(pkg.versionsTab, { timeout: 1e4 }).click();
|
|
130
|
+
cy.location("search").should("contain", "tab=versions");
|
|
131
|
+
cy.getByTestId(pkg.tagLatest).should("be.visible");
|
|
132
|
+
cy.getByTestId(pkg.readmeTab).click();
|
|
133
|
+
cy.location("search").should("not.contain", "tab=");
|
|
134
|
+
});
|
|
135
|
+
require_features.maybeIt(flags.detailTabInUrl)("should open the tab a link points to", () => {
|
|
136
|
+
cy.visit(`${detailUrl}?tab=dependencies`);
|
|
137
|
+
cy.getByTestId(pkg.dependenciesTab, { timeout: 1e4 }).should("have.attr", "aria-selected", "true");
|
|
138
|
+
cy.getByTestId(pkg.dependencies).contains("debug");
|
|
139
|
+
});
|
|
140
|
+
require_features.maybeIt(flags.installBunAndNpmrc)("should offer bun and the scoped .npmrc line in the install box", () => {
|
|
141
|
+
cy.visit(detailUrl);
|
|
142
|
+
cy.getByTestId(pkg.installBun, { timeout: 1e4 }).contains(`bun add ${pkgName}`);
|
|
143
|
+
cy.getByTestId(pkg.installNpmrc).contains(`@verdaccio:registry=${config.registryUrl}`);
|
|
144
|
+
});
|
|
145
|
+
require_features.maybeIt(flags.copyFeedback)("should confirm a copy on the copy button", () => {
|
|
146
|
+
cy.visit(detailUrl);
|
|
147
|
+
cy.getByTestId(pkg.installNpmrcCopy, { timeout: 1e4 }).click();
|
|
148
|
+
cy.getByTestId(pkg.installNpmrcCopy).should("have.attr", "aria-label", "Copied");
|
|
149
|
+
});
|
|
150
|
+
require_features.maybeIt(flags.searchGrouping)("should list a package published here under its own search group", () => {
|
|
151
|
+
cy.intercept("GET", "**/-/verdaccio/data/search/**").as("webSearch");
|
|
152
|
+
cy.visit(config.registryUrl);
|
|
153
|
+
cy.get("input[placeholder*=\"earch\"]", { timeout: 1e4 }).type("ux-detail-fixture", { delay: 30 });
|
|
154
|
+
cy.wait("@webSearch", { timeout: 1e4 });
|
|
155
|
+
cy.get("[role=\"listbox\"]", { timeout: 5e3 }).within(() => {
|
|
156
|
+
cy.getByTestId(`${search.groupPrefix}private`).should("be.visible");
|
|
157
|
+
cy.contains("[role=\"option\"]", pkgName).find(`[data-testid="${search.originPrefix}private"]`).should("exist");
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
//#endregion
|
|
164
|
+
exports.homeDetailUxTests = homeDetailUxTests;
|
|
165
|
+
|
|
166
|
+
//# sourceMappingURL=home-detail-ux.cjs.map
|