@playq/core 0.2.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/README.md +41 -0
  2. package/bin/playq.js +175 -0
  3. package/cucumber.js +10 -0
  4. package/dist/exec/featureFileCache.d.ts +21 -0
  5. package/dist/exec/featureFileCache.js +124 -0
  6. package/dist/exec/featureFilePreProcess.d.ts +12 -0
  7. package/dist/exec/featureFilePreProcess.js +208 -0
  8. package/dist/exec/preLoader.d.ts +1 -0
  9. package/dist/exec/preLoader.js +72 -0
  10. package/dist/exec/preProcessEntry.d.ts +1 -0
  11. package/dist/exec/preProcessEntry.js +83 -0
  12. package/dist/exec/preProcess_old_todelete.d.ts +1 -0
  13. package/dist/exec/preProcess_old_todelete.js +258 -0
  14. package/dist/exec/runner.d.ts +1 -0
  15. package/dist/exec/runner.js +221 -0
  16. package/dist/exec/runner_orchestrator.d.ts +1 -0
  17. package/dist/exec/runner_orchestrator.js +85 -0
  18. package/dist/exec/sgGenerator.d.ts +11 -0
  19. package/dist/exec/sgGenerator.js +310 -0
  20. package/dist/global.d.ts +15 -0
  21. package/dist/global.js +185 -0
  22. package/dist/helper/actions/api/apiRequestActions.d.ts +117 -0
  23. package/dist/helper/actions/api/apiRequestActions.js +374 -0
  24. package/dist/helper/actions/api/apiValidationActions.d.ts +119 -0
  25. package/dist/helper/actions/api/apiValidationActions.js +615 -0
  26. package/dist/helper/actions/apiActions.d.ts +18 -0
  27. package/dist/helper/actions/apiActions.js +34 -0
  28. package/dist/helper/actions/apiStepDefs.d.ts +1 -0
  29. package/dist/helper/actions/apiStepDefs.js +64 -0
  30. package/dist/helper/actions/comm/commonActions.d.ts +58 -0
  31. package/dist/helper/actions/comm/commonActions.js +198 -0
  32. package/dist/helper/actions/comm/utilityActions.d.ts +131 -0
  33. package/dist/helper/actions/comm/utilityActions.js +351 -0
  34. package/dist/helper/actions/commActions.d.ts +18 -0
  35. package/dist/helper/actions/commActions.js +34 -0
  36. package/dist/helper/actions/commStepDefs.d.ts +1 -0
  37. package/dist/helper/actions/commStepDefs.js +57 -0
  38. package/dist/helper/actions/stepGroupStepDefs.d.ts +1 -0
  39. package/dist/helper/actions/stepGroupStepDefs.js +15 -0
  40. package/dist/helper/actions/web/alertActions.d.ts +61 -0
  41. package/dist/helper/actions/web/alertActions.js +224 -0
  42. package/dist/helper/actions/web/cookieActions.d.ts +45 -0
  43. package/dist/helper/actions/web/cookieActions.js +186 -0
  44. package/dist/helper/actions/web/downloadActions.d.ts +40 -0
  45. package/dist/helper/actions/web/downloadActions.js +153 -0
  46. package/dist/helper/actions/web/elementReaderActions.d.ts +95 -0
  47. package/dist/helper/actions/web/elementReaderActions.js +326 -0
  48. package/dist/helper/actions/web/formActions.d.ts +122 -0
  49. package/dist/helper/actions/web/formActions.js +423 -0
  50. package/dist/helper/actions/web/iframeActions.d.ts +23 -0
  51. package/dist/helper/actions/web/iframeActions.js +108 -0
  52. package/dist/helper/actions/web/javascriptActions.d.ts +14 -0
  53. package/dist/helper/actions/web/javascriptActions.js +77 -0
  54. package/dist/helper/actions/web/keyboardActions.d.ts +35 -0
  55. package/dist/helper/actions/web/keyboardActions.js +118 -0
  56. package/dist/helper/actions/web/localStorageActions.d.ts +51 -0
  57. package/dist/helper/actions/web/localStorageActions.js +163 -0
  58. package/dist/helper/actions/web/mouseActions.d.ts +240 -0
  59. package/dist/helper/actions/web/mouseActions.js +609 -0
  60. package/dist/helper/actions/web/reportingActions.d.ts +34 -0
  61. package/dist/helper/actions/web/reportingActions.js +58 -0
  62. package/dist/helper/actions/web/screenshotActions.d.ts +34 -0
  63. package/dist/helper/actions/web/screenshotActions.js +151 -0
  64. package/dist/helper/actions/web/testDataActions.d.ts +21 -0
  65. package/dist/helper/actions/web/testDataActions.js +211 -0
  66. package/dist/helper/actions/web/validationActions.d.ts +547 -0
  67. package/dist/helper/actions/web/validationActions.js +1754 -0
  68. package/dist/helper/actions/web/waitActions.d.ts +191 -0
  69. package/dist/helper/actions/web/waitActions.js +589 -0
  70. package/dist/helper/actions/web/webNavigation.d.ts +104 -0
  71. package/dist/helper/actions/web/webNavigation.js +288 -0
  72. package/dist/helper/actions/webActions.d.ts +32 -0
  73. package/dist/helper/actions/webActions.js +48 -0
  74. package/dist/helper/actions/webStepDefs.d.ts +1 -0
  75. package/dist/helper/actions/webStepDefs.js +455 -0
  76. package/dist/helper/browsers/browserManager.d.ts +1 -0
  77. package/dist/helper/browsers/browserManager.js +56 -0
  78. package/dist/helper/bundle/defaultEntries.d.ts +6 -0
  79. package/dist/helper/bundle/defaultEntries.js +200 -0
  80. package/dist/helper/bundle/env.d.ts +1 -0
  81. package/dist/helper/bundle/env.js +157 -0
  82. package/dist/helper/bundle/vars.d.ts +9 -0
  83. package/dist/helper/bundle/vars.js +375 -0
  84. package/dist/helper/faker/customFaker.d.ts +55 -0
  85. package/dist/helper/faker/customFaker.js +45 -0
  86. package/dist/helper/faker/modules/data/postcodes_valid_sg.json +17 -0
  87. package/dist/helper/faker/modules/dateTime.d.ts +18 -0
  88. package/dist/helper/faker/modules/dateTime.js +106 -0
  89. package/dist/helper/faker/modules/mobile.d.ts +4 -0
  90. package/dist/helper/faker/modules/mobile.js +59 -0
  91. package/dist/helper/faker/modules/nric.d.ts +32 -0
  92. package/dist/helper/faker/modules/nric.js +84 -0
  93. package/dist/helper/faker/modules/passport.d.ts +3 -0
  94. package/dist/helper/faker/modules/passport.js +36 -0
  95. package/dist/helper/faker/modules/person.d.ts +14 -0
  96. package/dist/helper/faker/modules/person.js +73 -0
  97. package/dist/helper/faker/modules/postcode.d.ts +6 -0
  98. package/dist/helper/faker/modules/postcode.js +47 -0
  99. package/dist/helper/fixtures/locAggregate.d.ts +7 -0
  100. package/dist/helper/fixtures/locAggregate.js +94 -0
  101. package/dist/helper/fixtures/logFixture.d.ts +8 -0
  102. package/dist/helper/fixtures/logFixture.js +56 -0
  103. package/dist/helper/fixtures/webFixture.d.ts +19 -0
  104. package/dist/helper/fixtures/webFixture.js +186 -0
  105. package/dist/helper/fixtures/webLocFixture.d.ts +2 -0
  106. package/dist/helper/fixtures/webLocFixture.js +144 -0
  107. package/dist/helper/report/allureStepLogger.d.ts +0 -0
  108. package/dist/helper/report/allureStepLogger.js +25 -0
  109. package/dist/helper/report/customiseReport.d.ts +1 -0
  110. package/dist/helper/report/customiseReport.js +55 -0
  111. package/dist/helper/report/init.d.ts +1 -0
  112. package/dist/helper/report/init.js +14 -0
  113. package/dist/helper/report/report.d.ts +1 -0
  114. package/dist/helper/report/report.js +102 -0
  115. package/dist/helper/util/dataLoader.d.ts +10 -0
  116. package/dist/helper/util/dataLoader.js +73 -0
  117. package/dist/helper/util/logger.d.ts +4 -0
  118. package/dist/helper/util/logger.js +61 -0
  119. package/dist/helper/util/session/sessionUtil.d.ts +26 -0
  120. package/dist/helper/util/session/sessionUtil.js +729 -0
  121. package/dist/helper/util/stepHelpers.d.ts +2 -0
  122. package/dist/helper/util/stepHelpers.js +16 -0
  123. package/dist/helper/util/test-data/dataLoader.d.ts +7 -0
  124. package/dist/helper/util/test-data/dataLoader.js +145 -0
  125. package/dist/helper/util/test-data/dataTest.d.ts +10 -0
  126. package/dist/helper/util/test-data/dataTest.js +216 -0
  127. package/dist/helper/util/totp/totpHelper.d.ts +38 -0
  128. package/dist/helper/util/totp/totpHelper.js +117 -0
  129. package/dist/helper/util/utilities/cryptoUtil.d.ts +2 -0
  130. package/dist/helper/util/utilities/cryptoUtil.js +53 -0
  131. package/dist/helper/util/utilities/schemaGeneratorUtil.d.ts +2 -0
  132. package/dist/helper/util/utilities/schemaGeneratorUtil.js +129 -0
  133. package/dist/helper/util/utils.d.ts +2 -0
  134. package/dist/helper/util/utils.js +22 -0
  135. package/dist/helper/wrapper/PlaywrightWrappers.d.ts +8 -0
  136. package/dist/helper/wrapper/PlaywrightWrappers.js +26 -0
  137. package/dist/helper/wrapper/assert.d.ts +9 -0
  138. package/dist/helper/wrapper/assert.js +23 -0
  139. package/dist/index.d.ts +7 -0
  140. package/dist/index.js +57 -0
  141. package/dist/scripts/get-versions.d.ts +1 -0
  142. package/dist/scripts/get-versions.js +98 -0
  143. package/dist/scripts/posttest.d.ts +1 -0
  144. package/dist/scripts/posttest.js +29 -0
  145. package/dist/scripts/pretest.d.ts +1 -0
  146. package/dist/scripts/pretest.js +57 -0
  147. package/dist/scripts/util.d.ts +1 -0
  148. package/dist/scripts/util.js +376 -0
  149. package/package.json +68 -0
  150. package/src/exec/featureFileCache.ts +80 -0
  151. package/src/exec/featureFilePreProcess.ts +239 -0
  152. package/src/exec/preLoader.ts +72 -0
  153. package/src/exec/preProcessEntry.ts +59 -0
  154. package/src/exec/preProcess_old_todelete.ts +289 -0
  155. package/src/exec/runner.ts +241 -0
  156. package/src/exec/runnerCuke.js +90 -0
  157. package/src/exec/runner_orchestrator.ts +91 -0
  158. package/src/exec/sgGenerator.ts +373 -0
  159. package/src/global.ts +130 -0
  160. package/src/helper/actions/api/apiRequestActions.ts +362 -0
  161. package/src/helper/actions/api/apiValidationActions.ts +594 -0
  162. package/src/helper/actions/apiActions.ts +18 -0
  163. package/src/helper/actions/apiStepDefs.ts +80 -0
  164. package/src/helper/actions/comm/commonActions.ts +165 -0
  165. package/src/helper/actions/comm/utilityActions.ts +344 -0
  166. package/src/helper/actions/commActions.ts +18 -0
  167. package/src/helper/actions/commStepDefs.ts +72 -0
  168. package/src/helper/actions/stepGroupStepDefs.ts +17 -0
  169. package/src/helper/actions/web/alertActions.ts +179 -0
  170. package/src/helper/actions/web/cookieActions.ts +124 -0
  171. package/src/helper/actions/web/downloadActions.ts +129 -0
  172. package/src/helper/actions/web/elementReaderActions.ts +323 -0
  173. package/src/helper/actions/web/formActions.ts +469 -0
  174. package/src/helper/actions/web/iframeActions.ts +67 -0
  175. package/src/helper/actions/web/javascriptActions.ts +38 -0
  176. package/src/helper/actions/web/keyboardActions.ts +101 -0
  177. package/src/helper/actions/web/localStorageActions.ts +109 -0
  178. package/src/helper/actions/web/mouseActions.ts +864 -0
  179. package/src/helper/actions/web/reportingActions.ts +53 -0
  180. package/src/helper/actions/web/screenshotActions.ts +124 -0
  181. package/src/helper/actions/web/testDataActions.ts +162 -0
  182. package/src/helper/actions/web/validationActions.ts +2287 -0
  183. package/src/helper/actions/web/waitActions.ts +757 -0
  184. package/src/helper/actions/web/webNavigation.ts +313 -0
  185. package/src/helper/actions/webActions.ts +33 -0
  186. package/src/helper/actions/webStepDefs.ts +505 -0
  187. package/src/helper/browsers/browserManager.ts +23 -0
  188. package/src/helper/bundle/defaultEntries.ts +208 -0
  189. package/src/helper/bundle/env.ts +119 -0
  190. package/src/helper/bundle/vars.ts +368 -0
  191. package/src/helper/faker/customFaker.ts +107 -0
  192. package/src/helper/faker/modules/data/postcodes_valid_sg.json +17 -0
  193. package/src/helper/faker/modules/dateTime.ts +121 -0
  194. package/src/helper/faker/modules/mobile.ts +58 -0
  195. package/src/helper/faker/modules/nric.ts +109 -0
  196. package/src/helper/faker/modules/passport.ts +34 -0
  197. package/src/helper/faker/modules/person.ts +93 -0
  198. package/src/helper/faker/modules/postcode.ts +57 -0
  199. package/src/helper/fixtures/locAggregate.ts +61 -0
  200. package/src/helper/fixtures/logFixture.ts +57 -0
  201. package/src/helper/fixtures/webFixture.ts +206 -0
  202. package/src/helper/fixtures/webLocFixture.ts +143 -0
  203. package/src/helper/report/allureStepLogger.ts +26 -0
  204. package/src/helper/report/customiseReport.ts +61 -0
  205. package/src/helper/report/init.ts +18 -0
  206. package/src/helper/report/report.ts +72 -0
  207. package/src/helper/util/dataLoader.ts +42 -0
  208. package/src/helper/util/logger.ts +32 -0
  209. package/src/helper/util/session/sessionUtil.ts +839 -0
  210. package/src/helper/util/stepHelpers.ts +14 -0
  211. package/src/helper/util/test-data/dataLoader.ts +108 -0
  212. package/src/helper/util/test-data/dataTest.ts +191 -0
  213. package/src/helper/util/test-data/registerUser.json +7 -0
  214. package/src/helper/util/totp/totpHelper.ts +102 -0
  215. package/src/helper/util/utilities/cryptoUtil.ts +53 -0
  216. package/src/helper/util/utilities/schemaGeneratorUtil.ts +143 -0
  217. package/src/helper/util/utils.ts +28 -0
  218. package/src/helper/wrapper/PlaywrightWrappers.ts +28 -0
  219. package/src/helper/wrapper/assert.ts +25 -0
  220. package/src/index.ts +17 -0
  221. package/src/scripts/get-versions.ts +68 -0
  222. package/src/scripts/posttest.ts +32 -0
  223. package/src/scripts/pretest.ts +48 -0
  224. package/src/scripts/util.ts +406 -0
  225. package/tsconfig.json +30 -0
@@ -0,0 +1,129 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ /* PlayQ OpenAPI (OAS 3.1) -> schema TS files generator */
4
+ var __importDefault = (this && this.__importDefault) || function (mod) {
5
+ return (mod && mod.__esModule) ? mod : { "default": mod };
6
+ };
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ const node_fs_1 = __importDefault(require("node:fs"));
9
+ const node_path_1 = __importDefault(require("node:path"));
10
+ function parseArgs(argv) {
11
+ const args = {
12
+ outDir: "resources/schemas",
13
+ prefix: "", // optional export prefix e.g. "Api"
14
+ indexFile: "index.ts",
15
+ };
16
+ for (let i = 0; i < argv.length; i++) {
17
+ const a = argv[i];
18
+ const v = argv[i + 1];
19
+ if (a === "--input" && v) {
20
+ args.input = v;
21
+ i++;
22
+ continue;
23
+ }
24
+ if (a === "--url" && v) {
25
+ args.url = v;
26
+ i++;
27
+ continue;
28
+ }
29
+ if (a === "--outDir" && v) {
30
+ args.outDir = v;
31
+ i++;
32
+ continue;
33
+ }
34
+ if (a === "--prefix" && v) {
35
+ args.prefix = v;
36
+ i++;
37
+ continue;
38
+ }
39
+ if (a === "--indexFile" && v) {
40
+ args.indexFile = v;
41
+ i++;
42
+ continue;
43
+ }
44
+ }
45
+ if (!args.input && !args.url) {
46
+ throw new Error(`Provide either --input <path-to-openapi.json> OR --url <openapi-json-url>`);
47
+ }
48
+ if (args.input && args.url) {
49
+ throw new Error(`Use only one of --input or --url (not both).`);
50
+ }
51
+ return args;
52
+ }
53
+ async function loadOpenApi(args) {
54
+ if (args.input) {
55
+ const p = node_path_1.default.resolve(args.input);
56
+ const raw = node_fs_1.default.readFileSync(p, "utf8");
57
+ return JSON.parse(raw);
58
+ }
59
+ // URL
60
+ const res = await fetch(args.url, {
61
+ headers: { Accept: "application/json" },
62
+ });
63
+ if (!res.ok) {
64
+ throw new Error(`Failed to fetch OpenAPI JSON from ${args.url}. HTTP ${res.status}`);
65
+ }
66
+ return (await res.json());
67
+ }
68
+ function safeIdent(name) {
69
+ // Make a valid TS identifier-ish name (keeps underscores)
70
+ const cleaned = name.replace(/[^a-zA-Z0-9_]/g, "_");
71
+ // Avoid leading digit
72
+ if (/^\d/.test(cleaned))
73
+ return "_" + cleaned;
74
+ return cleaned;
75
+ }
76
+ function exportNameFor(schemaName, prefix) {
77
+ // AgentVersion -> AgentVersionSchema, optional prefix -> ApiAgentVersionSchema
78
+ const base = `${schemaName}Schema`;
79
+ return prefix ? `${prefix}${base}` : base;
80
+ }
81
+ function ensureOutDir(outDir) {
82
+ node_fs_1.default.mkdirSync(outDir, { recursive: true });
83
+ }
84
+ function writeSchemaFile(outDir, schemaKey, exportName, schema, openapiVersion) {
85
+ const fileName = `${schemaKey}.schema.ts`;
86
+ const fullPath = node_path_1.default.join(outDir, fileName);
87
+ const content = `/* Auto-generated by PlayQ schema generator - OpenAPI ${openapiVersion} */\n` +
88
+ `/* Source schema: #/components/schemas/${schemaKey} */\n\n` +
89
+ `export const ${exportName} = ${JSON.stringify(schema, null, 2)} as const;\n`;
90
+ node_fs_1.default.writeFileSync(fullPath, content, "utf8");
91
+ }
92
+ function writeIndexFile(outDir, indexFile, entries) {
93
+ const fullPath = node_path_1.default.join(outDir, indexFile);
94
+ const lines = entries
95
+ .sort((a, b) => a.schemaKey.localeCompare(b.schemaKey))
96
+ .map(e => `export { ${e.exportName} } from "./${e.schemaKey}.schema";`);
97
+ node_fs_1.default.writeFileSync(fullPath, lines.join("\n") + "\n", "utf8");
98
+ }
99
+ async function main() {
100
+ var _a, _b, _c;
101
+ const args = parseArgs(process.argv.slice(2));
102
+ const doc = await loadOpenApi(args);
103
+ if (!((_a = doc.openapi) === null || _a === void 0 ? void 0 : _a.startsWith("3.1"))) {
104
+ // still might work, but you said OAS 3.1 and this generator assumes that
105
+ console.warn(`āš ļø OpenAPI version is "${doc.openapi}". Generator is optimised for 3.1.x.`);
106
+ }
107
+ const schemas = (_c = (_b = doc.components) === null || _b === void 0 ? void 0 : _b.schemas) !== null && _c !== void 0 ? _c : {};
108
+ const schemaKeys = Object.keys(schemas);
109
+ if (!schemaKeys.length) {
110
+ throw new Error(`No components.schemas found in the OpenAPI document.`);
111
+ }
112
+ const outDir = node_path_1.default.resolve(args.outDir);
113
+ ensureOutDir(outDir);
114
+ const indexEntries = [];
115
+ for (const rawKey of schemaKeys) {
116
+ const schemaKey = safeIdent(rawKey);
117
+ const exportName = exportNameFor(schemaKey, args.prefix);
118
+ const schema = schemas[rawKey];
119
+ writeSchemaFile(outDir, schemaKey, exportName, schema, doc.openapi);
120
+ indexEntries.push({ schemaKey, exportName });
121
+ }
122
+ writeIndexFile(outDir, args.indexFile, indexEntries);
123
+ console.log(`āœ… Generated ${schemaKeys.length} schemas into: ${outDir}`);
124
+ console.log(`āœ… Barrel export: ${node_path_1.default.join(outDir, args.indexFile)}`);
125
+ }
126
+ main().catch(err => {
127
+ console.error(`āŒ ${err instanceof Error ? err.message : String(err)}`);
128
+ process.exit(1);
129
+ });
@@ -0,0 +1,2 @@
1
+ declare function toCamelCase(input: string): string;
2
+ export { toCamelCase };
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ // Utilities for Test Automation
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.toCamelCase = toCamelCase;
5
+ function toCamelCase(input) {
6
+ // Remove all non-alphanumeric characters except spaces
7
+ const cleaned = input.replace(/[^a-zA-Z0-9 ]/g, " ");
8
+ // Split by whitespace, lowercase first word, capitalize others
9
+ const words = cleaned.trim().split(/\s+/);
10
+ if (words.length === 0)
11
+ return "";
12
+ let camelCase = words[0].toLowerCase() +
13
+ words
14
+ .slice(1)
15
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
16
+ .join("");
17
+ // Ensure it doesn't start with a digit
18
+ if (/^[0-9]/.test(camelCase)) {
19
+ camelCase = "_" + camelCase;
20
+ }
21
+ return camelCase;
22
+ }
@@ -0,0 +1,8 @@
1
+ import { Page } from "@playwright/test";
2
+ export default class PlaywrightWrapper {
3
+ private page;
4
+ constructor(page: Page);
5
+ goto(url: string): Promise<void>;
6
+ waitAndClick(locator: string): Promise<void>;
7
+ navigateTo(link: string): Promise<void>;
8
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class PlaywrightWrapper {
4
+ constructor(page) {
5
+ this.page = page;
6
+ }
7
+ async goto(url) {
8
+ await this.page.goto(url, {
9
+ waitUntil: "domcontentloaded"
10
+ });
11
+ }
12
+ async waitAndClick(locator) {
13
+ const element = this.page.locator(locator);
14
+ await element.waitFor({
15
+ state: "visible"
16
+ });
17
+ await element.click();
18
+ }
19
+ async navigateTo(link) {
20
+ await Promise.all([
21
+ this.page.waitForNavigation(),
22
+ this.page.click(link)
23
+ ]);
24
+ }
25
+ }
26
+ exports.default = PlaywrightWrapper;
@@ -0,0 +1,9 @@
1
+ import { Page } from "@playwright/test";
2
+ export default class Assert {
3
+ private page;
4
+ constructor(page: Page);
5
+ assertTitle(title: string): Promise<void>;
6
+ assertTitleContains(title: string): Promise<void>;
7
+ assertURL(url: string): Promise<void>;
8
+ assertURLContains(title: string): Promise<void>;
9
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const test_1 = require("@playwright/test");
4
+ class Assert {
5
+ constructor(page) {
6
+ this.page = page;
7
+ }
8
+ async assertTitle(title) {
9
+ await (0, test_1.expect)(this.page).toHaveTitle(title);
10
+ }
11
+ async assertTitleContains(title) {
12
+ const pageTitle = await this.page.title();
13
+ (0, test_1.expect)(pageTitle).toContain(title);
14
+ }
15
+ async assertURL(url) {
16
+ await (0, test_1.expect)(this.page).toHaveURL(url);
17
+ }
18
+ async assertURLContains(title) {
19
+ const pageURL = this.page.url();
20
+ (0, test_1.expect)(pageURL).toContain(title);
21
+ }
22
+ }
23
+ exports.default = Assert;
@@ -0,0 +1,7 @@
1
+ export * from './global';
2
+ export { loadEnv } from './helper/bundle/env';
3
+ export * as vars from './helper/bundle/vars';
4
+ export { webFixture } from './helper/fixtures/webFixture';
5
+ export { logFixture } from './helper/fixtures/logFixture';
6
+ export { webLocResolver } from './helper/fixtures/webLocFixture';
7
+ export declare const loc: any;
package/dist/index.js ADDED
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ // Public entrypoint for @playq/core
3
+ // Re-export commonly used framework APIs
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
16
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
17
+ }) : function(o, v) {
18
+ o["default"] = v;
19
+ });
20
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
22
+ };
23
+ var __importStar = (this && this.__importStar) || (function () {
24
+ var ownKeys = function(o) {
25
+ ownKeys = Object.getOwnPropertyNames || function (o) {
26
+ var ar = [];
27
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
28
+ return ar;
29
+ };
30
+ return ownKeys(o);
31
+ };
32
+ return function (mod) {
33
+ if (mod && mod.__esModule) return mod;
34
+ var result = {};
35
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
36
+ __setModuleDefault(result, mod);
37
+ return result;
38
+ };
39
+ })();
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ exports.loc = exports.webLocResolver = exports.logFixture = exports.webFixture = exports.vars = exports.loadEnv = void 0;
42
+ // Global aggregator (vars, fixtures, actions, utils, faker, etc.)
43
+ __exportStar(require("./global"), exports);
44
+ // Lightweight config/env helpers for use in config files
45
+ var env_1 = require("./helper/bundle/env");
46
+ Object.defineProperty(exports, "loadEnv", { enumerable: true, get: function () { return env_1.loadEnv; } });
47
+ exports.vars = __importStar(require("./helper/bundle/vars"));
48
+ // Optional: direct exports for key fixtures
49
+ var webFixture_1 = require("./helper/fixtures/webFixture");
50
+ Object.defineProperty(exports, "webFixture", { enumerable: true, get: function () { return webFixture_1.webFixture; } });
51
+ var logFixture_1 = require("./helper/fixtures/logFixture");
52
+ Object.defineProperty(exports, "logFixture", { enumerable: true, get: function () { return logFixture_1.logFixture; } });
53
+ var webLocFixture_1 = require("./helper/fixtures/webLocFixture");
54
+ Object.defineProperty(exports, "webLocResolver", { enumerable: true, get: function () { return webLocFixture_1.webLocResolver; } });
55
+ const locAggregate_1 = require("./helper/fixtures/locAggregate");
56
+ // Expose loc from global if already initialized (via alias import), else build a best-effort namespace
57
+ exports.loc = globalThis.loc || (0, locAggregate_1.getLocNamespace)();
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,98 @@
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
+ const child_process_1 = require("child_process");
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ function getVersion(command) {
40
+ try {
41
+ return (0, child_process_1.execSync)(command, { encoding: 'utf8' }).trim();
42
+ }
43
+ catch (error) {
44
+ return 'Not installed';
45
+ }
46
+ }
47
+ function getPackageVersion(packageName) {
48
+ try {
49
+ const packageJsonPath = path.join(process.cwd(), 'node_modules', packageName, 'package.json');
50
+ if (fs.existsSync(packageJsonPath)) {
51
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
52
+ return packageJson.version;
53
+ }
54
+ return 'Not found';
55
+ }
56
+ catch (error) {
57
+ return 'Error reading version';
58
+ }
59
+ }
60
+ function getInstalledVersion(packageName) {
61
+ try {
62
+ const output = (0, child_process_1.execSync)(`npm list ${packageName} --depth=0`, { encoding: 'utf8' });
63
+ const match = output.match(new RegExp(`${packageName}@([\\d\\.]+)`));
64
+ return match ? match[1] : 'Not found';
65
+ }
66
+ catch (error) {
67
+ return 'Not installed';
68
+ }
69
+ }
70
+ function getPackageInfo() {
71
+ try {
72
+ const packageJsonPath = path.join(process.cwd(), 'package.json');
73
+ if (fs.existsSync(packageJsonPath)) {
74
+ return JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
75
+ }
76
+ return { name: 'Unknown', version: 'Unknown' };
77
+ }
78
+ catch (error) {
79
+ return { name: 'Error reading package.json', version: 'Error' };
80
+ }
81
+ }
82
+ console.log('šŸ” PlayQ Framework Version Information\n');
83
+ console.log('| Component | Version |');
84
+ console.log('|-----------|---------|');
85
+ console.log(`| Programming Language (TypeScript) | ${getVersion('npx tsc --version').replace('Version ', '')} |`);
86
+ console.log(`| Runtime Environment (Node.js) | ${getVersion('node --version').replace('v', '')} |`);
87
+ console.log(`| Automation Framework (Playwright) | ${getInstalledVersion('@playwright/test')} |`);
88
+ console.log(`| Test Runner (Playwright Test Runner) | ${getInstalledVersion('@playwright/test')} |`);
89
+ console.log(`| BDD Framework (Cucumber) | ${getInstalledVersion('@cucumber/cucumber')} |`);
90
+ console.log(`| Reporting (Allure Playwright) | ${getInstalledVersion('allure-playwright')} |`);
91
+ console.log(`| Data Generation Utility (Faker.js) | ${getInstalledVersion('@faker-js/faker')} |`);
92
+ console.log(`| Cross Platform (cross-env) | ${getInstalledVersion('cross-env')} |`);
93
+ console.log(`| File Operations (rimraf) | ${getInstalledVersion('rimraf')} |`);
94
+ console.log('\nšŸ“¦ Package Manager Information:');
95
+ console.log(`| npm | ${getVersion('npm --version')} |`);
96
+ const packageInfo = getPackageInfo();
97
+ console.log(`| Package Name | ${packageInfo.name || 'play-ts-cucumber'} |`);
98
+ console.log(`| Package Version | ${packageInfo.version || '1.0.0'} |`);
@@ -0,0 +1 @@
1
+ export declare function executePostTest(): void;
@@ -0,0 +1,29 @@
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.executePostTest = executePostTest;
7
+ const env_1 = require("../helper/bundle/env");
8
+ const path_1 = __importDefault(require("path"));
9
+ const { execSync } = require('child_process');
10
+ const global_1 = require("../global");
11
+ function executePostTest() {
12
+ (0, env_1.loadEnv)();
13
+ if (process.env.PLAYQ_RUNNER === 'cucumber') {
14
+ // CUCUMBER RUNNER
15
+ }
16
+ else {
17
+ // PLAYWRIGHT RUNNER
18
+ let allureSingleFile = (global_1.vars.getConfigValue('report.allure.singleFile') == 'true') ? '--single-file' : '';
19
+ execSync(`npx allure generate ${allureSingleFile} ./allure-results --output ./allure-report`, { stdio: 'inherit', cwd: path_1.default.resolve(__dirname, '../../') });
20
+ if (process.env.PLAYQ_REPORT_OPEN.toLowerCase() !== 'false' && global_1.vars.getConfigValue('testExecution.autoReportOpen') !== 'false') {
21
+ console.log('- [INFO] Report open disabled using PLAYQ_REPORT_OPEN');
22
+ execSync('npx allure open ./allure-report', { stdio: 'inherit', cwd: path_1.default.resolve(__dirname, '../../') });
23
+ }
24
+ }
25
+ }
26
+ // If called directly (not imported)
27
+ if (require.main === module) {
28
+ executePostTest();
29
+ }
@@ -0,0 +1 @@
1
+ export declare function setupEnvironment(): void;
@@ -0,0 +1,57 @@
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.setupEnvironment = setupEnvironment;
7
+ const env_1 = require("../helper/bundle/env");
8
+ const path_1 = __importDefault(require("path"));
9
+ const fs_1 = require("fs");
10
+ function setupEnvironment() {
11
+ (0, env_1.loadEnv)();
12
+ // If running in Cucumber mode, we need to handle pre-processing differently
13
+ if (process.env.PLAYQ_RUNNER === 'cucumber') {
14
+ // CUCUMBER RUNNER
15
+ // Remove allure-report directory in the project folder for cucumber runner
16
+ try {
17
+ (0, fs_1.rmSync)(path_1.default.resolve(process.env['PLAYQ_PROJECT_ROOT'], 'test-results'), { recursive: true, force: true });
18
+ }
19
+ catch (err) {
20
+ console.warn('Warning: Failed to remove allure-report', err);
21
+ }
22
+ require(path_1.default.resolve(process.env['PLAYQ_CORE_ROOT'], 'exec/preProcessEntry.ts'));
23
+ }
24
+ else {
25
+ // PLAYWRIGHT RUNNER
26
+ // Remove allure-report and allure-results directories
27
+ try {
28
+ (0, fs_1.rmSync)(path_1.default.resolve(process.env['PLAYQ_PROJECT_ROOT'], 'allure-report'), { recursive: true, force: true });
29
+ }
30
+ catch (err) {
31
+ console.warn('Warning: Failed to remove ./allure-report', err);
32
+ }
33
+ try {
34
+ (0, fs_1.rmSync)(path_1.default.resolve(process.env['PLAYQ_PROJECT_ROOT'], 'allure-results'), { recursive: true, force: true });
35
+ }
36
+ catch (err) {
37
+ console.warn('Warning: Failed to remove ./allure-results', err);
38
+ }
39
+ }
40
+ // General directory cleanup
41
+ try {
42
+ (0, fs_1.rmSync)(path_1.default.resolve(process.env['PLAYQ_PROJECT_ROOT'], '_Temp/sessions'), { recursive: true, force: true });
43
+ }
44
+ catch (err) {
45
+ console.warn('Warning: Failed to remove _Temp/sessions folder', err);
46
+ }
47
+ try {
48
+ (0, fs_1.rmSync)(path_1.default.resolve(process.env['PLAYQ_PROJECT_ROOT'], '_Temp/smartAI'), { recursive: true, force: true });
49
+ }
50
+ catch (err) {
51
+ console.warn('Warning: Failed to remove _Temp/smartAI folder', err);
52
+ }
53
+ }
54
+ // If called directly (not imported)
55
+ if (require.main === module) {
56
+ setupEnvironment();
57
+ }
@@ -0,0 +1 @@
1
+ export declare function encryptUserInput(): Promise<void>;