@verdaccio/e2e-ui 2.1.1 → 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 (57) hide show
  1. package/README.md +134 -0
  2. package/build/cjs/commands/index.cjs +21 -5
  3. package/build/cjs/commands/index.cjs.map +1 -1
  4. package/build/cjs/features.cjs +64 -0
  5. package/build/cjs/features.cjs.map +1 -0
  6. package/build/cjs/index.cjs +69 -10
  7. package/build/cjs/index.cjs.map +1 -1
  8. package/build/cjs/tasks/publish.cjs +245 -0
  9. package/build/cjs/tasks/publish.cjs.map +1 -0
  10. package/build/cjs/testIds.cjs +119 -0
  11. package/build/cjs/testIds.cjs.map +1 -0
  12. package/build/cjs/tests/home.cjs +63 -7
  13. package/build/cjs/tests/home.cjs.map +1 -1
  14. package/build/cjs/tests/layout.cjs +81 -0
  15. package/build/cjs/tests/layout.cjs.map +1 -0
  16. package/build/cjs/tests/publish.cjs +106 -33
  17. package/build/cjs/tests/publish.cjs.map +1 -1
  18. package/build/cjs/tests/search.cjs +122 -0
  19. package/build/cjs/tests/search.cjs.map +1 -0
  20. package/build/cjs/tests/settings.cjs +68 -0
  21. package/build/cjs/tests/settings.cjs.map +1 -0
  22. package/build/cjs/tests/signin.cjs +39 -9
  23. package/build/cjs/tests/signin.cjs.map +1 -1
  24. package/build/commands/index.d.ts +15 -3
  25. package/build/esm/commands/index.js +21 -5
  26. package/build/esm/commands/index.js.map +1 -1
  27. package/build/esm/features.js +62 -0
  28. package/build/esm/features.js.map +1 -0
  29. package/build/esm/index.js +57 -8
  30. package/build/esm/index.js.map +1 -1
  31. package/build/esm/tasks/publish.js +243 -0
  32. package/build/esm/tasks/publish.js.map +1 -0
  33. package/build/esm/testIds.js +116 -0
  34. package/build/esm/testIds.js.map +1 -0
  35. package/build/esm/tests/home.js +63 -7
  36. package/build/esm/tests/home.js.map +1 -1
  37. package/build/esm/tests/layout.js +81 -0
  38. package/build/esm/tests/layout.js.map +1 -0
  39. package/build/esm/tests/publish.js +106 -33
  40. package/build/esm/tests/publish.js.map +1 -1
  41. package/build/esm/tests/search.js +122 -0
  42. package/build/esm/tests/search.js.map +1 -0
  43. package/build/esm/tests/settings.js +68 -0
  44. package/build/esm/tests/settings.js.map +1 -0
  45. package/build/esm/tests/signin.js +39 -9
  46. package/build/esm/tests/signin.js.map +1 -1
  47. package/build/features.d.ts +94 -0
  48. package/build/index.d.ts +19 -2
  49. package/build/tasks/index.d.ts +2 -0
  50. package/build/tasks/publish.d.ts +94 -0
  51. package/build/testIds.d.ts +158 -0
  52. package/build/tests/index.d.ts +3 -0
  53. package/build/tests/layout.d.ts +12 -0
  54. package/build/tests/search.d.ts +10 -0
  55. package/build/tests/settings.d.ts +19 -0
  56. package/build/types.d.ts +92 -0
  57. package/package.json +1 -1
@@ -0,0 +1,94 @@
1
+ /// <reference types="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
@@ -1,9 +1,26 @@
1
1
  /// <reference types="cypress" />
2
2
  import { RegistryConfig, VerdaccioUiOptions } from './types';
3
- export type { RegistryConfig, VerdaccioUiOptions } from './types';
4
- export { homeTests, signinTests, publishTests } from './tests';
3
+ export type { RegistryConfig, RegistryTaskResult, VerdaccioUiOptions, } from './types';
4
+ export type { PublishPackageInput, PublishPackageTaskInput, PublishPackageResult, UnpublishPackageInput, UnpublishPackageResult, } from './tasks';
5
+ export type { DeepPartial, Selectors, TestIds } from './testIds';
6
+ export type { Features } from './features';
7
+ export { DEFAULT_SELECTORS, DEFAULT_TEST_IDS } from './testIds';
8
+ export { DEFAULT_FEATURES, maybeIt } from './features';
9
+ export { publishPackage, cleanupPublished, unpublishPackage } from './tasks';
10
+ export { homeTests, signinTests, publishTests, searchTests, settingsTests, layoutTests, } from './tests';
5
11
  /**
6
12
  * Build a full RegistryConfig from user-provided options with defaults.
13
+ *
14
+ * `testIds` and `selectors` are deep-merged per section with the
15
+ * defaults in `./testIds`. Consumers targeting a non-default Verdaccio
16
+ * build can override just the fields that drifted:
17
+ *
18
+ * createRegistryConfig({
19
+ * registryUrl: 'http://localhost:4873',
20
+ * testIds: {
21
+ * header: { settingsTooltip: 'my-new-settings-btn' },
22
+ * },
23
+ * });
7
24
  */
8
25
  export declare function createRegistryConfig(options: VerdaccioUiOptions): RegistryConfig;
9
26
  /**
@@ -0,0 +1,2 @@
1
+ export { publishPackage, cleanupPublished, unpublishPackage } from './publish';
2
+ export type { PublishPackageInput, PublishPackageTaskInput, PublishPackageResult, UnpublishPackageInput, UnpublishPackageResult, } from './publish';
@@ -0,0 +1,94 @@
1
+ export interface PublishPackageInput {
2
+ pkgName: string;
3
+ version?: string;
4
+ registryUrl: string;
5
+ credentials: {
6
+ user: string;
7
+ password: string;
8
+ };
9
+ dependencies?: Record<string, string>;
10
+ devDependencies?: Record<string, string>;
11
+ /**
12
+ * When true, append a timestamp suffix to the version so reruns against
13
+ * a persistent registry don't collide on 403. The suffix is a valid
14
+ * semver prerelease, e.g. `1.0.0-t1712345678`. Defaults to false.
15
+ */
16
+ unique?: boolean;
17
+ }
18
+ /**
19
+ * Shape of the argument passed to `cy.task('publishPackage', ...)`.
20
+ *
21
+ * `registryUrl` and `credentials` are optional here (they fall back to
22
+ * whatever was configured in `setupVerdaccioTasks`), but `pkgName` is
23
+ * still required — every publish needs a name.
24
+ */
25
+ export type PublishPackageTaskInput = Partial<Omit<PublishPackageInput, 'pkgName'>> & {
26
+ pkgName: string;
27
+ };
28
+ export interface PublishPackageResult {
29
+ pkgName: string;
30
+ version: string;
31
+ tempFolder: string;
32
+ stdout: string;
33
+ stderr: string;
34
+ exitCode: number;
35
+ }
36
+ /**
37
+ * Publish a throwaway npm package to the target Verdaccio registry.
38
+ *
39
+ * Flow:
40
+ * 1. Create a throwaway user via `PUT /-/user/...` and capture its
41
+ * legacy auth token. See `obtainLegacyToken` for why.
42
+ * 2. Scaffold a temp project with `package.json`, `README.md`,
43
+ * `index.js`, and an `.npmrc` that includes the token.
44
+ * 3. Spawn `npm publish` from that temp dir.
45
+ *
46
+ * `input.credentials` is kept on the signature for forward-compat but
47
+ * is currently unused — each call mints its own throwaway user.
48
+ *
49
+ * Throws on non-zero npm exit. Returns the temp folder path on success
50
+ * so callers can inspect or clean up.
51
+ */
52
+ export declare function publishPackage(input: PublishPackageInput): Promise<PublishPackageResult>;
53
+ /**
54
+ * Remove a temp project folder previously created by publishPackage.
55
+ * Safe to call with a missing path or a path outside the OS tmp dir —
56
+ * in the latter case it refuses rather than rm-rf'ing arbitrary paths.
57
+ */
58
+ export declare function cleanupPublished(tempFolder: string): Promise<void>;
59
+ export interface UnpublishPackageInput {
60
+ registryUrl: string;
61
+ pkgName: string;
62
+ /**
63
+ * Temp folder returned by a previous `publishPackage` call. If
64
+ * provided, its existing `.npmrc` (which already carries a legacy
65
+ * auth token) is reused for the unpublish call — no extra throwaway
66
+ * user is minted. Otherwise this task creates its own.
67
+ */
68
+ tempFolder?: string;
69
+ }
70
+ export interface UnpublishPackageResult {
71
+ pkgName: string;
72
+ stdout: string;
73
+ stderr: string;
74
+ exitCode: number;
75
+ /**
76
+ * True if the package was already absent (HTTP 404 from the
77
+ * registry). Tests typically want to treat this as success.
78
+ */
79
+ alreadyGone: boolean;
80
+ }
81
+ /**
82
+ * Unpublish a package from the target registry so subsequent tests
83
+ * start from a clean slate.
84
+ *
85
+ * If `tempFolder` is provided (typically from a prior `publishPackage`
86
+ * result), its `.npmrc` is reused so no extra throwaway user is
87
+ * minted. Otherwise this function creates its own temp folder + token.
88
+ * Either way the temp folder used by THIS call is removed on exit
89
+ * (but callers still own the lifecycle of a tempFolder they passed in).
90
+ *
91
+ * Treats HTTP 404 / "tarball does not exist" as success so reruns and
92
+ * parallel teardowns don't flap.
93
+ */
94
+ export declare function unpublishPackage(input: UnpublishPackageInput): Promise<UnpublishPackageResult>;
@@ -0,0 +1,158 @@
1
+ /**
2
+ * Configurable DOM selectors used by the e2e-ui test suites.
3
+ *
4
+ * The Verdaccio UI is a moving target — data-testids can and do change
5
+ * between majors — so every selector referenced by a test lives here
6
+ * and can be overridden by consumers of `@verdaccio/e2e-ui` via
7
+ * `createRegistryConfig({ testIds, selectors })`.
8
+ *
9
+ * The defaults below match Verdaccio 6.x as of the last time we audited
10
+ * the ui-components source. If a selector moves, override just the
11
+ * affected field instead of forking the suite.
12
+ */
13
+ /**
14
+ * Map of data-testid values used by the test suites, grouped by UI
15
+ * section. Each field holds the bare testid string (no `data-testid="…"`
16
+ * wrapping) — the test helpers pass it through `cy.getByTestId(...)`.
17
+ */
18
+ export interface TestIds {
19
+ home: {
20
+ /** Help card shown on the empty-registry landing page. */
21
+ helpCard: string;
22
+ /** 404 "not found" container. */
23
+ notFound: string;
24
+ };
25
+ header: {
26
+ /** Outermost `<NavBar>` element. */
27
+ container: string;
28
+ /** Inner wrapper inside the nav bar. */
29
+ innerNavBar: string;
30
+ /** Right-side action cluster wrapper. */
31
+ right: string;
32
+ /** Wrapper around the header search input. */
33
+ searchContainer: string;
34
+ /** Default SVG Verdaccio logo. */
35
+ defaultLogo: string;
36
+ /** Custom (user-provided) logo image. */
37
+ customLogo: string;
38
+ /** "Login" button shown when logged out. */
39
+ loginButton: string;
40
+ /** Gear icon that opens the settings dialog. */
41
+ settingsTooltip: string;
42
+ /** Info icon that opens the registry info dialog. */
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;
52
+ /** Menu icon shown after login (opens the logged-in menu). */
53
+ logInDialogIcon: string;
54
+ /** "Log out" entry inside the logged-in menu. */
55
+ logOutDialogIcon: string;
56
+ /** "Hi <username>" label inside the logged-in menu. */
57
+ greetingsLabel: string;
58
+ };
59
+ footer: {
60
+ /** Outer footer wrapper. */
61
+ container: string;
62
+ /** "Powered by" version text on the right side of the footer. */
63
+ version: string;
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
+ };
77
+ package: {
78
+ /** Wrapper around the list of packages on the home page. */
79
+ itemList: string;
80
+ /** Package name link in the package list (home + search results). */
81
+ title: string;
82
+ /** Readme container on the package detail page. */
83
+ readme: string;
84
+ /** Sidebar container on the package detail page. */
85
+ sidebar: string;
86
+ /** Install commands section list. */
87
+ installList: string;
88
+ /** Individual install line for npm. */
89
+ installNpm: string;
90
+ /** Individual install line for yarn. */
91
+ installYarn: string;
92
+ /** Individual install line for pnpm. */
93
+ installPnpm: string;
94
+ /** Keyword list below the install section. */
95
+ keywordList: string;
96
+ /** Tab that reveals the dependencies view. */
97
+ dependenciesTab: string;
98
+ /** Dependencies list wrapper (one entry per dep). */
99
+ dependencies: string;
100
+ /** Tab that reveals the versions view. */
101
+ versionsTab: string;
102
+ /** "latest" tag row inside the versions view. */
103
+ tagLatest: string;
104
+ /** Tab that reveals the uplinks view. */
105
+ uplinksTab: string;
106
+ /** Empty-state message when the package has no uplinks. */
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;
116
+ };
117
+ }
118
+ /**
119
+ * CSS selectors (not data-testids) used by the test suites. These are
120
+ * things like form-field IDs and framework-specific class names that
121
+ * Verdaccio's UI exposes as plain selectors rather than testids.
122
+ */
123
+ export interface Selectors {
124
+ /** Class applied to the parsed README markdown body. */
125
+ markdownBody: string;
126
+ loginDialog: {
127
+ /** Username text input inside the login dialog. */
128
+ usernameInput: string;
129
+ /** Password text input inside the login dialog. */
130
+ passwordInput: string;
131
+ /** Submit button inside the login dialog. */
132
+ submitButton: string;
133
+ };
134
+ }
135
+ /**
136
+ * Defaults matching Verdaccio 6.x (bundled ui-theme@9.0.0-next-9.x).
137
+ * Overridable via `createRegistryConfig({ testIds: { ... } })`.
138
+ */
139
+ export declare const DEFAULT_TEST_IDS: TestIds;
140
+ /**
141
+ * Defaults for non-testid CSS selectors. Overridable via
142
+ * `createRegistryConfig({ selectors: { ... } })`.
143
+ */
144
+ export declare const DEFAULT_SELECTORS: Selectors;
145
+ /** Deep-partial helper — every field of a nested object becomes optional. */
146
+ export type DeepPartial<T> = {
147
+ [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];
148
+ };
149
+ /**
150
+ * Merge user overrides into the default testIds map. Merging is
151
+ * per-section (one level deep): `overrides.header` replaces individual
152
+ * fields under `defaults.header` without touching `defaults.footer`.
153
+ * The shape is fixed and small, so we enumerate sections by hand
154
+ * rather than relying on a recursive generic merger.
155
+ */
156
+ export declare function mergeTestIds(defaults: TestIds, overrides?: DeepPartial<TestIds>): TestIds;
157
+ /** Same idea as `mergeTestIds`, for the CSS-selector block. */
158
+ export declare function mergeSelectors(defaults: Selectors, overrides?: DeepPartial<Selectors>): Selectors;
@@ -1,3 +1,6 @@
1
1
  export { homeTests } from './home';
2
2
  export { signinTests } from './signin';
3
3
  export { publishTests } from './publish';
4
+ export { searchTests } from './search';
5
+ export { settingsTests } from './settings';
6
+ export { layoutTests } from './layout';
@@ -0,0 +1,12 @@
1
+ import { RegistryConfig } from '../types';
2
+ /**
3
+ * Tests for the persistent page chrome: the header (nav bar, logo,
4
+ * search container, action buttons) and the footer (version marker).
5
+ * Also asserts that the runtime UI configuration endpoint
6
+ * `/-/static/ui-options.js` loads successfully — this endpoint emits
7
+ * `window.__VERDACCIO_BASENAME_UI_OPTIONS`, which the ui-theme relies
8
+ * on for feature flags like showFooter / showSearch / showSettings. If
9
+ * it fails the whole SPA degrades to whatever defaults the provider
10
+ * ships with, so it's worth a direct network-level check.
11
+ */
12
+ export declare function layoutTests(config: RegistryConfig): void;
@@ -0,0 +1,10 @@
1
+ import { RegistryConfig } from '../types';
2
+ /**
3
+ * UI tests for the Verdaccio search box.
4
+ *
5
+ * These tests do NOT depend on any published package — they assert the
6
+ * search *flow* (input exists, typing triggers the search API, results
7
+ * region updates) rather than specific package metadata. Tests that need
8
+ * a real package in the registry should live in publishTests instead.
9
+ */
10
+ export declare function searchTests(config: RegistryConfig): void;
@@ -0,0 +1,19 @@
1
+ import { RegistryConfig } from '../types';
2
+ /**
3
+ * Tests for the header Settings dialog and the Translations (language)
4
+ * picker inside it.
5
+ *
6
+ * Requires `web.showSettings: true` in the registry config — the gear
7
+ * icon only renders when the flag is on (see HeaderRight in Verdaccio's
8
+ * ui-components package).
9
+ *
10
+ * Selector strategy: the language cards in LanguageSwitch do NOT have
11
+ * data-testids, so this suite leans on:
12
+ * - MUI's ARIA roles: `[role="dialog"]`, `[role="tab"]`
13
+ * - The stable English labels "Configuration", "Translations",
14
+ * "English", "German", and the language description text, which are
15
+ * bundled into the ui-theme via `@verdaccio/ui-i18n`
16
+ * - The settings trigger's testid from Verdaccio's HeaderToolTipIcon:
17
+ * `header--tooltip-settings`
18
+ */
19
+ export declare function settingsTests(config: RegistryConfig): void;
package/build/types.d.ts CHANGED
@@ -1,3 +1,9 @@
1
+ /// <reference types="cypress" />
2
+ /// <reference types="cypress" />
3
+ /// <reference types="cypress" />
4
+ import type { Features } from './features';
5
+ import type { PublishPackageResult, PublishPackageTaskInput, UnpublishPackageInput, UnpublishPackageResult } from './tasks';
6
+ import type { DeepPartial, Selectors, TestIds } from './testIds';
1
7
  export type RegistryConfig = {
2
8
  registryUrl: string;
3
9
  port: number;
@@ -6,6 +12,15 @@ export type RegistryConfig = {
6
12
  password: string;
7
13
  };
8
14
  title: string;
15
+ /** Fully-resolved data-testid map (defaults merged with overrides). */
16
+ testIds: TestIds;
17
+ /** Fully-resolved CSS selector map (defaults merged with overrides). */
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;
9
24
  };
10
25
  export type VerdaccioUiOptions = {
11
26
  registryUrl: string;
@@ -15,4 +30,81 @@ export type VerdaccioUiOptions = {
15
30
  password: string;
16
31
  };
17
32
  title?: string;
33
+ /** Partial override of the default data-testid map. */
34
+ testIds?: DeepPartial<TestIds>;
35
+ /** Partial override of the default CSS selector map. */
36
+ selectors?: DeepPartial<Selectors>;
37
+ /** Partial override of the default feature flags. */
38
+ features?: DeepPartial<Features>;
18
39
  };
40
+ /**
41
+ * Return value of the `registry` Cypress task — exposed as a named
42
+ * type so `cy.task('registry')` can be strongly typed at the call site.
43
+ */
44
+ export interface RegistryTaskResult {
45
+ registryUrl: string;
46
+ port: number;
47
+ }
48
+ declare global {
49
+ namespace Cypress {
50
+ interface Chainable<Subject = any> {
51
+ /**
52
+ * Find an element by its `data-testid` attribute.
53
+ */
54
+ getByTestId(selector: string, ...args: any[]): Chainable<JQuery<HTMLElement>>;
55
+ /**
56
+ * Log in to the Verdaccio UI via the login dialog.
57
+ *
58
+ * `selectors` is optional — each field falls back to the
59
+ * Verdaccio 6.x default selector if omitted. Pass overrides when
60
+ * targeting a non-default Verdaccio build.
61
+ */
62
+ login(user: string, password: string, selectors?: {
63
+ loginButton?: string;
64
+ usernameInput?: string;
65
+ passwordInput?: string;
66
+ submitButton?: string;
67
+ }): Chainable<void>;
68
+ /**
69
+ * Publish a throwaway package to the configured registry.
70
+ *
71
+ * @example
72
+ * cy.task('publishPackage', {
73
+ * pkgName: '@verdaccio/pkg-scoped',
74
+ * version: '1.0.0',
75
+ * dependencies: { debug: '4.0.0' },
76
+ * unique: true,
77
+ * }).then((result) => {
78
+ * // result is a PublishPackageResult — fully typed.
79
+ * });
80
+ */
81
+ task(event: 'publishPackage', arg: PublishPackageTaskInput, options?: Partial<Loggable & Timeoutable>): Chainable<PublishPackageResult>;
82
+ /**
83
+ * Remove a temp project folder previously returned by
84
+ * `cy.task('publishPackage', …)`. Refuses to delete paths outside
85
+ * `os.tmpdir()`. Resolves with `null`.
86
+ */
87
+ task(event: 'cleanupPublished', arg: string, options?: Partial<Loggable & Timeoutable>): Chainable<null>;
88
+ /**
89
+ * Unpublish a package from the registry so the next test starts
90
+ * from a clean slate. Accepts either a bare package name (uses
91
+ * the configured registry URL and mints its own throwaway token)
92
+ * or a full input object (reuses an existing `tempFolder`'s
93
+ * .npmrc for efficiency).
94
+ *
95
+ * @example
96
+ * cy.task('unpublishPackage', '@verdaccio/pkg-scoped');
97
+ * cy.task('unpublishPackage', { pkgName, tempFolder });
98
+ */
99
+ task(event: 'unpublishPackage', arg: string | (Omit<UnpublishPackageInput, 'registryUrl'> & {
100
+ registryUrl?: string;
101
+ }), options?: Partial<Loggable & Timeoutable>): Chainable<UnpublishPackageResult>;
102
+ /**
103
+ * Read back the registry URL and port that were passed to
104
+ * `setupVerdaccioTasks`. Useful in specs that need to compute
105
+ * URLs without importing the cypress config.
106
+ */
107
+ task(event: 'registry', arg?: unknown, options?: Partial<Loggable & Timeoutable>): Chainable<RegistryTaskResult>;
108
+ }
109
+ }
110
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdaccio/e2e-ui",
3
- "version": "2.1.1",
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",