@verdaccio/e2e-ui 2.4.1 → 2.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -12
- package/build/cjs/commands/index.cjs.map +1 -1
- package/build/cjs/features.cjs.map +1 -1
- package/build/cjs/index.cjs +25 -1
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/tasks/publish.cjs.map +1 -1
- package/build/cjs/testIds.cjs.map +1 -1
- package/build/cjs/tests/change-password.cjs.map +1 -1
- package/build/cjs/tests/home.cjs.map +1 -1
- package/build/cjs/tests/layout.cjs.map +1 -1
- package/build/cjs/tests/publish.cjs.map +1 -1
- package/build/cjs/tests/search.cjs +0 -7
- package/build/cjs/tests/search.cjs.map +1 -1
- package/build/cjs/tests/settings.cjs.map +1 -1
- package/build/cjs/tests/signin.cjs.map +1 -1
- package/build/commands/index.d.ts +0 -2
- package/build/esm/commands/index.js.map +1 -1
- package/build/esm/features.js.map +1 -1
- package/build/esm/index.js +25 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/tasks/publish.js.map +1 -1
- package/build/esm/testIds.js.map +1 -1
- package/build/esm/tests/change-password.js.map +1 -1
- package/build/esm/tests/home.js.map +1 -1
- package/build/esm/tests/layout.js.map +1 -1
- package/build/esm/tests/publish.js.map +1 -1
- package/build/esm/tests/search.js +0 -7
- package/build/esm/tests/search.js.map +1 -1
- package/build/esm/tests/settings.js.map +1 -1
- package/build/esm/tests/signin.js.map +1 -1
- package/build/features.d.ts +1 -3
- package/build/index.d.ts +1 -2
- package/build/types.d.ts +0 -3
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"change-password.js","names":[],"sources":["../../../src/tests/change-password.ts"],"sourcesContent":["/// <reference types=\"cypress\" />\n\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 onSubmit catch block in ChangePassword.tsx sets a hardcoded\n // English string — if the upstream component ever localizes this,\n // this constant and the wrongOldPassword test will need updating.\n const GENERIC_FAILURE_TEXT = 'Failed to change password';\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\"]')\n .should('not.be.disabled')\n .click();\n // Server rejects (htpasswd → plain Error → handler returns 4xx).\n cy.wait('@reset').its('response.statusCode').should('not.eq', 200);\n // onSubmit's catch sets errors.root → rendered via LoginDialogFormError.\n cy.getByTestId(login.error, { timeout: 5000 })\n .should('be.visible')\n .and('contain.text', GENERIC_FAILURE_TEXT);\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\"]')\n .should('not.be.disabled')\n .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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,SAAgB,oBAAoB,QAAwB;CAC1D,MAAM,EAAE,QAAQ,UAAU,OAAO;CACjC,MAAM,EAAE,gBAAgB,OAAO;CAC/B,MAAM,EAAE,aAAa;CAKrB,MAAM,uBAAuB;AAE7B,UAAS,yBAAyB;EAChC,MAAM,uBAAuB;EAC7B,MAAM,EAAE,MAAM,aAAa,OAAO;;;;;;EAOlC,IAAI,kBAAkB;;;;;;;;;;;;;;AAetB,SAAO,WAAY;AACjB,MAAG,MAAM,OAAO,YAAY;AAC5B,MAAG,QAAQ,CAAC,MAAM,QAAQ;IACxB,MAAM,OAAQ,IAAY;AAE1B,QAAI,CADY,CAAC,CAAC,MAAM,OAAO,gBACjB;AAEZ,aAAQ,KACN,8GAEE,KAAK,UAAU,MAAM,SAAS,EAAE,CAAC,CACpC;AACD,UAAK,MAAM;;KAEb;IACF;AAEF,mBAAiB;AAKf,MAAG,UAAU,QAAQ,yBAAyB,CAAC,GAAG,gBAAgB;AAClE,MAAG,MAAM,OAAO,YAAY;AAC5B,MAAG,MAAM,MAAM,iBAAiB;IAC9B,aAAa,OAAO;IACpB,GAAG;IACJ,CAAC;AACF,MAAG,KAAK,iBAAiB,CAAC,IAAI,sBAAsB,CAAC,OAAO,MAAM,IAAI;AAEtE,MAAG,MAAM,qBAAqB;AAM9B,MAAG,IAAI,gCAA8B,EAAE,SAAS,KAAM,CAAC,CAAC,OAAO,aAAa;IAC5E;AAEF,cAAY;AAGV,OAAI,oBAAoB,SAAU;AAClC,MAAG,UAAU,Q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C,IAAI,sBAAsB,CAAC,OAAO,UAAU,IAAI;AAElE,MAAG,YAAY,MAAM,OAAO,EAAE,SAAS,KAAM,CAAC,CAC3C,OAAO,aAAa,CACpB,IAAI,gBAAgB,qBAAqB;AAE5C,MAAG,SAAS,WAAW,CAAC,OAAO,WAAW,qBAAqB;IAElE;AAID,UAAQ,SAAS,eAAe,UAAU,CACxC,qEACM;GACJ,MAAM,cAAc,GAAG,gBAAgB;AACvC,MAAG,UAAU,OAAO,kCAAkC,CAAC,GAAG,QAAQ;AAElE,MAAG,IAAI,2BAAyB,CAAC,KAAK,KAAK;AAC3C,MAAG,IAAI,8BAA4B,CAAC,KAAK,gBAAgB;AACzD,MAAG,IAAI,8BAA4B,CAAC,KAAK,YAAY;AACrD,MAAG,IAAI,kCAAgC,CAAC,KAAK,YAAY;AACzD,MAAG,IAAI,+BAA6B,CACjC,OAAO,kBAAkB,CACzB,OAAO;AAEV,MAAG,KAAK,SAAS,CAAC,IAAI,sBAAsB,CAAC,OAAO,MAAM,IAAI;AAI9D,MAAG,SAAS,YAAY,EAAE,SAAS,KAAM,CAAC,CAAC,OAAO,WAAW,iBAAiB;AAG9E,qBAAkB;IAErB;GACD"}
|
|
1
|
+
{"version":3,"file":"change-password.js","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 onSubmit catch block in ChangePassword.tsx sets a hardcoded\n // English string — if the upstream component ever localizes this,\n // this constant and the wrongOldPassword test will need updating.\n const GENERIC_FAILURE_TEXT = 'Failed to change password';\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 (htpasswd → plain Error → handler returns 4xx).\n cy.wait('@reset').its('response.statusCode').should('not.eq', 200);\n // onSubmit's catch sets errors.root → rendered via LoginDialogFormError.\n cy.getByTestId(login.error, { timeout: 5000 })\n .should('be.visible')\n .and('contain.text', GENERIC_FAILURE_TEXT);\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,SA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AAkC,CAAC,GAAG,QAAQ;GAElE,GAAG,IAAI,2BAAyB,CAAC,KAAK,KAAK;GAC3C,GAAG,IAAI,8BAA4B,CAAC,KAAK,gBAAgB;GACzD,GAAG,IAAI,8BAA4B,CAAC,KAAK,YAAY;GACrD,GAAG,IAAI,kCAAgC,CAAC,KAAK,YAAY;GACzD,GAAG,IAAI,+BAA6B,CAAC,OAAO,kBAAkB,CAAC,OAAO;GAEtE,GAAG,KAAK,SAAS,CAAC,IAAI,sBAAsB,CAAC,OAAO,MAAM,IAAI;GAI9D,GAAG,SAAS,YAAY,EAAE,SAAS,KAAM,CAAC,CAAC,OAAO,WAAW,iBAAiB;GAG9E,kBAAkB;IAErB;GACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"home.js","names":[],"sources":["../../../src/tests/home.ts"],"sourcesContent":["/// <reference types=\"cypress\" />\
|
|
1
|
+
{"version":3,"file":"home.js","names":[],"sources":["../../../src/tests/home.ts"],"sourcesContent":["/// <reference types=\"cypress\" />\nimport { RegistryConfig } from '../types';\n\nexport function homeTests(config: RegistryConfig) {\n const { home, header, package: pkg } = config.testIds;\n const { features } = config;\n\n // Only register the `with a published package` nested describe when\n // the corresponding feature flag is on. Using a plain `if` is simpler\n // than wrapping `describe` itself in `describe.skip`, and it avoids\n // emitting a pending describe block in reports.\n const registerPublishedPackageBlock = features.home.publishedPackageRendering;\n\n describe('home', () => {\n beforeEach(() => {\n cy.intercept('GET', '/-/verdaccio/data/packages').as('pkgs');\n cy.visit(config.registryUrl);\n // Wait for the app to render\n cy.get('body').should('be.visible');\n });\n\n afterEach(() => {\n cy.wait(2000);\n });\n\n it('title should be correct', () => {\n cy.location('pathname').should('include', '/');\n cy.title().should('eq', config.title);\n });\n\n it('should fetch the package list from the API', () => {\n // The home page always fires /-/verdaccio/data/packages on mount;\n // verifying the endpoint is healthy is the cheapest way to catch\n // registry-side regressions before any DOM assertions.\n //\n // Accept both 200 (fresh fetch) and 304 (cache hit from a prior\n // spec run in the same session) — both indicate a healthy endpoint.\n // 304 responses have no body, so only assert array-shape on 200.\n cy.wait('@pkgs', { timeout: 10000 }).then((interception) => {\n const status = interception.response?.statusCode;\n expect(status).to.be.oneOf([200, 304]);\n if (status === 200) {\n expect(interception.response?.body).to.be.an('array');\n }\n });\n });\n\n it('should match title with no packages published', () => {\n cy.wait('@pkgs');\n cy.getByTestId(home.helpCard, { timeout: 10000 }).should('be.visible');\n cy.getByTestId(home.helpCard).contains('No Package Published Yet.');\n });\n\n it('should display instructions on help card', () => {\n cy.wait('@pkgs');\n cy.getByTestId(home.helpCard, { timeout: 10000 }).should('be.visible');\n cy.getByTestId(home.helpCard).contains(`npm adduser --registry ${config.registryUrl}`);\n cy.getByTestId(home.helpCard).contains(`npm publish --registry ${config.registryUrl}`);\n });\n\n it('should render the header logo and login button', () => {\n cy.getByTestId(header.container).should('be.visible');\n cy.get(`[data-testid=\"${header.defaultLogo}\"], [data-testid=\"${header.customLogo}\"]`).should(\n 'be.visible'\n );\n cy.getByTestId(header.loginButton).should('be.visible');\n });\n\n it('should navigate back to home when clicking the header logo', () => {\n // Land on the 404 page, then click the logo — URL should reset.\n cy.visit(`${config.registryUrl}/-/web/detail/@verdaccio/not-found`);\n cy.getByTestId(home.notFound, { timeout: 10000 }).should('be.visible');\n cy.get(`[data-testid=\"${header.defaultLogo}\"], [data-testid=\"${header.customLogo}\"]`)\n .first()\n .click();\n cy.location('pathname').should('eq', '/');\n cy.getByTestId(home.helpCard).should('be.visible');\n });\n\n it('should go to 404 page', () => {\n cy.visit(`${config.registryUrl}/-/web/detail/@verdaccio/not-found`);\n cy.getByTestId(home.notFound, { timeout: 10000 }).should('be.visible');\n cy.getByTestId(home.notFound).contains(\"Sorry, we couldn't find it.\");\n });\n\n // ── Rendering assertions that require real package data ─────────\n // Publishes a throwaway package before each test in this block so\n // we can verify the home page actually renders the list (not just\n // the empty state) and cleans up after each test so the outer\n // \"empty registry\" assertions above keep working in isolation.\n //\n // Gated on `features.home.publishedPackageRendering` so builds\n // where this shape doesn't apply can skip it without forking.\n (registerPublishedPackageBlock ? describe : describe.skip)('with a published package', () => {\n const pkgName = '@verdaccio/home-fixture';\n let tempFolder: string | null = null;\n\n beforeEach(() => {\n cy.task('publishPackage', {\n pkgName,\n version: '1.0.0',\n unique: true,\n }).then((result) => {\n tempFolder = result?.tempFolder ?? null;\n });\n // Re-visit so the page picks up the just-published package.\n cy.visit(config.registryUrl);\n });\n\n afterEach(() => {\n cy.task('unpublishPackage', {\n pkgName,\n tempFolder: tempFolder ?? undefined,\n });\n if (tempFolder) {\n cy.task('cleanupPublished', tempFolder);\n }\n tempFolder = null;\n });\n\n it('should render the package list when a package exists', () => {\n cy.wait('@pkgs');\n cy.getByTestId(pkg.itemList).should('be.visible');\n cy.getByTestId(pkg.title).should('have.length.at.least', 1);\n });\n\n it('should show the published package name in the list', () => {\n cy.wait('@pkgs');\n cy.contains(`[data-testid=\"${pkg.title}\"]`, pkgName).should('be.visible');\n });\n });\n });\n}\n"],"mappings":";AAGA,SAAgB,UAAU,QAAwB;CAChD,MAAM,EAAE,MAAM,QAAQ,SAAS,QAAQ,OAAO;CAC9C,MAAM,EAAE,aAAa;CAMrB,MAAM,gCAAgC,SAAS,KAAK;CAEpD,SAAS,cAAc;EACrB,iBAAiB;GACf,GAAG,UAAU,OAAO,6BAA6B,CAAC,GAAG,OAAO;GAC5D,GAAG,MAAM,OAAO,YAAY;GAE5B,GAAG,IAAI,OAAO,CAAC,OAAO,aAAa;IACnC;EAEF,gBAAgB;GACd,GAAG,KAAK,IAAK;IACb;EAEF,GAAG,iCAAiC;GAClC,GAAG,SAAS,WAAW,CAAC,OAAO,WAAW,IAAI;GAC9C,GAAG,OAAO,CAAC,OAAO,MAAM,OAAO,MAAM;IACrC;EAEF,GAAG,oDAAoD;GAQrD,GAAG,KAAK,SAAS,EAAE,SAAS,KAAO,CAAC,CAAC,MAAM,iBAAiB;IAC1D,MAAM,SAAS,aAAa,UAAU;IACtC,O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,aAAa;GACtE,GAAG,YAAY,KAAK,SAAS,CAAC,SAAS,8BAA8B;IACrE;EAUF,CAAC,gCAAgC,WAAW,SAAS,MAAM,kCAAkC;GAC3F,MAAM,UAAU;GAChB,IAAI,aAA4B;GAEhC,iBAAiB;IACf,GAAG,KAAK,kBAAkB;KACxB;KACA,SAAS;KACT,QAAQ;KACT,CAAC,CAAC,MAAM,WAAW;KAClB,aAAa,QAAQ,cAAc;MACnC;IAEF,GAAG,MAAM,OAAO,YAAY;KAC5B;GAEF,gBAAgB;IACd,GAAG,KAAK,oBAAoB;KAC1B;KACA,YAAY,cAAc,KAAA;KAC3B,CAAC;IACF,IAAI,YACF,GAAG,KAAK,oBAAoB,WAAW;IAEzC,aAAa;KACb;GAEF,GAAG,8DAA8D;IAC/D,GAAG,KAAK,QAAQ;IAChB,GAAG,YAAY,IAAI,SAAS,CAAC,OAAO,aAAa;IACjD,GAAG,YAAY,IAAI,MAAM,CAAC,OAAO,wBAAwB,EAAE;KAC3D;GAEF,GAAG,4DAA4D;IAC7D,GAAG,KAAK,QAAQ;IAChB,GAAG,SAAS,iBAAiB,IAAI,MAAM,KAAK,QAAQ,CAAC,OAAO,aAAa;KACzE;IACF;GACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.js","names":[],"sources":["../../../src/tests/layout.ts"],"sourcesContent":["/// <reference types=\"cypress\" />\
|
|
1
|
+
{"version":3,"file":"layout.js","names":[],"sources":["../../../src/tests/layout.ts"],"sourcesContent":["/// <reference types=\"cypress\" />\nimport { maybeIt } from '../features';\nimport { RegistryConfig } from '../types';\n\n/**\n * Tests for the persistent page chrome: the header (nav bar, logo,\n * search container, action buttons) and the footer (version marker).\n * Also asserts that the runtime UI configuration endpoint\n * `/-/static/ui-options.js` loads successfully — this endpoint emits\n * `window.__VERDACCIO_BASENAME_UI_OPTIONS`, which the ui-theme relies\n * on for feature flags like showFooter / showSearch / showSettings. If\n * it fails the whole SPA degrades to whatever defaults the provider\n * ships with, so it's worth a direct network-level check.\n */\nexport function layoutTests(config: RegistryConfig) {\n const { header, footer } = config.testIds;\n const { features } = config;\n\n describe('layout: header, footer, ui-options', () => {\n beforeEach(() => {\n cy.intercept('GET', '**/-/static/ui-options.js').as('uiOptions');\n cy.visit(config.registryUrl);\n cy.get('body').should('be.visible');\n });\n\n it('should load /-/static/ui-options.js with HTTP 200', () => {\n cy.wait('@uiOptions', { timeout: 10000 }).its('response.statusCode').should('eq', 200);\n });\n\n it('should serve ui-options.js with a JavaScript content-type', () => {\n cy.wait('@uiOptions', { timeout: 10000 }).then((interception: any) => {\n const contentType = interception.response?.headers?.['content-type'] || '';\n // Verdaccio serves this as `application/javascript` (possibly\n // with a charset suffix). Match loosely so small header tweaks\n // don't break the test.\n expect(contentType).to.match(/javascript/i);\n });\n });\n\n it('should expose window.__VERDACCIO_BASENAME_UI_OPTIONS at runtime', () => {\n cy.wait('@uiOptions', { timeout: 10000 });\n // ui-options.js sets this global before the React app boots, so\n // by the time the body is visible it should already be populated.\n cy.window().its('__VERDACCIO_BASENAME_UI_OPTIONS').should('be.an', 'object');\n });\n\n describe('header', () => {\n it('should render the header container', () => {\n cy.getByTestId(header.container).should('be.visible');\n cy.getByTestId(header.innerNavBar).should('be.visible');\n });\n\n it('should render the logo', () => {\n // Either the default SVG logo or a user-provided custom one.\n cy.get(\n `[data-testid=\"${header.defaultLogo}\"], [data-testid=\"${header.customLogo}\"]`\n ).should('be.visible');\n });\n\n it('should render the search container', () => {\n cy.getByTestId(header.searchContainer).should('be.visible');\n });\n\n it('should render the header-right action cluster', () => {\n cy.getByTestId(header.right).should('be.visible');\n });\n\n it('should render the login button when logged out', () => {\n cy.getByTestId(header.loginButton).should('be.visible');\n });\n\n it('should render the settings and info buttons', () => {\n // Both depend on `showSettings` / `showInfo` being truthy in\n // the ui-options response. On the default config provider\n // they default to true so no explicit registry config is\n // required.\n cy.getByTestId(header.settingsTooltip).should('be.visible');\n cy.getByTestId(header.infoTooltip).should('be.visible');\n });\n\n maybeIt(features.layout.themeSwitch)('should toggle between light and dark mode', () => {\n // Cypress clears localStorage between tests (testIsolation),\n // so each test starts from whatever the client default is.\n // On CI the default is light (the Electron headless browser\n // reports `prefers-color-scheme: light`).\n //\n // `handleToggleDarkLightMode` in HeaderRight wraps\n // `setIsDarkMode` in a 300ms setTimeout, so we assert with\n // Cypress's built-in retryability (no `cy.wait(ms)` needed —\n // the `.should('be.visible')` retry window covers it).\n\n // Start: light mode → the \"light\" icon button is rendered.\n cy.getByTestId(header.themeSwitchLight).should('be.visible').click();\n\n // After the debounced flip, the \"dark\" variant replaces it.\n cy.getByTestId(header.themeSwitchDark, { timeout: 5000 }).should('be.visible');\n cy.getByTestId(header.themeSwitchLight).should('not.exist');\n\n // localStorage.darkMode is the source of truth (see\n // useLocalStorage('darkMode', …) in ThemeProvider).\n cy.window().its('localStorage').invoke('getItem', 'darkMode').should('eq', 'true');\n\n // Toggle back so subsequent tests don't inherit dark state\n // via a stale cache (testIsolation clears localStorage, but\n // being explicit keeps the assertion symmetric).\n cy.getByTestId(header.themeSwitchDark).click();\n cy.getByTestId(header.themeSwitchLight, { timeout: 5000 }).should('be.visible');\n });\n });\n\n describe('footer', () => {\n it('should render the footer container', () => {\n cy.getByTestId(footer.container).scrollIntoView().should('be.visible');\n });\n\n it('should render the version marker with the powered-by label', () => {\n // <PoweredBy> only renders when `configOptions.version` is\n // truthy, which Verdaccio sets automatically from its\n // package.json at startup.\n cy.getByTestId(footer.version)\n .scrollIntoView()\n .should('be.visible')\n .invoke('text')\n .should('have.length.greaterThan', 0);\n });\n\n it('should render a logo next to the version marker', () => {\n // The footer uses the default SVG logo as the link to\n // verdaccio.org.\n cy.getByTestId(footer.container)\n .find(`[data-testid=\"${header.defaultLogo}\"], [data-testid=\"${header.customLogo}\"]`)\n .should('exist');\n });\n });\n });\n}\n"],"mappings":";;;;;;;;;;;;AAcA,SAAgB,YAAY,QAAwB;CAClD,MAAM,EAAE,QAAQ,WAAW,OAAO;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OAAO,aAAa;KACvD;GAEF,QAAQ,SAAS,OAAO,YAAY,CAAC,mDAAmD;IAYtF,GAAG,YAAY,OAAO,iBAAiB,CAAC,OAAO,aAAa,CAAC,OAAO;IAGpE,GAAG,YAAY,OAAO,iBAAiB,EAAE,SAAS,KAAM,CAAC,CAAC,OAAO,aAAa;IAC9E,GAAG,YAAY,OAAO,iBAAiB,CAAC,OAAO,YAAY;IAI3D,GAAG,QAAQ,CAAC,IAAI,eAAe,CAAC,OAAO,WAAW,WAAW,CAAC,OAAO,MAAM,OAAO;IAKlF,GAAG,YAAY,OAAO,gBAAgB,CAAC,OAAO;IAC9C,GAAG,YAAY,OAAO,kBAAkB,EAAE,SAAS,KAAM,CAAC,CAAC,OAAO,aAAa;KAC/E;IACF;EAEF,SAAS,gBAAgB;GACvB,GAAG,4CAA4C;IAC7C,GAAG,YAAY,OAAO,UAAU,CAAC,gBAAgB,CAAC,OAAO,aAAa;KACtE;GAEF,GAAG,oEAAoE;IAIrE,GAAG,YAAY,OAAO,QAAQ,CAC3B,gBAAgB,CAChB,OAAO,aAAa,CACpB,OAAO,OAAO,CACd,OAAO,2BAA2B,EAAE;KACvC;GAEF,GAAG,yDAAyD;IAG1D,GAAG,YAAY,OAAO,UAAU,CAC7B,KAAK,iBAAiB,OAAO,YAAY,oBAAoB,OAAO,WAAW,IAAI,CACnF,OAAO,QAAQ;KAClB;IACF;GACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish.js","names":[],"sources":["../../../src/tests/publish.ts"],"sourcesContent":["/// <reference types=\"cypress\" />\n\nimport { maybeIt } from '../features';\nimport { RegistryConfig } from '../types';\n\nexport function publishTests(config: RegistryConfig) {\n const { header, package: pkg } = config.testIds;\n const { markdownBody, loginDialog } = config.selectors;\n const { features } = config;\n\n describe('publish', () => {\n const pkgName = '@verdaccio/pkg-scoped';\n // Single source of truth for the dependency the publish fixture\n // writes into its package.json. The dependencies-tab assertion\n // reads these back to verify the UI rendered both fields.\n const depName = 'debug';\n const depVersion = '4.0.0';\n // Per-test state so afterEach can clean up the specific publish\n // that this test created (temp folder + registry entry).\n let tempFolder: string | null = null;\n\n /**\n * Log in once, reuse the session across every test in this suite.\n * `cy.session` caches cookies + localStorage keyed on the first\n * argument, so subsequent calls restore without hitting the network.\n */\n const loginOnce = () => {\n cy.session(\n ['publish-suite', config.credentials.user],\n () => {\n cy.visit(config.registryUrl);\n cy.login(config.credentials.user, config.credentials.password, {\n loginButton: header.loginButton,\n ...loginDialog,\n });\n cy.wait('@sign');\n },\n {\n validate() {\n cy.request({\n url: `${config.registryUrl}/-/verdaccio/data/packages`,\n failOnStatusCode: false,\n })\n .its('status')\n .should('be.oneOf', [200, 304]);\n },\n cacheAcrossSpecs: true,\n }\n );\n };\n\n beforeEach(() => {\n cy.intercept('POST', '/-/verdaccio/sec/login').as('sign');\n cy.intercept('GET', '/-/verdaccio/data/packages').as('pkgs');\n cy.intercept('GET', `/-/verdaccio/data/sidebar/${pkgName}`).as('sidebar');\n cy.intercept('GET', `/-/verdaccio/data/package/readme/${pkgName}`).as('readme');\n\n // Publish a fresh copy for this test. `unique: true` appends a\n // timestamp suffix so the version is distinct per test even when\n // the registry briefly has a stale copy from a prior afterEach.\n cy.task('publishPackage', {\n pkgName,\n version: '1.0.0',\n dependencies: { [depName]: depVersion },\n unique: true,\n }).then((result) => {\n tempFolder = result?.tempFolder ?? null;\n });\n\n loginOnce();\n cy.visit(config.registryUrl);\n });\n\n afterEach(() => {\n // Remove the package from the registry AND the local temp folder.\n // Run both regardless of test outcome so the next test starts\n // clean. `unpublishPackage` treats 404 as success, so a re-run\n // after a half-published state is still safe.\n cy.task('unpublishPackage', { pkgName, tempFolder: tempFolder ?? undefined });\n if (tempFolder) {\n cy.task('cleanupPublished', tempFolder);\n }\n tempFolder = null;\n });\n\n it('should have one published package', () => {\n cy.wait('@pkgs');\n cy.getByTestId(pkg.title).should('have.length.at.least', 1);\n });\n\n it('should navigate to page detail', () => {\n cy.wait('@pkgs');\n cy.wait(300);\n cy.getByTestId(pkg.title).first().click();\n });\n\n it('should have readme content', () => {\n cy.wait('@pkgs');\n cy.getByTestId(pkg.title).first().click();\n cy.wait('@readme');\n cy.wait('@sidebar');\n cy.getByTestId(pkg.readme).should('be.visible');\n cy.get(markdownBody).should('have.length', 1);\n // publishPackage writes a README whose body contains \"e2e testing\".\n cy.contains(markdownBody, /test/);\n cy.contains(`${markdownBody} h1`, pkgName).should('be.visible');\n });\n\n it('should render the sidebar with install commands for npm, yarn, pnpm', () => {\n cy.wait('@pkgs');\n cy.getByTestId(pkg.title).first().click();\n cy.wait('@sidebar');\n cy.getByTestId(pkg.sidebar).should('be.visible');\n cy.getByTestId(pkg.installList).within(() => {\n cy.getByTestId(pkg.installNpm).should('be.visible');\n cy.getByTestId(pkg.installYarn).should('be.visible');\n cy.getByTestId(pkg.installPnpm).should('be.visible');\n });\n cy.getByTestId(pkg.installNpm).should('contain.text', pkgName);\n });\n\n it('should render the sidebar keywords from the published manifest', () => {\n cy.wait('@pkgs');\n cy.getByTestId(pkg.title).first().click();\n cy.wait('@sidebar');\n // publishPackage writes `keywords: ['verdaccio', 'e2e', 'test']`\n // into the generated package.json.\n cy.getByTestId(pkg.keywordList).should('be.visible');\n cy.getByTestId(pkg.keywordList).should('contain.text', 'verdaccio');\n cy.getByTestId(pkg.keywordList).should('contain.text', 'e2e');\n cy.getByTestId(pkg.keywordList).should('contain.text', 'test');\n });\n\n it('should click on dependencies tab', () => {\n cy.wait('@pkgs');\n cy.wait(300);\n cy.getByTestId(pkg.title).first().click();\n cy.wait('@readme');\n cy.wait('@sidebar');\n cy.getByTestId(pkg.dependenciesTab).click();\n cy.wait(100);\n cy.getByTestId(pkg.dependencies).should('have.length', 1);\n\n // The dep Chip uses the dep name as its data-testid (dynamic\n // Verdaccio convention, see DependencyBlock.tsx:68), and its\n // label is `\"${name}: ${version}\"` via the `dependencies.\n // dependency-block` i18n key. Assert BOTH fields are rendered.\n cy.getByTestId(depName)\n .should('be.visible')\n .and('contain.text', depName)\n .and('contain.text', depVersion);\n\n // Also verify the Chip text matches the exact \"name: version\"\n // format so a regression in the label template would fail here\n // rather than pass via a loose substring match.\n cy.getByTestId(depName)\n .invoke('text')\n .should('match', new RegExp(`${depName}\\\\s*:\\\\s*${depVersion}`));\n });\n\n it('should click on versions tab', () => {\n cy.wait('@pkgs');\n cy.wait(300);\n cy.getByTestId(pkg.title).first().click();\n cy.wait('@readme');\n cy.wait('@sidebar');\n cy.getByTestId(pkg.versionsTab).click();\n // With `unique: true` the version becomes `1.0.0-t<timestamp>`,\n // but \"1.0.0\" still appears as a substring — match loosely.\n cy.getByTestId(pkg.tagLatest)\n .children()\n .invoke('text')\n .should('match', /1\\.0\\.0/);\n });\n\n it('should click on uplinks tab', () => {\n cy.wait('@pkgs');\n cy.wait(300);\n cy.getByTestId(pkg.title).first().click();\n cy.wait('@readme');\n cy.wait('@sidebar');\n cy.getByTestId(pkg.uplinksTab).click();\n cy.getByTestId(pkg.noUplinks).should('be.visible');\n });\n\n // ── Action-bar FABs: tarball download + raw viewer ─────────────\n // Both buttons live in the sidebar ActionBar. They're gated on\n // `web.showDownloadTarball` / `web.showRaw` (both default to true\n // in the ui-theme's AppConfigurationProvider) and each test is\n // also guarded by a feature flag so branches that ship a\n // different action bar can skip cleanly.\n\n maybeIt(features.publish.downloadTarball)(\n 'should fetch the tarball when the download button is clicked',\n () => {\n // The download provider hits the package manifest's dist.tarball\n // URL directly. For our published fixture the filename looks\n // like `pkg-scoped-1.0.0-t<ts>.tgz`, served from\n // `/<pkg>/-/<filename>.tgz`. Intercept before clicking.\n cy.intercept('GET', '**/pkg-scoped-*.tgz').as('tarballFetch');\n\n cy.wait('@pkgs');\n cy.getByTestId(pkg.title).first().click();\n cy.wait('@sidebar');\n\n cy.getByTestId(pkg.downloadTarballBtn)\n .should('be.visible')\n .click();\n\n // The fetch should fire and return 200. We can't assert on the\n // actual file landing on disk — Cypress doesn't track OS-level\n // downloads — but a successful GET proves the end-to-end path\n // from click → download provider → registry.\n cy.wait('@tarballFetch', { timeout: 10000 })\n .its('response.statusCode')\n .should('eq', 200);\n }\n );\n\n maybeIt(features.publish.rawViewer)(\n 'should open the raw manifest viewer when the raw button is clicked',\n () => {\n cy.wait('@pkgs');\n cy.getByTestId(pkg.title).first().click();\n cy.wait('@sidebar');\n\n // RawViewer is a full-screen MUI Dialog — initially unmounted\n // because `isOpen=false` keeps Dialog closed and Cypress won't\n // find it. Clicking the FAB flips `isOpen` to true.\n cy.getByTestId(pkg.rawBtn).should('be.visible').click();\n\n cy.getByTestId(pkg.rawViewerDialog, { timeout: 5000 }).should(\n 'be.visible'\n );\n // The ReactJson viewer renders the package manifest — the\n // package name should appear somewhere in the serialized JSON.\n cy.getByTestId(pkg.rawViewerDialog).should('contain.text', pkgName);\n\n // Close via the X button and confirm the dialog goes away so\n // subsequent tests don't inherit an open overlay.\n cy.getByTestId(pkg.closeRawViewer).click();\n cy.getByTestId(pkg.rawViewerDialog).should('not.exist');\n }\n );\n });\n}\n"],"mappings":";;AAKA,SAAgB,aAAa,QAAwB;CACnD,MAAM,EAAE,QAAQ,SAAS,QAAQ,OAAO;CACxC,MAAM,EAAE,cAAc,gBAAgB,OAAO;CAC7C,MAAM,EAAE,aAAa;AAErB,UAAS,iBAAiB;EACxB,MAAM,UAAU;EAIhB,MAAM,UAAU;EAChB,MAAM,aAAa;EAGnB,IAAI,aAA4B;;;;;;EAOhC,MAAM,kBAAkB;AACtB,MAAG,QACD,CAAC,iBAAiB,OAAO,YAAY,KAAK,QACpC;AACJ,OAAG,MAAM,OAAO,YAAY;AAC5B,OAAG,MAAM,OAAO,YAAY,MAAM,OAAO,YAAY,UAAU;KAC7D,aAAa,OAAO;KACpB,GAAG;KACJ,CAAC;AACF,OAAG,KAAK,QAAQ;MAElB;IACE,WAAW;AACT,QAAG,QAAQ;MACT,KAAK,GAAG,OAAO,YAAY;MAC3B,kBAAkB;MACnB,CAAC,CACC,IAAI,SAAS,CACb,O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B,EAAE,SAAS,KAAM,CAAC,CAAC,OACrD,aACD;AAGD,MAAG,YAAY,IAAI,gBAAgB,CAAC,OAAO,gBAAgB,QAAQ;AAInE,MAAG,YAAY,IAAI,eAAe,CAAC,OAAO;AAC1C,MAAG,YAAY,IAAI,gBAAgB,CAAC,OAAO,YAAY;IAE1D;GACD"}
|
|
1
|
+
{"version":3,"file":"publish.js","names":[],"sources":["../../../src/tests/publish.ts"],"sourcesContent":["/// <reference types=\"cypress\" />\nimport { maybeIt } from '../features';\nimport { RegistryConfig } from '../types';\n\nexport function publishTests(config: RegistryConfig) {\n const { header, package: pkg } = config.testIds;\n const { markdownBody, loginDialog } = config.selectors;\n const { features } = config;\n\n describe('publish', () => {\n const pkgName = '@verdaccio/pkg-scoped';\n // Single source of truth for the dependency the publish fixture\n // writes into its package.json. The dependencies-tab assertion\n // reads these back to verify the UI rendered both fields.\n const depName = 'debug';\n const depVersion = '4.0.0';\n // Per-test state so afterEach can clean up the specific publish\n // that this test created (temp folder + registry entry).\n let tempFolder: string | null = null;\n\n /**\n * Log in once, reuse the session across every test in this suite.\n * `cy.session` caches cookies + localStorage keyed on the first\n * argument, so subsequent calls restore without hitting the network.\n */\n const loginOnce = () => {\n cy.session(\n ['publish-suite', config.credentials.user],\n () => {\n cy.visit(config.registryUrl);\n cy.login(config.credentials.user, config.credentials.password, {\n loginButton: header.loginButton,\n ...loginDialog,\n });\n cy.wait('@sign');\n },\n {\n validate() {\n cy.request({\n url: `${config.registryUrl}/-/verdaccio/data/packages`,\n failOnStatusCode: false,\n })\n .its('status')\n .should('be.oneOf', [200, 304]);\n },\n cacheAcrossSpecs: true,\n }\n );\n };\n\n beforeEach(() => {\n cy.intercept('POST', '/-/verdaccio/sec/login').as('sign');\n cy.intercept('GET', '/-/verdaccio/data/packages').as('pkgs');\n cy.intercept('GET', `/-/verdaccio/data/sidebar/${pkgName}`).as('sidebar');\n cy.intercept('GET', `/-/verdaccio/data/package/readme/${pkgName}`).as('readme');\n\n // Publish a fresh copy for this test. `unique: true` appends a\n // timestamp suffix so the version is distinct per test even when\n // the registry briefly has a stale copy from a prior afterEach.\n cy.task('publishPackage', {\n pkgName,\n version: '1.0.0',\n dependencies: { [depName]: depVersion },\n unique: true,\n }).then((result) => {\n tempFolder = result?.tempFolder ?? null;\n });\n\n loginOnce();\n cy.visit(config.registryUrl);\n });\n\n afterEach(() => {\n // Remove the package from the registry AND the local temp folder.\n // Run both regardless of test outcome so the next test starts\n // clean. `unpublishPackage` treats 404 as success, so a re-run\n // after a half-published state is still safe.\n cy.task('unpublishPackage', { pkgName, tempFolder: tempFolder ?? undefined });\n if (tempFolder) {\n cy.task('cleanupPublished', tempFolder);\n }\n tempFolder = null;\n });\n\n it('should have one published package', () => {\n cy.wait('@pkgs');\n cy.getByTestId(pkg.title).should('have.length.at.least', 1);\n });\n\n it('should navigate to page detail', () => {\n cy.wait('@pkgs');\n cy.wait(300);\n cy.getByTestId(pkg.title).first().click();\n });\n\n it('should have readme content', () => {\n cy.wait('@pkgs');\n cy.getByTestId(pkg.title).first().click();\n cy.wait('@readme');\n cy.wait('@sidebar');\n cy.getByTestId(pkg.readme).should('be.visible');\n cy.get(markdownBody).should('have.length', 1);\n // publishPackage writes a README whose body contains \"e2e testing\".\n cy.contains(markdownBody, /test/);\n cy.contains(`${markdownBody} h1`, pkgName).should('be.visible');\n });\n\n it('should render the sidebar with install commands for npm, yarn, pnpm', () => {\n cy.wait('@pkgs');\n cy.getByTestId(pkg.title).first().click();\n cy.wait('@sidebar');\n cy.getByTestId(pkg.sidebar).should('be.visible');\n cy.getByTestId(pkg.installList).within(() => {\n cy.getByTestId(pkg.installNpm).should('be.visible');\n cy.getByTestId(pkg.installYarn).should('be.visible');\n cy.getByTestId(pkg.installPnpm).should('be.visible');\n });\n cy.getByTestId(pkg.installNpm).should('contain.text', pkgName);\n });\n\n it('should render the sidebar keywords from the published manifest', () => {\n cy.wait('@pkgs');\n cy.getByTestId(pkg.title).first().click();\n cy.wait('@sidebar');\n // publishPackage writes `keywords: ['verdaccio', 'e2e', 'test']`\n // into the generated package.json.\n cy.getByTestId(pkg.keywordList).should('be.visible');\n cy.getByTestId(pkg.keywordList).should('contain.text', 'verdaccio');\n cy.getByTestId(pkg.keywordList).should('contain.text', 'e2e');\n cy.getByTestId(pkg.keywordList).should('contain.text', 'test');\n });\n\n it('should click on dependencies tab', () => {\n cy.wait('@pkgs');\n cy.wait(300);\n cy.getByTestId(pkg.title).first().click();\n cy.wait('@readme');\n cy.wait('@sidebar');\n cy.getByTestId(pkg.dependenciesTab).click();\n cy.wait(100);\n cy.getByTestId(pkg.dependencies).should('have.length', 1);\n\n // The dep Chip uses the dep name as its data-testid (dynamic\n // Verdaccio convention, see DependencyBlock.tsx:68), and its\n // label is `\"${name}: ${version}\"` via the `dependencies.\n // dependency-block` i18n key. Assert BOTH fields are rendered.\n cy.getByTestId(depName)\n .should('be.visible')\n .and('contain.text', depName)\n .and('contain.text', depVersion);\n\n // Also verify the Chip text matches the exact \"name: version\"\n // format so a regression in the label template would fail here\n // rather than pass via a loose substring match.\n cy.getByTestId(depName)\n .invoke('text')\n .should('match', new RegExp(`${depName}\\\\s*:\\\\s*${depVersion}`));\n });\n\n it('should click on versions tab', () => {\n cy.wait('@pkgs');\n cy.wait(300);\n cy.getByTestId(pkg.title).first().click();\n cy.wait('@readme');\n cy.wait('@sidebar');\n cy.getByTestId(pkg.versionsTab).click();\n // With `unique: true` the version becomes `1.0.0-t<timestamp>`,\n // but \"1.0.0\" still appears as a substring — match loosely.\n cy.getByTestId(pkg.tagLatest)\n .children()\n .invoke('text')\n .should('match', /1\\.0\\.0/);\n });\n\n it('should click on uplinks tab', () => {\n cy.wait('@pkgs');\n cy.wait(300);\n cy.getByTestId(pkg.title).first().click();\n cy.wait('@readme');\n cy.wait('@sidebar');\n cy.getByTestId(pkg.uplinksTab).click();\n cy.getByTestId(pkg.noUplinks).should('be.visible');\n });\n\n // ── Action-bar FABs: tarball download + raw viewer ─────────────\n // Both buttons live in the sidebar ActionBar. They're gated on\n // `web.showDownloadTarball` / `web.showRaw` (both default to true\n // in the ui-theme's AppConfigurationProvider) and each test is\n // also guarded by a feature flag so branches that ship a\n // different action bar can skip cleanly.\n\n maybeIt(features.publish.downloadTarball)(\n 'should fetch the tarball when the download button is clicked',\n () => {\n // The download provider hits the package manifest's dist.tarball\n // URL directly. For our published fixture the filename looks\n // like `pkg-scoped-1.0.0-t<ts>.tgz`, served from\n // `/<pkg>/-/<filename>.tgz`. Intercept before clicking.\n cy.intercept('GET', '**/pkg-scoped-*.tgz').as('tarballFetch');\n\n cy.wait('@pkgs');\n cy.getByTestId(pkg.title).first().click();\n cy.wait('@sidebar');\n\n cy.getByTestId(pkg.downloadTarballBtn).should('be.visible').click();\n\n // The fetch should fire and return 200. We can't assert on the\n // actual file landing on disk — Cypress doesn't track OS-level\n // downloads — but a successful GET proves the end-to-end path\n // from click → download provider → registry.\n cy.wait('@tarballFetch', { timeout: 10000 }).its('response.statusCode').should('eq', 200);\n }\n );\n\n maybeIt(features.publish.rawViewer)(\n 'should open the raw manifest viewer when the raw button is clicked',\n () => {\n cy.wait('@pkgs');\n cy.getByTestId(pkg.title).first().click();\n cy.wait('@sidebar');\n\n // RawViewer is a full-screen MUI Dialog — initially unmounted\n // because `isOpen=false` keeps Dialog closed and Cypress won't\n // find it. Clicking the FAB flips `isOpen` to true.\n cy.getByTestId(pkg.rawBtn).should('be.visible').click();\n\n cy.getByTestId(pkg.rawViewerDialog, { timeout: 5000 }).should('be.visible');\n // The ReactJson viewer renders the package manifest — the\n // package name should appear somewhere in the serialized JSON.\n cy.getByTestId(pkg.rawViewerDialog).should('contain.text', pkgName);\n\n // Close via the X button and confirm the dialog goes away so\n // subsequent tests don't inherit an open overlay.\n cy.getByTestId(pkg.closeRawViewer).click();\n cy.getByTestId(pkg.rawViewerDialog).should('not.exist');\n }\n );\n });\n}\n"],"mappings":";;AAIA,SAAgB,aAAa,QAAwB;CACnD,MAAM,EAAE,QAAQ,SA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,GAAG,eAAe;GAE7D,GAAG,KAAK,QAAQ;GAChB,GAAG,YAAY,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO;GACzC,GAAG,KAAK,WAAW;GAEnB,GAAG,YAAY,IAAI,mBAAmB,CAAC,OAAO,aAAa,CAAC,OAAO;GAMnE,GAAG,KAAK,iBAAiB,EAAE,SAAS,KAAO,CAAC,CAAC,IAAI,sBAAsB,CAAC,OAAO,MAAM,IAAI;IAE5F;EAED,QAAQ,SAAS,QAAQ,UAAU,CACjC,4EACM;GACJ,GAAG,KAAK,QAAQ;GAChB,GAAG,YAAY,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO;GACzC,GAAG,KAAK,WAAW;GAKnB,GAAG,YAAY,IAAI,OAAO,CAAC,OAAO,aAAa,CAAC,OAAO;GAEvD,GAAG,YAAY,IAAI,iBAAiB,EAAE,SAAS,KAAM,CAAC,CAAC,OAAO,aAAa;GAG3E,GAAG,YAAY,IAAI,gBAAgB,CAAC,OAAO,gBAAgB,QAAQ;GAInE,GAAG,YAAY,IAAI,eAAe,CAAC,OAAO;GAC1C,GAAG,YAAY,IAAI,gBAAgB,CAAC,OAAO,YAAY;IAE1D;GACD"}
|
|
@@ -29,13 +29,6 @@ function searchTests(config) {
|
|
|
29
29
|
expect(interception.request.url).to.contain(query);
|
|
30
30
|
});
|
|
31
31
|
});
|
|
32
|
-
it("should show a \"no results\" state for an impossible query", () => {
|
|
33
|
-
const query = "xyzzy-no-such-package-" + Date.now();
|
|
34
|
-
getSearchInput().clear().type(query, { delay: 30 });
|
|
35
|
-
cy.wait(anySearchAlias(), { timeout: 1e4 });
|
|
36
|
-
cy.wait(300);
|
|
37
|
-
cy.contains(/no\s+(match|results|packages)/i, { timeout: 5e3 }).should("be.visible");
|
|
38
|
-
});
|
|
39
32
|
it("should clear the query and allow typing a new one", () => {
|
|
40
33
|
getSearchInput().clear().type("first-query", { delay: 20 });
|
|
41
34
|
cy.wait(anySearchAlias(), { timeout: 1e4 });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","names":[],"sources":["../../../src/tests/search.ts"],"sourcesContent":["/// <reference types=\"cypress\" />\n\nimport { maybeIt } from '../features';\nimport { RegistryConfig } from '../types';\n\n/**\n * UI tests for the Verdaccio search box.\n *\n * These tests do NOT depend on any published package — they assert the\n * search *flow* (input exists, typing triggers the search API, results\n * region updates) rather than specific package metadata. Tests that need\n * a real package in the registry should live in publishTests instead.\n */\nexport function searchTests(config: RegistryConfig) {\n const { features } = config;\n const { package: pkg } = config.testIds;\n\n describe('search', () => {\n beforeEach(() => {\n // Verdaccio's search endpoint — covers both the web API and the\n // npm v1 search API, depending on which one the UI calls.\n cy.intercept('GET', '**/-/verdaccio/data/search/**').as('webSearch');\n cy.intercept('GET', '**/-/v1/search**').as('v1Search');\n cy.intercept('GET', '**/-/verdaccio/data/packages').as('pkgs');\n\n cy.visit(config.registryUrl);\n cy.get('body').should('be.visible');\n });\n\n it('should render the search input', () => {\n getSearchInput().should('be.visible');\n });\n\n it('should fire a search request when typing a query', () => {\n const query = 'verdaccio';\n\n getSearchInput().clear().type(query, { delay: 30 });\n\n // Whichever endpoint the UI is wired to, at least one should hit.\n cy.wait(anySearchAlias(), { timeout: 10000 }).then((interception: any) => {\n expect(interception.request.url).to.contain(query);\n });\n });\n\n it('should show a \"no results\" state for an impossible query', () => {\n const query = 'xyzzy-no-such-package-' + Date.now();\n\n getSearchInput().clear().type(query, { delay: 30 });\n cy.wait(anySearchAlias(), { timeout: 10000 });\n\n // Give the UI a tick to render the empty state.\n cy.wait(300);\n\n // The UI may render \"No Match\", \"No results\", or similar — match\n // loosely rather than binding to one exact string.\n cy.contains(/no\\s+(match|results|packages)/i, { timeout: 5000 }).should(\n 'be.visible'\n );\n });\n\n it('should clear the query and allow typing a new one', () => {\n getSearchInput().clear().type('first-query', { delay: 20 });\n cy.wait(anySearchAlias(), { timeout: 10000 });\n\n // Clearing should empty the input value. We deliberately do NOT\n // assert on the autocomplete dropdown's empty-state text: on a\n // registry with no packages published it lingers regardless of\n // the input value, which previously caused a false positive.\n getSearchInput().clear();\n getSearchInput().should('have.value', '');\n\n // Typing a fresh query must fire another search request so the\n // search box is still functional after a clear.\n getSearchInput().type('second-query', { delay: 20 });\n cy.wait(anySearchAlias(), { timeout: 10000 }).then(\n (interception: any) => {\n expect(interception.request.url).to.contain('second-query');\n }\n );\n });\n\n // ── Rendering assertions that require real package data ────────\n // Publishes a throwaway package before each test and unpublishes\n // after so the outer \"no results\" test still sees a clean registry.\n // The search query uses a substring of the package name to avoid\n // scope-parsing issues with `@` / `/` characters in the URL.\n describe('with a published package', () => {\n const pkgName = '@verdaccio/search-fixture';\n // Unique slug we can type into the search box — must be a\n // substring of pkgName so Verdaccio's search matches it.\n const pkgSlug = 'search-fixture';\n let tempFolder: string | null = null;\n\n beforeEach(() => {\n cy.task('publishPackage', {\n pkgName,\n version: '1.0.0',\n unique: true,\n }).then((result) => {\n tempFolder = result?.tempFolder ?? null;\n });\n cy.visit(config.registryUrl);\n });\n\n afterEach(() => {\n cy.task('unpublishPackage', {\n pkgName,\n tempFolder: tempFolder ?? undefined,\n });\n if (tempFolder) {\n cy.task('cleanupPublished', tempFolder);\n }\n tempFolder = null;\n });\n\n maybeIt(features.search.resultsDropdown)(\n 'should display the matching package in the results dropdown',\n () => {\n getSearchInput().clear().type(pkgSlug, { delay: 30 });\n\n // Wait for the search request to resolve with results.\n cy.wait(anySearchAlias(), { timeout: 10000 }).then(\n (interception: any) => {\n expect(interception.request.url).to.contain(pkgSlug);\n }\n );\n\n // MUI Autocomplete opens a listbox with role=\"listbox\" when\n // there are matching options. Each result renders with\n // role=\"option\". No data-testids on the dropdown itself, so\n // we lean on the ARIA roles which are stable across MUI\n // versions.\n cy.get('[role=\"listbox\"]', { timeout: 5000 }).should('be.visible');\n cy.get('[role=\"listbox\"] [role=\"option\"]').should(\n 'have.length.at.least',\n 1\n );\n // The result item must contain the full package name.\n cy.contains('[role=\"listbox\"] [role=\"option\"]', pkgName).should(\n 'be.visible'\n );\n }\n );\n\n maybeIt(features.search.resultClickNavigation)(\n 'should navigate to the package detail page when a result is clicked',\n () => {\n // Intercept the two data endpoints that the detail route\n // fetches on mount. Waiting on these is the most reliable\n // way to know the router actually resolved the new page\n // (not just changed the URL).\n cy.intercept('GET', `/-/verdaccio/data/sidebar/${pkgName}`).as(\n 'detailSidebar'\n );\n cy.intercept(\n 'GET',\n `/-/verdaccio/data/package/readme/${pkgName}`\n ).as('detailReadme');\n\n getSearchInput().clear().type(pkgSlug, { delay: 30 });\n cy.wait(anySearchAlias(), { timeout: 10000 });\n\n cy.contains('[role=\"listbox\"] [role=\"option\"]', pkgName)\n .should('be.visible')\n .click();\n\n // Verdaccio routes package detail under /-/web/detail/<pkg>.\n cy.location('pathname').should('contain', '/-/web/detail');\n cy.location('pathname').should('contain', 'search-fixture');\n\n // Wait for the detail page's own fetches to settle so\n // assertions don't race the async content.\n cy.wait('@detailSidebar', { timeout: 10000 });\n cy.wait('@detailReadme', { timeout: 10000 });\n\n // Detail page rendered both panes end-to-end.\n cy.getByTestId(pkg.sidebar).should('be.visible');\n cy.getByTestId(pkg.readme).should('be.visible');\n }\n );\n });\n });\n}\n\n/**\n * Resolve the search input. Verdaccio 6 renders it with different\n * data-testid values across versions, so we try a few in order before\n * falling back to a generic role/type selector.\n */\nfunction getSearchInput() {\n return cy.get(\n [\n '[data-testid=\"search-input\"]',\n '[data-testid=\"header--input-search\"]',\n '[data-testid=\"autoCompleteSearch\"] input',\n 'input[aria-label*=\"earch\"]',\n 'input[placeholder*=\"earch\"]',\n 'input[type=\"search\"]',\n ].join(', '),\n { timeout: 10000 }\n );\n}\n\n/**\n * Cypress `cy.wait` only accepts one alias at a time, so pick whichever\n * alias fires first. This helper lets us stay agnostic to which search\n * endpoint the UI is wired to.\n */\nfunction anySearchAlias(): string {\n // In practice most Verdaccio 6 builds call the web search endpoint;\n // prefer that one and let the test fail loud if neither fires.\n return '@webSearch';\n}\n"],"mappings":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AAE,EAAE,SAAS,KAAO,CAAC;AAE7C,OAAG,SAAS,wCAAoC,QAAQ,CACrD,OAAO,aAAa,CACpB,OAAO;AAGV,OAAG,SAAS,WAAW,CAAC,OAAO,WAAW,gBAAgB;AAC1D,OAAG,SAAS,WAAW,CAAC,OAAO,WAAW,iBAAiB;AAI3D,OAAG,KAAK,kBAAkB,EAAE,SAAS,KAAO,CAAC;AAC7C,OAAG,KAAK,iBAAiB,EAAE,SAAS,KAAO,CAAC;AAG5C,OAAG,YAAY,IAAI,QAAQ,CAAC,OAAO,aAAa;AAChD,OAAG,YAAY,IAAI,OAAO,CAAC,OAAO,aAAa;KAElD;IACD;GACF;;;;;;;AAQJ,SAAS,iBAAiB;AACxB,QAAO,GAAG,IACR;EACE;EACA;EACA;EACA;EACA;EACA;EACD,CAAC,KAAK,KAAK,EACZ,EAAE,SAAS,KAAO,CACnB;;;;;;;AAQH,SAAS,iBAAyB;AAGhC,QAAO"}
|
|
1
|
+
{"version":3,"file":"search.js","names":[],"sources":["../../../src/tests/search.ts"],"sourcesContent":["/// <reference types=\"cypress\" />\nimport { maybeIt } from '../features';\nimport { RegistryConfig } from '../types';\n\n/**\n * UI tests for the Verdaccio search box.\n *\n * These tests do NOT depend on any published package — they assert the\n * search *flow* (input exists, typing triggers the search API, results\n * region updates) rather than specific package metadata. Tests that need\n * a real package in the registry should live in publishTests instead.\n */\nexport function searchTests(config: RegistryConfig) {\n const { features } = config;\n const { package: pkg } = config.testIds;\n\n describe('search', () => {\n beforeEach(() => {\n // Verdaccio's search endpoint — covers both the web API and the\n // npm v1 search API, depending on which one the UI calls.\n cy.intercept('GET', '**/-/verdaccio/data/search/**').as('webSearch');\n cy.intercept('GET', '**/-/v1/search**').as('v1Search');\n cy.intercept('GET', '**/-/verdaccio/data/packages').as('pkgs');\n\n cy.visit(config.registryUrl);\n cy.get('body').should('be.visible');\n });\n\n it('should render the search input', () => {\n getSearchInput().should('be.visible');\n });\n\n it('should fire a search request when typing a query', () => {\n const query = 'verdaccio';\n\n getSearchInput().clear().type(query, { delay: 30 });\n\n // Whichever endpoint the UI is wired to, at least one should hit.\n cy.wait(anySearchAlias(), { timeout: 10000 }).then((interception: any) => {\n expect(interception.request.url).to.contain(query);\n });\n });\n\n // NOTE: there is intentionally no \"no results / empty state\" test.\n //\n // Verdaccio 7+ removed the `searchRemote` flag (verdaccio/verdaccio#5801)\n // and the Web UI search now ALWAYS queries the configured uplinks. The CI\n // config proxies `**` to registry.npmjs.org, and npmjs' `/-/v1/search`\n // returns fuzzy / fallback matches for ANY non-empty text — so there is no\n // query that reliably yields zero results and renders the autocomplete's\n // \"No results found\" state. (On verdaccio 6, where search stayed local by\n // default, an impossible query did return `[]`, so this test used to pass.)\n // Asserting the empty state here is therefore non-deterministic; the search\n // *flow* is covered by the tests above and the published-package tests below.\n\n it('should clear the query and allow typing a new one', () => {\n getSearchInput().clear().type('first-query', { delay: 20 });\n cy.wait(anySearchAlias(), { timeout: 10000 });\n\n // Clearing should empty the input value. We deliberately do NOT\n // assert on the autocomplete dropdown's empty-state text: on a\n // registry with no packages published it lingers regardless of\n // the input value, which previously caused a false positive.\n getSearchInput().clear();\n getSearchInput().should('have.value', '');\n\n // Typing a fresh query must fire another search request so the\n // search box is still functional after a clear.\n getSearchInput().type('second-query', { delay: 20 });\n cy.wait(anySearchAlias(), { timeout: 10000 }).then((interception: any) => {\n expect(interception.request.url).to.contain('second-query');\n });\n });\n\n // ── Rendering assertions that require real package data ────────\n // Publishes a throwaway package before each test and unpublishes\n // after so the outer \"no results\" test still sees a clean registry.\n // The search query uses a substring of the package name to avoid\n // scope-parsing issues with `@` / `/` characters in the URL.\n describe('with a published package', () => {\n const pkgName = '@verdaccio/search-fixture';\n // Unique slug we can type into the search box — must be a\n // substring of pkgName so Verdaccio's search matches it.\n const pkgSlug = 'search-fixture';\n let tempFolder: string | null = null;\n\n beforeEach(() => {\n cy.task('publishPackage', {\n pkgName,\n version: '1.0.0',\n unique: true,\n }).then((result) => {\n tempFolder = result?.tempFolder ?? null;\n });\n cy.visit(config.registryUrl);\n });\n\n afterEach(() => {\n cy.task('unpublishPackage', {\n pkgName,\n tempFolder: tempFolder ?? undefined,\n });\n if (tempFolder) {\n cy.task('cleanupPublished', tempFolder);\n }\n tempFolder = null;\n });\n\n maybeIt(features.search.resultsDropdown)(\n 'should display the matching package in the results dropdown',\n () => {\n getSearchInput().clear().type(pkgSlug, { delay: 30 });\n\n // Wait for the search request to resolve with results.\n cy.wait(anySearchAlias(), { timeout: 10000 }).then((interception: any) => {\n expect(interception.request.url).to.contain(pkgSlug);\n });\n\n // MUI Autocomplete opens a listbox with role=\"listbox\" when\n // there are matching options. Each result renders with\n // role=\"option\". No data-testids on the dropdown itself, so\n // we lean on the ARIA roles which are stable across MUI\n // versions.\n cy.get('[role=\"listbox\"]', { timeout: 5000 }).should('be.visible');\n cy.get('[role=\"listbox\"] [role=\"option\"]').should('have.length.at.least', 1);\n // The result item must contain the full package name.\n cy.contains('[role=\"listbox\"] [role=\"option\"]', pkgName).should('be.visible');\n }\n );\n\n maybeIt(features.search.resultClickNavigation)(\n 'should navigate to the package detail page when a result is clicked',\n () => {\n // Intercept the two data endpoints that the detail route\n // fetches on mount. Waiting on these is the most reliable\n // way to know the router actually resolved the new page\n // (not just changed the URL).\n cy.intercept('GET', `/-/verdaccio/data/sidebar/${pkgName}`).as('detailSidebar');\n cy.intercept('GET', `/-/verdaccio/data/package/readme/${pkgName}`).as('detailReadme');\n\n getSearchInput().clear().type(pkgSlug, { delay: 30 });\n cy.wait(anySearchAlias(), { timeout: 10000 });\n\n cy.contains('[role=\"listbox\"] [role=\"option\"]', pkgName).should('be.visible').click();\n\n // Verdaccio routes package detail under /-/web/detail/<pkg>.\n cy.location('pathname').should('contain', '/-/web/detail');\n cy.location('pathname').should('contain', 'search-fixture');\n\n // Wait for the detail page's own fetches to settle so\n // assertions don't race the async content.\n cy.wait('@detailSidebar', { timeout: 10000 });\n cy.wait('@detailReadme', { timeout: 10000 });\n\n // Detail page rendered both panes end-to-end.\n cy.getByTestId(pkg.sidebar).should('be.visible');\n cy.getByTestId(pkg.readme).should('be.visible');\n }\n );\n });\n });\n}\n\n/**\n * Resolve the search input. Verdaccio 6 renders it with different\n * data-testid values across versions, so we try a few in order before\n * falling back to a generic role/type selector.\n */\nfunction getSearchInput() {\n return cy.get(\n [\n '[data-testid=\"search-input\"]',\n '[data-testid=\"header--input-search\"]',\n '[data-testid=\"autoCompleteSearch\"] input',\n 'input[aria-label*=\"earch\"]',\n 'input[placeholder*=\"earch\"]',\n 'input[type=\"search\"]',\n ].join(', '),\n { timeout: 10000 }\n );\n}\n\n/**\n * Cypress `cy.wait` only accepts one alias at a time, so pick whichever\n * alias fires first. This helper lets us stay agnostic to which search\n * endpoint the UI is wired to.\n */\nfunction anySearchAlias(): string {\n // In practice most Verdaccio 6 builds call the web search endpoint;\n // prefer that one and let the test fail loud if neither fires.\n return '@webSearch';\n}\n"],"mappings":";;;;;;;;;;AAYA,SAAgB,YAAY,QAAwB;CAClD,MAAM,EAAE,aAAa;CACrB,MAAM,EAAE,SAAS,QAAQ,OAAO;CAEhC,SAAS,gBAAgB;EACvB,iBAAiB;GAGf,GAAG,UAAU,OAAO,gCAAgC,CAAC,GAAG,YAAY;GACpE,GAAG,UAAU,OAAO,mBAAmB,CAAC,GAAG,WAAW;GACtD,GAAG,UAAU,OAAO,+BAA+B,CAAC,GAAG,OAAO;GAE9D,GAAG,MAAM,OAAO,YAAY;GAC5B,GAAG,IAAI,OAAO,CAAC,OAAO,aAAa;IACnC;EAEF,GAAG,wCAAwC;GACzC,gBAAgB,CAAC,OAAO,aAAa;IACrC;EAEF,GAAG,0DAA0D;GAC3D,MAAM,QAAQ;GAEd,gBAAgB,CAAC,OAAO,CAAC,KAAK,OAAO,EAAE,OAAO,IAAI,CAAC;GAGnD,GAAG,KAAK,gBAAgB,EAAE,EAAE,SAAS,KAAO,CAAC,CAAC,MAAM,iBAAsB;IACxE,OAAO,aAAa,QAAQ,IAA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AG,SAAS,wCAAoC,QAAQ,CAAC,OAAO,aAAa;KAEhF;GAED,QAAQ,SAAS,OAAO,sBAAsB,CAC5C,6EACM;IAKJ,GAAG,UAAU,OAAO,6BAA6B,UAAU,CAAC,GAAG,gBAAgB;IAC/E,GAAG,UAAU,OAAO,oCAAoC,UAAU,CAAC,GAAG,eAAe;IAErF,gBAAgB,CAAC,OAAO,CAAC,KAAK,SAAS,EAAE,OAAO,IAAI,CAAC;IACrD,GAAG,KAAK,gBAAgB,EAAE,EAAE,SAAS,KAAO,CAAC;IAE7C,GAAG,SAAS,wCAAoC,QAAQ,CAAC,OAAO,aAAa,CAAC,OAAO;IAGrF,GAAG,SAAS,WAAW,CAAC,OAAO,WAAW,gBAAgB;IAC1D,GAAG,SAAS,WAAW,CAAC,OAAO,WAAW,iBAAiB;IAI3D,GAAG,KAAK,kBAAkB,EAAE,SAAS,KAAO,CAAC;IAC7C,GAAG,KAAK,iBAAiB,EAAE,SAAS,KAAO,CAAC;IAG5C,GAAG,YAAY,IAAI,QAAQ,CAAC,OAAO,aAAa;IAChD,GAAG,YAAY,IAAI,OAAO,CAAC,OAAO,aAAa;KAElD;IACD;GACF;;;;;;;AAQJ,SAAS,iBAAiB;CACxB,OAAO,GAAG,IACR;EACE;EACA;EACA;EACA;EACA;EACA;EACD,CAAC,KAAK,KAAK,EACZ,EAAE,SAAS,KAAO,CACnB;;;;;;;AAQH,SAAS,iBAAyB;CAGhC,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.js","names":[],"sources":["../../../src/tests/settings.ts"],"sourcesContent":["/// <reference types=\"cypress\" />\
|
|
1
|
+
{"version":3,"file":"settings.js","names":[],"sources":["../../../src/tests/settings.ts"],"sourcesContent":["/// <reference types=\"cypress\" />\nimport { maybeIt } from '../features';\nimport { RegistryConfig } from '../types';\n\n/**\n * Tests for the header Settings dialog and the Translations (language)\n * picker inside it.\n *\n * Requires `web.showSettings: true` in the registry config — the gear\n * icon only renders when the flag is on (see HeaderRight in Verdaccio's\n * ui-components package).\n *\n * Selector strategy: the language cards in LanguageSwitch do NOT have\n * data-testids, so this suite leans on:\n * - MUI's ARIA roles: `[role=\"dialog\"]`, `[role=\"tab\"]`\n * - The stable English labels \"Configuration\", \"Translations\",\n * \"English\", \"German\", and the language description text, which are\n * bundled into the ui-theme via `@verdaccio/ui-i18n`\n * - The settings trigger's testid from Verdaccio's HeaderToolTipIcon:\n * `header--tooltip-settings`\n */\nexport function settingsTests(config: RegistryConfig) {\n const { header } = config.testIds;\n const { features } = config;\n\n describe('settings & language', () => {\n beforeEach(() => {\n cy.visit(config.registryUrl);\n cy.get('body').should('be.visible');\n });\n\n it('should open the settings dialog from the header', () => {\n cy.getByTestId(header.settingsTooltip).click();\n cy.get('[role=\"dialog\"]').should('be.visible');\n // Dialog title key: dialog.settings.title → \"Configuration\" in EN.\n cy.contains('[role=\"dialog\"]', 'Configuration').should('be.visible');\n });\n\n it('should show both Package Managers and Translations tabs', () => {\n cy.getByTestId(header.settingsTooltip).click();\n cy.get('[role=\"dialog\"]').should('be.visible');\n cy.get('[role=\"dialog\"] [role=\"tab\"]').should('have.length', 2);\n cy.contains('[role=\"dialog\"] [role=\"tab\"]', 'Translations').should('be.visible');\n });\n\n it('should switch to the Translations tab and list languages', () => {\n cy.getByTestId(header.settingsTooltip).click();\n cy.get('[role=\"dialog\"]').should('be.visible');\n cy.contains('[role=\"dialog\"] [role=\"tab\"]', 'Translations').click();\n // language.description text is bundled in EN — good sentinel.\n cy.contains('[role=\"dialog\"]', /this is the configuration details for the language/i).should(\n 'be.visible'\n );\n // Sanity-check a couple of language cards are rendered.\n cy.contains('[role=\"dialog\"]', 'English').should('be.visible');\n cy.contains('[role=\"dialog\"]', 'German').should('be.visible');\n });\n\n maybeIt(features.settings.languageSwitcher)(\n 'should change the UI language when a language card is clicked',\n () => {\n cy.getByTestId(header.settingsTooltip).click();\n cy.get('[role=\"dialog\"]').should('be.visible');\n cy.contains('[role=\"dialog\"] [role=\"tab\"]', 'Translations').click();\n\n // Before switching, capture the current dialog title so we can\n // assert it changes. This avoids hard-coding the German string.\n cy.contains('[role=\"dialog\"]', 'Configuration')\n .invoke('text')\n .then((englishTitle) => {\n // Click the German card. We scope to the dialog + the MUI\n // card class to avoid matching other \"German\" text.\n cy.contains('[role=\"dialog\"] .MuiCard-root', 'German').click({\n force: true,\n });\n\n // The English tab label \"Translations\" must no longer be\n // present anywhere in the dialog — strongest proof the\n // language actually switched.\n cy.contains('[role=\"dialog\"] [role=\"tab\"]', 'Translations').should('not.exist');\n // And the original dialog title text should also be gone.\n cy.contains('[role=\"dialog\"]', englishTitle).should('not.exist');\n });\n }\n );\n\n it('should close the settings dialog with Escape', () => {\n cy.getByTestId(header.settingsTooltip).click();\n cy.get('[role=\"dialog\"]').should('be.visible');\n cy.get('body').type('{esc}');\n cy.get('[role=\"dialog\"]').should('not.exist');\n });\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqBA,SAAgB,cAAc,QAAwB;CACpD,MAAM,EAAE,WAAW,OAAO;CAC1B,MAAM,EAAE,aAAa;CAErB,SAAS,6BAA6B;EACpC,iBAAiB;GACf,GAAG,MAAM,OAAO,YAAY;GAC5B,GAAG,IAAI,OAAO,CAAC,OAAO,aAAa;IACnC;EAEF,GAAG,yDAAyD;GAC1D,GAAG,YAAY,OAAO,gBAAgB,CAAC,OAAO;GAC9C,GAAG,IAAI,oBAAkB,CAAC,OAAO,aAAa;GAE9C,GAAG,SAAS,qBAAmB,gBAAgB,CAAC,OAAO,aAAa;IACpE;EAEF,GAAG,iEAAiE;GAClE,GAAG,YAAY,OAAO,gBAAgB,CAAC,OAAO;GAC9C,GAAG,IAAI,oBAAkB,CAAC,OAAO,aAAa;GAC9C,GAAG,IAAI,mCAA+B,CAAC,OAAO,eAAe,EAAE;GAC/D,GAAG,SAAS,oCAAgC,eAAe,CAAC,OAAO,aAAa;IAChF;EAEF,GAAG,kEAAkE;GACnE,GAAG,YAAY,OAAO,gBAAgB,CAAC,OAAO;GAC9C,GAAG,IAAI,oBAAkB,CAAC,OAAO,aAAa;GAC9C,GAAG,SAAS,oCAAgC,eAAe,CAAC,OAAO;GAEnE,GAAG,SAAS,qBAAmB,sDAAsD,CAAC,OACpF,aACD;GAED,GAAG,SAAS,qBAAmB,UAAU,CAAC,OAAO,aAAa;GAC9D,GAAG,SAAS,qBAAmB,SAAS,CAAC,OAAO,aAAa;IAC7D;EAEF,QAAQ,SAAS,SAAS,iBAAiB,CACzC,uEACM;GACJ,GAAG,YAAY,OAAO,gBAAgB,CAAC,OAAO;GAC9C,GAAG,IAAI,oBAAkB,CAAC,OAAO,aAAa;GAC9C,GAAG,SAAS,oCAAgC,eAAe,CAAC,OAAO;GAInE,GAAG,SAAS,qBAAmB,gBAAgB,CAC5C,OAAO,OAAO,CACd,MAAM,iBAAiB;IAGtB,GAAG,SAAS,mCAAiC,SAAS,CAAC,MAAM,EAC3D,OAAO,MACR,CAAC;IAKF,GAAG,SAAS,oCAAgC,eAAe,CAAC,OAAO,YAAY;IAE/E,GAAG,SAAS,qBAAmB,aAAa,CAAC,OAAO,YAAY;KAChE;IAEP;EAED,GAAG,sDAAsD;GACvD,GAAG,YAAY,OAAO,gBAAgB,CAAC,OAAO;GAC9C,GAAG,IAAI,oBAAkB,CAAC,OAAO,aAAa;GAC9C,GAAG,IAAI,OAAO,CAAC,KAAK,QAAQ;GAC5B,GAAG,IAAI,oBAAkB,CAAC,OAAO,YAAY;IAC7C;GACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signin.js","names":[],"sources":["../../../src/tests/signin.ts"],"sourcesContent":["/// <reference types=\"cypress\" />\
|
|
1
|
+
{"version":3,"file":"signin.js","names":[],"sources":["../../../src/tests/signin.ts"],"sourcesContent":["/// <reference types=\"cypress\" />\nimport { maybeIt } from '../features';\nimport { RegistryConfig } from '../types';\n\nexport function signinTests(config: RegistryConfig) {\n const { header, login } = config.testIds;\n const { loginDialog } = config.selectors;\n const { features } = config;\n\n describe('sign in / sign out', () => {\n beforeEach(() => {\n cy.intercept('POST', '/-/verdaccio/sec/login').as('sign');\n cy.visit(config.registryUrl);\n });\n\n it('should login user', () => {\n cy.login(config.credentials.user, config.credentials.password, {\n loginButton: header.loginButton,\n ...loginDialog,\n });\n cy.wait('@sign');\n cy.getByTestId(header.logInDialogIcon).click();\n cy.wait(100);\n cy.getByTestId(header.greetingsLabel).contains(config.credentials.user);\n });\n\n it('should logout a user', () => {\n cy.login(config.credentials.user, config.credentials.password, {\n loginButton: header.loginButton,\n ...loginDialog,\n });\n cy.wait('@sign');\n cy.getByTestId(header.logInDialogIcon).click();\n cy.wait(100);\n cy.getByTestId(header.logOutDialogIcon).click();\n cy.wait(200);\n cy.getByTestId(header.loginButton).contains('Login');\n });\n\n // ── Validation tests ───────────────────────────────────────────\n // The login form uses a yup schema (username >= 2 chars + URL-safe,\n // password >= 2 chars) and the submit button is `disabled={!isValid}`.\n // Server rejection renders an error banner with `data-testid=\"error\"`\n // inside `LoginDialogFormError`. Gated on\n // `features.signin.validationTests` so builds with a different\n // schema or error string can skip without forking.\n\n maybeIt(features.signin.validationTests)(\n 'should disable the submit button while the form is empty',\n () => {\n cy.getByTestId(header.loginButton).click();\n cy.getByTestId(login.dialog).should('be.visible');\n // Neither field filled → schema invalid → button disabled.\n cy.get(loginDialog.submitButton).should('be.disabled');\n }\n );\n\n maybeIt(features.signin.validationTests)(\n 'should keep the submit button disabled when only the username is filled',\n () => {\n cy.getByTestId(header.loginButton).click();\n cy.getByTestId(login.dialog).should('be.visible');\n cy.get(loginDialog.usernameInput).type(config.credentials.user);\n // Password still empty → schema still invalid.\n cy.get(loginDialog.submitButton).should('be.disabled');\n }\n );\n\n maybeIt(features.signin.validationTests)(\n 'should show an error banner on invalid credentials',\n () => {\n cy.login(config.credentials.user, 'definitely-wrong-password-xyz', {\n loginButton: header.loginButton,\n ...loginDialog,\n });\n // The request goes through (valid schema), the server rejects it.\n cy.wait('@sign').its('response.statusCode').should('not.eq', 200);\n // The form sets errors.root which renders via LoginDialogFormError\n // with a fixed English string (\"Invalid username or password\").\n cy.getByTestId(login.error, { timeout: 5000 }).should('be.visible');\n cy.getByTestId(login.error).should('contain.text', 'Invalid username or password');\n // Dialog should still be open so the user can retry.\n cy.getByTestId(login.dialog).should('be.visible');\n }\n );\n });\n}\n"],"mappings":";;AAIA,SAAgB,YAAY,QAAwB;CAClD,MAAM,EAAE,QAAQ,UAAU,OAAO;CACjC,MAAM,EAAE,gBAAgB,OAAO;CAC/B,MAAM,EAAE,aAAa;CAErB,SAAS,4BAA4B;EACnC,iBAAiB;GACf,GAAG,UAAU,QAAQ,yBAAyB,CAAC,GAAG,OAAO;GACzD,GAAG,MAAM,OAAO,YAAY;IAC5B;EAEF,GAAG,2BAA2B;GAC5B,GAAG,MAAM,OAAO,YAAY,MAAM,OAAO,YAAY,UAAU;IAC7D,aAAa,OAAO;IACpB,GAAG;IACJ,CAAC;GACF,GAAG,KAAK,QAAQ;GAChB,GAAG,YAAY,OAAO,gBAAgB,CAAC,OAAO;GAC9C,GAAG,KAAK,IAAI;GACZ,GAAG,YAAY,OAAO,eAAe,CAAC,SAAS,OAAO,YAAY,KAAK;IACvE;EAEF,GAAG,8BAA8B;GAC/B,GAAG,MAAM,OAAO,YAAY,MAAM,OAAO,YAAY,UAAU;IAC7D,aAAa,OAAO;IACpB,GAAG;IACJ,CAAC;GACF,GAAG,KAAK,QAAQ;GAChB,GAAG,YAAY,OAAO,gBAAgB,CAAC,OAAO;GAC9C,GAAG,KAAK,IAAI;GACZ,GAAG,YAAY,OAAO,iBAAiB,CAAC,OAAO;GAC/C,GAAG,KAAK,IAAI;GACZ,GAAG,YAAY,OAAO,YAAY,CAAC,SAAS,QAAQ;IACpD;EAUF,QAAQ,SAAS,OAAO,gBAAgB,CACtC,kEACM;GACJ,GAAG,YAAY,OAAO,YAAY,CAAC,OAAO;GAC1C,GAAG,YAAY,MAAM,OAAO,CAAC,OAAO,aAAa;GAEjD,GAAG,IAAI,YAAY,aAAa,CAAC,OAAO,cAAc;IAEzD;EAED,QAAQ,SAAS,OAAO,gBAAgB,CACtC,iFACM;GACJ,GAAG,YAAY,OAAO,YAAY,CAAC,OAAO;GAC1C,GAAG,YAAY,MAAM,OAAO,CAAC,OAAO,aAAa;GACjD,GAAG,IAAI,YAAY,cAAc,CAAC,KAAK,OAAO,YAAY,KAAK;GAE/D,GAAG,IAAI,YAAY,aAAa,CAAC,OAAO,cAAc;IAEzD;EAED,QAAQ,SAAS,OAAO,gBAAgB,CACtC,4DACM;GACJ,GAAG,MAAM,OAAO,YAAY,MAAM,iCAAiC;IACjE,aAAa,OAAO;IACpB,GAAG;IACJ,CAAC;GAEF,GAAG,KAAK,QAAQ,CAAC,IAAI,sBAAsB,CAAC,OAAO,UAAU,IAAI;GAGjE,GAAG,YAAY,MAAM,OAAO,EAAE,SAAS,KAAM,CAAC,CAAC,OAAO,aAAa;GACnE,GAAG,YAAY,MAAM,MAAM,CAAC,OAAO,gBAAgB,+BAA+B;GAElF,GAAG,YAAY,MAAM,OAAO,CAAC,OAAO,aAAa;IAEpD;GACD"}
|
package/build/features.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/// <reference types="cypress" />
|
|
1
|
+
import type { DeepPartial } from './testIds';
|
|
3
2
|
/**
|
|
4
3
|
* Per-test feature flags for enabling/disabling individual test cases
|
|
5
4
|
* in the e2e-ui suites.
|
|
@@ -114,7 +113,6 @@ export interface Features {
|
|
|
114
113
|
}
|
|
115
114
|
/** Defaults: all flags on. */
|
|
116
115
|
export declare const DEFAULT_FEATURES: Features;
|
|
117
|
-
import type { DeepPartial } from './testIds';
|
|
118
116
|
/**
|
|
119
117
|
* Merge user overrides into the default feature flags. Per-section,
|
|
120
118
|
* one level deep — matching the style of `mergeTestIds`.
|
package/build/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="cypress" />
|
|
2
1
|
import { RegistryConfig, VerdaccioUiOptions } from './types';
|
|
3
|
-
export type { RegistryConfig, RegistryTaskResult, VerdaccioUiOptions
|
|
2
|
+
export type { RegistryConfig, RegistryTaskResult, VerdaccioUiOptions } from './types';
|
|
4
3
|
export type { PublishPackageInput, PublishPackageTaskInput, PublishPackageResult, UnpublishPackageInput, UnpublishPackageResult, } from './tasks';
|
|
5
4
|
export type { DeepPartial, Selectors, TestIds } from './testIds';
|
|
6
5
|
export type { Features } from './features';
|
package/build/types.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/// <reference types="cypress" />
|
|
2
|
-
/// <reference types="cypress" />
|
|
3
|
-
/// <reference types="cypress" />
|
|
4
1
|
import type { Features } from './features';
|
|
5
2
|
import type { PublishPackageResult, PublishPackageTaskInput, UnpublishPackageInput, UnpublishPackageResult } from './tasks';
|
|
6
3
|
import type { DeepPartial, Selectors, TestIds } from './testIds';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdaccio/e2e-ui",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Cypress plugin for Verdaccio UI e2e tests — run against any registry",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"cypress": ">=12.0.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@types/node": "
|
|
34
|
+
"@types/node": "24.12.4",
|
|
35
35
|
"cypress": "15.12.0",
|
|
36
|
-
"vite": "8.0.
|
|
36
|
+
"vite": "8.0.11"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "vite build && tsc --emitDeclarationOnly -p tsconfig.build.json",
|