@verdaccio/e2e-ui 2.0.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/commands/index.cjs +16 -0
- package/build/cjs/commands/index.cjs.map +1 -0
- package/build/cjs/index.cjs +73 -0
- package/build/cjs/index.cjs.map +1 -0
- package/build/cjs/tests/home.cjs +34 -0
- package/build/cjs/tests/home.cjs.map +1 -0
- package/build/cjs/tests/publish.cjs +79 -0
- package/build/cjs/tests/publish.cjs.map +1 -0
- package/build/cjs/tests/signin.cjs +30 -0
- package/build/cjs/tests/signin.cjs.map +1 -0
- package/build/commands/index.d.ts +17 -0
- package/build/esm/commands/index.js +17 -0
- package/build/esm/commands/index.js.map +1 -0
- package/build/esm/index.js +67 -0
- package/build/esm/index.js.map +1 -0
- package/build/esm/tests/home.js +34 -0
- package/build/esm/tests/home.js.map +1 -0
- package/build/esm/tests/publish.js +79 -0
- package/build/esm/tests/publish.js.map +1 -0
- package/build/esm/tests/signin.js +30 -0
- package/build/esm/tests/signin.js.map +1 -0
- package/build/index.d.ts +40 -0
- package/build/tests/home.d.ts +2 -0
- package/build/tests/index.d.ts +3 -0
- package/build/tests/publish.d.ts +2 -0
- package/build/tests/signin.d.ts +2 -0
- package/build/types.d.ts +18 -0
- package/package.json +7 -4
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/commands/index.ts
|
|
2
|
+
Cypress.Commands.add("getByTestId", (selector, ...args) => {
|
|
3
|
+
return cy.get(`[data-testid=${selector}]`, ...args);
|
|
4
|
+
});
|
|
5
|
+
Cypress.Commands.add("login", (user, password) => {
|
|
6
|
+
cy.getByTestId("header--button-login").click();
|
|
7
|
+
cy.wait(300);
|
|
8
|
+
cy.get("#login--dialog-username").type(user);
|
|
9
|
+
cy.wait(200);
|
|
10
|
+
cy.get("#login--dialog-password").type(password);
|
|
11
|
+
cy.wait(500);
|
|
12
|
+
cy.get("#login--dialog-button-submit").click();
|
|
13
|
+
});
|
|
14
|
+
//#endregion
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../src/commands/index.ts"],"sourcesContent":["/// <reference types=\"cypress\" />\n\ndeclare global {\n namespace Cypress {\n interface Chainable {\n /**\n * Find element by data-testid attribute\n */\n getByTestId(selector: string, ...args: any[]): Chainable<JQuery<HTMLElement>>;\n /**\n * Login to Verdaccio UI\n */\n login(user: string, password: string): Chainable<void>;\n }\n }\n}\n\nCypress.Commands.add('getByTestId', (selector: string, ...args: any[]) => {\n return cy.get(`[data-testid=${selector}]`, ...args);\n});\n\nCypress.Commands.add('login', (user: string, password: string) => {\n cy.getByTestId('header--button-login').click();\n cy.wait(300);\n cy.get('#login--dialog-username').type(user);\n cy.wait(200);\n cy.get('#login--dialog-password').type(password);\n cy.wait(500);\n cy.get('#login--dialog-button-submit').click();\n});\n\nexport {};\n"],"mappings":";AAiBA,QAAQ,SAAS,IAAI,gBAAgB,UAAkB,GAAG,SAAgB;AACxE,QAAO,GAAG,IAAI,gBAAgB,SAAS,IAAI,GAAG,KAAK;EACnD;AAEF,QAAQ,SAAS,IAAI,UAAU,MAAc,aAAqB;AAChE,IAAG,YAAY,uBAAuB,CAAC,OAAO;AAC9C,IAAG,KAAK,IAAI;AACZ,IAAG,IAAI,0BAA0B,CAAC,KAAK,KAAK;AAC5C,IAAG,KAAK,IAAI;AACZ,IAAG,IAAI,0BAA0B,CAAC,KAAK,SAAS;AAChD,IAAG,KAAK,IAAI;AACZ,IAAG,IAAI,+BAA+B,CAAC,OAAO;EAC9C"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_home = require("./tests/home.cjs");
|
|
3
|
+
const require_signin = require("./tests/signin.cjs");
|
|
4
|
+
const require_publish = require("./tests/publish.cjs");
|
|
5
|
+
//#region src/index.ts
|
|
6
|
+
/**
|
|
7
|
+
* Build a full RegistryConfig from user-provided options with defaults.
|
|
8
|
+
*/
|
|
9
|
+
function createRegistryConfig(options) {
|
|
10
|
+
const url = new URL(options.registryUrl);
|
|
11
|
+
return {
|
|
12
|
+
registryUrl: options.registryUrl,
|
|
13
|
+
port: options.port ?? (parseInt(url.port, 10) || 4873),
|
|
14
|
+
credentials: options.credentials ?? {
|
|
15
|
+
user: "test",
|
|
16
|
+
password: "test"
|
|
17
|
+
},
|
|
18
|
+
title: options.title ?? "Verdaccio"
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Register Verdaccio Cypress tasks in setupNodeEvents.
|
|
23
|
+
*
|
|
24
|
+
* Usage in cypress.config.ts:
|
|
25
|
+
* import { setupVerdaccioTasks } from '@verdaccio/e2e-ui';
|
|
26
|
+
*
|
|
27
|
+
* export default defineConfig({
|
|
28
|
+
* e2e: {
|
|
29
|
+
* setupNodeEvents(on) {
|
|
30
|
+
* setupVerdaccioTasks(on, { registryUrl: 'http://localhost:4873' });
|
|
31
|
+
* },
|
|
32
|
+
* },
|
|
33
|
+
* });
|
|
34
|
+
*/
|
|
35
|
+
function setupVerdaccioTasks(on, options) {
|
|
36
|
+
const config = createRegistryConfig(options);
|
|
37
|
+
on("task", { registry() {
|
|
38
|
+
return {
|
|
39
|
+
registryUrl: config.registryUrl,
|
|
40
|
+
port: config.port
|
|
41
|
+
};
|
|
42
|
+
} });
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Register all Verdaccio UI tests.
|
|
46
|
+
*
|
|
47
|
+
* Usage in a spec file:
|
|
48
|
+
* import { registerAllTests, createRegistryConfig } from '@verdaccio/e2e-ui';
|
|
49
|
+
*
|
|
50
|
+
* const config = createRegistryConfig({ registryUrl: 'http://localhost:4873' });
|
|
51
|
+
* registerAllTests(config);
|
|
52
|
+
*
|
|
53
|
+
* Or pick individual suites:
|
|
54
|
+
* import { homeTests, signinTests } from '@verdaccio/e2e-ui';
|
|
55
|
+
*
|
|
56
|
+
* const config = createRegistryConfig({ registryUrl: 'http://localhost:4873' });
|
|
57
|
+
* homeTests(config);
|
|
58
|
+
* signinTests(config);
|
|
59
|
+
*/
|
|
60
|
+
function registerAllTests(config) {
|
|
61
|
+
require_home.homeTests(config);
|
|
62
|
+
require_signin.signinTests(config);
|
|
63
|
+
require_publish.publishTests(config);
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
exports.createRegistryConfig = createRegistryConfig;
|
|
67
|
+
exports.homeTests = require_home.homeTests;
|
|
68
|
+
exports.publishTests = require_publish.publishTests;
|
|
69
|
+
exports.registerAllTests = registerAllTests;
|
|
70
|
+
exports.setupVerdaccioTasks = setupVerdaccioTasks;
|
|
71
|
+
exports.signinTests = require_signin.signinTests;
|
|
72
|
+
|
|
73
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/index.ts"],"sourcesContent":["import { RegistryConfig, VerdaccioUiOptions } from './types';\n\nexport type { RegistryConfig, VerdaccioUiOptions } from './types';\nexport { homeTests, signinTests, publishTests } from './tests';\n\n/**\n * Build a full RegistryConfig from user-provided options with defaults.\n */\nexport function createRegistryConfig(options: VerdaccioUiOptions): RegistryConfig {\n const url = new URL(options.registryUrl);\n return {\n registryUrl: options.registryUrl,\n port: options.port ?? (parseInt(url.port, 10) || 4873),\n credentials: options.credentials ?? { user: 'test', password: 'test' },\n title: options.title ?? 'Verdaccio',\n };\n}\n\n/**\n * Register Verdaccio Cypress tasks in setupNodeEvents.\n *\n * Usage in cypress.config.ts:\n * import { setupVerdaccioTasks } from '@verdaccio/e2e-ui';\n *\n * export default defineConfig({\n * e2e: {\n * setupNodeEvents(on) {\n * setupVerdaccioTasks(on, { registryUrl: 'http://localhost:4873' });\n * },\n * },\n * });\n */\nexport function setupVerdaccioTasks(\n on: Cypress.PluginEvents,\n options: VerdaccioUiOptions\n): void {\n const config = createRegistryConfig(options);\n\n on('task', {\n registry() {\n return {\n registryUrl: config.registryUrl,\n port: config.port,\n };\n },\n });\n}\n\n/**\n * Register all Verdaccio UI tests.\n *\n * Usage in a spec file:\n * import { registerAllTests, createRegistryConfig } from '@verdaccio/e2e-ui';\n *\n * const config = createRegistryConfig({ registryUrl: 'http://localhost:4873' });\n * registerAllTests(config);\n *\n * Or pick individual suites:\n * import { homeTests, signinTests } from '@verdaccio/e2e-ui';\n *\n * const config = createRegistryConfig({ registryUrl: 'http://localhost:4873' });\n * homeTests(config);\n * signinTests(config);\n */\nexport function registerAllTests(config: RegistryConfig): void {\n homeTests(config);\n signinTests(config);\n publishTests(config);\n}\n\n// Re-export for convenience\nimport { homeTests, signinTests, publishTests } from './tests';\n"],"mappings":";;;;;;;;AAQA,SAAgB,qBAAqB,SAA6C;CAChF,MAAM,MAAM,IAAI,IAAI,QAAQ,YAAY;AACxC,QAAO;EACL,aAAa,QAAQ;EACrB,MAAM,QAAQ,SAAS,SAAS,IAAI,MAAM,GAAG,IAAI;EACjD,aAAa,QAAQ,eAAe;GAAE,MAAM;GAAQ,UAAU;GAAQ;EACtE,OAAO,QAAQ,SAAS;EACzB;;;;;;;;;;;;;;;;AAiBH,SAAgB,oBACd,IACA,SACM;CACN,MAAM,SAAS,qBAAqB,QAAQ;AAE5C,IAAG,QAAQ,EACT,WAAW;AACT,SAAO;GACL,aAAa,OAAO;GACpB,MAAM,OAAO;GACd;IAEJ,CAAC;;;;;;;;;;;;;;;;;;AAmBJ,SAAgB,iBAAiB,QAA8B;AAC7D,cAAA,UAAU,OAAO;AACjB,gBAAA,YAAY,OAAO;AACnB,iBAAA,aAAa,OAAO"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/tests/home.ts
|
|
2
|
+
function homeTests(config) {
|
|
3
|
+
describe("home", () => {
|
|
4
|
+
beforeEach(() => {
|
|
5
|
+
cy.visit(config.registryUrl);
|
|
6
|
+
cy.get("body").should("be.visible");
|
|
7
|
+
});
|
|
8
|
+
afterEach(() => {
|
|
9
|
+
cy.wait(2e3);
|
|
10
|
+
});
|
|
11
|
+
it("title should be correct", () => {
|
|
12
|
+
cy.location("pathname").should("include", "/");
|
|
13
|
+
cy.title().should("eq", config.title);
|
|
14
|
+
});
|
|
15
|
+
it("should match title with no packages published", () => {
|
|
16
|
+
cy.getByTestId("help-card", { timeout: 1e4 }).should("be.visible");
|
|
17
|
+
cy.getByTestId("help-card").contains("No Package Published Yet.");
|
|
18
|
+
});
|
|
19
|
+
it("should display instructions on help card", () => {
|
|
20
|
+
cy.getByTestId("help-card", { timeout: 1e4 }).should("be.visible");
|
|
21
|
+
cy.getByTestId("help-card").contains(`npm adduser --registry ${config.registryUrl}`);
|
|
22
|
+
cy.getByTestId("help-card").contains(`npm publish --registry ${config.registryUrl}`);
|
|
23
|
+
});
|
|
24
|
+
it("should go to 404 page", () => {
|
|
25
|
+
cy.visit(`${config.registryUrl}/-/web/detail/@verdaccio/not-found`);
|
|
26
|
+
cy.getByTestId("404", { timeout: 1e4 }).should("be.visible");
|
|
27
|
+
cy.getByTestId("404").contains("Sorry, we couldn't find it.");
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
exports.homeTests = homeTests;
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=home.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"home.cjs","names":[],"sources":["../../../src/tests/home.ts"],"sourcesContent":["/// <reference types=\"cypress\" />\n\nimport { RegistryConfig } from '../types';\n\nexport function homeTests(config: RegistryConfig) {\n describe('home', () => {\n beforeEach(() => {\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 match title with no packages published', () => {\n cy.getByTestId('help-card', { timeout: 10000 }).should('be.visible');\n cy.getByTestId('help-card').contains('No Package Published Yet.');\n });\n\n it('should display instructions on help card', () => {\n cy.getByTestId('help-card', { timeout: 10000 }).should('be.visible');\n cy.getByTestId('help-card').contains(\n `npm adduser --registry ${config.registryUrl}`\n );\n cy.getByTestId('help-card').contains(\n `npm publish --registry ${config.registryUrl}`\n );\n });\n\n it('should go to 404 page', () => {\n cy.visit(`${config.registryUrl}/-/web/detail/@verdaccio/not-found`);\n cy.getByTestId('404', { timeout: 10000 }).should('be.visible');\n cy.getByTestId('404').contains(\"Sorry, we couldn't find it.\");\n });\n });\n}\n"],"mappings":";AAIA,SAAgB,UAAU,QAAwB;AAChD,UAAS,cAAc;AACrB,mBAAiB;AACf,MAAG,MAAM,OAAO,YAAY;AAE5B,MAAG,IAAI,OAAO,CAAC,OAAO,aAAa;IACnC;AAEF,kBAAgB;AACd,MAAG,KAAK,IAAK;IACb;AAEF,KAAG,iCAAiC;AAClC,MAAG,SAAS,WAAW,CAAC,OAAO,WAAW,IAAI;AAC9C,MAAG,OAAO,CAAC,OAAO,MAAM,OAAO,MAAM;IACrC;AAEF,KAAG,uDAAuD;AACxD,MAAG,YAAY,aAAa,EAAE,SAAS,KAAO,CAAC,CAAC,OAAO,aAAa;AACpE,MAAG,YAAY,YAAY,CAAC,SAAS,4BAA4B;IACjE;AAEF,KAAG,kDAAkD;AACnD,MAAG,YAAY,aAAa,EAAE,SAAS,KAAO,CAAC,CAAC,OAAO,aAAa;AACpE,MAAG,YAAY,YAAY,CAAC,SAC1B,0BAA0B,OAAO,cAClC;AACD,MAAG,YAAY,YAAY,CAAC,SAC1B,0BAA0B,OAAO,cAClC;IACD;AAEF,KAAG,+BAA+B;AAChC,MAAG,MAAM,GAAG,OAAO,YAAY,oCAAoC;AACnE,MAAG,YAAY,OAAO,EAAE,SAAS,KAAO,CAAC,CAAC,OAAO,aAAa;AAC9D,MAAG,YAAY,MAAM,CAAC,SAAS,8BAA8B;IAC7D;GACF"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
//#region src/tests/publish.ts
|
|
2
|
+
function publishTests(config) {
|
|
3
|
+
describe("publish", () => {
|
|
4
|
+
const pkgName = "@verdaccio/pkg-scoped";
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
cy.intercept("POST", "/-/verdaccio/sec/login").as("sign");
|
|
7
|
+
cy.intercept("GET", "/-/verdaccio/data/packages").as("pkgs");
|
|
8
|
+
cy.intercept("GET", `/-/verdaccio/data/sidebar/${pkgName}`).as("sidebar");
|
|
9
|
+
cy.intercept("GET", `/-/verdaccio/data/package/readme/${pkgName}`).as("readme");
|
|
10
|
+
cy.task("publishScoped", { pkgName });
|
|
11
|
+
});
|
|
12
|
+
it("should have one published package", () => {
|
|
13
|
+
cy.visit(config.registryUrl);
|
|
14
|
+
cy.login(config.credentials.user, config.credentials.password);
|
|
15
|
+
cy.wait("@sign");
|
|
16
|
+
});
|
|
17
|
+
it("should navigate to page detail", () => {
|
|
18
|
+
cy.visit(config.registryUrl);
|
|
19
|
+
cy.login(config.credentials.user, config.credentials.password);
|
|
20
|
+
cy.wait("@sign");
|
|
21
|
+
cy.wait("@pkgs");
|
|
22
|
+
cy.wait(300);
|
|
23
|
+
cy.getByTestId("package-title").first().click();
|
|
24
|
+
});
|
|
25
|
+
it("should have readme content", () => {
|
|
26
|
+
cy.visit(config.registryUrl);
|
|
27
|
+
cy.login(config.credentials.user, config.credentials.password);
|
|
28
|
+
cy.wait("@sign");
|
|
29
|
+
cy.wait("@pkgs");
|
|
30
|
+
cy.getByTestId("package-title").first().click();
|
|
31
|
+
cy.wait("@readme");
|
|
32
|
+
cy.wait("@sidebar");
|
|
33
|
+
cy.get(".markdown-body").should("have.length", 1);
|
|
34
|
+
cy.contains(".markdown-body", /test/);
|
|
35
|
+
});
|
|
36
|
+
it("should click on dependencies tab", () => {
|
|
37
|
+
cy.visit(config.registryUrl);
|
|
38
|
+
cy.login(config.credentials.user, config.credentials.password);
|
|
39
|
+
cy.wait("@sign");
|
|
40
|
+
cy.wait("@pkgs");
|
|
41
|
+
cy.wait(300);
|
|
42
|
+
cy.getByTestId("package-title").first().click();
|
|
43
|
+
cy.wait("@readme");
|
|
44
|
+
cy.wait("@sidebar");
|
|
45
|
+
cy.getByTestId("dependencies-tab").click();
|
|
46
|
+
cy.wait(100);
|
|
47
|
+
cy.getByTestId("dependencies").should("have.length", 1);
|
|
48
|
+
cy.getByTestId("verdaccio").children().invoke("text").should("match", /verdaccio/);
|
|
49
|
+
});
|
|
50
|
+
it("should click on versions tab", () => {
|
|
51
|
+
cy.visit(config.registryUrl);
|
|
52
|
+
cy.login(config.credentials.user, config.credentials.password);
|
|
53
|
+
cy.wait("@sign");
|
|
54
|
+
cy.wait("@pkgs");
|
|
55
|
+
cy.wait(300);
|
|
56
|
+
cy.getByTestId("package-title").first().click();
|
|
57
|
+
cy.wait("@readme");
|
|
58
|
+
cy.wait("@sidebar");
|
|
59
|
+
cy.getByTestId("versions-tab").click();
|
|
60
|
+
cy.getByTestId("tag-latest").children().invoke("text").should("match", /1.0.6/);
|
|
61
|
+
});
|
|
62
|
+
it("should click on uplinks tab", () => {
|
|
63
|
+
cy.visit(config.registryUrl);
|
|
64
|
+
cy.login(config.credentials.user, config.credentials.password);
|
|
65
|
+
cy.wait("@sign");
|
|
66
|
+
cy.wait("@pkgs");
|
|
67
|
+
cy.wait(300);
|
|
68
|
+
cy.getByTestId("package-title").first().click();
|
|
69
|
+
cy.wait("@readme");
|
|
70
|
+
cy.wait("@sidebar");
|
|
71
|
+
cy.getByTestId("uplinks-tab").click();
|
|
72
|
+
cy.getByTestId("no-uplinks").should("be.visible");
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
exports.publishTests = publishTests;
|
|
78
|
+
|
|
79
|
+
//# sourceMappingURL=publish.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish.cjs","names":[],"sources":["../../../src/tests/publish.ts"],"sourcesContent":["/// <reference types=\"cypress\" />\n\nimport { RegistryConfig } from '../types';\n\nexport function publishTests(config: RegistryConfig) {\n describe('publish', () => {\n const pkgName = '@verdaccio/pkg-scoped';\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 cy.task('publishScoped', { pkgName });\n });\n\n it('should have one published package', () => {\n cy.visit(config.registryUrl);\n cy.login(config.credentials.user, config.credentials.password);\n cy.wait('@sign');\n });\n\n it('should navigate to page detail', () => {\n cy.visit(config.registryUrl);\n cy.login(config.credentials.user, config.credentials.password);\n cy.wait('@sign');\n cy.wait('@pkgs');\n cy.wait(300);\n cy.getByTestId('package-title').first().click();\n });\n\n it('should have readme content', () => {\n cy.visit(config.registryUrl);\n cy.login(config.credentials.user, config.credentials.password);\n cy.wait('@sign');\n cy.wait('@pkgs');\n cy.getByTestId('package-title').first().click();\n cy.wait('@readme');\n cy.wait('@sidebar');\n cy.get('.markdown-body').should('have.length', 1);\n cy.contains('.markdown-body', /test/);\n });\n\n it('should click on dependencies tab', () => {\n cy.visit(config.registryUrl);\n cy.login(config.credentials.user, config.credentials.password);\n cy.wait('@sign');\n cy.wait('@pkgs');\n cy.wait(300);\n cy.getByTestId('package-title').first().click();\n cy.wait('@readme');\n cy.wait('@sidebar');\n cy.getByTestId('dependencies-tab').click();\n cy.wait(100);\n cy.getByTestId('dependencies').should('have.length', 1);\n cy.getByTestId('verdaccio')\n .children()\n .invoke('text')\n .should('match', /verdaccio/);\n });\n\n it('should click on versions tab', () => {\n cy.visit(config.registryUrl);\n cy.login(config.credentials.user, config.credentials.password);\n cy.wait('@sign');\n cy.wait('@pkgs');\n cy.wait(300);\n cy.getByTestId('package-title').first().click();\n cy.wait('@readme');\n cy.wait('@sidebar');\n cy.getByTestId('versions-tab').click();\n cy.getByTestId('tag-latest')\n .children()\n .invoke('text')\n .should('match', /1.0.6/);\n });\n\n it('should click on uplinks tab', () => {\n cy.visit(config.registryUrl);\n cy.login(config.credentials.user, config.credentials.password);\n cy.wait('@sign');\n cy.wait('@pkgs');\n cy.wait(300);\n cy.getByTestId('package-title').first().click();\n cy.wait('@readme');\n cy.wait('@sidebar');\n cy.getByTestId('uplinks-tab').click();\n cy.getByTestId('no-uplinks').should('be.visible');\n });\n });\n}\n"],"mappings":";AAIA,SAAgB,aAAa,QAAwB;AACnD,UAAS,iBAAiB;EACxB,MAAM,UAAU;AAEhB,mBAAiB;AACf,MAAG,UAAU,QAAQ,yBAAyB,CAAC,GAAG,OAAO;AACzD,MAAG,UAAU,OAAO,6BAA6B,CAAC,GAAG,OAAO;AAC5D,MAAG,UAAU,OAAO,6BAA6B,UAAU,CAAC,GAAG,UAAU;AACzE,MAAG,UAAU,OAAO,oCAAoC,UAAU,CAAC,GAAG,SAAS;AAC/E,MAAG,KAAK,iBAAiB,EAAE,SAAS,CAAC;IACrC;AAEF,KAAG,2CAA2C;AAC5C,MAAG,MAAM,OAAO,YAAY;AAC5B,MAAG,MAAM,OAAO,YAAY,MAAM,OAAO,YAAY,SAAS;AAC9D,MAAG,KAAK,QAAQ;IAChB;AAEF,KAAG,wCAAwC;AACzC,MAAG,MAAM,OAAO,YAAY;AAC5B,MAAG,MAAM,OAAO,YAAY,MAAM,OAAO,YAAY,SAAS;AAC9D,MAAG,KAAK,QAAQ;AAChB,MAAG,KAAK,QAAQ;AAChB,MAAG,KAAK,IAAI;AACZ,MAAG,YAAY,gBAAgB,CAAC,OAAO,CAAC,OAAO;IAC/C;AAEF,KAAG,oCAAoC;AACrC,MAAG,MAAM,OAAO,YAAY;AAC5B,MAAG,MAAM,OAAO,YAAY,MAAM,OAAO,YAAY,SAAS;AAC9D,MAAG,KAAK,QAAQ;AAChB,MAAG,KAAK,QAAQ;AAChB,MAAG,YAAY,gBAAgB,CAAC,OAAO,CAAC,OAAO;AAC/C,MAAG,KAAK,UAAU;AAClB,MAAG,KAAK,WAAW;AACnB,MAAG,IAAI,iBAAiB,CAAC,OAAO,eAAe,EAAE;AACjD,MAAG,SAAS,kBAAkB,OAAO;IACrC;AAEF,KAAG,0CAA0C;AAC3C,MAAG,MAAM,OAAO,YAAY;AAC5B,MAAG,MAAM,OAAO,YAAY,MAAM,OAAO,YAAY,SAAS;AAC9D,MAAG,KAAK,QAAQ;AAChB,MAAG,KAAK,QAAQ;AAChB,MAAG,KAAK,IAAI;AACZ,MAAG,YAAY,gBAAgB,CAAC,OAAO,CAAC,OAAO;AAC/C,MAAG,KAAK,UAAU;AAClB,MAAG,KAAK,WAAW;AACnB,MAAG,YAAY,mBAAmB,CAAC,OAAO;AAC1C,MAAG,KAAK,IAAI;AACZ,MAAG,YAAY,eAAe,CAAC,OAAO,eAAe,EAAE;AACvD,MAAG,YAAY,YAAY,CACxB,UAAU,CACV,OAAO,OAAO,CACd,OAAO,SAAS,YAAY;IAC/B;AAEF,KAAG,sCAAsC;AACvC,MAAG,MAAM,OAAO,YAAY;AAC5B,MAAG,MAAM,OAAO,YAAY,MAAM,OAAO,YAAY,SAAS;AAC9D,MAAG,KAAK,QAAQ;AAChB,MAAG,KAAK,QAAQ;AAChB,MAAG,KAAK,IAAI;AACZ,MAAG,YAAY,gBAAgB,CAAC,OAAO,CAAC,OAAO;AAC/C,MAAG,KAAK,UAAU;AAClB,MAAG,KAAK,WAAW;AACnB,MAAG,YAAY,eAAe,CAAC,OAAO;AACtC,MAAG,YAAY,aAAa,CACzB,UAAU,CACV,OAAO,OAAO,CACd,OAAO,SAAS,QAAQ;IAC3B;AAEF,KAAG,qCAAqC;AACtC,MAAG,MAAM,OAAO,YAAY;AAC5B,MAAG,MAAM,OAAO,YAAY,MAAM,OAAO,YAAY,SAAS;AAC9D,MAAG,KAAK,QAAQ;AAChB,MAAG,KAAK,QAAQ;AAChB,MAAG,KAAK,IAAI;AACZ,MAAG,YAAY,gBAAgB,CAAC,OAAO,CAAC,OAAO;AAC/C,MAAG,KAAK,UAAU;AAClB,MAAG,KAAK,WAAW;AACnB,MAAG,YAAY,cAAc,CAAC,OAAO;AACrC,MAAG,YAAY,aAAa,CAAC,OAAO,aAAa;IACjD;GACF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/tests/signin.ts
|
|
2
|
+
function signinTests(config) {
|
|
3
|
+
describe("sign in / sign out", () => {
|
|
4
|
+
beforeEach(() => {
|
|
5
|
+
cy.intercept("POST", "/-/verdaccio/sec/login").as("sign");
|
|
6
|
+
});
|
|
7
|
+
it("should login user", () => {
|
|
8
|
+
cy.visit(config.registryUrl);
|
|
9
|
+
cy.login(config.credentials.user, config.credentials.password);
|
|
10
|
+
cy.wait("@sign");
|
|
11
|
+
cy.getByTestId("logInDialogIcon").click();
|
|
12
|
+
cy.wait(100);
|
|
13
|
+
cy.getByTestId("greetings-label").contains(config.credentials.user);
|
|
14
|
+
});
|
|
15
|
+
it("should logout a user", () => {
|
|
16
|
+
cy.visit(config.registryUrl);
|
|
17
|
+
cy.login(config.credentials.user, config.credentials.password);
|
|
18
|
+
cy.wait("@sign");
|
|
19
|
+
cy.getByTestId("logInDialogIcon").click();
|
|
20
|
+
cy.wait(100);
|
|
21
|
+
cy.getByTestId("logOutDialogIcon").click();
|
|
22
|
+
cy.wait(200);
|
|
23
|
+
cy.getByTestId("header--button-login").contains("Login");
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
exports.signinTests = signinTests;
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=signin.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signin.cjs","names":[],"sources":["../../../src/tests/signin.ts"],"sourcesContent":["/// <reference types=\"cypress\" />\n\nimport { RegistryConfig } from '../types';\n\nexport function signinTests(config: RegistryConfig) {\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 cy.wait('@sign');\n cy.getByTestId('logInDialogIcon').click();\n cy.wait(100);\n cy.getByTestId('greetings-label').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 cy.wait('@sign');\n cy.getByTestId('logInDialogIcon').click();\n cy.wait(100);\n cy.getByTestId('logOutDialogIcon').click();\n cy.wait(200);\n cy.getByTestId('header--button-login').contains('Login');\n });\n });\n}\n"],"mappings":";AAIA,SAAgB,YAAY,QAAwB;AAClD,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,SAAS;AAC9D,MAAG,KAAK,QAAQ;AAChB,MAAG,YAAY,kBAAkB,CAAC,OAAO;AACzC,MAAG,KAAK,IAAI;AACZ,MAAG,YAAY,kBAAkB,CAAC,SAAS,OAAO,YAAY,KAAK;IACnE;AAEF,KAAG,8BAA8B;AAC/B,MAAG,MAAM,OAAO,YAAY;AAC5B,MAAG,MAAM,OAAO,YAAY,MAAM,OAAO,YAAY,SAAS;AAC9D,MAAG,KAAK,QAAQ;AAChB,MAAG,YAAY,kBAAkB,CAAC,OAAO;AACzC,MAAG,KAAK,IAAI;AACZ,MAAG,YAAY,mBAAmB,CAAC,OAAO;AAC1C,MAAG,KAAK,IAAI;AACZ,MAAG,YAAY,uBAAuB,CAAC,SAAS,QAAQ;IACxD;GACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="cypress" />
|
|
2
|
+
/// <reference types="cypress" />
|
|
3
|
+
declare global {
|
|
4
|
+
namespace Cypress {
|
|
5
|
+
interface Chainable {
|
|
6
|
+
/**
|
|
7
|
+
* Find element by data-testid attribute
|
|
8
|
+
*/
|
|
9
|
+
getByTestId(selector: string, ...args: any[]): Chainable<JQuery<HTMLElement>>;
|
|
10
|
+
/**
|
|
11
|
+
* Login to Verdaccio UI
|
|
12
|
+
*/
|
|
13
|
+
login(user: string, password: string): Chainable<void>;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/commands/index.ts
|
|
2
|
+
Cypress.Commands.add("getByTestId", (selector, ...args) => {
|
|
3
|
+
return cy.get(`[data-testid=${selector}]`, ...args);
|
|
4
|
+
});
|
|
5
|
+
Cypress.Commands.add("login", (user, password) => {
|
|
6
|
+
cy.getByTestId("header--button-login").click();
|
|
7
|
+
cy.wait(300);
|
|
8
|
+
cy.get("#login--dialog-username").type(user);
|
|
9
|
+
cy.wait(200);
|
|
10
|
+
cy.get("#login--dialog-password").type(password);
|
|
11
|
+
cy.wait(500);
|
|
12
|
+
cy.get("#login--dialog-button-submit").click();
|
|
13
|
+
});
|
|
14
|
+
//#endregion
|
|
15
|
+
export {};
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/commands/index.ts"],"sourcesContent":["/// <reference types=\"cypress\" />\n\ndeclare global {\n namespace Cypress {\n interface Chainable {\n /**\n * Find element by data-testid attribute\n */\n getByTestId(selector: string, ...args: any[]): Chainable<JQuery<HTMLElement>>;\n /**\n * Login to Verdaccio UI\n */\n login(user: string, password: string): Chainable<void>;\n }\n }\n}\n\nCypress.Commands.add('getByTestId', (selector: string, ...args: any[]) => {\n return cy.get(`[data-testid=${selector}]`, ...args);\n});\n\nCypress.Commands.add('login', (user: string, password: string) => {\n cy.getByTestId('header--button-login').click();\n cy.wait(300);\n cy.get('#login--dialog-username').type(user);\n cy.wait(200);\n cy.get('#login--dialog-password').type(password);\n cy.wait(500);\n cy.get('#login--dialog-button-submit').click();\n});\n\nexport {};\n"],"mappings":";AAiBA,QAAQ,SAAS,IAAI,gBAAgB,UAAkB,GAAG,SAAgB;AACxE,QAAO,GAAG,IAAI,gBAAgB,SAAS,IAAI,GAAG,KAAK;EACnD;AAEF,QAAQ,SAAS,IAAI,UAAU,MAAc,aAAqB;AAChE,IAAG,YAAY,uBAAuB,CAAC,OAAO;AAC9C,IAAG,KAAK,IAAI;AACZ,IAAG,IAAI,0BAA0B,CAAC,KAAK,KAAK;AAC5C,IAAG,KAAK,IAAI;AACZ,IAAG,IAAI,0BAA0B,CAAC,KAAK,SAAS;AAChD,IAAG,KAAK,IAAI;AACZ,IAAG,IAAI,+BAA+B,CAAC,OAAO;EAC9C"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { homeTests } from "./tests/home.js";
|
|
2
|
+
import { signinTests } from "./tests/signin.js";
|
|
3
|
+
import { publishTests } from "./tests/publish.js";
|
|
4
|
+
//#region src/index.ts
|
|
5
|
+
/**
|
|
6
|
+
* Build a full RegistryConfig from user-provided options with defaults.
|
|
7
|
+
*/
|
|
8
|
+
function createRegistryConfig(options) {
|
|
9
|
+
const url = new URL(options.registryUrl);
|
|
10
|
+
return {
|
|
11
|
+
registryUrl: options.registryUrl,
|
|
12
|
+
port: options.port ?? (parseInt(url.port, 10) || 4873),
|
|
13
|
+
credentials: options.credentials ?? {
|
|
14
|
+
user: "test",
|
|
15
|
+
password: "test"
|
|
16
|
+
},
|
|
17
|
+
title: options.title ?? "Verdaccio"
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Register Verdaccio Cypress tasks in setupNodeEvents.
|
|
22
|
+
*
|
|
23
|
+
* Usage in cypress.config.ts:
|
|
24
|
+
* import { setupVerdaccioTasks } from '@verdaccio/e2e-ui';
|
|
25
|
+
*
|
|
26
|
+
* export default defineConfig({
|
|
27
|
+
* e2e: {
|
|
28
|
+
* setupNodeEvents(on) {
|
|
29
|
+
* setupVerdaccioTasks(on, { registryUrl: 'http://localhost:4873' });
|
|
30
|
+
* },
|
|
31
|
+
* },
|
|
32
|
+
* });
|
|
33
|
+
*/
|
|
34
|
+
function setupVerdaccioTasks(on, options) {
|
|
35
|
+
const config = createRegistryConfig(options);
|
|
36
|
+
on("task", { registry() {
|
|
37
|
+
return {
|
|
38
|
+
registryUrl: config.registryUrl,
|
|
39
|
+
port: config.port
|
|
40
|
+
};
|
|
41
|
+
} });
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Register all Verdaccio UI tests.
|
|
45
|
+
*
|
|
46
|
+
* Usage in a spec file:
|
|
47
|
+
* import { registerAllTests, createRegistryConfig } from '@verdaccio/e2e-ui';
|
|
48
|
+
*
|
|
49
|
+
* const config = createRegistryConfig({ registryUrl: 'http://localhost:4873' });
|
|
50
|
+
* registerAllTests(config);
|
|
51
|
+
*
|
|
52
|
+
* Or pick individual suites:
|
|
53
|
+
* import { homeTests, signinTests } from '@verdaccio/e2e-ui';
|
|
54
|
+
*
|
|
55
|
+
* const config = createRegistryConfig({ registryUrl: 'http://localhost:4873' });
|
|
56
|
+
* homeTests(config);
|
|
57
|
+
* signinTests(config);
|
|
58
|
+
*/
|
|
59
|
+
function registerAllTests(config) {
|
|
60
|
+
homeTests(config);
|
|
61
|
+
signinTests(config);
|
|
62
|
+
publishTests(config);
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { createRegistryConfig, homeTests, publishTests, registerAllTests, setupVerdaccioTasks, signinTests };
|
|
66
|
+
|
|
67
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["import { RegistryConfig, VerdaccioUiOptions } from './types';\n\nexport type { RegistryConfig, VerdaccioUiOptions } from './types';\nexport { homeTests, signinTests, publishTests } from './tests';\n\n/**\n * Build a full RegistryConfig from user-provided options with defaults.\n */\nexport function createRegistryConfig(options: VerdaccioUiOptions): RegistryConfig {\n const url = new URL(options.registryUrl);\n return {\n registryUrl: options.registryUrl,\n port: options.port ?? (parseInt(url.port, 10) || 4873),\n credentials: options.credentials ?? { user: 'test', password: 'test' },\n title: options.title ?? 'Verdaccio',\n };\n}\n\n/**\n * Register Verdaccio Cypress tasks in setupNodeEvents.\n *\n * Usage in cypress.config.ts:\n * import { setupVerdaccioTasks } from '@verdaccio/e2e-ui';\n *\n * export default defineConfig({\n * e2e: {\n * setupNodeEvents(on) {\n * setupVerdaccioTasks(on, { registryUrl: 'http://localhost:4873' });\n * },\n * },\n * });\n */\nexport function setupVerdaccioTasks(\n on: Cypress.PluginEvents,\n options: VerdaccioUiOptions\n): void {\n const config = createRegistryConfig(options);\n\n on('task', {\n registry() {\n return {\n registryUrl: config.registryUrl,\n port: config.port,\n };\n },\n });\n}\n\n/**\n * Register all Verdaccio UI tests.\n *\n * Usage in a spec file:\n * import { registerAllTests, createRegistryConfig } from '@verdaccio/e2e-ui';\n *\n * const config = createRegistryConfig({ registryUrl: 'http://localhost:4873' });\n * registerAllTests(config);\n *\n * Or pick individual suites:\n * import { homeTests, signinTests } from '@verdaccio/e2e-ui';\n *\n * const config = createRegistryConfig({ registryUrl: 'http://localhost:4873' });\n * homeTests(config);\n * signinTests(config);\n */\nexport function registerAllTests(config: RegistryConfig): void {\n homeTests(config);\n signinTests(config);\n publishTests(config);\n}\n\n// Re-export for convenience\nimport { homeTests, signinTests, publishTests } from './tests';\n"],"mappings":";;;;;;;AAQA,SAAgB,qBAAqB,SAA6C;CAChF,MAAM,MAAM,IAAI,IAAI,QAAQ,YAAY;AACxC,QAAO;EACL,aAAa,QAAQ;EACrB,MAAM,QAAQ,SAAS,SAAS,IAAI,MAAM,GAAG,IAAI;EACjD,aAAa,QAAQ,eAAe;GAAE,MAAM;GAAQ,UAAU;GAAQ;EACtE,OAAO,QAAQ,SAAS;EACzB;;;;;;;;;;;;;;;;AAiBH,SAAgB,oBACd,IACA,SACM;CACN,MAAM,SAAS,qBAAqB,QAAQ;AAE5C,IAAG,QAAQ,EACT,WAAW;AACT,SAAO;GACL,aAAa,OAAO;GACpB,MAAM,OAAO;GACd;IAEJ,CAAC;;;;;;;;;;;;;;;;;;AAmBJ,SAAgB,iBAAiB,QAA8B;AAC7D,WAAU,OAAO;AACjB,aAAY,OAAO;AACnB,cAAa,OAAO"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/tests/home.ts
|
|
2
|
+
function homeTests(config) {
|
|
3
|
+
describe("home", () => {
|
|
4
|
+
beforeEach(() => {
|
|
5
|
+
cy.visit(config.registryUrl);
|
|
6
|
+
cy.get("body").should("be.visible");
|
|
7
|
+
});
|
|
8
|
+
afterEach(() => {
|
|
9
|
+
cy.wait(2e3);
|
|
10
|
+
});
|
|
11
|
+
it("title should be correct", () => {
|
|
12
|
+
cy.location("pathname").should("include", "/");
|
|
13
|
+
cy.title().should("eq", config.title);
|
|
14
|
+
});
|
|
15
|
+
it("should match title with no packages published", () => {
|
|
16
|
+
cy.getByTestId("help-card", { timeout: 1e4 }).should("be.visible");
|
|
17
|
+
cy.getByTestId("help-card").contains("No Package Published Yet.");
|
|
18
|
+
});
|
|
19
|
+
it("should display instructions on help card", () => {
|
|
20
|
+
cy.getByTestId("help-card", { timeout: 1e4 }).should("be.visible");
|
|
21
|
+
cy.getByTestId("help-card").contains(`npm adduser --registry ${config.registryUrl}`);
|
|
22
|
+
cy.getByTestId("help-card").contains(`npm publish --registry ${config.registryUrl}`);
|
|
23
|
+
});
|
|
24
|
+
it("should go to 404 page", () => {
|
|
25
|
+
cy.visit(`${config.registryUrl}/-/web/detail/@verdaccio/not-found`);
|
|
26
|
+
cy.getByTestId("404", { timeout: 1e4 }).should("be.visible");
|
|
27
|
+
cy.getByTestId("404").contains("Sorry, we couldn't find it.");
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { homeTests };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=home.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"home.js","names":[],"sources":["../../../src/tests/home.ts"],"sourcesContent":["/// <reference types=\"cypress\" />\n\nimport { RegistryConfig } from '../types';\n\nexport function homeTests(config: RegistryConfig) {\n describe('home', () => {\n beforeEach(() => {\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 match title with no packages published', () => {\n cy.getByTestId('help-card', { timeout: 10000 }).should('be.visible');\n cy.getByTestId('help-card').contains('No Package Published Yet.');\n });\n\n it('should display instructions on help card', () => {\n cy.getByTestId('help-card', { timeout: 10000 }).should('be.visible');\n cy.getByTestId('help-card').contains(\n `npm adduser --registry ${config.registryUrl}`\n );\n cy.getByTestId('help-card').contains(\n `npm publish --registry ${config.registryUrl}`\n );\n });\n\n it('should go to 404 page', () => {\n cy.visit(`${config.registryUrl}/-/web/detail/@verdaccio/not-found`);\n cy.getByTestId('404', { timeout: 10000 }).should('be.visible');\n cy.getByTestId('404').contains(\"Sorry, we couldn't find it.\");\n });\n });\n}\n"],"mappings":";AAIA,SAAgB,UAAU,QAAwB;AAChD,UAAS,cAAc;AACrB,mBAAiB;AACf,MAAG,MAAM,OAAO,YAAY;AAE5B,MAAG,IAAI,OAAO,CAAC,OAAO,aAAa;IACnC;AAEF,kBAAgB;AACd,MAAG,KAAK,IAAK;IACb;AAEF,KAAG,iCAAiC;AAClC,MAAG,SAAS,WAAW,CAAC,OAAO,WAAW,IAAI;AAC9C,MAAG,OAAO,CAAC,OAAO,MAAM,OAAO,MAAM;IACrC;AAEF,KAAG,uDAAuD;AACxD,MAAG,YAAY,aAAa,EAAE,SAAS,KAAO,CAAC,CAAC,OAAO,aAAa;AACpE,MAAG,YAAY,YAAY,CAAC,SAAS,4BAA4B;IACjE;AAEF,KAAG,kDAAkD;AACnD,MAAG,YAAY,aAAa,EAAE,SAAS,KAAO,CAAC,CAAC,OAAO,aAAa;AACpE,MAAG,YAAY,YAAY,CAAC,SAC1B,0BAA0B,OAAO,cAClC;AACD,MAAG,YAAY,YAAY,CAAC,SAC1B,0BAA0B,OAAO,cAClC;IACD;AAEF,KAAG,+BAA+B;AAChC,MAAG,MAAM,GAAG,OAAO,YAAY,oCAAoC;AACnE,MAAG,YAAY,OAAO,EAAE,SAAS,KAAO,CAAC,CAAC,OAAO,aAAa;AAC9D,MAAG,YAAY,MAAM,CAAC,SAAS,8BAA8B;IAC7D;GACF"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
//#region src/tests/publish.ts
|
|
2
|
+
function publishTests(config) {
|
|
3
|
+
describe("publish", () => {
|
|
4
|
+
const pkgName = "@verdaccio/pkg-scoped";
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
cy.intercept("POST", "/-/verdaccio/sec/login").as("sign");
|
|
7
|
+
cy.intercept("GET", "/-/verdaccio/data/packages").as("pkgs");
|
|
8
|
+
cy.intercept("GET", `/-/verdaccio/data/sidebar/${pkgName}`).as("sidebar");
|
|
9
|
+
cy.intercept("GET", `/-/verdaccio/data/package/readme/${pkgName}`).as("readme");
|
|
10
|
+
cy.task("publishScoped", { pkgName });
|
|
11
|
+
});
|
|
12
|
+
it("should have one published package", () => {
|
|
13
|
+
cy.visit(config.registryUrl);
|
|
14
|
+
cy.login(config.credentials.user, config.credentials.password);
|
|
15
|
+
cy.wait("@sign");
|
|
16
|
+
});
|
|
17
|
+
it("should navigate to page detail", () => {
|
|
18
|
+
cy.visit(config.registryUrl);
|
|
19
|
+
cy.login(config.credentials.user, config.credentials.password);
|
|
20
|
+
cy.wait("@sign");
|
|
21
|
+
cy.wait("@pkgs");
|
|
22
|
+
cy.wait(300);
|
|
23
|
+
cy.getByTestId("package-title").first().click();
|
|
24
|
+
});
|
|
25
|
+
it("should have readme content", () => {
|
|
26
|
+
cy.visit(config.registryUrl);
|
|
27
|
+
cy.login(config.credentials.user, config.credentials.password);
|
|
28
|
+
cy.wait("@sign");
|
|
29
|
+
cy.wait("@pkgs");
|
|
30
|
+
cy.getByTestId("package-title").first().click();
|
|
31
|
+
cy.wait("@readme");
|
|
32
|
+
cy.wait("@sidebar");
|
|
33
|
+
cy.get(".markdown-body").should("have.length", 1);
|
|
34
|
+
cy.contains(".markdown-body", /test/);
|
|
35
|
+
});
|
|
36
|
+
it("should click on dependencies tab", () => {
|
|
37
|
+
cy.visit(config.registryUrl);
|
|
38
|
+
cy.login(config.credentials.user, config.credentials.password);
|
|
39
|
+
cy.wait("@sign");
|
|
40
|
+
cy.wait("@pkgs");
|
|
41
|
+
cy.wait(300);
|
|
42
|
+
cy.getByTestId("package-title").first().click();
|
|
43
|
+
cy.wait("@readme");
|
|
44
|
+
cy.wait("@sidebar");
|
|
45
|
+
cy.getByTestId("dependencies-tab").click();
|
|
46
|
+
cy.wait(100);
|
|
47
|
+
cy.getByTestId("dependencies").should("have.length", 1);
|
|
48
|
+
cy.getByTestId("verdaccio").children().invoke("text").should("match", /verdaccio/);
|
|
49
|
+
});
|
|
50
|
+
it("should click on versions tab", () => {
|
|
51
|
+
cy.visit(config.registryUrl);
|
|
52
|
+
cy.login(config.credentials.user, config.credentials.password);
|
|
53
|
+
cy.wait("@sign");
|
|
54
|
+
cy.wait("@pkgs");
|
|
55
|
+
cy.wait(300);
|
|
56
|
+
cy.getByTestId("package-title").first().click();
|
|
57
|
+
cy.wait("@readme");
|
|
58
|
+
cy.wait("@sidebar");
|
|
59
|
+
cy.getByTestId("versions-tab").click();
|
|
60
|
+
cy.getByTestId("tag-latest").children().invoke("text").should("match", /1.0.6/);
|
|
61
|
+
});
|
|
62
|
+
it("should click on uplinks tab", () => {
|
|
63
|
+
cy.visit(config.registryUrl);
|
|
64
|
+
cy.login(config.credentials.user, config.credentials.password);
|
|
65
|
+
cy.wait("@sign");
|
|
66
|
+
cy.wait("@pkgs");
|
|
67
|
+
cy.wait(300);
|
|
68
|
+
cy.getByTestId("package-title").first().click();
|
|
69
|
+
cy.wait("@readme");
|
|
70
|
+
cy.wait("@sidebar");
|
|
71
|
+
cy.getByTestId("uplinks-tab").click();
|
|
72
|
+
cy.getByTestId("no-uplinks").should("be.visible");
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
export { publishTests };
|
|
78
|
+
|
|
79
|
+
//# sourceMappingURL=publish.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish.js","names":[],"sources":["../../../src/tests/publish.ts"],"sourcesContent":["/// <reference types=\"cypress\" />\n\nimport { RegistryConfig } from '../types';\n\nexport function publishTests(config: RegistryConfig) {\n describe('publish', () => {\n const pkgName = '@verdaccio/pkg-scoped';\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 cy.task('publishScoped', { pkgName });\n });\n\n it('should have one published package', () => {\n cy.visit(config.registryUrl);\n cy.login(config.credentials.user, config.credentials.password);\n cy.wait('@sign');\n });\n\n it('should navigate to page detail', () => {\n cy.visit(config.registryUrl);\n cy.login(config.credentials.user, config.credentials.password);\n cy.wait('@sign');\n cy.wait('@pkgs');\n cy.wait(300);\n cy.getByTestId('package-title').first().click();\n });\n\n it('should have readme content', () => {\n cy.visit(config.registryUrl);\n cy.login(config.credentials.user, config.credentials.password);\n cy.wait('@sign');\n cy.wait('@pkgs');\n cy.getByTestId('package-title').first().click();\n cy.wait('@readme');\n cy.wait('@sidebar');\n cy.get('.markdown-body').should('have.length', 1);\n cy.contains('.markdown-body', /test/);\n });\n\n it('should click on dependencies tab', () => {\n cy.visit(config.registryUrl);\n cy.login(config.credentials.user, config.credentials.password);\n cy.wait('@sign');\n cy.wait('@pkgs');\n cy.wait(300);\n cy.getByTestId('package-title').first().click();\n cy.wait('@readme');\n cy.wait('@sidebar');\n cy.getByTestId('dependencies-tab').click();\n cy.wait(100);\n cy.getByTestId('dependencies').should('have.length', 1);\n cy.getByTestId('verdaccio')\n .children()\n .invoke('text')\n .should('match', /verdaccio/);\n });\n\n it('should click on versions tab', () => {\n cy.visit(config.registryUrl);\n cy.login(config.credentials.user, config.credentials.password);\n cy.wait('@sign');\n cy.wait('@pkgs');\n cy.wait(300);\n cy.getByTestId('package-title').first().click();\n cy.wait('@readme');\n cy.wait('@sidebar');\n cy.getByTestId('versions-tab').click();\n cy.getByTestId('tag-latest')\n .children()\n .invoke('text')\n .should('match', /1.0.6/);\n });\n\n it('should click on uplinks tab', () => {\n cy.visit(config.registryUrl);\n cy.login(config.credentials.user, config.credentials.password);\n cy.wait('@sign');\n cy.wait('@pkgs');\n cy.wait(300);\n cy.getByTestId('package-title').first().click();\n cy.wait('@readme');\n cy.wait('@sidebar');\n cy.getByTestId('uplinks-tab').click();\n cy.getByTestId('no-uplinks').should('be.visible');\n });\n });\n}\n"],"mappings":";AAIA,SAAgB,aAAa,QAAwB;AACnD,UAAS,iBAAiB;EACxB,MAAM,UAAU;AAEhB,mBAAiB;AACf,MAAG,UAAU,QAAQ,yBAAyB,CAAC,GAAG,OAAO;AACzD,MAAG,UAAU,OAAO,6BAA6B,CAAC,GAAG,OAAO;AAC5D,MAAG,UAAU,OAAO,6BAA6B,UAAU,CAAC,GAAG,UAAU;AACzE,MAAG,UAAU,OAAO,oCAAoC,UAAU,CAAC,GAAG,SAAS;AAC/E,MAAG,KAAK,iBAAiB,EAAE,SAAS,CAAC;IACrC;AAEF,KAAG,2CAA2C;AAC5C,MAAG,MAAM,OAAO,YAAY;AAC5B,MAAG,MAAM,OAAO,YAAY,MAAM,OAAO,YAAY,SAAS;AAC9D,MAAG,KAAK,QAAQ;IAChB;AAEF,KAAG,wCAAwC;AACzC,MAAG,MAAM,OAAO,YAAY;AAC5B,MAAG,MAAM,OAAO,YAAY,MAAM,OAAO,YAAY,SAAS;AAC9D,MAAG,KAAK,QAAQ;AAChB,MAAG,KAAK,QAAQ;AAChB,MAAG,KAAK,IAAI;AACZ,MAAG,YAAY,gBAAgB,CAAC,OAAO,CAAC,OAAO;IAC/C;AAEF,KAAG,oCAAoC;AACrC,MAAG,MAAM,OAAO,YAAY;AAC5B,MAAG,MAAM,OAAO,YAAY,MAAM,OAAO,YAAY,SAAS;AAC9D,MAAG,KAAK,QAAQ;AAChB,MAAG,KAAK,QAAQ;AAChB,MAAG,YAAY,gBAAgB,CAAC,OAAO,CAAC,OAAO;AAC/C,MAAG,KAAK,UAAU;AAClB,MAAG,KAAK,WAAW;AACnB,MAAG,IAAI,iBAAiB,CAAC,OAAO,eAAe,EAAE;AACjD,MAAG,SAAS,kBAAkB,OAAO;IACrC;AAEF,KAAG,0CAA0C;AAC3C,MAAG,MAAM,OAAO,YAAY;AAC5B,MAAG,MAAM,OAAO,YAAY,MAAM,OAAO,YAAY,SAAS;AAC9D,MAAG,KAAK,QAAQ;AAChB,MAAG,KAAK,QAAQ;AAChB,MAAG,KAAK,IAAI;AACZ,MAAG,YAAY,gBAAgB,CAAC,OAAO,CAAC,OAAO;AAC/C,MAAG,KAAK,UAAU;AAClB,MAAG,KAAK,WAAW;AACnB,MAAG,YAAY,mBAAmB,CAAC,OAAO;AAC1C,MAAG,KAAK,IAAI;AACZ,MAAG,YAAY,eAAe,CAAC,OAAO,eAAe,EAAE;AACvD,MAAG,YAAY,YAAY,CACxB,UAAU,CACV,OAAO,OAAO,CACd,OAAO,SAAS,YAAY;IAC/B;AAEF,KAAG,sCAAsC;AACvC,MAAG,MAAM,OAAO,YAAY;AAC5B,MAAG,MAAM,OAAO,YAAY,MAAM,OAAO,YAAY,SAAS;AAC9D,MAAG,KAAK,QAAQ;AAChB,MAAG,KAAK,QAAQ;AAChB,MAAG,KAAK,IAAI;AACZ,MAAG,YAAY,gBAAgB,CAAC,OAAO,CAAC,OAAO;AAC/C,MAAG,KAAK,UAAU;AAClB,MAAG,KAAK,WAAW;AACnB,MAAG,YAAY,eAAe,CAAC,OAAO;AACtC,MAAG,YAAY,aAAa,CACzB,UAAU,CACV,OAAO,OAAO,CACd,OAAO,SAAS,QAAQ;IAC3B;AAEF,KAAG,qCAAqC;AACtC,MAAG,MAAM,OAAO,YAAY;AAC5B,MAAG,MAAM,OAAO,YAAY,MAAM,OAAO,YAAY,SAAS;AAC9D,MAAG,KAAK,QAAQ;AAChB,MAAG,KAAK,QAAQ;AAChB,MAAG,KAAK,IAAI;AACZ,MAAG,YAAY,gBAAgB,CAAC,OAAO,CAAC,OAAO;AAC/C,MAAG,KAAK,UAAU;AAClB,MAAG,KAAK,WAAW;AACnB,MAAG,YAAY,cAAc,CAAC,OAAO;AACrC,MAAG,YAAY,aAAa,CAAC,OAAO,aAAa;IACjD;GACF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/tests/signin.ts
|
|
2
|
+
function signinTests(config) {
|
|
3
|
+
describe("sign in / sign out", () => {
|
|
4
|
+
beforeEach(() => {
|
|
5
|
+
cy.intercept("POST", "/-/verdaccio/sec/login").as("sign");
|
|
6
|
+
});
|
|
7
|
+
it("should login user", () => {
|
|
8
|
+
cy.visit(config.registryUrl);
|
|
9
|
+
cy.login(config.credentials.user, config.credentials.password);
|
|
10
|
+
cy.wait("@sign");
|
|
11
|
+
cy.getByTestId("logInDialogIcon").click();
|
|
12
|
+
cy.wait(100);
|
|
13
|
+
cy.getByTestId("greetings-label").contains(config.credentials.user);
|
|
14
|
+
});
|
|
15
|
+
it("should logout a user", () => {
|
|
16
|
+
cy.visit(config.registryUrl);
|
|
17
|
+
cy.login(config.credentials.user, config.credentials.password);
|
|
18
|
+
cy.wait("@sign");
|
|
19
|
+
cy.getByTestId("logInDialogIcon").click();
|
|
20
|
+
cy.wait(100);
|
|
21
|
+
cy.getByTestId("logOutDialogIcon").click();
|
|
22
|
+
cy.wait(200);
|
|
23
|
+
cy.getByTestId("header--button-login").contains("Login");
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { signinTests };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=signin.js.map
|
|
@@ -0,0 +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 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 cy.wait('@sign');\n cy.getByTestId('logInDialogIcon').click();\n cy.wait(100);\n cy.getByTestId('greetings-label').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 cy.wait('@sign');\n cy.getByTestId('logInDialogIcon').click();\n cy.wait(100);\n cy.getByTestId('logOutDialogIcon').click();\n cy.wait(200);\n cy.getByTestId('header--button-login').contains('Login');\n });\n });\n}\n"],"mappings":";AAIA,SAAgB,YAAY,QAAwB;AAClD,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,SAAS;AAC9D,MAAG,KAAK,QAAQ;AAChB,MAAG,YAAY,kBAAkB,CAAC,OAAO;AACzC,MAAG,KAAK,IAAI;AACZ,MAAG,YAAY,kBAAkB,CAAC,SAAS,OAAO,YAAY,KAAK;IACnE;AAEF,KAAG,8BAA8B;AAC/B,MAAG,MAAM,OAAO,YAAY;AAC5B,MAAG,MAAM,OAAO,YAAY,MAAM,OAAO,YAAY,SAAS;AAC9D,MAAG,KAAK,QAAQ;AAChB,MAAG,YAAY,kBAAkB,CAAC,OAAO;AACzC,MAAG,KAAK,IAAI;AACZ,MAAG,YAAY,mBAAmB,CAAC,OAAO;AAC1C,MAAG,KAAK,IAAI;AACZ,MAAG,YAAY,uBAAuB,CAAC,SAAS,QAAQ;IACxD;GACF"}
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/// <reference types="cypress" />
|
|
2
|
+
import { RegistryConfig, VerdaccioUiOptions } from './types';
|
|
3
|
+
export type { RegistryConfig, VerdaccioUiOptions } from './types';
|
|
4
|
+
export { homeTests, signinTests, publishTests } from './tests';
|
|
5
|
+
/**
|
|
6
|
+
* Build a full RegistryConfig from user-provided options with defaults.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createRegistryConfig(options: VerdaccioUiOptions): RegistryConfig;
|
|
9
|
+
/**
|
|
10
|
+
* Register Verdaccio Cypress tasks in setupNodeEvents.
|
|
11
|
+
*
|
|
12
|
+
* Usage in cypress.config.ts:
|
|
13
|
+
* import { setupVerdaccioTasks } from '@verdaccio/e2e-ui';
|
|
14
|
+
*
|
|
15
|
+
* export default defineConfig({
|
|
16
|
+
* e2e: {
|
|
17
|
+
* setupNodeEvents(on) {
|
|
18
|
+
* setupVerdaccioTasks(on, { registryUrl: 'http://localhost:4873' });
|
|
19
|
+
* },
|
|
20
|
+
* },
|
|
21
|
+
* });
|
|
22
|
+
*/
|
|
23
|
+
export declare function setupVerdaccioTasks(on: Cypress.PluginEvents, options: VerdaccioUiOptions): void;
|
|
24
|
+
/**
|
|
25
|
+
* Register all Verdaccio UI tests.
|
|
26
|
+
*
|
|
27
|
+
* Usage in a spec file:
|
|
28
|
+
* import { registerAllTests, createRegistryConfig } from '@verdaccio/e2e-ui';
|
|
29
|
+
*
|
|
30
|
+
* const config = createRegistryConfig({ registryUrl: 'http://localhost:4873' });
|
|
31
|
+
* registerAllTests(config);
|
|
32
|
+
*
|
|
33
|
+
* Or pick individual suites:
|
|
34
|
+
* import { homeTests, signinTests } from '@verdaccio/e2e-ui';
|
|
35
|
+
*
|
|
36
|
+
* const config = createRegistryConfig({ registryUrl: 'http://localhost:4873' });
|
|
37
|
+
* homeTests(config);
|
|
38
|
+
* signinTests(config);
|
|
39
|
+
*/
|
|
40
|
+
export declare function registerAllTests(config: RegistryConfig): void;
|
package/build/types.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type RegistryConfig = {
|
|
2
|
+
registryUrl: string;
|
|
3
|
+
port: number;
|
|
4
|
+
credentials: {
|
|
5
|
+
user: string;
|
|
6
|
+
password: string;
|
|
7
|
+
};
|
|
8
|
+
title: string;
|
|
9
|
+
};
|
|
10
|
+
export type VerdaccioUiOptions = {
|
|
11
|
+
registryUrl: string;
|
|
12
|
+
port?: number;
|
|
13
|
+
credentials?: {
|
|
14
|
+
user: string;
|
|
15
|
+
password: string;
|
|
16
|
+
};
|
|
17
|
+
title?: string;
|
|
18
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdaccio/e2e-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Cypress plugin for Verdaccio UI e2e tests — run against any registry",
|
|
@@ -12,15 +12,18 @@
|
|
|
12
12
|
"files": [
|
|
13
13
|
"build"
|
|
14
14
|
],
|
|
15
|
-
"main": "./build/index.
|
|
15
|
+
"main": "./build/cjs/index.cjs",
|
|
16
|
+
"module": "./build/esm/index.js",
|
|
16
17
|
"types": "./build/index.d.ts",
|
|
17
18
|
"exports": {
|
|
18
19
|
".": {
|
|
19
|
-
"import": "./build/index.js",
|
|
20
|
+
"import": "./build/esm/index.js",
|
|
21
|
+
"require": "./build/cjs/index.cjs",
|
|
20
22
|
"types": "./build/index.d.ts"
|
|
21
23
|
},
|
|
22
24
|
"./commands": {
|
|
23
|
-
"import": "./build/commands/index.js",
|
|
25
|
+
"import": "./build/esm/commands/index.js",
|
|
26
|
+
"require": "./build/cjs/commands/index.cjs",
|
|
24
27
|
"types": "./build/commands/index.d.ts"
|
|
25
28
|
}
|
|
26
29
|
},
|