@futdevpro/fdp-e2e-helpers 1.15.18 → 1.15.21
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/_collections/fdp-api-e2e.util.d.ts +57 -0
- package/build/_collections/fdp-api-e2e.util.js +85 -0
- package/build/_collections/fdp-browser-e2e.util.d.ts +24 -0
- package/build/_collections/fdp-browser-e2e.util.js +36 -0
- package/build/index.d.ts +2 -0
- package/build/index.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { defineConfig } from '@playwright/test';
|
|
2
|
+
/**
|
|
3
|
+
* `fdp-api-e2e.util` — **közös API-E2E helperek** a backend microservice-ek (auth, ftp, …) Playwright
|
|
4
|
+
* API-tesztjeihez (böngésző NÉLKÜL, a `request` fixture-rel).
|
|
5
|
+
*
|
|
6
|
+
* Cél: a per-rendszer e2e-scaffold (playwright.config + global-setup + server-status spec) NE duplikálódjon —
|
|
7
|
+
* minden microservice innen örökli. Használat egy fogyasztóban:
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* // playwright.config.ts
|
|
11
|
+
* export default FDP_createApiE2EConfig({
|
|
12
|
+
* serverBaseURL: process.env.E2E_SERVER_URL || 'http://localhost:48005',
|
|
13
|
+
* globalSetup: require.resolve('./src/_shared/_fixtures/e2e-global-setup'),
|
|
14
|
+
* });
|
|
15
|
+
*
|
|
16
|
+
* // src/_shared/_fixtures/e2e-global-setup.ts
|
|
17
|
+
* import { FDP_apiHealthCheck } from '@futdevpro/fdp-e2e-helpers';
|
|
18
|
+
* export default async () => FDP_apiHealthCheck(process.env.E2E_SERVER_URL || 'http://localhost:48005', 'auth');
|
|
19
|
+
*
|
|
20
|
+
* // src/_modules/server-status/server-status.spec.ts
|
|
21
|
+
* import { FDP_buildServerStatusE2E } from '@futdevpro/fdp-e2e-helpers';
|
|
22
|
+
* FDP_buildServerStatusE2E({ issuerSystem: 'auth' });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
/** A `FDP_createApiE2EConfig` opciói. */
|
|
26
|
+
export interface FDP_ApiE2EConfig_Options {
|
|
27
|
+
/** A cél szerver base-URL-je (lokál vagy test-env, jellemzően `process.env.E2E_SERVER_URL` fallback-kel). */
|
|
28
|
+
serverBaseURL: string;
|
|
29
|
+
/** A spec-ek könyvtára. Default: `./src/_modules`. */
|
|
30
|
+
testDir?: string;
|
|
31
|
+
/** A global-setup modul-útja (`require.resolve(...)`). Opcionális (jellemzően a health-check). */
|
|
32
|
+
globalSetup?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Egységes Playwright **API-E2E** config (böngésző nélkül, JSON-Accept, önaláírt-cert-toleráns).
|
|
36
|
+
* @description a fogyasztó `export default FDP_createApiE2EConfig({...})`-tal használja
|
|
37
|
+
*/
|
|
38
|
+
export declare function FDP_createApiE2EConfig(opts: FDP_ApiE2EConfig_Options): ReturnType<typeof defineConfig>;
|
|
39
|
+
/**
|
|
40
|
+
* Soft API-health-check global-setupnak (NEM fatális): a `/api/server/status`-t hiteli, és jelzi ha a
|
|
41
|
+
* szerver nem érhető el, de nem dobja el a futást.
|
|
42
|
+
* @description a fogyasztó global-setupja: `export default () => FDP_apiHealthCheck(url, 'auth')`
|
|
43
|
+
*/
|
|
44
|
+
export declare function FDP_apiHealthCheck(serverBaseURL: string, systemName?: string): Promise<void>;
|
|
45
|
+
/** A `FDP_buildServerStatusE2E` opciói. */
|
|
46
|
+
export interface FDP_ServerStatusE2E_Options {
|
|
47
|
+
/** A rendszer azonosítója, amit a status-body issuer-jelzésében ellenőrzünk (pl. `'auth'`, `'ftp'`). */
|
|
48
|
+
issuerSystem: string;
|
|
49
|
+
/** A status-endpoint útja. Default: `/api/server/status`. */
|
|
50
|
+
statusPath?: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Beregisztrálja a **standard server-status API-E2E** teszteket (status 200 + issuer-system cross-wiring-check
|
|
54
|
+
* + unknown-route graceful). A fogyasztó spec-je: `FDP_buildServerStatusE2E({ issuerSystem: 'auth' })`.
|
|
55
|
+
*/
|
|
56
|
+
export declare function FDP_buildServerStatusE2E(opts: FDP_ServerStatusE2E_Options): void;
|
|
57
|
+
//# sourceMappingURL=fdp-api-e2e.util.d.ts.map
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FDP_createApiE2EConfig = FDP_createApiE2EConfig;
|
|
4
|
+
exports.FDP_apiHealthCheck = FDP_apiHealthCheck;
|
|
5
|
+
exports.FDP_buildServerStatusE2E = FDP_buildServerStatusE2E;
|
|
6
|
+
const test_1 = require("@playwright/test");
|
|
7
|
+
/**
|
|
8
|
+
* Egységes Playwright **API-E2E** config (böngésző nélkül, JSON-Accept, önaláírt-cert-toleráns).
|
|
9
|
+
* @description a fogyasztó `export default FDP_createApiE2EConfig({...})`-tal használja
|
|
10
|
+
*/
|
|
11
|
+
function FDP_createApiE2EConfig(opts) {
|
|
12
|
+
return (0, test_1.defineConfig)({
|
|
13
|
+
testDir: opts.testDir ?? './src/_modules',
|
|
14
|
+
timeout: 60_000,
|
|
15
|
+
expect: { timeout: 10_000 },
|
|
16
|
+
fullyParallel: false,
|
|
17
|
+
forbidOnly: Boolean(process.env.CI),
|
|
18
|
+
retries: 0,
|
|
19
|
+
workers: 1,
|
|
20
|
+
reporter: [
|
|
21
|
+
['json', { outputFile: 'test-results/results.json' }],
|
|
22
|
+
['list'],
|
|
23
|
+
],
|
|
24
|
+
globalSetup: opts.globalSetup,
|
|
25
|
+
use: {
|
|
26
|
+
baseURL: opts.serverBaseURL,
|
|
27
|
+
ignoreHTTPSErrors: true,
|
|
28
|
+
extraHTTPHeaders: { 'Accept': 'application/json' },
|
|
29
|
+
},
|
|
30
|
+
projects: [
|
|
31
|
+
{ name: 'api', use: { baseURL: opts.serverBaseURL } },
|
|
32
|
+
],
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Soft API-health-check global-setupnak (NEM fatális): a `/api/server/status`-t hiteli, és jelzi ha a
|
|
37
|
+
* szerver nem érhető el, de nem dobja el a futást.
|
|
38
|
+
* @description a fogyasztó global-setupja: `export default () => FDP_apiHealthCheck(url, 'auth')`
|
|
39
|
+
*/
|
|
40
|
+
async function FDP_apiHealthCheck(serverBaseURL, systemName = 'service') {
|
|
41
|
+
const statusUrl = `${serverBaseURL.replace(/\/+$/, '')}/api/server/status`;
|
|
42
|
+
try {
|
|
43
|
+
const response = await fetch(statusUrl, {
|
|
44
|
+
method: 'GET',
|
|
45
|
+
signal: AbortSignal.timeout(8000),
|
|
46
|
+
});
|
|
47
|
+
if (!response.ok) {
|
|
48
|
+
console.warn(`[E2E] ${systemName} status non-OK (${response.status}) @ ${statusUrl}`);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
console.log(`[E2E] Global setup OK — ${systemName} reachable @ ${serverBaseURL}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
console.warn(`[E2E] ${systemName} nem elérhető (${statusUrl}): ${error.message}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Beregisztrálja a **standard server-status API-E2E** teszteket (status 200 + issuer-system cross-wiring-check
|
|
60
|
+
* + unknown-route graceful). A fogyasztó spec-je: `FDP_buildServerStatusE2E({ issuerSystem: 'auth' })`.
|
|
61
|
+
*/
|
|
62
|
+
function FDP_buildServerStatusE2E(opts) {
|
|
63
|
+
const statusPath = opts.statusPath ?? '/api/server/status';
|
|
64
|
+
test_1.test.describe(`API — server-status / routing (${opts.issuerSystem})`, () => {
|
|
65
|
+
(0, test_1.test)(`GET ${statusPath} → 200 + JSON body`, async ({ request }) => {
|
|
66
|
+
const response = await request.get(statusPath);
|
|
67
|
+
(0, test_1.expect)(response.status(), 'a status-endpoint elérhető és 200-at ad').toBe(200);
|
|
68
|
+
const body = await response.json();
|
|
69
|
+
(0, test_1.expect)(body, 'a status JSON-body nem üres').toBeTruthy();
|
|
70
|
+
});
|
|
71
|
+
(0, test_1.test)(`a status a(z) "${opts.issuerSystem}" issuer-system-et jelzi (nincs cross-wiring)`, async ({ request }) => {
|
|
72
|
+
const response = await request.get(statusPath);
|
|
73
|
+
(0, test_1.expect)(response.status()).toBe(200);
|
|
74
|
+
const body = await response.json();
|
|
75
|
+
const serialized = JSON.stringify(body).toLowerCase();
|
|
76
|
+
(0, test_1.expect)(serialized, `a status-body issuer-jelzése: ${serialized.slice(0, 200)}`)
|
|
77
|
+
.toContain(opts.issuerSystem.toLowerCase());
|
|
78
|
+
});
|
|
79
|
+
(0, test_1.test)('ismeretlen API-route → nem 500 (graceful)', async ({ request }) => {
|
|
80
|
+
const response = await request.get('/api/__fdp_nonexistent_route_xyz_12345');
|
|
81
|
+
(0, test_1.expect)(response.status(), `ismeretlen route status: ${response.status()}`).toBeLessThan(500);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=fdp-api-e2e.util.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `fdp-browser-e2e.util` — **közös böngésző-E2E helperek** a frontendes rendszerek (master-prompter, futdevpro,
|
|
3
|
+
* token-service, …) Playwright page-tesztjeihez. Cél: a visszatérő smoke-minták NE duplikálódjanak rendszerenként.
|
|
4
|
+
*
|
|
5
|
+
* Használat egy fogyasztó spec-ben:
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { FDP_buildAuthFormsE2E } from '@futdevpro/fdp-e2e-helpers';
|
|
8
|
+
* FDP_buildAuthFormsE2E({ loginRoute: '/landing/login', registerRoute: '/landing/register' });
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
/** A `FDP_buildAuthFormsE2E` opciói. */
|
|
12
|
+
export interface FDP_AuthFormsE2E_Options {
|
|
13
|
+
/** A login-oldal route-ja (pl. `/landing/login`). */
|
|
14
|
+
loginRoute: string;
|
|
15
|
+
/** A register-oldal route-ja (pl. `/landing/register`). */
|
|
16
|
+
registerRoute: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Beregisztrálja a **standard auth-UI form-struktúra** smoke-okat (no-auth, no-spend): a login + register oldal
|
|
20
|
+
* renderel jelszó-mezőt + submit-gombot, a login-on van email/text input. Egy törött login-form = launch-blokkoló,
|
|
21
|
+
* ezért érdemes E2E-vel őrizni. A fogyasztó: `FDP_buildAuthFormsE2E({ loginRoute, registerRoute })`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function FDP_buildAuthFormsE2E(opts: FDP_AuthFormsE2E_Options): void;
|
|
24
|
+
//# sourceMappingURL=fdp-browser-e2e.util.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FDP_buildAuthFormsE2E = FDP_buildAuthFormsE2E;
|
|
4
|
+
const test_1 = require("@playwright/test");
|
|
5
|
+
/**
|
|
6
|
+
* Beregisztrálja a **standard auth-UI form-struktúra** smoke-okat (no-auth, no-spend): a login + register oldal
|
|
7
|
+
* renderel jelszó-mezőt + submit-gombot, a login-on van email/text input. Egy törött login-form = launch-blokkoló,
|
|
8
|
+
* ezért érdemes E2E-vel őrizni. A fogyasztó: `FDP_buildAuthFormsE2E({ loginRoute, registerRoute })`.
|
|
9
|
+
*/
|
|
10
|
+
function FDP_buildAuthFormsE2E(opts) {
|
|
11
|
+
test_1.test.describe('Auth UI — login / register form-struktúra', () => {
|
|
12
|
+
(0, test_1.test)('a login-oldal renderel jelszó-mezőt + submit-gombot', async ({ page }) => {
|
|
13
|
+
await page.goto(opts.loginRoute);
|
|
14
|
+
await page.waitForLoadState('networkidle');
|
|
15
|
+
const passwordField = page.locator('input[type="password"]');
|
|
16
|
+
await (0, test_1.expect)(passwordField.first(), 'a login-formon van jelszó-mező').toBeVisible({ timeout: 10_000 });
|
|
17
|
+
const submitish = page.locator('button, input[type="submit"]');
|
|
18
|
+
(0, test_1.expect)(await submitish.count(), 'a login-oldalon van legalább egy gomb/submit').toBeGreaterThan(0);
|
|
19
|
+
});
|
|
20
|
+
(0, test_1.test)('a register-oldal renderel jelszó-mezőt + submit-gombot', async ({ page }) => {
|
|
21
|
+
await page.goto(opts.registerRoute);
|
|
22
|
+
await page.waitForLoadState('networkidle');
|
|
23
|
+
const passwordField = page.locator('input[type="password"]');
|
|
24
|
+
await (0, test_1.expect)(passwordField.first(), 'a register-formon van jelszó-mező').toBeVisible({ timeout: 10_000 });
|
|
25
|
+
const submitish = page.locator('button, input[type="submit"]');
|
|
26
|
+
(0, test_1.expect)(await submitish.count(), 'a register-oldalon van legalább egy gomb/submit').toBeGreaterThan(0);
|
|
27
|
+
});
|
|
28
|
+
(0, test_1.test)('a login-oldalon van szöveges/email beviteli mező (nem csak jelszó)', async ({ page }) => {
|
|
29
|
+
await page.goto(opts.loginRoute);
|
|
30
|
+
await page.waitForLoadState('networkidle');
|
|
31
|
+
const textInputs = page.locator('input:not([type="password"]):not([type="hidden"]):not([type="checkbox"])');
|
|
32
|
+
await (0, test_1.expect)(textInputs.first(), 'a login-formon van szöveges/email mező').toBeVisible({ timeout: 10_000 });
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=fdp-browser-e2e.util.js.map
|
package/build/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from './_collections/e2e-hard-delete.util';
|
|
2
2
|
export * from './_collections/e2e-unique-generator.util';
|
|
3
3
|
export * from './_collections/fdp-cwv-collector.util';
|
|
4
|
+
export * from './_collections/fdp-api-e2e.util';
|
|
5
|
+
export * from './_collections/fdp-browser-e2e.util';
|
|
4
6
|
export * from './_services/e2e-config.service';
|
|
5
7
|
export * from './_services/e2e-logger.service';
|
|
6
8
|
export * from './_services/e2e-login-helper.service';
|
package/build/index.js
CHANGED
|
@@ -5,6 +5,8 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
tslib_1.__exportStar(require("./_collections/e2e-hard-delete.util"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./_collections/e2e-unique-generator.util"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./_collections/fdp-cwv-collector.util"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./_collections/fdp-api-e2e.util"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./_collections/fdp-browser-e2e.util"), exports);
|
|
8
10
|
// SERVICES
|
|
9
11
|
tslib_1.__exportStar(require("./_services/e2e-config.service"), exports);
|
|
10
12
|
tslib_1.__exportStar(require("./_services/e2e-logger.service"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@futdevpro/fdp-e2e-helpers",
|
|
3
|
-
"version": "01.15.
|
|
3
|
+
"version": "01.15.21",
|
|
4
4
|
"description": "Shared E2E test helpers for FDP-stack apps. First util: E2E_HardDelete_Util. Stateless utility-collection — NOT a framework.",
|
|
5
5
|
"DyBu_settings": {
|
|
6
6
|
"packageType": "shared-package",
|