playwright-cucumber-ts-steps 1.0.5 → 1.0.6

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 (70) hide show
  1. package/dist/backend/actions/formTable.d.ts +2 -0
  2. package/dist/backend/actions/formTable.d.ts.map +1 -0
  3. package/dist/backend/actions/formTable.js +16 -7
  4. package/dist/backend/actions/index.d.ts +4 -0
  5. package/dist/backend/actions/index.d.ts.map +1 -0
  6. package/dist/backend/actions/interactions.d.ts +2 -0
  7. package/dist/backend/actions/interactions.d.ts.map +1 -0
  8. package/dist/backend/actions/interactions.js +24 -15
  9. package/dist/backend/actions/navigation.d.ts +2 -0
  10. package/dist/backend/actions/navigation.d.ts.map +1 -0
  11. package/dist/backend/actions/navigation.js +21 -12
  12. package/dist/backend/api/assertions.d.ts +2 -0
  13. package/dist/backend/api/assertions.d.ts.map +1 -0
  14. package/dist/backend/api/assertions.js +17 -8
  15. package/dist/backend/api/index.d.ts +4 -0
  16. package/dist/backend/api/index.d.ts.map +1 -0
  17. package/dist/backend/api/mock.d.ts +2 -0
  18. package/dist/backend/api/mock.d.ts.map +1 -0
  19. package/dist/backend/api/mock.js +24 -15
  20. package/dist/backend/api/requests.d.ts +2 -0
  21. package/dist/backend/api/requests.d.ts.map +1 -0
  22. package/dist/backend/api/requests.js +21 -12
  23. package/dist/backend/api/state.d.ts +6 -0
  24. package/dist/backend/api/state.d.ts.map +1 -0
  25. package/dist/backend/assertions/expectVisible.d.ts +3 -0
  26. package/dist/backend/assertions/expectVisible.d.ts.map +1 -0
  27. package/dist/backend/assertions/expectVisible.js +15 -4
  28. package/dist/backend/assertions/index.d.ts +4 -0
  29. package/dist/backend/assertions/index.d.ts.map +1 -0
  30. package/dist/backend/assertions/pageState.d.ts +2 -0
  31. package/dist/backend/assertions/pageState.d.ts.map +1 -0
  32. package/dist/backend/assertions/pageState.js +24 -15
  33. package/dist/backend/assertions/text.d.ts +2 -0
  34. package/dist/backend/assertions/text.d.ts.map +1 -0
  35. package/dist/backend/assertions/text.js +21 -12
  36. package/dist/backend/assertions/visibility.d.ts +2 -0
  37. package/dist/backend/assertions/visibility.d.ts.map +1 -0
  38. package/dist/backend/assertions/visibility.js +21 -12
  39. package/dist/backend/auth/index.d.ts +2 -0
  40. package/dist/backend/auth/index.d.ts.map +1 -0
  41. package/dist/backend/auth/index.js +15 -6
  42. package/dist/backend/db/index.d.ts +3 -0
  43. package/dist/backend/db/index.d.ts.map +1 -0
  44. package/dist/backend/db/state.d.ts +6 -0
  45. package/dist/backend/db/state.d.ts.map +1 -0
  46. package/dist/backend/db/state.js +12 -3
  47. package/dist/backend/db/steps.d.ts +2 -0
  48. package/dist/backend/db/steps.d.ts.map +1 -0
  49. package/dist/backend/db/steps.js +16 -7
  50. package/dist/backend/elements/alerts.d.ts +2 -0
  51. package/dist/backend/elements/alerts.d.ts.map +1 -0
  52. package/dist/backend/elements/alerts.js +24 -15
  53. package/dist/backend/elements/forms.d.ts +2 -0
  54. package/dist/backend/elements/forms.d.ts.map +1 -0
  55. package/dist/backend/elements/forms.js +21 -12
  56. package/dist/backend/elements/frames.d.ts +2 -0
  57. package/dist/backend/elements/frames.d.ts.map +1 -0
  58. package/dist/backend/elements/frames.js +20 -11
  59. package/dist/backend/elements/index.d.ts +4 -0
  60. package/dist/backend/elements/index.d.ts.map +1 -0
  61. package/dist/core/registry.d.ts +23 -0
  62. package/dist/core/registry.d.ts.map +1 -0
  63. package/dist/core/runner.d.ts +17 -0
  64. package/dist/core/runner.d.ts.map +1 -0
  65. package/dist/core/runner.js +16 -7
  66. package/dist/index.d.ts +4 -0
  67. package/dist/index.d.ts.map +1 -0
  68. package/dist/reporting/index.d.ts +12 -0
  69. package/dist/reporting/index.d.ts.map +1 -0
  70. package/package.json +1 -1
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=formTable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formTable.d.ts","sourceRoot":"","sources":["../../../src/backend/actions/formTable.ts"],"names":[],"mappings":""}
@@ -1,9 +1,18 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  const registry_1 = require("../../core/registry");
4
13
  const test_1 = require("@playwright/test");
5
14
  // CHANGE: Removed the ':' at the end of the string below
6
- (0, registry_1.Step)("I fill the following {string} form data", async (page, formName, tableData) => {
15
+ (0, registry_1.Step)("I fill the following {string} form data", (page, formName, tableData) => __awaiter(void 0, void 0, void 0, function* () {
7
16
  console.log(`📝 Processing Form: ${formName}`);
8
17
  // The runner passes the table data as the last argument
9
18
  // tableData = [ ['#username', 'tomsmith'], ['#password', '...'] ]
@@ -15,20 +24,20 @@ const test_1 = require("@playwright/test");
15
24
  const selector = row[0];
16
25
  const value = row[1];
17
26
  if (value === "click") {
18
- await page.click(selector);
27
+ yield page.click(selector);
19
28
  }
20
29
  else if (value === "check") {
21
- await page.check(selector);
30
+ yield page.check(selector);
22
31
  }
23
32
  else if (value === "assert:visible") {
24
- await (0, test_1.expect)(page.locator(selector)).toBeVisible();
33
+ yield (0, test_1.expect)(page.locator(selector)).toBeVisible();
25
34
  }
26
35
  else if (value.startsWith("assert:text:")) {
27
36
  const text = value.replace("assert:text:", "");
28
- await (0, test_1.expect)(page.locator(selector)).toHaveText(text);
37
+ yield (0, test_1.expect)(page.locator(selector)).toHaveText(text);
29
38
  }
30
39
  else {
31
- await page.fill(selector, value);
40
+ yield page.fill(selector, value);
32
41
  }
33
42
  }
34
- });
43
+ }));
@@ -0,0 +1,4 @@
1
+ import "./navigation";
2
+ import "./interactions";
3
+ import "./formTable";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/backend/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AACtB,OAAO,gBAAgB,CAAC;AACxB,OAAO,aAAa,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=interactions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interactions.d.ts","sourceRoot":"","sources":["../../../src/backend/actions/interactions.ts"],"names":[],"mappings":""}
@@ -1,23 +1,32 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  const registry_1 = require("../../core/registry");
4
13
  // Click
5
- (0, registry_1.Step)("I click {string}", async (page, selector) => {
6
- await page.click(selector);
7
- });
14
+ (0, registry_1.Step)("I click {string}", (page, selector) => __awaiter(void 0, void 0, void 0, function* () {
15
+ yield page.click(selector);
16
+ }));
8
17
  // Force Click (sometimes needed for stubborn elements)
9
- (0, registry_1.Step)("I force click {string}", async (page, selector) => {
10
- await page.click(selector, { force: true });
11
- });
18
+ (0, registry_1.Step)("I force click {string}", (page, selector) => __awaiter(void 0, void 0, void 0, function* () {
19
+ yield page.click(selector, { force: true });
20
+ }));
12
21
  // Type/Fill
13
- (0, registry_1.Step)("I fill {string} with {string}", async (page, selector, value) => {
14
- await page.fill(selector, value);
15
- });
22
+ (0, registry_1.Step)("I fill {string} with {string}", (page, selector, value) => __awaiter(void 0, void 0, void 0, function* () {
23
+ yield page.fill(selector, value);
24
+ }));
16
25
  // Press Key (e.g., "Enter")
17
- (0, registry_1.Step)("I press {string}", async (page, key) => {
18
- await page.keyboard.press(key);
19
- });
26
+ (0, registry_1.Step)("I press {string}", (page, key) => __awaiter(void 0, void 0, void 0, function* () {
27
+ yield page.keyboard.press(key);
28
+ }));
20
29
  // Wait (Hard wait - use sparingly!)
21
- (0, registry_1.Step)("I wait for {int} milliseconds", async (page, ms) => {
22
- await page.waitForTimeout(ms);
23
- });
30
+ (0, registry_1.Step)("I wait for {int} milliseconds", (page, ms) => __awaiter(void 0, void 0, void 0, function* () {
31
+ yield page.waitForTimeout(ms);
32
+ }));
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=navigation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../src/backend/actions/navigation.ts"],"names":[],"mappings":""}
@@ -1,19 +1,28 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  const registry_1 = require("../../core/registry");
4
13
  // Basic visit
5
- (0, registry_1.Step)("I visit {string}", async (page, url) => {
6
- await page.goto(url);
7
- });
14
+ (0, registry_1.Step)("I visit {string}", (page, url) => __awaiter(void 0, void 0, void 0, function* () {
15
+ yield page.goto(url);
16
+ }));
8
17
  // Visit and wait for network (useful for slow apps)
9
- (0, registry_1.Step)("I visit {string} and wait for network idle", async (page, url) => {
10
- await page.goto(url, { waitUntil: "networkidle" });
11
- });
18
+ (0, registry_1.Step)("I visit {string} and wait for network idle", (page, url) => __awaiter(void 0, void 0, void 0, function* () {
19
+ yield page.goto(url, { waitUntil: "networkidle" });
20
+ }));
12
21
  // Reload page
13
- (0, registry_1.Step)("I reload the page", async (page) => {
14
- await page.reload();
15
- });
22
+ (0, registry_1.Step)("I reload the page", (page) => __awaiter(void 0, void 0, void 0, function* () {
23
+ yield page.reload();
24
+ }));
16
25
  // Go back
17
- (0, registry_1.Step)("I go back", async (page) => {
18
- await page.goBack();
19
- });
26
+ (0, registry_1.Step)("I go back", (page) => __awaiter(void 0, void 0, void 0, function* () {
27
+ yield page.goBack();
28
+ }));
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=assertions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assertions.d.ts","sourceRoot":"","sources":["../../../src/backend/api/assertions.ts"],"names":[],"mappings":""}
@@ -1,26 +1,35 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  const test_1 = require("@playwright/test");
4
13
  const registry_1 = require("../../core/registry");
5
14
  const state_1 = require("./state");
6
15
  // Check Status Code
7
- (0, registry_1.Step)("I expect the response status to be {int}", async (page, statusCode) => {
16
+ (0, registry_1.Step)("I expect the response status to be {int}", (page, statusCode) => __awaiter(void 0, void 0, void 0, function* () {
8
17
  const response = state_1.apiState.getResponse();
9
18
  (0, test_1.expect)(response.status()).toBe(statusCode);
10
- });
19
+ }));
11
20
  // Check entire Body Text
12
- (0, registry_1.Step)("I expect the response body to contain {string}", async (page, text) => {
21
+ (0, registry_1.Step)("I expect the response body to contain {string}", (page, text) => __awaiter(void 0, void 0, void 0, function* () {
13
22
  const response = state_1.apiState.getResponse();
14
- const body = await response.text();
23
+ const body = yield response.text();
15
24
  (0, test_1.expect)(body).toContain(text);
16
- });
25
+ }));
17
26
  // Check JSON Property
18
- (0, registry_1.Step)("I expect the response property {string} to be {string}", async (page, jsonPath, value) => {
27
+ (0, registry_1.Step)("I expect the response property {string} to be {string}", (page, jsonPath, value) => __awaiter(void 0, void 0, void 0, function* () {
19
28
  const response = state_1.apiState.getResponse();
20
- const json = await response.json();
29
+ const json = yield response.json();
21
30
  // FIX: Added ': string' to the 'i' parameter
22
31
  const actualValue = jsonPath
23
32
  .split(".")
24
33
  .reduce((o, i) => o[i], json);
25
34
  (0, test_1.expect)(String(actualValue)).toBe(value);
26
- });
35
+ }));
@@ -0,0 +1,4 @@
1
+ import "./requests";
2
+ import "./assertions";
3
+ import "./mock";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/backend/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,CAAC;AACpB,OAAO,cAAc,CAAC;AACtB,OAAO,QAAQ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=mock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../../src/backend/api/mock.ts"],"names":[],"mappings":""}
@@ -32,44 +32,53 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
35
44
  Object.defineProperty(exports, "__esModule", { value: true });
36
45
  const registry_1 = require("../../core/registry");
37
46
  const fs = __importStar(require("fs"));
38
47
  const path = __importStar(require("path"));
39
48
  // 1. Mock with Inline JSON
40
49
  // Usage: Given I mock the API endpoint "/api/users" with body '{"id": 1, "name": "Fake"}'
41
- (0, registry_1.Step)("I mock the API endpoint {string} with body {string}", async (page, urlPattern, jsonBody) => {
42
- await page.route(urlPattern, async (route) => {
50
+ (0, registry_1.Step)("I mock the API endpoint {string} with body {string}", (page, urlPattern, jsonBody) => __awaiter(void 0, void 0, void 0, function* () {
51
+ yield page.route(urlPattern, (route) => __awaiter(void 0, void 0, void 0, function* () {
43
52
  const json = JSON.parse(jsonBody);
44
- await route.fulfill({
53
+ yield route.fulfill({
45
54
  status: 200,
46
55
  contentType: "application/json",
47
56
  body: JSON.stringify(json),
48
57
  });
49
- });
58
+ }));
50
59
  console.log(`🎭 Mocked ${urlPattern} with inline JSON`);
51
- });
60
+ }));
52
61
  // 2. Mock with File
53
62
  // Usage: Given I mock the API endpoint "/api/users" with response from "mocks/users.json"
54
- (0, registry_1.Step)("I mock the API endpoint {string} with response from {string}", async (page, urlPattern, filePath) => {
63
+ (0, registry_1.Step)("I mock the API endpoint {string} with response from {string}", (page, urlPattern, filePath) => __awaiter(void 0, void 0, void 0, function* () {
55
64
  const fullPath = path.resolve(process.cwd(), filePath);
56
65
  if (!fs.existsSync(fullPath)) {
57
66
  throw new Error(`❌ Mock file not found at: ${fullPath}`);
58
67
  }
59
68
  const bodyContent = fs.readFileSync(fullPath, "utf8");
60
- await page.route(urlPattern, async (route) => {
61
- await route.fulfill({
69
+ yield page.route(urlPattern, (route) => __awaiter(void 0, void 0, void 0, function* () {
70
+ yield route.fulfill({
62
71
  status: 200,
63
72
  contentType: "application/json",
64
73
  body: bodyContent,
65
74
  });
66
- });
75
+ }));
67
76
  console.log(`🎭 Mocked ${urlPattern} with file: ${filePath}`);
68
- });
77
+ }));
69
78
  // 3. Mock Status Code Only (Simulate Errors)
70
79
  // Usage: Given I mock the API endpoint "/api/broken" with status 500
71
- (0, registry_1.Step)("I mock the API endpoint {string} with status {int}", async (page, urlPattern, statusCode) => {
72
- await page.route(urlPattern, async (route) => {
73
- await route.fulfill({ status: statusCode });
74
- });
75
- });
80
+ (0, registry_1.Step)("I mock the API endpoint {string} with status {int}", (page, urlPattern, statusCode) => __awaiter(void 0, void 0, void 0, function* () {
81
+ yield page.route(urlPattern, (route) => __awaiter(void 0, void 0, void 0, function* () {
82
+ yield route.fulfill({ status: statusCode });
83
+ }));
84
+ }));
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=requests.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../../src/backend/api/requests.ts"],"names":[],"mappings":""}
@@ -32,28 +32,37 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
35
44
  Object.defineProperty(exports, "__esModule", { value: true });
36
45
  const registry_1 = require("../../core/registry");
37
46
  const state_1 = require("./state");
38
47
  const fs = __importStar(require("fs"));
39
48
  const path = __importStar(require("path"));
40
49
  // GET Request
41
- (0, registry_1.Step)("I make a GET request to {string}", async (page, url) => {
42
- const response = await page.request.get(url);
50
+ (0, registry_1.Step)("I make a GET request to {string}", (page, url) => __awaiter(void 0, void 0, void 0, function* () {
51
+ const response = yield page.request.get(url);
43
52
  state_1.apiState.setResponse(response);
44
53
  console.log(`GET ${url} - Status: ${response.status()}`);
45
- });
54
+ }));
46
55
  // DELETE Request
47
- (0, registry_1.Step)("I make a DELETE request to {string}", async (page, url) => {
48
- const response = await page.request.delete(url);
56
+ (0, registry_1.Step)("I make a DELETE request to {string}", (page, url) => __awaiter(void 0, void 0, void 0, function* () {
57
+ const response = yield page.request.delete(url);
49
58
  state_1.apiState.setResponse(response);
50
- });
59
+ }));
51
60
  // 1. POST with Data Table
52
61
  // Usage:
53
62
  // When I make a POST request to "/api/users" with data:
54
63
  // | name | John |
55
64
  // | job | Dev |
56
- (0, registry_1.Step)("I make a POST request to {string} with data", async (page, url, tableData) => {
65
+ (0, registry_1.Step)("I make a POST request to {string} with data", (page, url, tableData) => __awaiter(void 0, void 0, void 0, function* () {
57
66
  if (!tableData)
58
67
  throw new Error("This step requires a Data Table.");
59
68
  // Convert Table [ ["key", "val"], ["k2", "v2"] ] -> Object { key: "val", k2: "v2" }
@@ -61,15 +70,15 @@ const path = __importStar(require("path"));
61
70
  acc[row[0]] = row[1];
62
71
  return acc;
63
72
  }, {});
64
- const response = await page.request.post(url, {
73
+ const response = yield page.request.post(url, {
65
74
  data: payload,
66
75
  headers: { "Content-Type": "application/json" },
67
76
  });
68
77
  state_1.apiState.setResponse(response);
69
- });
78
+ }));
70
79
  // 2. POST with File Payload
71
80
  // Usage: When I make a POST request to "/api/users" with payload from "data/user.json"
72
- (0, registry_1.Step)("I make a POST request to {string} with payload from {string}", async (page, url, filePath) => {
81
+ (0, registry_1.Step)("I make a POST request to {string} with payload from {string}", (page, url, filePath) => __awaiter(void 0, void 0, void 0, function* () {
73
82
  // Resolve file path (relative to root)
74
83
  const fullPath = path.resolve(process.cwd(), filePath);
75
84
  if (!fs.existsSync(fullPath)) {
@@ -78,9 +87,9 @@ const path = __importStar(require("path"));
78
87
  // Read and parse JSON
79
88
  const fileContent = fs.readFileSync(fullPath, "utf8");
80
89
  const payload = JSON.parse(fileContent);
81
- const response = await page.request.post(url, {
90
+ const response = yield page.request.post(url, {
82
91
  data: payload,
83
92
  headers: { "Content-Type": "application/json" },
84
93
  });
85
94
  state_1.apiState.setResponse(response);
86
- });
95
+ }));
@@ -0,0 +1,6 @@
1
+ import { APIResponse } from "@playwright/test";
2
+ export declare const apiState: {
3
+ setResponse: (response: APIResponse) => void;
4
+ getResponse: () => APIResponse;
5
+ };
6
+ //# sourceMappingURL=state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/backend/api/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAK/C,eAAO,MAAM,QAAQ;4BACK,WAAW;;CAUpC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Page } from 'playwright';
2
+ export declare function expectVisible(page: Page, selector: string, timeout?: number): Promise<void>;
3
+ //# sourceMappingURL=expectVisible.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expectVisible.d.ts","sourceRoot":"","sources":["../../../src/backend/assertions/expectVisible.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,wBAAsB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,SAAO,iBAG/E"}
@@ -1,8 +1,19 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.expectVisible = expectVisible;
4
- async function expectVisible(page, selector, timeout = 2000) {
5
- const el = await page.waitForSelector(selector, { state: 'visible', timeout });
6
- if (!el)
7
- throw new Error(`Element ${selector} not visible`);
13
+ function expectVisible(page_1, selector_1) {
14
+ return __awaiter(this, arguments, void 0, function* (page, selector, timeout = 2000) {
15
+ const el = yield page.waitForSelector(selector, { state: 'visible', timeout });
16
+ if (!el)
17
+ throw new Error(`Element ${selector} not visible`);
18
+ });
8
19
  }
@@ -0,0 +1,4 @@
1
+ import "./visibility";
2
+ import "./text";
3
+ import "./pageState";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/backend/assertions/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AACtB,OAAO,QAAQ,CAAC;AAChB,OAAO,aAAa,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=pageState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pageState.d.ts","sourceRoot":"","sources":["../../../src/backend/assertions/pageState.ts"],"names":[],"mappings":""}
@@ -1,25 +1,34 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  const test_1 = require("@playwright/test");
4
13
  const registry_1 = require("../../core/registry");
5
14
  // URL Check
6
- (0, registry_1.Step)("I expect the url to be {string}", async (page, url) => {
7
- await (0, test_1.expect)(page).toHaveURL(url);
8
- });
15
+ (0, registry_1.Step)("I expect the url to be {string}", (page, url) => __awaiter(void 0, void 0, void 0, function* () {
16
+ yield (0, test_1.expect)(page).toHaveURL(url);
17
+ }));
9
18
  // Partial URL Check
10
- (0, registry_1.Step)("I expect the url to contain {string}", async (page, part) => {
19
+ (0, registry_1.Step)("I expect the url to contain {string}", (page, part) => __awaiter(void 0, void 0, void 0, function* () {
11
20
  // We use a RegExp to allow partial matching safely
12
- await (0, test_1.expect)(page).toHaveURL(new RegExp(part));
13
- });
21
+ yield (0, test_1.expect)(page).toHaveURL(new RegExp(part));
22
+ }));
14
23
  // Title Check
15
- (0, registry_1.Step)("I expect the title to be {string}", async (page, title) => {
16
- await (0, test_1.expect)(page).toHaveTitle(title);
17
- });
24
+ (0, registry_1.Step)("I expect the title to be {string}", (page, title) => __awaiter(void 0, void 0, void 0, function* () {
25
+ yield (0, test_1.expect)(page).toHaveTitle(title);
26
+ }));
18
27
  // Partial Title Check
19
- (0, registry_1.Step)("I expect the title to contain {string}", async (page, titlePart) => {
20
- await (0, test_1.expect)(page).toHaveTitle(new RegExp(titlePart));
21
- });
28
+ (0, registry_1.Step)("I expect the title to contain {string}", (page, titlePart) => __awaiter(void 0, void 0, void 0, function* () {
29
+ yield (0, test_1.expect)(page).toHaveTitle(new RegExp(titlePart));
30
+ }));
22
31
  // Screenshot Match (Visual Regression)
23
- (0, registry_1.Step)("I expect the page screenshot to match {string}", async (page, filename) => {
24
- await (0, test_1.expect)(page).toHaveScreenshot(filename);
25
- });
32
+ (0, registry_1.Step)("I expect the page screenshot to match {string}", (page, filename) => __awaiter(void 0, void 0, void 0, function* () {
33
+ yield (0, test_1.expect)(page).toHaveScreenshot(filename);
34
+ }));
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/backend/assertions/text.ts"],"names":[],"mappings":""}
@@ -1,20 +1,29 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  const test_1 = require("@playwright/test");
4
13
  const registry_1 = require("../../core/registry");
5
14
  // Exact text match
6
- (0, registry_1.Step)("I expect {string} to have text {string}", async (page, selector, text) => {
7
- await (0, test_1.expect)(page.locator(selector)).toHaveText(text);
8
- });
15
+ (0, registry_1.Step)("I expect {string} to have text {string}", (page, selector, text) => __awaiter(void 0, void 0, void 0, function* () {
16
+ yield (0, test_1.expect)(page.locator(selector)).toHaveText(text);
17
+ }));
9
18
  // Partial text match (contains)
10
- (0, registry_1.Step)("I expect {string} to contain text {string}", async (page, selector, text) => {
11
- await (0, test_1.expect)(page.locator(selector)).toContainText(text);
12
- });
19
+ (0, registry_1.Step)("I expect {string} to contain text {string}", (page, selector, text) => __awaiter(void 0, void 0, void 0, function* () {
20
+ yield (0, test_1.expect)(page.locator(selector)).toContainText(text);
21
+ }));
13
22
  // Check input value (for form fields)
14
- (0, registry_1.Step)("I expect {string} to have value {string}", async (page, selector, value) => {
15
- await (0, test_1.expect)(page.locator(selector)).toHaveValue(value);
16
- });
23
+ (0, registry_1.Step)("I expect {string} to have value {string}", (page, selector, value) => __awaiter(void 0, void 0, void 0, function* () {
24
+ yield (0, test_1.expect)(page.locator(selector)).toHaveValue(value);
25
+ }));
17
26
  // Check an attribute (e.g., class, href, src)
18
- (0, registry_1.Step)("I expect {string} to have attribute {string} with value {string}", async (page, selector, attr, value) => {
19
- await (0, test_1.expect)(page.locator(selector)).toHaveAttribute(attr, value);
20
- });
27
+ (0, registry_1.Step)("I expect {string} to have attribute {string} with value {string}", (page, selector, attr, value) => __awaiter(void 0, void 0, void 0, function* () {
28
+ yield (0, test_1.expect)(page.locator(selector)).toHaveAttribute(attr, value);
29
+ }));
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=visibility.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visibility.d.ts","sourceRoot":"","sources":["../../../src/backend/assertions/visibility.ts"],"names":[],"mappings":""}
@@ -1,20 +1,29 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  const test_1 = require("@playwright/test");
4
13
  const registry_1 = require("../../core/registry");
5
14
  // Check if element exists and is visible
6
- (0, registry_1.Step)("I expect {string} to be visible", async (page, selector) => {
7
- await (0, test_1.expect)(page.locator(selector)).toBeVisible();
8
- });
15
+ (0, registry_1.Step)("I expect {string} to be visible", (page, selector) => __awaiter(void 0, void 0, void 0, function* () {
16
+ yield (0, test_1.expect)(page.locator(selector)).toBeVisible();
17
+ }));
9
18
  // Check if element is hidden (or doesn't exist)
10
- (0, registry_1.Step)("I expect {string} to be hidden", async (page, selector) => {
11
- await (0, test_1.expect)(page.locator(selector)).toBeHidden();
12
- });
19
+ (0, registry_1.Step)("I expect {string} to be hidden", (page, selector) => __awaiter(void 0, void 0, void 0, function* () {
20
+ yield (0, test_1.expect)(page.locator(selector)).toBeHidden();
21
+ }));
13
22
  // Check if element is enabled (clickable)
14
- (0, registry_1.Step)("I expect {string} to be enabled", async (page, selector) => {
15
- await (0, test_1.expect)(page.locator(selector)).toBeEnabled();
16
- });
23
+ (0, registry_1.Step)("I expect {string} to be enabled", (page, selector) => __awaiter(void 0, void 0, void 0, function* () {
24
+ yield (0, test_1.expect)(page.locator(selector)).toBeEnabled();
25
+ }));
17
26
  // Check if element is disabled
18
- (0, registry_1.Step)("I expect {string} to be disabled", async (page, selector) => {
19
- await (0, test_1.expect)(page.locator(selector)).toBeDisabled();
20
- });
27
+ (0, registry_1.Step)("I expect {string} to be disabled", (page, selector) => __awaiter(void 0, void 0, void 0, function* () {
28
+ yield (0, test_1.expect)(page.locator(selector)).toBeDisabled();
29
+ }));
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/backend/auth/index.ts"],"names":[],"mappings":""}
@@ -32,25 +32,34 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
35
44
  Object.defineProperty(exports, "__esModule", { value: true });
36
45
  const registry_1 = require("../../core/registry");
37
46
  const path = __importStar(require("path"));
38
47
  const fs = __importStar(require("fs"));
39
48
  // 1. SAVE STATE (Use this after a successful login)
40
49
  // Example: And I save the browser state to "admin.json"
41
- (0, registry_1.Step)("I save the browser state to {string}", async (page, filename) => {
50
+ (0, registry_1.Step)("I save the browser state to {string}", (page, filename) => __awaiter(void 0, void 0, void 0, function* () {
42
51
  // Ensure the directory exists
43
52
  const authDir = path.resolve(process.cwd(), "auth");
44
53
  if (!fs.existsSync(authDir)) {
45
54
  fs.mkdirSync(authDir);
46
55
  }
47
56
  const filePath = path.resolve(authDir, filename);
48
- await page.context().storageState({ path: filePath });
57
+ yield page.context().storageState({ path: filePath });
49
58
  console.log(`✅ State saved to: ${filePath}`);
50
- });
59
+ }));
51
60
  // 2. LOAD STATE (Use this at the start of other scenarios)
52
61
  // Example: Given I load the browser state from "admin.json"
53
- (0, registry_1.Step)("I load the browser state from {string}", async (page, filename) => {
62
+ (0, registry_1.Step)("I load the browser state from {string}", (page, filename) => __awaiter(void 0, void 0, void 0, function* () {
54
63
  const filePath = path.resolve(process.cwd(), "auth", filename);
55
64
  if (!fs.existsSync(filePath)) {
56
65
  throw new Error(`❌ Auth file not found at: ${filePath}. Did you run the login scenario first?`);
@@ -59,7 +68,7 @@ const fs = __importStar(require("fs"));
59
68
  // To load it dynamically mid-test, we need to add cookies/origins to the current context.
60
69
  const state = JSON.parse(fs.readFileSync(filePath, "utf8"));
61
70
  if (state.cookies) {
62
- await page.context().addCookies(state.cookies);
71
+ yield page.context().addCookies(state.cookies);
63
72
  }
64
73
  if (state.origins) {
65
74
  // LocalStorage requires a bit more work, usually handled by context creation,
@@ -68,4 +77,4 @@ const fs = __importStar(require("fs"));
68
77
  // but this step is a great dynamic helper.
69
78
  }
70
79
  console.log(`✅ Loaded session for: ${filename}`);
71
- });
80
+ }));
@@ -0,0 +1,3 @@
1
+ import "./steps";
2
+ export { dbState } from "./state";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/backend/db/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const dbState: {
2
+ setAdapter: (fn: (query: string) => Promise<any>) => void;
3
+ executeQuery: (query: string) => Promise<any>;
4
+ getLastResult: () => any;
5
+ };
6
+ //# sourceMappingURL=state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/backend/db/state.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,OAAO;qBAED,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC;0BAKpB,MAAM;;CAcnC,CAAC"}
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.dbState = void 0;
4
13
  // Holds the user's custom DB function
@@ -10,15 +19,15 @@ exports.dbState = {
10
19
  dbAdapter = fn;
11
20
  },
12
21
  // Step calls this to run a query
13
- executeQuery: async (query) => {
22
+ executeQuery: (query) => __awaiter(void 0, void 0, void 0, function* () {
14
23
  if (!dbAdapter) {
15
24
  throw new Error("❌ No Database Adapter found. Pass a 'dbQuery' function to runTests().");
16
25
  }
17
- const result = await dbAdapter(query);
26
+ const result = yield dbAdapter(query);
18
27
  lastResult = result;
19
28
  console.log(`🗄️ DB Result:`, JSON.stringify(lastResult));
20
29
  return result;
21
- },
30
+ }),
22
31
  // Assertions use this to check results
23
32
  getLastResult: () => lastResult,
24
33
  };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=steps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../../../src/backend/db/steps.ts"],"names":[],"mappings":""}
@@ -1,14 +1,23 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  const registry_1 = require("../../core/registry");
4
13
  const state_1 = require("./state");
5
14
  const test_1 = require("@playwright/test");
6
15
  // 1. Run Query
7
- (0, registry_1.Step)("I run the database query {string}", async (page, query) => {
8
- await state_1.dbState.executeQuery(query);
9
- });
16
+ (0, registry_1.Step)("I run the database query {string}", (page, query) => __awaiter(void 0, void 0, void 0, function* () {
17
+ yield state_1.dbState.executeQuery(query);
18
+ }));
10
19
  // 2. Count Check
11
- (0, registry_1.Step)("I expect the database to return {int} record(s)", async (page, count) => {
20
+ (0, registry_1.Step)("I expect the database to return {int} record(s)", (page, count) => __awaiter(void 0, void 0, void 0, function* () {
12
21
  const result = state_1.dbState.getLastResult();
13
22
  if (Array.isArray(result)) {
14
23
  (0, test_1.expect)(result.length).toBe(count);
@@ -16,10 +25,10 @@ const test_1 = require("@playwright/test");
16
25
  else {
17
26
  throw new Error(`Expected array result but got: ${typeof result}`);
18
27
  }
19
- });
28
+ }));
20
29
  // 3. JSON/Table Check
21
30
  // CHANGE: Removed the colon ':' at the end of the string below
22
- (0, registry_1.Step)("I expect the first database record to contain", async (page, tableData) => {
31
+ (0, registry_1.Step)("I expect the first database record to contain", (page, tableData) => __awaiter(void 0, void 0, void 0, function* () {
23
32
  const result = state_1.dbState.getLastResult();
24
33
  // Guard Clauses
25
34
  if (!Array.isArray(result) || result.length === 0) {
@@ -40,4 +49,4 @@ const test_1 = require("@playwright/test");
40
49
  // Loose equality check (DB might return int, Gherkin sends string)
41
50
  (0, test_1.expect)(String(firstRow[key])).toBe(expectedValue);
42
51
  }
43
- });
52
+ }));
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=alerts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alerts.d.ts","sourceRoot":"","sources":["../../../src/backend/elements/alerts.ts"],"names":[],"mappings":""}
@@ -1,21 +1,30 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  const registry_1 = require("../../core/registry");
4
13
  // Accept the next popup (Alert/Confirm/Prompt)
5
- (0, registry_1.Step)("I accept the next dialog", async (page) => {
6
- page.once("dialog", async (dialog) => {
7
- await dialog.accept();
8
- });
9
- });
14
+ (0, registry_1.Step)("I accept the next dialog", (page) => __awaiter(void 0, void 0, void 0, function* () {
15
+ page.once("dialog", (dialog) => __awaiter(void 0, void 0, void 0, function* () {
16
+ yield dialog.accept();
17
+ }));
18
+ }));
10
19
  // Dismiss (Cancel) the next popup
11
- (0, registry_1.Step)("I dismiss the next dialog", async (page) => {
12
- page.once("dialog", async (dialog) => {
13
- await dialog.dismiss();
14
- });
15
- });
20
+ (0, registry_1.Step)("I dismiss the next dialog", (page) => __awaiter(void 0, void 0, void 0, function* () {
21
+ page.once("dialog", (dialog) => __awaiter(void 0, void 0, void 0, function* () {
22
+ yield dialog.dismiss();
23
+ }));
24
+ }));
16
25
  // Type text into a prompt and accept
17
- (0, registry_1.Step)("I type {string} into the next prompt and accept", async (page, text) => {
18
- page.once("dialog", async (dialog) => {
19
- await dialog.accept(text);
20
- });
21
- });
26
+ (0, registry_1.Step)("I type {string} into the next prompt and accept", (page, text) => __awaiter(void 0, void 0, void 0, function* () {
27
+ page.once("dialog", (dialog) => __awaiter(void 0, void 0, void 0, function* () {
28
+ yield dialog.accept(text);
29
+ }));
30
+ }));
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=forms.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forms.d.ts","sourceRoot":"","sources":["../../../src/backend/elements/forms.ts"],"names":[],"mappings":""}
@@ -32,28 +32,37 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
35
44
  Object.defineProperty(exports, "__esModule", { value: true });
36
45
  const registry_1 = require("../../core/registry");
37
46
  const path = __importStar(require("path"));
38
47
  // Dropdown: Select by value or label
39
- (0, registry_1.Step)("I select option {string} from {string}", async (page, option, selector) => {
40
- await page.selectOption(selector, { label: option }).catch(() => {
48
+ (0, registry_1.Step)("I select option {string} from {string}", (page, option, selector) => __awaiter(void 0, void 0, void 0, function* () {
49
+ yield page.selectOption(selector, { label: option }).catch(() => {
41
50
  // Fallback: try selecting by value if label fails
42
51
  return page.selectOption(selector, { value: option });
43
52
  });
44
- });
53
+ }));
45
54
  // Checkboxes & Radio Buttons
46
- (0, registry_1.Step)("I check {string}", async (page, selector) => {
47
- await page.check(selector);
48
- });
49
- (0, registry_1.Step)("I uncheck {string}", async (page, selector) => {
50
- await page.uncheck(selector);
51
- });
55
+ (0, registry_1.Step)("I check {string}", (page, selector) => __awaiter(void 0, void 0, void 0, function* () {
56
+ yield page.check(selector);
57
+ }));
58
+ (0, registry_1.Step)("I uncheck {string}", (page, selector) => __awaiter(void 0, void 0, void 0, function* () {
59
+ yield page.uncheck(selector);
60
+ }));
52
61
  // File Upload
53
62
  // Usage: When I upload file "data.csv" to "#upload-input"
54
- (0, registry_1.Step)("I upload file {string} to {string}", async (page, fileName, selector) => {
63
+ (0, registry_1.Step)("I upload file {string} to {string}", (page, fileName, selector) => __awaiter(void 0, void 0, void 0, function* () {
55
64
  // We assume the user puts files in a 'fixtures' or root folder.
56
65
  // You might want to customize this path resolution.
57
66
  const filePath = path.resolve(process.cwd(), fileName);
58
- await page.setInputFiles(selector, filePath);
59
- });
67
+ yield page.setInputFiles(selector, filePath);
68
+ }));
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=frames.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frames.d.ts","sourceRoot":"","sources":["../../../src/backend/elements/frames.ts"],"names":[],"mappings":""}
@@ -1,25 +1,34 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  const registry_1 = require("../../core/registry");
4
13
  // Click inside a specific frame
5
- (0, registry_1.Step)("I click {string} inside frame {string}", async (page, elementSelector, frameSelector) => {
14
+ (0, registry_1.Step)("I click {string} inside frame {string}", (page, elementSelector, frameSelector) => __awaiter(void 0, void 0, void 0, function* () {
6
15
  const frame = page.frameLocator(frameSelector);
7
- await frame.locator(elementSelector).click();
8
- });
16
+ yield frame.locator(elementSelector).click();
17
+ }));
9
18
  // Fill input inside a specific frame
10
- (0, registry_1.Step)("I fill {string} inside frame {string} with {string}", async (page, elementSelector, frameSelector, value) => {
19
+ (0, registry_1.Step)("I fill {string} inside frame {string} with {string}", (page, elementSelector, frameSelector, value) => __awaiter(void 0, void 0, void 0, function* () {
11
20
  const frame = page.frameLocator(frameSelector);
12
- await frame.locator(elementSelector).fill(value);
13
- });
21
+ yield frame.locator(elementSelector).fill(value);
22
+ }));
14
23
  // Assert text inside a specific frame
15
- (0, registry_1.Step)("I expect {string} inside frame {string} to have text {string}", async (page, elementSelector, frameSelector, text) => {
24
+ (0, registry_1.Step)("I expect {string} inside frame {string} to have text {string}", (page, elementSelector, frameSelector, text) => __awaiter(void 0, void 0, void 0, function* () {
16
25
  const frame = page.frameLocator(frameSelector);
17
26
  const locator = frame.locator(elementSelector);
18
27
  // We need to import expect for this assertion, or use a custom check
19
28
  // Since we are inside 'elements', let's just do a basic wait/check or re-export expect
20
- await locator.waitFor();
21
- const actualText = await locator.textContent();
22
- if (!actualText?.includes(text)) {
29
+ yield locator.waitFor();
30
+ const actualText = yield locator.textContent();
31
+ if (!(actualText === null || actualText === void 0 ? void 0 : actualText.includes(text))) {
23
32
  throw new Error(`Expected text "${text}" but found "${actualText}" in frame`);
24
33
  }
25
- });
34
+ }));
@@ -0,0 +1,4 @@
1
+ import "./forms";
2
+ import "./alerts";
3
+ import "./frames";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/backend/elements/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,CAAC;AACjB,OAAO,UAAU,CAAC;AAClB,OAAO,UAAU,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { CucumberExpression } from "@cucumber/cucumber-expressions";
2
+ import { Page } from "@playwright/test";
3
+ /**
4
+ * Registers a new Step Definition.
5
+ * * @param pattern - The Gherkin pattern (e.g., 'I click {string}')
6
+ * @param fn - The async function to execute. It receives the Playwright Page object as the first argument.
7
+ * * @example
8
+ * ```ts
9
+ * Step('I scroll to bottom', async (page) => {
10
+ * await page.evaluate(() => window.scrollTo(0, document.body.scrollHeight));
11
+ * });
12
+ * ```
13
+ */
14
+ export type StepAction = (page: Page, ...args: any[]) => Promise<void>;
15
+ interface StepDefinition {
16
+ expression: CucumberExpression;
17
+ fn: StepAction;
18
+ pattern: string;
19
+ }
20
+ export declare const stepRegistry: StepDefinition[];
21
+ export declare function Step(pattern: string, fn: StepAction): void;
22
+ export {};
23
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/core/registry.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAEnB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC;;;;;;;;;;GAUG;AAGH,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEvE,UAAU,cAAc;IACtB,UAAU,EAAE,kBAAkB,CAAC;IAC/B,EAAE,EAAE,UAAU,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAID,eAAO,MAAM,YAAY,EAAE,cAAc,EAAO,CAAC;AAMjD,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,QAQnD"}
@@ -0,0 +1,17 @@
1
+ import "../backend/actions/index";
2
+ import "../backend/assertions/index";
3
+ import "../backend/elements/index";
4
+ import "../backend/api/index";
5
+ import "../backend/auth/index";
6
+ import "../backend/db/index";
7
+ interface RunnerOptions {
8
+ tags?: string;
9
+ dbQuery?: (query: string) => Promise<any>;
10
+ }
11
+ /**
12
+ * The main test runner. Parses feature files and executes them as Playwright tests.
13
+ * Includes support for Data Tables and Auto-Screenshots.
14
+ */
15
+ export declare function runTests(featureGlob: string, options?: RunnerOptions): void;
16
+ export {};
17
+ //# sourceMappingURL=runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/core/runner.ts"],"names":[],"mappings":"AAOA,OAAO,0BAA0B,CAAC;AAClC,OAAO,6BAA6B,CAAC;AACrC,OAAO,2BAA2B,CAAC;AACnC,OAAO,sBAAsB,CAAC;AAC9B,OAAO,uBAAuB,CAAC;AAE/B,OAAO,qBAAqB,CAAC;AAE7B,UAAU,aAAa;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;CAC3C;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,QA8GpE"}
@@ -32,6 +32,15 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
35
44
  Object.defineProperty(exports, "__esModule", { value: true });
36
45
  exports.runTests = runTests;
37
46
  // src/core/runner.ts
@@ -53,7 +62,7 @@ require("../backend/db/index"); // Register DB steps
53
62
  */
54
63
  function runTests(featureGlob, options) {
55
64
  // 1. Register DB Adapter if provided
56
- if (options?.dbQuery) {
65
+ if (options === null || options === void 0 ? void 0 : options.dbQuery) {
57
66
  state_1.dbState.setAdapter(options.dbQuery);
58
67
  }
59
68
  const files = (0, glob_1.globSync)(featureGlob);
@@ -74,10 +83,10 @@ function runTests(featureGlob, options) {
74
83
  const nextMatchIndex = content.slice(startIndex).search(/Scenario:/);
75
84
  const blockEnd = nextMatchIndex === -1 ? content.length : startIndex + nextMatchIndex;
76
85
  const scenarioBlock = content.slice(startIndex, blockEnd);
77
- if (options?.tags && !foundTags.includes(options.tags)) {
86
+ if ((options === null || options === void 0 ? void 0 : options.tags) && !foundTags.includes(options.tags)) {
78
87
  continue;
79
88
  }
80
- (0, test_1.test)(scenarioName, async ({ page }, testInfo) => {
89
+ (0, test_1.test)(scenarioName, (_a, testInfo_1) => __awaiter(this, [_a, testInfo_1], void 0, function* ({ page }, testInfo) {
81
90
  const lines = scenarioBlock
82
91
  .trim()
83
92
  .split("\n")
@@ -119,23 +128,23 @@ function runTests(featureGlob, options) {
119
128
  args.push(tableData);
120
129
  }
121
130
  // Pass 'page' + args to the step function
122
- await stepDef.fn(page, ...args);
131
+ yield stepDef.fn(page, ...args);
123
132
  }
124
133
  catch (error) {
125
134
  console.error(`❌ Failed at step: "${stepText}"`);
126
135
  // Take a screenshot immediately
127
- const screenshot = await page.screenshot({
136
+ const screenshot = yield page.screenshot({
128
137
  fullPage: true,
129
138
  type: "png",
130
139
  });
131
- await testInfo.attach("failure-screenshot", {
140
+ yield testInfo.attach("failure-screenshot", {
132
141
  body: screenshot,
133
142
  contentType: "image/png",
134
143
  });
135
144
  throw error;
136
145
  }
137
146
  }
138
- });
147
+ }));
139
148
  }
140
149
  });
141
150
  }
@@ -0,0 +1,4 @@
1
+ export { runTests } from "./core/runner";
2
+ export { Step } from "./core/registry";
3
+ export { getReporters } from "./reporting/index";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,12 @@
1
+ interface ReportOptions {
2
+ on: ("html" | "slack" | "teams" | "json")[];
3
+ slackWebhookUrl?: string;
4
+ }
5
+ /**
6
+ * Helper to generate Playwright Reporter configuration.
7
+ * * @param options - Select which reporters to enable ('html', 'slack', etc.)
8
+ * @returns An array suitable for the 'reporter' field in playwright.config.ts
9
+ */
10
+ export declare function getReporters(options: ReportOptions): any[];
11
+ export {};
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/reporting/index.ts"],"names":[],"mappings":"AAEA,UAAU,aAAa;IACrB,EAAE,EAAE,CAAC,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC,EAAE,CAAC;IAC5C,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AACD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,aAAa,SAqClD"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "playwright-cucumber-ts-steps",
3
3
  "description": "A collection of reusable Playwright step definitions for Cucumber in TypeScript, designed to streamline end-to-end testing across web, API, and mobile applications.",
4
- "version": "1.0.5",
4
+ "version": "1.0.6",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",