@flash-ai-team/flash-test-framework 0.0.2 → 0.0.4

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.
@@ -3,11 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.expect = exports.test = void 0;
4
4
  const test_1 = require("@playwright/test");
5
5
  const Keyword_1 = require("./Keyword");
6
+ const ReporterUtils_1 = require("../reporting/ReporterUtils");
6
7
  exports.test = test_1.test.extend({
7
8
  contextSetup: [async ({ page }, use, testInfo) => {
8
9
  // Initialize the Keyword Context before every test
9
10
  Keyword_1.KeywordContext.page = page;
10
11
  Keyword_1.KeywordContext.testInfo = testInfo;
12
+ // Ensure report folder exists automatically
13
+ (0, ReporterUtils_1.ensureReportFolder)(testInfo);
11
14
  await use();
12
15
  }, { auto: true }],
13
16
  });
package/dist/index.d.ts CHANGED
@@ -3,3 +3,7 @@ export { AIWeb } from './keywords/AIWebUI';
3
3
  export { Keyword, KeywordContext } from './core/Keyword';
4
4
  export { TestObject, el } from './core/ObjectRepository';
5
5
  export { TestCase } from './core/TestDecorators';
6
+ export { test, expect } from './core/TestBase';
7
+ export { default as CustomReporter } from './reporting/CustomReporter';
8
+ export { default as HtmlReporter } from './reporting/HtmlReporter';
9
+ export { default as EmailReporter } from './reporting/EmailReporter';
package/dist/index.js CHANGED
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TestCase = exports.el = exports.TestObject = exports.KeywordContext = exports.Keyword = exports.AIWeb = exports.Web = void 0;
6
+ exports.EmailReporter = exports.HtmlReporter = exports.CustomReporter = exports.expect = exports.test = exports.TestCase = exports.el = exports.TestObject = exports.KeywordContext = exports.Keyword = exports.AIWeb = exports.Web = void 0;
7
+ // Core
4
8
  var WebUI_1 = require("./keywords/WebUI");
5
9
  Object.defineProperty(exports, "Web", { enumerable: true, get: function () { return WebUI_1.Web; } });
6
10
  var AIWebUI_1 = require("./keywords/AIWebUI");
@@ -13,3 +17,13 @@ Object.defineProperty(exports, "TestObject", { enumerable: true, get: function (
13
17
  Object.defineProperty(exports, "el", { enumerable: true, get: function () { return ObjectRepository_1.el; } });
14
18
  var TestDecorators_1 = require("./core/TestDecorators");
15
19
  Object.defineProperty(exports, "TestCase", { enumerable: true, get: function () { return TestDecorators_1.TestCase; } });
20
+ var TestBase_1 = require("./core/TestBase");
21
+ Object.defineProperty(exports, "test", { enumerable: true, get: function () { return TestBase_1.test; } });
22
+ Object.defineProperty(exports, "expect", { enumerable: true, get: function () { return TestBase_1.expect; } });
23
+ // Reporters
24
+ var CustomReporter_1 = require("./reporting/CustomReporter");
25
+ Object.defineProperty(exports, "CustomReporter", { enumerable: true, get: function () { return __importDefault(CustomReporter_1).default; } });
26
+ var HtmlReporter_1 = require("./reporting/HtmlReporter");
27
+ Object.defineProperty(exports, "HtmlReporter", { enumerable: true, get: function () { return __importDefault(HtmlReporter_1).default; } });
28
+ var EmailReporter_1 = require("./reporting/EmailReporter");
29
+ Object.defineProperty(exports, "EmailReporter", { enumerable: true, get: function () { return __importDefault(EmailReporter_1).default; } });
@@ -1,3 +1,5 @@
1
1
  import { Suite } from '@playwright/test/reporter';
2
2
  export declare function getReportFolder(suite: Suite): string;
3
+ import { TestInfo } from '@playwright/test';
4
+ export declare function ensureReportFolder(testInfo: TestInfo): string;
3
5
  export declare function resetReportFolderCache(): void;
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.getReportFolder = getReportFolder;
37
+ exports.ensureReportFolder = ensureReportFolder;
37
38
  exports.resetReportFolderCache = resetReportFolderCache;
38
39
  const fs = __importStar(require("fs"));
39
40
  const path = __importStar(require("path"));
@@ -64,6 +65,28 @@ function getReportFolder(suite) {
64
65
  console.log(`[ReporterUtils] Calculated report folder: ${cachedReportFolder}`);
65
66
  return cachedReportFolder;
66
67
  }
68
+ // ... existing code ...
69
+ function ensureReportFolder(testInfo) {
70
+ if (cachedReportFolder) {
71
+ return cachedReportFolder;
72
+ }
73
+ const timestamp = new Date().toISOString().replace(/T/, '_').replace(/:/g, '').split('.')[0];
74
+ // Extract suite name from test info title path (usually file name without ext)
75
+ // testInfo.titlePath[0] is usually the file name relative to test dir, e.g. "suites/SauceDemoAI.spec.ts"
76
+ let suiteName = 'TestRun';
77
+ if (testInfo.titlePath.length > 0) {
78
+ const fileName = path.basename(testInfo.file || '');
79
+ if (fileName) {
80
+ suiteName = fileName.split('.')[0];
81
+ }
82
+ }
83
+ cachedReportFolder = path.join(process.cwd(), 'reports', suiteName, `test_${timestamp}`);
84
+ if (!fs.existsSync(cachedReportFolder)) {
85
+ fs.mkdirSync(cachedReportFolder, { recursive: true });
86
+ }
87
+ console.log(`[ReporterUtils] AUTO-CREATED report folder: ${cachedReportFolder}`);
88
+ return cachedReportFolder;
89
+ }
67
90
  function resetReportFolderCache() {
68
91
  cachedReportFolder = null;
69
92
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flash-ai-team/flash-test-framework",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "A powerful keyword-driven automation framework built on top of Playwright and TypeScript.",
5
5
  "keywords": [
6
6
  "playwright",