playwright-cucumber-ts-steps 1.0.4 → 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 +26 -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":""}