@playwright-test-runner/core 1.0.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.
package/dist/server.js ADDED
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PlaywrightServer = void 0;
7
+ const express_1 = __importDefault(require("express"));
8
+ const cors_1 = __importDefault(require("cors"));
9
+ const test_runner_1 = require("./test-runner");
10
+ class PlaywrightServer {
11
+ app;
12
+ port;
13
+ testRunner;
14
+ reportProcess = null;
15
+ constructor(options = {}) {
16
+ this.app = (0, express_1.default)();
17
+ this.port = options.port || 3000;
18
+ this.testRunner = new test_runner_1.PlaywrightTestRunner({
19
+ projectRoot: options.projectRoot,
20
+ testsDir: options.testsDir,
21
+ });
22
+ this.setupMiddleware();
23
+ this.setupRoutes();
24
+ }
25
+ setupMiddleware() {
26
+ this.app.use((0, cors_1.default)());
27
+ this.app.use(express_1.default.json());
28
+ }
29
+ setupRoutes() {
30
+ this.app.get('/health', (req, res) => {
31
+ res.json({ status: 'ok', service: 'playwright-test-runner' });
32
+ });
33
+ this.app.get('/tests', async (req, res) => {
34
+ try {
35
+ const files = await this.testRunner.getTestFiles();
36
+ res.json({
37
+ success: true,
38
+ count: files.length,
39
+ files,
40
+ });
41
+ }
42
+ catch (error) {
43
+ res.status(500).json({
44
+ success: false,
45
+ error: error.message,
46
+ });
47
+ }
48
+ });
49
+ this.app.post('/run', async (req, res) => {
50
+ try {
51
+ const options = {
52
+ reporter: req.body.reporter || 'html',
53
+ headed: req.body.headed || false,
54
+ };
55
+ const result = await this.testRunner.runTests(options);
56
+ res.json({
57
+ success: result.success,
58
+ output: result.output,
59
+ error: result.error,
60
+ reportPath: result.reportPath,
61
+ });
62
+ }
63
+ catch (error) {
64
+ res.status(500).json({
65
+ success: false,
66
+ error: error.message,
67
+ });
68
+ }
69
+ });
70
+ this.app.post('/report/show', async (req, res) => {
71
+ try {
72
+ if (this.reportProcess) {
73
+ return res.json({
74
+ success: true,
75
+ message: 'Report già in esecuzione',
76
+ url: 'http://localhost:9323',
77
+ });
78
+ }
79
+ const { url, process } = await this.testRunner.showReport();
80
+ this.reportProcess = process;
81
+ res.json({
82
+ success: true,
83
+ message: 'Report UI avviato',
84
+ url,
85
+ });
86
+ }
87
+ catch (error) {
88
+ res.status(500).json({
89
+ success: false,
90
+ error: error.message,
91
+ });
92
+ }
93
+ });
94
+ this.app.post('/report/stop', (req, res) => {
95
+ if (this.reportProcess) {
96
+ this.reportProcess.kill();
97
+ this.reportProcess = null;
98
+ res.json({
99
+ success: true,
100
+ message: 'Report UI fermato',
101
+ });
102
+ }
103
+ else {
104
+ res.json({
105
+ success: false,
106
+ message: 'Nessun report in esecuzione',
107
+ });
108
+ }
109
+ });
110
+ }
111
+ start() {
112
+ this.app.listen(this.port, () => {
113
+ console.log(`🎭 Playwright Test Runner server in esecuzione su http://localhost:${this.port}`);
114
+ console.log(`\nEndpoint disponibili:`);
115
+ console.log(` GET /health - Health check`);
116
+ console.log(` GET /tests - Lista dei test disponibili`);
117
+ console.log(` POST /run - Esegui i test`);
118
+ console.log(` POST /report/show - Mostra report UI`);
119
+ console.log(` POST /report/stop - Ferma report UI`);
120
+ });
121
+ }
122
+ getApp() {
123
+ return this.app;
124
+ }
125
+ }
126
+ exports.PlaywrightServer = PlaywrightServer;
127
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAqD;AACrD,gDAAwB;AACxB,+CAAwE;AAQxE,MAAa,gBAAgB;IACnB,GAAG,CAAsB;IACzB,IAAI,CAAS;IACb,UAAU,CAAuB;IACjC,aAAa,GAAQ,IAAI,CAAC;IAElC,YAAY,UAAyB,EAAE;QACrC,IAAI,C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YACvD,OAAO,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC;YAC1D,OAAO,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,MAAM;QACX,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;CACF;AA7HD,4CA6HC"}
@@ -0,0 +1,24 @@
1
+ export interface TestRunnerOptions {
2
+ projectRoot?: string;
3
+ testsDir?: string;
4
+ reporter?: 'html' | 'json' | 'line' | 'list';
5
+ headed?: boolean;
6
+ }
7
+ export interface TestResult {
8
+ success: boolean;
9
+ output: string;
10
+ error?: string;
11
+ reportPath?: string;
12
+ }
13
+ export declare class PlaywrightTestRunner {
14
+ private projectRoot;
15
+ private testsDir;
16
+ constructor(options?: TestRunnerOptions);
17
+ getTestFiles(): Promise<string[]>;
18
+ runTests(options?: TestRunnerOptions): Promise<TestResult>;
19
+ showReport(): Promise<{
20
+ url: string;
21
+ process: any;
22
+ }>;
23
+ }
24
+ //# sourceMappingURL=test-runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-runner.d.ts","sourceRoot":"","sources":["../src/test-runner.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,iBAAiB;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAC7C,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,QAAQ,CAAS;gBAEb,OAAO,GAAE,iBAAsB;IAKrC,YAAY,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAuBjC,QAAQ,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,UAAU,CAAC;IAsC9D,UAAU,IAAI,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,GAAG,CAAA;KAAE,CAAC;CA2B3D"}
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.PlaywrightTestRunner = void 0;
37
+ const child_process_1 = require("child_process");
38
+ const util_1 = require("util");
39
+ const path = __importStar(require("path"));
40
+ const fs = __importStar(require("fs/promises"));
41
+ const execAsync = (0, util_1.promisify)(child_process_1.exec);
42
+ class PlaywrightTestRunner {
43
+ projectRoot;
44
+ testsDir;
45
+ constructor(options = {}) {
46
+ this.projectRoot = options.projectRoot || process.cwd();
47
+ this.testsDir = options.testsDir || 'tests';
48
+ }
49
+ async getTestFiles() {
50
+ const testsPath = path.join(this.projectRoot, this.testsDir);
51
+ try {
52
+ const files = await fs.readdir(testsPath, { recursive: true });
53
+ return files
54
+ .filter((file) => file.endsWith('.spec.ts') || file.endsWith('.spec.js'))
55
+ .map((file) => path.join(testsPath, file));
56
+ }
57
+ catch (error) {
58
+ if (error.code === 'ENOENT') {
59
+ throw new Error(`\n❌ Cartella '${this.testsDir}' non trovata!\n\n` +
60
+ `Per utilizzare questa libreria:\n` +
61
+ `1. Crea una cartella '${this.testsDir}' nella root del progetto\n` +
62
+ `2. Aggiungi i tuoi file di test (*.spec.ts o *.spec.js)\n` +
63
+ `3. Riprova il comando\n\n` +
64
+ `Percorso cercato: ${testsPath}\n`);
65
+ }
66
+ throw new Error(`Impossibile leggere la cartella tests: ${testsPath}`);
67
+ }
68
+ }
69
+ async runTests(options = {}) {
70
+ const reporter = options.reporter || 'html';
71
+ const headed = options.headed ? '--headed' : '';
72
+ const testsPath = path.join(this.projectRoot, this.testsDir);
73
+ // Usa il playwright dalla libreria, non dal progetto consumer
74
+ const playwrightBin = path.join(__dirname, '../node_modules/.bin/playwright');
75
+ const command = `${playwrightBin} test ${testsPath} --reporter=${reporter} ${headed}`;
76
+ try {
77
+ const { stdout, stderr } = await execAsync(command, {
78
+ cwd: this.projectRoot,
79
+ maxBuffer: 10 * 1024 * 1024,
80
+ env: {
81
+ ...process.env,
82
+ // Assicurati che usi i moduli della libreria
83
+ NODE_PATH: path.join(__dirname, '../node_modules'),
84
+ },
85
+ });
86
+ const reportPath = reporter === 'html'
87
+ ? path.join(this.projectRoot, 'playwright-report')
88
+ : undefined;
89
+ return {
90
+ success: true,
91
+ output: stdout,
92
+ reportPath,
93
+ };
94
+ }
95
+ catch (error) {
96
+ return {
97
+ success: false,
98
+ output: error.stdout || '',
99
+ error: error.stderr || error.message,
100
+ };
101
+ }
102
+ }
103
+ async showReport() {
104
+ const reportPath = path.join(this.projectRoot, 'playwright-report');
105
+ try {
106
+ await fs.access(reportPath);
107
+ }
108
+ catch {
109
+ throw new Error('Report non trovato. Esegui prima i test con reporter html.');
110
+ }
111
+ return new Promise((resolve, reject) => {
112
+ // Usa il playwright dalla libreria
113
+ const playwrightBin = path.join(__dirname, '../node_modules/.bin/playwright');
114
+ const showProcess = (0, child_process_1.exec)(`${playwrightBin} show-report`, { cwd: this.projectRoot });
115
+ setTimeout(() => {
116
+ resolve({
117
+ url: 'http://localhost:9323',
118
+ process: showProcess,
119
+ });
120
+ }, 2000);
121
+ showProcess.on('error', reject);
122
+ });
123
+ }
124
+ }
125
+ exports.PlaywrightTestRunner = PlaywrightTestRunner;
126
+ //# sourceMappingURL=test-runner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-runner.js","sourceRoot":"","sources":["../src/test-runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAqC;AACrC,+BAAiC;AACjC,2CAA6B;AAC7B,gDAAkC;AAElC,MAAM,SAAS,GAAG,IAAA,gBAAS,EAAC,oBAAI,CAAC,CAAC;AAgBlC,MAAa,oBAAoB;IACvB,WAAW,CAAS;IACpB,QAAQ,CAAS;IAEzB,YAAY,UAA6B,EAAE;QACzC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QACxD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,C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AAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,iCAAiC,CAAC,CAAC;YAC9E,MAAM,WAAW,GAAG,IAAA,oBAAI,EACtB,GAAG,aAAa,cAAc,EAC9B,EAAE,GAAG,EAAE,IAAI,CAAC,WAAW,EAAE,CAC1B,CAAC;YAEF,UAAU,CAAC,GAAG,EAAE;gBACd,OAAO,CAAC;oBACN,GAAG,EAAE,uBAAuB;oBAC5B,OAAO,EAAE,WAAW;iBACrB,CAAC,CAAC;YACL,CAAC,EAAE,IAAI,CAAC,CAAC;YAET,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAjGD,oDAiGC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=web-cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-cli.d.ts","sourceRoot":"","sources":["../src/web-cli.ts"],"names":[],"mappings":""}
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const web_ui_1 = require("./web-ui");
5
+ const args = process.argv.slice(2);
6
+ function parseArgs() {
7
+ // Usa INIT_CWD (directory da cui npm/npx è stato chiamato) invece di cwd
8
+ const options = {
9
+ port: 3001,
10
+ projectRoot: process.env.INIT_CWD || process.cwd(),
11
+ testsDir: 'tests',
12
+ };
13
+ for (let i = 0; i < args.length; i++) {
14
+ switch (args[i]) {
15
+ case '--port':
16
+ case '-p':
17
+ options.port = Number(args[++i]);
18
+ break;
19
+ case '--project':
20
+ case '-r':
21
+ options.projectRoot = args[++i];
22
+ break;
23
+ case '--tests-dir':
24
+ case '-t':
25
+ options.testsDir = args[++i];
26
+ break;
27
+ case '--help':
28
+ case '-h':
29
+ console.log(`
30
+ Playwright Test Runner - Web UI
31
+
32
+ Usage:
33
+ playwright-ui [options]
34
+
35
+ Options:
36
+ -p, --port <port> Porta del server (default: 3001)
37
+ -r, --project <path> Root del progetto (default: current directory)
38
+ -t, --tests-dir <dir> Cartella dei test (default: tests)
39
+ -h, --help Mostra questo messaggio
40
+
41
+ Esempi:
42
+ playwright-ui
43
+ playwright-ui --port 4000
44
+ playwright-ui --project /path/to/project --tests-dir e2e
45
+
46
+ Questo comando:
47
+ 1. Avvia un server web con interfaccia grafica
48
+ 2. Apri http://localhost:3001 nel browser
49
+ 3. Lancia i test con un click dal browser
50
+ `);
51
+ process.exit(0);
52
+ }
53
+ }
54
+ return options;
55
+ }
56
+ const options = parseArgs();
57
+ const webUI = new web_ui_1.PlaywrightWebUI(options);
58
+ webUI.start();
59
+ // Keep process alive and handle graceful shutdown
60
+ process.on('SIGINT', () => {
61
+ console.log('\n\n👋 Chiusura server...');
62
+ process.exit(0);
63
+ });
64
+ //# sourceMappingURL=web-cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-cli.js","sourceRoot":"","sources":["../src/web-cli.ts"],"names":[],"mappings":";;;AAEA,qCAA2C;AAE3C,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAEnC,SAAS,SAAS;IAChB,yEAAyE;IACzE,MAAM,OAAO,GAAQ;QACnB,IAAI,EAAE,IAAI;QACV,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,EAAE;QAClD,QAAQ,EAAE,OAAO;KAClB,CAAC;IAEF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,QAAQ,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;YAChB,KAAK,QAAQ,CAAC;YACd,KAAK,IAAI;gBACP,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;gBACjC,MAAM;YACR,KAAK,WAAW,CAAC;YACjB,KAAK,IAAI;gBACP,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;gBAChC,MAAM;YACR,KAAK,aAAa,CAAC;YACnB,KAAK,IAAI;gBACP,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC7B,MAAM;YACR,KAAK,QAAQ,CAAC;YACd,KAAK,IAAI;gBACP,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;SAqBX,CAAC,CAAC;gBACH,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,OAAO,GAAG,SAAS,EAAE,CAAC;AAC5B,MAAM,KAAK,GAAG,IAAI,wBAAe,CAAC,OAAO,CAAC,CAAC;AAC3C,KAAK,CAAC,KAAK,EAAE,CAAC;AAEd,kDAAkD;AAClD,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;IACxB,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;IACzC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,19 @@
1
+ import express from 'express';
2
+ export interface WebUIOptions {
3
+ port?: number;
4
+ projectRoot?: string;
5
+ testsDir?: string;
6
+ }
7
+ export declare class PlaywrightWebUI {
8
+ private app;
9
+ private port;
10
+ private testRunner;
11
+ private reportProcess;
12
+ constructor(options?: WebUIOptions);
13
+ private setupMiddleware;
14
+ private setupRoutes;
15
+ start(): void;
16
+ getApp(): express.Application;
17
+ }
18
+ export declare function createWebUI(options?: WebUIOptions): PlaywrightWebUI;
19
+ //# sourceMappingURL=web-ui.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-ui.d.ts","sourceRoot":"","sources":["../src/web-ui.ts"],"names":[],"mappings":"AAAA,OAAO,OAA8B,MAAM,SAAS,CAAC;AAKrD,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,GAAG,CAAsB;IACjC,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,aAAa,CAAa;gBAEtB,OAAO,GAAE,YAAiB;IAYtC,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,WAAW;IA6FZ,KAAK,IAAI,IAAI;IAYb,MAAM,IAAI,OAAO,CAAC,WAAW;CAGrC;AAED,wBAAgB,WAAW,CAAC,OAAO,GAAE,YAAiB,mBAErD"}
package/dist/web-ui.js ADDED
@@ -0,0 +1,138 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PlaywrightWebUI = void 0;
7
+ exports.createWebUI = createWebUI;
8
+ const express_1 = __importDefault(require("express"));
9
+ const path_1 = __importDefault(require("path"));
10
+ const test_runner_1 = require("./test-runner");
11
+ const cors_1 = __importDefault(require("cors"));
12
+ class PlaywrightWebUI {
13
+ app;
14
+ port;
15
+ testRunner;
16
+ reportProcess = null;
17
+ constructor(options = {}) {
18
+ this.app = (0, express_1.default)();
19
+ this.port = options.port || 3001;
20
+ this.testRunner = new test_runner_1.PlaywrightTestRunner({
21
+ projectRoot: options.projectRoot || process.cwd(),
22
+ testsDir: options.testsDir || 'tests',
23
+ });
24
+ this.setupMiddleware();
25
+ this.setupRoutes();
26
+ }
27
+ setupMiddleware() {
28
+ this.app.use((0, cors_1.default)());
29
+ this.app.use(express_1.default.json());
30
+ this.app.use(express_1.default.static(path_1.default.join(__dirname, '../public')));
31
+ }
32
+ setupRoutes() {
33
+ // Serve the HTML UI
34
+ this.app.get('/', (req, res) => {
35
+ res.sendFile(path_1.default.join(__dirname, '../public/index.html'));
36
+ });
37
+ // API endpoints
38
+ this.app.get('/api/health', (req, res) => {
39
+ res.json({ status: 'ok', service: 'playwright-web-ui' });
40
+ });
41
+ this.app.get('/api/tests', async (req, res) => {
42
+ try {
43
+ const files = await this.testRunner.getTestFiles();
44
+ res.json({
45
+ success: true,
46
+ count: files.length,
47
+ files: files.map(f => path_1.default.relative(process.cwd(), f)),
48
+ });
49
+ }
50
+ catch (error) {
51
+ res.status(500).json({
52
+ success: false,
53
+ error: error.message,
54
+ });
55
+ }
56
+ });
57
+ this.app.post('/api/run', async (req, res) => {
58
+ try {
59
+ const { reporter = 'html', headed = false } = req.body;
60
+ const result = await this.testRunner.runTests({
61
+ reporter,
62
+ headed,
63
+ });
64
+ res.json({
65
+ success: result.success,
66
+ output: result.output,
67
+ error: result.error,
68
+ reportPath: result.reportPath,
69
+ });
70
+ }
71
+ catch (error) {
72
+ res.status(500).json({
73
+ success: false,
74
+ error: error.message,
75
+ });
76
+ }
77
+ });
78
+ this.app.post('/api/report/show', async (req, res) => {
79
+ try {
80
+ if (this.reportProcess) {
81
+ return res.json({
82
+ success: true,
83
+ message: 'Report già in esecuzione',
84
+ url: 'http://localhost:9323',
85
+ });
86
+ }
87
+ const { url, process } = await this.testRunner.showReport();
88
+ this.reportProcess = process;
89
+ res.json({
90
+ success: true,
91
+ message: 'Report UI avviato',
92
+ url,
93
+ });
94
+ }
95
+ catch (error) {
96
+ res.status(500).json({
97
+ success: false,
98
+ error: error.message,
99
+ });
100
+ }
101
+ });
102
+ this.app.post('/api/report/stop', (req, res) => {
103
+ if (this.reportProcess) {
104
+ this.reportProcess.kill();
105
+ this.reportProcess = null;
106
+ res.json({
107
+ success: true,
108
+ message: 'Report UI fermato',
109
+ });
110
+ }
111
+ else {
112
+ res.json({
113
+ success: false,
114
+ message: 'Nessun report in esecuzione',
115
+ });
116
+ }
117
+ });
118
+ }
119
+ start() {
120
+ this.app.listen(this.port, () => {
121
+ console.log(`\n🎭 Playwright Web UI`);
122
+ console.log(`━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`);
123
+ console.log(`\n✨ Apri il browser su: http://localhost:${this.port}`);
124
+ console.log(`\n📁 Progetto: ${process.cwd()}`);
125
+ console.log(`📂 Cartella test: ${this.testRunner['testsDir']}`);
126
+ console.log(`\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`);
127
+ console.log(`\nPremi Ctrl+C per fermare il server\n`);
128
+ });
129
+ }
130
+ getApp() {
131
+ return this.app;
132
+ }
133
+ }
134
+ exports.PlaywrightWebUI = PlaywrightWebUI;
135
+ function createWebUI(options = {}) {
136
+ return new PlaywrightWebUI(options);
137
+ }
138
+ //# sourceMappingURL=web-ui.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-ui.js","sourceRoot":"","sources":["../src/web-ui.ts"],"names":[],"mappings":";;;;;;AAiJA,kCAEC;AAnJD,sDAAqD;AACrD,gDAAwB;AACxB,+CAAqD;AACrD,gDAAwB;AAQxB,MAAa,eAAe;IAClB,GAAG,CAAsB;IACzB,IAAI,CAAS;IACb,UAAU,CAAuB;IACjC,aAAa,GAAQ,IAAI,CAAC;IAElC,YAAY,UAAwB,EAAE;QACpC,IAAI,CAAC,GAAG,GAAG,IAAA,iBAAO,GAAE,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC;QACjC,IAAI,CAAC,UAAU,GAAG,IAAI,kCAAoB,CAAC;YACzC,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,GAAG,EAAE;YACjD,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,OAAO;SACtC,CAAC,CAAC;QAEH,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,IAAI,CAAC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C,GAAG,CAAC,4CAA4C,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YACrE,OAAO,CAAC,GAAG,CAAC,kBAAkB,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YAC/C,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;YAChE,OAAO,CAAC,GAAG,CAAC,yDAAyD,CAAC,CAAC;YACvE,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,MAAM;QACX,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;CACF;AApID,0CAoIC;AAED,SAAgB,WAAW,CAAC,UAAwB,EAAE;IACpD,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;AACtC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@playwright-test-runner/core",
3
+ "version": "1.0.0",
4
+ "description": "Libreria agnostica per eseguire test Playwright con server Express e UI report",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "bin": {
8
+ "playwright-runner": "dist/cli.js",
9
+ "playwright-test": "dist/run-and-show.js",
10
+ "playwright-ui": "dist/web-cli.js"
11
+ },
12
+ "scripts": {
13
+ "build": "tsc",
14
+ "dev": "tsc --watch",
15
+ "start": "node dist/index.js",
16
+ "prepare": "npm run build"
17
+ },
18
+ "keywords": [
19
+ "playwright",
20
+ "testing",
21
+ "e2e",
22
+ "test-runner",
23
+ "express"
24
+ ],
25
+ "author": "Giovanni Cannone",
26
+ "license": "MIT",
27
+ "dependencies": {
28
+ "express": "^4.18.2",
29
+ "@playwright/test": "^1.40.1",
30
+ "playwright": "^1.40.1",
31
+ "cors": "^2.8.5"
32
+ },
33
+ "devDependencies": {
34
+ "@types/express": "^4.17.21",
35
+ "@types/node": "^20.10.5",
36
+ "@types/cors": "^2.8.17",
37
+ "typescript": "^5.3.3"
38
+ },
39
+ "files": [
40
+ "dist",
41
+ "public",
42
+ "playwright.config.ts"
43
+ ],
44
+ "directories": {
45
+ "example": "example"
46
+ },
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "ssh://git@ssh.git.dotitsrl.it:22102/playwright-package/playwright.git"
50
+ }
51
+ }
@@ -0,0 +1,41 @@
1
+ import { defineConfig, devices } from '@playwright/test';
2
+
3
+ /**
4
+ * Configurazione Playwright di esempio
5
+ * Copiare questo file nella root del progetto consumer
6
+ */
7
+ export default defineConfig({
8
+ testDir: './tests',
9
+ fullyParallel: true,
10
+ forbidOnly: !!process.env.CI,
11
+ retries: process.env.CI ? 2 : 0,
12
+ workers: process.env.CI ? 1 : undefined,
13
+ reporter: 'html',
14
+
15
+ use: {
16
+ baseURL: process.env.BASE_URL || 'http://localhost:3000',
17
+ trace: 'on-first-retry',
18
+ screenshot: 'only-on-failure',
19
+ },
20
+
21
+ projects: [
22
+ {
23
+ name: 'chromium',
24
+ use: { ...devices['Desktop Chrome'] },
25
+ },
26
+ {
27
+ name: 'firefox',
28
+ use: { ...devices['Desktop Firefox'] },
29
+ },
30
+ {
31
+ name: 'webkit',
32
+ use: { ...devices['Desktop Safari'] },
33
+ },
34
+ ],
35
+
36
+ webServer: {
37
+ command: 'npm run dev',
38
+ url: 'http://localhost:3000',
39
+ reuseExistingServer: !process.env.CI,
40
+ },
41
+ });