@verdaccio/e2e-ui 2.2.0 → 2.3.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.
Files changed (41) hide show
  1. package/build/cjs/features.cjs +64 -0
  2. package/build/cjs/features.cjs.map +1 -0
  3. package/build/cjs/index.cjs +5 -1
  4. package/build/cjs/index.cjs.map +1 -1
  5. package/build/cjs/testIds.cjs +16 -1
  6. package/build/cjs/testIds.cjs.map +1 -1
  7. package/build/cjs/tests/home.cjs +3 -1
  8. package/build/cjs/tests/home.cjs.map +1 -1
  9. package/build/cjs/tests/layout.cjs +10 -0
  10. package/build/cjs/tests/layout.cjs.map +1 -1
  11. package/build/cjs/tests/publish.cjs +25 -2
  12. package/build/cjs/tests/publish.cjs.map +1 -1
  13. package/build/cjs/tests/search.cjs +48 -0
  14. package/build/cjs/tests/search.cjs.map +1 -1
  15. package/build/cjs/tests/settings.cjs +3 -1
  16. package/build/cjs/tests/settings.cjs.map +1 -1
  17. package/build/cjs/tests/signin.cjs +25 -3
  18. package/build/cjs/tests/signin.cjs.map +1 -1
  19. package/build/esm/features.js +62 -0
  20. package/build/esm/features.js.map +1 -0
  21. package/build/esm/index.js +4 -2
  22. package/build/esm/index.js.map +1 -1
  23. package/build/esm/testIds.js +16 -1
  24. package/build/esm/testIds.js.map +1 -1
  25. package/build/esm/tests/home.js +3 -1
  26. package/build/esm/tests/home.js.map +1 -1
  27. package/build/esm/tests/layout.js +10 -0
  28. package/build/esm/tests/layout.js.map +1 -1
  29. package/build/esm/tests/publish.js +25 -2
  30. package/build/esm/tests/publish.js.map +1 -1
  31. package/build/esm/tests/search.js +48 -0
  32. package/build/esm/tests/search.js.map +1 -1
  33. package/build/esm/tests/settings.js +3 -1
  34. package/build/esm/tests/settings.js.map +1 -1
  35. package/build/esm/tests/signin.js +25 -3
  36. package/build/esm/tests/signin.js.map +1 -1
  37. package/build/features.d.ts +94 -0
  38. package/build/index.d.ts +2 -0
  39. package/build/testIds.d.ts +28 -0
  40. package/build/types.d.ts +8 -0
  41. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ import { maybeIt } from "../features.js";
1
2
  //#region src/tests/search.ts
2
3
  /**
3
4
  * UI tests for the Verdaccio search box.
@@ -8,6 +9,8 @@
8
9
  * a real package in the registry should live in publishTests instead.
9
10
  */
10
11
  function searchTests(config) {
12
+ const { features } = config;
13
+ const { package: pkg } = config.testIds;
11
14
  describe("search", () => {
12
15
  beforeEach(() => {
13
16
  cy.intercept("GET", "**/-/verdaccio/data/search/**").as("webSearch");
@@ -43,6 +46,51 @@ function searchTests(config) {
43
46
  expect(interception.request.url).to.contain("second-query");
44
47
  });
45
48
  });
49
+ describe("with a published package", () => {
50
+ const pkgName = "@verdaccio/search-fixture";
51
+ const pkgSlug = "search-fixture";
52
+ let tempFolder = null;
53
+ beforeEach(() => {
54
+ cy.task("publishPackage", {
55
+ pkgName,
56
+ version: "1.0.0",
57
+ unique: true
58
+ }).then((result) => {
59
+ tempFolder = result?.tempFolder ?? null;
60
+ });
61
+ cy.visit(config.registryUrl);
62
+ });
63
+ afterEach(() => {
64
+ cy.task("unpublishPackage", {
65
+ pkgName,
66
+ tempFolder: tempFolder ?? void 0
67
+ });
68
+ if (tempFolder) cy.task("cleanupPublished", tempFolder);
69
+ tempFolder = null;
70
+ });
71
+ maybeIt(features.search.resultsDropdown)("should display the matching package in the results dropdown", () => {
72
+ getSearchInput().clear().type(pkgSlug, { delay: 30 });
73
+ cy.wait(anySearchAlias(), { timeout: 1e4 }).then((interception) => {
74
+ expect(interception.request.url).to.contain(pkgSlug);
75
+ });
76
+ cy.get("[role=\"listbox\"]", { timeout: 5e3 }).should("be.visible");
77
+ cy.get("[role=\"listbox\"] [role=\"option\"]").should("have.length.at.least", 1);
78
+ cy.contains("[role=\"listbox\"] [role=\"option\"]", pkgName).should("be.visible");
79
+ });
80
+ maybeIt(features.search.resultClickNavigation)("should navigate to the package detail page when a result is clicked", () => {
81
+ cy.intercept("GET", `/-/verdaccio/data/sidebar/${pkgName}`).as("detailSidebar");
82
+ cy.intercept("GET", `/-/verdaccio/data/package/readme/${pkgName}`).as("detailReadme");
83
+ getSearchInput().clear().type(pkgSlug, { delay: 30 });
84
+ cy.wait(anySearchAlias(), { timeout: 1e4 });
85
+ cy.contains("[role=\"listbox\"] [role=\"option\"]", pkgName).should("be.visible").click();
86
+ cy.location("pathname").should("contain", "/-/web/detail");
87
+ cy.location("pathname").should("contain", "search-fixture");
88
+ cy.wait("@detailSidebar", { timeout: 1e4 });
89
+ cy.wait("@detailReadme", { timeout: 1e4 });
90
+ cy.getByTestId(pkg.sidebar).should("be.visible");
91
+ cy.getByTestId(pkg.readme).should("be.visible");
92
+ });
93
+ });
46
94
  });
47
95
  }
48
96
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"search.js","names":[],"sources":["../../../src/tests/search.ts"],"sourcesContent":["/// <reference types=\"cypress\" />\n\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 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}\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;AAClD,UAAS,gBAAgB;AACvB,mBAAiB;AAGf,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Ae;KAE9D;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\" />\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":";;;;;;;;;;AAaA,SAAgB,YAAY,QAAwB;CAClD,MAAM,EAAE,aAAa;CACrB,MAAM,EAAE,SAAS,QAAQ,OAAO;AAEhC,UAAS,gBAAgB;AACvB,mBAAiB;AAGf,MAAG,UAAU,OAAO,gCAAgC,CAAC,GAAG,YAAY;AACpE,MAAG,UAAU,OAAO,mBAAmB,CAAC,GAAG,WAAW;AACtD,MAAG,UAAU,OAAO,+BAA+B,CAAC,GAAG,OAAO;AAE9D,MAAG,MAAM,OAAO,YAAY;AAC5B,MAAG,IAAI,OAAO,CAAC,OAAO,aAAa;IACnC;AAEF,KAAG,wCAAwC;AACzC,mBAAgB,CAAC,OAAO,aAAa;IACrC;AAEF,KAAG,0DAA0D;GAC3D,MAAM,QAAQ;AAEd,mBAAgB,CAAC,OAAO,CAAC,KAAK,OAAO,EAAE,OAAO,IAAI,CAAC;AAGnD,MAAG,KAAK,gBAAgB,EAAE,EAAE,SAAS,KAAO,CAAC,CAAC,MAAM,iBAAsB;AACxE,WAAO,aAAa,QAAQ,IAAI,CAAC,GAAG,QAAQ,MAAM;KAClD;IACF;AAEF,KAAG,oEAAkE;GACnE,MAAM,QAAQ,2BAA2B,KAAK,KAAK;AAEnD,mBAAgB,CAAC,OAAO,CAAC,KAAK,OAAO,EAAE,OAAO,IAAI,CAAC;AACnD,MAAG,KAAK,gBAAgB,EAAE,EAAE,SAAS,KAAO,CAAC;AAG7C,MAAG,KAAK,IAAI;AAIZ,MAAG,SAAS,kCAAkC,EAAE,SAAS,KAAM,CAAC,CAAC,OAC/D,aACD;IACD;AAEF,KAAG,2DAA2D;AAC5D,mBAAgB,CAAC,OAAO,CAAC,KAAK,eAAe,EAAE,OAAO,IAAI,CAAC;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AU,CAAC,GAC1D,gBACD;AACD,OAAG,UACD,OACA,oCAAoC,UACrC,CAAC,GAAG,eAAe;AAEpB,oBAAgB,CAAC,OAAO,CAAC,KAAK,SAAS,EAAE,OAAO,IAAI,CAAC;AACrD,OAAG,KAAK,gBAAgB,EAAE,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,3 +1,4 @@
1
+ import { maybeIt } from "../features.js";
1
2
  //#region src/tests/settings.ts
2
3
  /**
3
4
  * Tests for the header Settings dialog and the Translations (language)
@@ -18,6 +19,7 @@
18
19
  */
19
20
  function settingsTests(config) {
20
21
  const { header } = config.testIds;
22
+ const { features } = config;
21
23
  describe("settings & language", () => {
22
24
  beforeEach(() => {
23
25
  cy.visit(config.registryUrl);
@@ -42,7 +44,7 @@ function settingsTests(config) {
42
44
  cy.contains("[role=\"dialog\"]", "English").should("be.visible");
43
45
  cy.contains("[role=\"dialog\"]", "German").should("be.visible");
44
46
  });
45
- it("should change the UI language when a language card is clicked", () => {
47
+ maybeIt(features.settings.languageSwitcher)("should change the UI language when a language card is clicked", () => {
46
48
  cy.getByTestId(header.settingsTooltip).click();
47
49
  cy.get("[role=\"dialog\"]").should("be.visible");
48
50
  cy.contains("[role=\"dialog\"] [role=\"tab\"]", "Translations").click();
@@ -1 +1 @@
1
- {"version":3,"file":"settings.js","names":[],"sources":["../../../src/tests/settings.ts"],"sourcesContent":["/// <reference types=\"cypress\" />\n\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\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(\n 'be.visible'\n );\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(\n '[role=\"dialog\"]',\n /this is the configuration details for the language/i\n ).should('be.visible');\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 it('should change the UI language when a language card is clicked', () => {\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(\n 'not.exist'\n );\n // And the original dialog title text should also be gone.\n cy.contains('[role=\"dialog\"]', englishTitle).should('not.exist');\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;AAE1B,UAAS,6BAA6B;AACpC,mBAAiB;AACf,MAAG,MAAM,OAAO,YAAY;AAC5B,MAAG,IAAI,OAAO,CAAC,OAAO,aAAa;IACnC;AAEF,KAAG,yDAAyD;AAC1D,MAAG,YAAY,OAAO,gBAAgB,CAAC,OAAO;AAC9C,MAAG,IAAI,oBAAkB,CAAC,OAAO,aAAa;AAE9C,MAAG,SAAS,qBAAmB,gBAAgB,CAAC,OAAO,aAAa;IACpE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=\"cypress\" />\n\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(\n 'be.visible'\n );\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(\n '[role=\"dialog\"]',\n /this is the configuration details for the language/i\n ).should('be.visible');\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(\n 'not.exist'\n );\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":";;;;;;;;;;;;;;;;;;;AAsBA,SAAgB,cAAc,QAAwB;CACpD,MAAM,EAAE,WAAW,OAAO;CAC1B,MAAM,EAAE,aAAa;AAErB,UAAS,6BAA6B;AACpC,mBAAiB;AACf,MAAG,MAAM,OAAO,YAAY;AAC5B,MAAG,IAAI,OAAO,CAAC,OAAO,aAAa;IACnC;AAEF,KAAG,yDAAyD;AAC1D,MAAG,YAAY,OAAO,gBAAgB,CAAC,OAAO;AAC9C,MAAG,IAAI,oBAAkB,CAAC,OAAO,aAAa;AAE9C,MAAG,SAAS,qBAAmB,gBAAgB,CAAC,OAAO,aAAa;IACpE;AAEF,KAAG,iEAAiE;AAClE,MAAG,YAAY,OAAO,gBAAgB,CAAC,OAAO;AAC9C,MAAG,IAAI,oBAAkB,CAAC,OAAO,aAAa;AAC9C,MAAG,IAAI,mCAA+B,CAAC,OAAO,eAAe,EAAE;AAC/D,MAAG,SAAS,oCAAgC,eAAe,CAAC,OAC1D,aACD;IACD;AAEF,KAAG,kEAAkE;AACnE,MAAG,YAAY,OAAO,gBAAgB,CAAC,OAAO;AAC9C,MAAG,IAAI,oBAAkB,CAAC,OAAO,aAAa;AAC9C,MAAG,SAAS,oCAAgC,eAAe,CAAC,OAAO;AAEnE,MAAG,SACD,qBACA,sDACD,CAAC,OAAO,aAAa;AAEtB,MAAG,SAAS,qBAAmB,UAAU,CAAC,OAAO,aAAa;AAC9D,MAAG,SAAS,qBAAmB,SAAS,CAAC,OAAO,aAAa;IAC7D;AAEF,UAAQ,SAAS,SAAS,iBAAiB,CACzC,uEACM;AACN,MAAG,YAAY,OAAO,gBAAgB,CAAC,OAAO;AAC9C,MAAG,IAAI,oBAAkB,CAAC,OAAO,aAAa;AAC9C,MAAG,SAAS,oCAAgC,eAAe,CAAC,OAAO;AAInE,MAAG,SAAS,qBAAmB,gBAAgB,CAC5C,OAAO,OAAO,CACd,MAAM,iBAAiB;AAGtB,OAAG,SAAS,mCAAiC,SAAS,CAAC,MAAM,EAC3D,OAAO,MACR,CAAC;AAKF,OAAG,SAAS,oCAAgC,eAAe,CAAC,OAC1D,YACD;AAED,OAAG,SAAS,qBAAmB,aAAa,CAAC,OAAO,YAAY;KAChE;IAEL;AAED,KAAG,sDAAsD;AACvD,MAAG,YAAY,OAAO,gBAAgB,CAAC,OAAO;AAC9C,MAAG,IAAI,oBAAkB,CAAC,OAAO,aAAa;AAC9C,MAAG,IAAI,OAAO,CAAC,KAAK,QAAQ;AAC5B,MAAG,IAAI,oBAAkB,CAAC,OAAO,YAAY;IAC7C;GACF"}
@@ -1,13 +1,15 @@
1
+ import { maybeIt } from "../features.js";
1
2
  //#region src/tests/signin.ts
2
3
  function signinTests(config) {
3
- const { header } = config.testIds;
4
+ const { header, login } = config.testIds;
4
5
  const { loginDialog } = config.selectors;
6
+ const { features } = config;
5
7
  describe("sign in / sign out", () => {
6
8
  beforeEach(() => {
7
9
  cy.intercept("POST", "/-/verdaccio/sec/login").as("sign");
10
+ cy.visit(config.registryUrl);
8
11
  });
9
12
  it("should login user", () => {
10
- cy.visit(config.registryUrl);
11
13
  cy.login(config.credentials.user, config.credentials.password, {
12
14
  loginButton: header.loginButton,
13
15
  ...loginDialog
@@ -18,7 +20,6 @@ function signinTests(config) {
18
20
  cy.getByTestId(header.greetingsLabel).contains(config.credentials.user);
19
21
  });
20
22
  it("should logout a user", () => {
21
- cy.visit(config.registryUrl);
22
23
  cy.login(config.credentials.user, config.credentials.password, {
23
24
  loginButton: header.loginButton,
24
25
  ...loginDialog
@@ -30,6 +31,27 @@ function signinTests(config) {
30
31
  cy.wait(200);
31
32
  cy.getByTestId(header.loginButton).contains("Login");
32
33
  });
34
+ maybeIt(features.signin.validationTests)("should disable the submit button while the form is empty", () => {
35
+ cy.getByTestId(header.loginButton).click();
36
+ cy.getByTestId(login.dialog).should("be.visible");
37
+ cy.get(loginDialog.submitButton).should("be.disabled");
38
+ });
39
+ maybeIt(features.signin.validationTests)("should keep the submit button disabled when only the username is filled", () => {
40
+ cy.getByTestId(header.loginButton).click();
41
+ cy.getByTestId(login.dialog).should("be.visible");
42
+ cy.get(loginDialog.usernameInput).type(config.credentials.user);
43
+ cy.get(loginDialog.submitButton).should("be.disabled");
44
+ });
45
+ maybeIt(features.signin.validationTests)("should show an error banner on invalid credentials", () => {
46
+ cy.login(config.credentials.user, "definitely-wrong-password-xyz", {
47
+ loginButton: header.loginButton,
48
+ ...loginDialog
49
+ });
50
+ cy.wait("@sign").its("response.statusCode").should("not.eq", 200);
51
+ cy.getByTestId(login.error, { timeout: 5e3 }).should("be.visible");
52
+ cy.getByTestId(login.error).should("contain.text", "Invalid username or password");
53
+ cy.getByTestId(login.dialog).should("be.visible");
54
+ });
33
55
  });
34
56
  }
35
57
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"signin.js","names":[],"sources":["../../../src/tests/signin.ts"],"sourcesContent":["/// <reference types=\"cypress\" />\n\nimport { RegistryConfig } from '../types';\n\nexport function signinTests(config: RegistryConfig) {\n const { header } = config.testIds;\n const { loginDialog } = config.selectors;\n\n describe('sign in / sign out', () => {\n beforeEach(() => {\n cy.intercept('POST', '/-/verdaccio/sec/login').as('sign');\n });\n\n it('should login user', () => {\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 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.visit(config.registryUrl);\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}\n"],"mappings":";AAIA,SAAgB,YAAY,QAAwB;CAClD,MAAM,EAAE,WAAW,OAAO;CAC1B,MAAM,EAAE,gBAAgB,OAAO;AAE/B,UAAS,4BAA4B;AACnC,mBAAiB;AACf,MAAG,UAAU,QAAQ,yBAAyB,CAAC,GAAG,OAAO;IACzD;AAEF,KAAG,2BAA2B;AAC5B,MAAG,MAAM,OAAO,YAAY;AAC5B,MAAG,MAAM,OAAO,YAAY,MAAM,OAAO,YAAY,UAAU;IAC7D,aAAa,OAAO;IACpB,GAAG;IACJ,CAAC;AACF,MAAG,KAAK,QAAQ;AAChB,MAAG,YAAY,OAAO,gBAAgB,CAAC,OAAO;AAC9C,MAAG,KAAK,IAAI;AACZ,MAAG,YAAY,OAAO,eAAe,CAAC,SAAS,OAAO,YAAY,KAAK;IACvE;AAEF,KAAG,8BAA8B;AAC/B,MAAG,MAAM,OAAO,YAAY;AAC5B,MAAG,MAAM,OAAO,YAAY,MAAM,OAAO,YAAY,UAAU;IAC7D,aAAa,OAAO;IACpB,GAAG;IACJ,CAAC;AACF,MAAG,KAAK,QAAQ;AAChB,MAAG,YAAY,OAAO,gBAAgB,CAAC,OAAO;AAC9C,MAAG,KAAK,IAAI;AACZ,MAAG,YAAY,OAAO,iBAAiB,CAAC,OAAO;AAC/C,MAAG,KAAK,IAAI;AACZ,MAAG,YAAY,OAAO,YAAY,CAAC,SAAS,QAAQ;IACpD;GACF"}
1
+ {"version":3,"file":"signin.js","names":[],"sources":["../../../src/tests/signin.ts"],"sourcesContent":["/// <reference types=\"cypress\" />\n\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(\n 'contain.text',\n 'Invalid username or password'\n );\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":";;AAKA,SAAgB,YAAY,QAAwB;CAClD,MAAM,EAAE,QAAQ,UAAU,OAAO;CACjC,MAAM,EAAE,gBAAgB,OAAO;CAC/B,MAAM,EAAE,aAAa;AAErB,UAAS,4BAA4B;AACnC,mBAAiB;AACf,MAAG,UAAU,QAAQ,yBAAyB,CAAC,GAAG,OAAO;AACzD,MAAG,MAAM,OAAO,YAAY;IAC5B;AAEF,KAAG,2BAA2B;AAC5B,MAAG,MAAM,OAAO,YAAY,MAAM,OAAO,YAAY,UAAU;IAC7D,aAAa,OAAO;IACpB,GAAG;IACJ,CAAC;AACF,MAAG,KAAK,QAAQ;AAChB,MAAG,YAAY,OAAO,gBAAgB,CAAC,OAAO;AAC9C,MAAG,KAAK,IAAI;AACZ,MAAG,YAAY,OAAO,eAAe,CAAC,SAAS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="cypress" />
2
+ /// <reference types="cypress" />
3
+ /**
4
+ * Per-test feature flags for enabling/disabling individual test cases
5
+ * in the e2e-ui suites.
6
+ *
7
+ * The Verdaccio UI behaves differently across branches — search result
8
+ * payload shape differs between the `/-/v1/search` and
9
+ * `/-/verdaccio/data/search/*` endpoints, the language picker was
10
+ * added in a specific minor, etc. Rather than forking the suite per
11
+ * branch, consumers can disable individual tests via
12
+ * `createRegistryConfig({ features: { … } })`.
13
+ *
14
+ * Every flag defaults to `true` (test runs). Override to `false` to
15
+ * convert the test into a Mocha `it.skip` call — the suite still
16
+ * reports the test but marks it as pending.
17
+ */
18
+ export interface Features {
19
+ search: {
20
+ /**
21
+ * Whether to run the "results dropdown renders a matching
22
+ * package" test. Disable on builds where the search result shape
23
+ * or the Autocomplete rendering differs from the default assumption.
24
+ */
25
+ resultsDropdown: boolean;
26
+ /**
27
+ * Whether to run the "clicking a result navigates to detail" test.
28
+ * Depends on the Autocomplete `onSelectItem` → router wiring.
29
+ */
30
+ resultClickNavigation: boolean;
31
+ };
32
+ home: {
33
+ /**
34
+ * Whether to run the `with a published package` sub-block inside
35
+ * `homeTests` (publishes a throwaway package and asserts it
36
+ * renders in the package list).
37
+ */
38
+ publishedPackageRendering: boolean;
39
+ };
40
+ settings: {
41
+ /**
42
+ * Whether to run the "change language via card click" test.
43
+ * Depends on the `LanguageSwitch` component layout and its
44
+ * translation sentinels ("Translations", "German"). Skip on
45
+ * builds that lag behind the upstream translation file.
46
+ */
47
+ languageSwitcher: boolean;
48
+ };
49
+ signin: {
50
+ /**
51
+ * Whether to run the three validation tests (disabled submit
52
+ * button, invalid credentials error banner). Depends on the
53
+ * current yup schema and the hard-coded "Invalid username or
54
+ * password" error string.
55
+ */
56
+ validationTests: boolean;
57
+ };
58
+ layout: {
59
+ /**
60
+ * Whether to run the dark/light theme switch test. Depends on
61
+ * `web.showThemeSwitch` (defaults to true in ui-theme) and the
62
+ * `header--button--light` / `header--button--dark` testids.
63
+ */
64
+ themeSwitch: boolean;
65
+ };
66
+ publish: {
67
+ /**
68
+ * Whether to run the "tarball download button fires a GET" test.
69
+ * Depends on `web.showDownloadTarball` (defaults to true) and
70
+ * the published package manifest having a valid `dist.tarball`.
71
+ */
72
+ downloadTarball: boolean;
73
+ /**
74
+ * Whether to run the "raw viewer dialog opens + closes" test.
75
+ * Depends on `web.showRaw` (defaults to true).
76
+ */
77
+ rawViewer: boolean;
78
+ };
79
+ }
80
+ /** Defaults: all flags on. */
81
+ export declare const DEFAULT_FEATURES: Features;
82
+ import type { DeepPartial } from './testIds';
83
+ /**
84
+ * Merge user overrides into the default feature flags. Per-section,
85
+ * one level deep — matching the style of `mergeTestIds`.
86
+ */
87
+ export declare function mergeFeatures(defaults: Features, overrides?: DeepPartial<Features>): Features;
88
+ /**
89
+ * Helper that returns either `it` or `it.skip` depending on an
90
+ * enabled flag. Usage:
91
+ *
92
+ * maybeIt(features.search.resultsDropdown)('…', () => { … });
93
+ */
94
+ export declare function maybeIt(enabled: boolean): Mocha.TestFunction | Mocha.PendingTestFunction;
package/build/index.d.ts CHANGED
@@ -3,7 +3,9 @@ import { RegistryConfig, VerdaccioUiOptions } from './types';
3
3
  export type { RegistryConfig, RegistryTaskResult, VerdaccioUiOptions, } from './types';
4
4
  export type { PublishPackageInput, PublishPackageTaskInput, PublishPackageResult, UnpublishPackageInput, UnpublishPackageResult, } from './tasks';
5
5
  export type { DeepPartial, Selectors, TestIds } from './testIds';
6
+ export type { Features } from './features';
6
7
  export { DEFAULT_SELECTORS, DEFAULT_TEST_IDS } from './testIds';
8
+ export { DEFAULT_FEATURES, maybeIt } from './features';
7
9
  export { publishPackage, cleanupPublished, unpublishPackage } from './tasks';
8
10
  export { homeTests, signinTests, publishTests, searchTests, settingsTests, layoutTests, } from './tests';
9
11
  /**
@@ -41,6 +41,14 @@ export interface TestIds {
41
41
  settingsTooltip: string;
42
42
  /** Info icon that opens the registry info dialog. */
43
43
  infoTooltip: string;
44
+ /**
45
+ * Theme switch button shown while in LIGHT mode (clicking it
46
+ * flips to dark). The underlying component swaps between this
47
+ * and `themeSwitchDark` based on `isDarkMode`.
48
+ */
49
+ themeSwitchLight: string;
50
+ /** Theme switch button shown while in DARK mode. */
51
+ themeSwitchDark: string;
44
52
  /** Menu icon shown after login (opens the logged-in menu). */
45
53
  logInDialogIcon: string;
46
54
  /** "Log out" entry inside the logged-in menu. */
@@ -54,6 +62,18 @@ export interface TestIds {
54
62
  /** "Powered by" version text on the right side of the footer. */
55
63
  version: string;
56
64
  };
65
+ login: {
66
+ /** Login dialog container (the MUI Dialog root). */
67
+ dialog: string;
68
+ /** DialogContent wrapper inside the login dialog. */
69
+ dialogContent: string;
70
+ /**
71
+ * Error banner shown inside the login dialog when the server
72
+ * rejects credentials (or any other `errors.root` message the form
73
+ * sets). Renders inside the `LoginDialogFormError` component.
74
+ */
75
+ error: string;
76
+ };
57
77
  package: {
58
78
  /** Wrapper around the list of packages on the home page. */
59
79
  itemList: string;
@@ -85,6 +105,14 @@ export interface TestIds {
85
105
  uplinksTab: string;
86
106
  /** Empty-state message when the package has no uplinks. */
87
107
  noUplinks: string;
108
+ /** Action-bar tarball download FAB. */
109
+ downloadTarballBtn: string;
110
+ /** Action-bar "view raw manifest" FAB. */
111
+ rawBtn: string;
112
+ /** Full-screen dialog that opens when `rawBtn` is clicked. */
113
+ rawViewerDialog: string;
114
+ /** Close button inside the raw viewer dialog. */
115
+ closeRawViewer: string;
88
116
  };
89
117
  }
90
118
  /**
package/build/types.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  /// <reference types="cypress" />
2
2
  /// <reference types="cypress" />
3
3
  /// <reference types="cypress" />
4
+ import type { Features } from './features';
4
5
  import type { PublishPackageResult, PublishPackageTaskInput, UnpublishPackageInput, UnpublishPackageResult } from './tasks';
5
6
  import type { DeepPartial, Selectors, TestIds } from './testIds';
6
7
  export type RegistryConfig = {
@@ -15,6 +16,11 @@ export type RegistryConfig = {
15
16
  testIds: TestIds;
16
17
  /** Fully-resolved CSS selector map (defaults merged with overrides). */
17
18
  selectors: Selectors;
19
+ /**
20
+ * Per-test feature flags — set to `false` to convert a specific
21
+ * test into `it.skip` without forking the suite.
22
+ */
23
+ features: Features;
18
24
  };
19
25
  export type VerdaccioUiOptions = {
20
26
  registryUrl: string;
@@ -28,6 +34,8 @@ export type VerdaccioUiOptions = {
28
34
  testIds?: DeepPartial<TestIds>;
29
35
  /** Partial override of the default CSS selector map. */
30
36
  selectors?: DeepPartial<Selectors>;
37
+ /** Partial override of the default feature flags. */
38
+ features?: DeepPartial<Features>;
31
39
  };
32
40
  /**
33
41
  * Return value of the `registry` Cypress task — exposed as a named
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdaccio/e2e-ui",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Cypress plugin for Verdaccio UI e2e tests — run against any registry",