playwright-cucumber-ts-steps 1.3.1 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +358 -671
- package/dist/backend/actions/click.d.ts +29 -29
- package/dist/backend/actions/click.js +59 -59
- package/dist/backend/actions/form.d.ts +2 -2
- package/dist/backend/actions/form.js +4 -4
- package/dist/backend/actions/formTable.d.ts +1 -1
- package/dist/backend/actions/formTable.js +2 -2
- package/dist/backend/actions/frames.d.ts +3 -3
- package/dist/backend/actions/frames.js +6 -6
- package/dist/backend/actions/inputs.d.ts +14 -14
- package/dist/backend/actions/inputs.js +32 -32
- package/dist/backend/actions/interactions.d.ts +7 -7
- package/dist/backend/actions/interactions.js +13 -13
- package/dist/backend/actions/keyboard.d.ts +6 -6
- package/dist/backend/actions/keyboard.js +12 -12
- package/dist/backend/actions/misc.d.ts +15 -15
- package/dist/backend/actions/misc.js +30 -30
- package/dist/backend/actions/mobile.d.ts +7 -7
- package/dist/backend/actions/mobile.js +14 -14
- package/dist/backend/actions/mouse.d.ts +9 -9
- package/dist/backend/actions/mouse.js +18 -18
- package/dist/backend/actions/navigation.d.ts +5 -5
- package/dist/backend/actions/navigation.js +10 -10
- package/dist/backend/actions/visual.d.ts +6 -6
- package/dist/backend/actions/visual.js +13 -13
- package/dist/backend/actions/waits.d.ts +6 -6
- package/dist/backend/actions/waits.js +12 -12
- package/dist/backend/api/assertions.d.ts +3 -3
- package/dist/backend/api/assertions.js +6 -6
- package/dist/backend/api/mock.d.ts +3 -3
- package/dist/backend/api/mock.js +6 -6
- package/dist/backend/api/network.d.ts +6 -6
- package/dist/backend/api/network.js +12 -12
- package/dist/backend/api/requests.d.ts +4 -4
- package/dist/backend/api/requests.js +8 -8
- package/dist/backend/assertions/document.d.ts +10 -10
- package/dist/backend/assertions/document.js +20 -20
- package/dist/backend/assertions/elements.d.ts +28 -28
- package/dist/backend/assertions/elements.js +56 -56
- package/dist/backend/assertions/expectVisible.d.ts +1 -1
- package/dist/backend/assertions/expectVisible.js +2 -2
- package/dist/backend/assertions/forms.d.ts +7 -7
- package/dist/backend/assertions/forms.js +14 -14
- package/dist/backend/assertions/pageState.d.ts +4 -4
- package/dist/backend/assertions/pageState.js +8 -8
- package/dist/backend/assertions/storage.d.ts +11 -11
- package/dist/backend/assertions/storage.js +22 -22
- package/dist/backend/assertions/text.d.ts +17 -17
- package/dist/backend/assertions/text.js +34 -34
- package/dist/backend/assertions/visibility.d.ts +15 -15
- package/dist/backend/assertions/visibility.js +30 -30
- package/dist/backend/auth/index.d.ts +2 -2
- package/dist/backend/auth/index.js +4 -4
- package/dist/backend/db/steps.d.ts +10 -10
- package/dist/backend/db/steps.d.ts.map +1 -1
- package/dist/backend/db/steps.js +19 -19
- package/dist/backend/elements/alerts.d.ts +3 -3
- package/dist/backend/elements/alerts.js +6 -6
- package/dist/backend/elements/find.d.ts +15 -15
- package/dist/backend/elements/find.js +41 -41
- package/dist/backend/elements/forms.d.ts +4 -4
- package/dist/backend/elements/forms.js +8 -8
- package/dist/backend/elements/frames.d.ts +3 -3
- package/dist/backend/elements/frames.js +6 -6
- package/dist/backend/utils/fixtures.d.ts +22 -0
- package/dist/backend/utils/fixtures.d.ts.map +1 -1
- package/dist/backend/utils/fixtures.js +76 -2
- package/dist/backend/utils/resolver.js +1 -1
- package/dist/component/runner.d.ts +1 -1
- package/dist/component/runner.d.ts.map +1 -1
- package/dist/component/runner.js +38 -5
- package/dist/core/runner.js +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/metadata.json +270 -270
- package/package.json +3 -2
|
@@ -1,10 +1,83 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setFixtureConfig = setFixtureConfig;
|
|
3
4
|
exports.loadFixture = loadFixture;
|
|
4
5
|
exports.getFixtureValue = getFixtureValue;
|
|
5
6
|
//src/backend/utils/fixtures.ts
|
|
6
7
|
const fs_1 = require("fs");
|
|
7
8
|
const path_1 = require("path");
|
|
9
|
+
/**
|
|
10
|
+
* Global fixture configuration.
|
|
11
|
+
* Can be overridden via setFixtureConfig() from playwright.config.ts
|
|
12
|
+
*/
|
|
13
|
+
let fixtureConfig = {
|
|
14
|
+
fixturesDir: "fixtures",
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Sets the fixture configuration from playwright.config.ts
|
|
18
|
+
* @param config - The fixture configuration object
|
|
19
|
+
*/
|
|
20
|
+
function setFixtureConfig(config) {
|
|
21
|
+
if (config.fixturesDir) {
|
|
22
|
+
fixtureConfig.fixturesDir = config.fixturesDir;
|
|
23
|
+
}
|
|
24
|
+
if (config.selectorsFile) {
|
|
25
|
+
fixtureConfig.selectorsFile = config.selectorsFile;
|
|
26
|
+
}
|
|
27
|
+
if (config.textsFile) {
|
|
28
|
+
fixtureConfig.textsFile = config.textsFile;
|
|
29
|
+
}
|
|
30
|
+
if (config.valuesFile) {
|
|
31
|
+
fixtureConfig.valuesFile = config.valuesFile;
|
|
32
|
+
}
|
|
33
|
+
if (config.optionsFile) {
|
|
34
|
+
fixtureConfig.optionsFile = config.optionsFile;
|
|
35
|
+
}
|
|
36
|
+
if (config.endpointsFile) {
|
|
37
|
+
fixtureConfig.endpointsFile = config.endpointsFile;
|
|
38
|
+
}
|
|
39
|
+
if (config.filesFile) {
|
|
40
|
+
fixtureConfig.filesFile = config.filesFile;
|
|
41
|
+
}
|
|
42
|
+
if (config.pathsFile) {
|
|
43
|
+
fixtureConfig.pathsFile = config.pathsFile;
|
|
44
|
+
}
|
|
45
|
+
if (config.responsesFile) {
|
|
46
|
+
fixtureConfig.responsesFile = config.responsesFile;
|
|
47
|
+
}
|
|
48
|
+
if (config.queriesFile) {
|
|
49
|
+
fixtureConfig.queriesFile = config.queriesFile;
|
|
50
|
+
}
|
|
51
|
+
if (config.columnsFile) {
|
|
52
|
+
fixtureConfig.columnsFile = config.columnsFile;
|
|
53
|
+
}
|
|
54
|
+
if (config.typesFile) {
|
|
55
|
+
fixtureConfig.typesFile = config.typesFile;
|
|
56
|
+
}
|
|
57
|
+
if (config.titlesFile) {
|
|
58
|
+
fixtureConfig.titlesFile = config.titlesFile;
|
|
59
|
+
}
|
|
60
|
+
if (config.urlsFile) {
|
|
61
|
+
fixtureConfig.urlsFile = config.urlsFile;
|
|
62
|
+
}
|
|
63
|
+
if (config.attributesFile) {
|
|
64
|
+
fixtureConfig.attributesFile = config.attributesFile;
|
|
65
|
+
}
|
|
66
|
+
if (config.promptsFile) {
|
|
67
|
+
fixtureConfig.promptsFile = config.promptsFile;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Resolves the actual file name for a given fixture type.
|
|
72
|
+
* Uses custom file name if configured, otherwise defaults to the standard name.
|
|
73
|
+
* @param fileName - The default/standard fixture file name
|
|
74
|
+
* @returns The configured file name or the default if not configured
|
|
75
|
+
*/
|
|
76
|
+
function resolveFileName(fileName) {
|
|
77
|
+
const configKey = fileName.replace(".json", "") + "File";
|
|
78
|
+
const customFile = fixtureConfig[configKey];
|
|
79
|
+
return customFile || fileName;
|
|
80
|
+
}
|
|
8
81
|
/**
|
|
9
82
|
* Loads a JSON fixture file from the test project's fixtures directory.
|
|
10
83
|
* Looks in the current working directory (test project root).
|
|
@@ -13,13 +86,14 @@ const path_1 = require("path");
|
|
|
13
86
|
*/
|
|
14
87
|
function loadFixture(fileName) {
|
|
15
88
|
try {
|
|
16
|
-
const
|
|
89
|
+
const actualFileName = resolveFileName(fileName);
|
|
90
|
+
const fixturePath = (0, path_1.resolve)(process.cwd(), fixtureConfig.fixturesDir, actualFileName);
|
|
17
91
|
const content = (0, fs_1.readFileSync)(fixturePath, "utf8");
|
|
18
92
|
return JSON.parse(content);
|
|
19
93
|
}
|
|
20
94
|
catch (_error) {
|
|
21
95
|
// Return empty object for optional fixtures
|
|
22
|
-
console.warn(`⚠️ Fixture "${fileName}" not found in
|
|
96
|
+
console.warn(`⚠️ Fixture "${fileName}" not found in "${fixtureConfig.fixturesDir}". Proceeding with empty object.`);
|
|
23
97
|
return {};
|
|
24
98
|
}
|
|
25
99
|
}
|
|
@@ -12,7 +12,7 @@ function resolveParam(key, fixtureFile) {
|
|
|
12
12
|
// getFixtureValue handles the logic of returning the raw key if the value isn't found
|
|
13
13
|
return (0, fixtures_1.getFixtureValue)(fixture, key);
|
|
14
14
|
}
|
|
15
|
-
catch (
|
|
15
|
+
catch (_error) {
|
|
16
16
|
// If fixture file is missing, fallback to the raw string
|
|
17
17
|
return key;
|
|
18
18
|
}
|
|
@@ -14,5 +14,5 @@ export interface ComponentRunnerOptions {
|
|
|
14
14
|
* Runs component tests using Playwright's component testing capabilities
|
|
15
15
|
* This allows testing individual UI components in isolation
|
|
16
16
|
*/
|
|
17
|
-
export declare function runComponentTests(entryPoint: string, options?: ComponentRunnerOptions): void
|
|
17
|
+
export declare function runComponentTests(entryPoint: string, options?: ComponentRunnerOptions): Promise<void>;
|
|
18
18
|
//# sourceMappingURL=runner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/component/runner.ts"],"names":[],"mappings":"AAMA,OAAO,0BAA0B,CAAC;AAClC,OAAO,6BAA6B,CAAC;AACrC,OAAO,2BAA2B,CAAC;AACnC,OAAO,sBAAsB,CAAC;AAC9B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,wBAAwB,CAAC;AAChC,OAAO,qBAAqB,CAAC;AAE7B,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/component/runner.ts"],"names":[],"mappings":"AAMA,OAAO,0BAA0B,CAAC;AAClC,OAAO,6BAA6B,CAAC;AACrC,OAAO,2BAA2B,CAAC;AACnC,OAAO,sBAAsB,CAAC;AAC9B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,wBAAwB,CAAC;AAChC,OAAO,qBAAqB,CAAC;AAE7B,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,sBAAsB,iBAmC3F"}
|
package/dist/component/runner.js
CHANGED
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.runComponentTests = runComponentTests;
|
|
4
37
|
// src/component/runner.ts
|
|
@@ -17,17 +50,17 @@ require("../backend/db/index");
|
|
|
17
50
|
* Runs component tests using Playwright's component testing capabilities
|
|
18
51
|
* This allows testing individual UI components in isolation
|
|
19
52
|
*/
|
|
20
|
-
function runComponentTests(entryPoint, options) {
|
|
53
|
+
async function runComponentTests(entryPoint, options) {
|
|
21
54
|
const files = (0, glob_1.globSync)(options?.componentGlob || entryPoint);
|
|
22
55
|
if (files.length === 0) {
|
|
23
56
|
console.log(`⚠️ No Component test files found for: ${entryPoint}`);
|
|
24
57
|
}
|
|
25
58
|
for (const file of files) {
|
|
26
59
|
// Import the component test file to register any component-specific steps
|
|
27
|
-
|
|
60
|
+
await Promise.resolve(`${file}`).then(s => __importStar(require(s)));
|
|
28
61
|
// Run tests using Playwright's component testing setup
|
|
29
62
|
test_1.test.describe(`Component: ${file}`, () => {
|
|
30
|
-
test_1.test.beforeEach(async ({ page }) => {
|
|
63
|
+
test_1.test.beforeEach(async ({ page: _page }) => {
|
|
31
64
|
// Component testing setup would happen here
|
|
32
65
|
// In actual component testing, we'd mount components directly
|
|
33
66
|
console.log(`🔧 Preparing component test environment for: ${file}`);
|
|
@@ -36,7 +69,7 @@ function runComponentTests(entryPoint, options) {
|
|
|
36
69
|
for (const step of registry_1.stepRegistry) {
|
|
37
70
|
// Only run steps that are relevant to component testing
|
|
38
71
|
if (isComponentRelevantStep(step)) {
|
|
39
|
-
(0, test_1.test)(`Component step: ${typeof step.pattern === 'string' ? step.pattern : step.pattern.source}`, async ({ page }) => {
|
|
72
|
+
(0, test_1.test)(`Component step: ${typeof step.pattern === 'string' ? step.pattern : step.pattern.source}`, async ({ page: _page }) => {
|
|
40
73
|
// In component testing context, we might have different parameters
|
|
41
74
|
// For now, we'll just log that this would be a component test
|
|
42
75
|
console.log(`🧪 Running component test for step: ${typeof step.pattern === 'string' ? step.pattern : step.pattern.source}`);
|
|
@@ -51,7 +84,7 @@ function runComponentTests(entryPoint, options) {
|
|
|
51
84
|
/**
|
|
52
85
|
* Determines if a step is relevant for component testing
|
|
53
86
|
*/
|
|
54
|
-
function isComponentRelevantStep(
|
|
87
|
+
function isComponentRelevantStep(_step) {
|
|
55
88
|
// For now, consider all steps potentially relevant for component testing
|
|
56
89
|
// In the future, we could have more specific logic
|
|
57
90
|
return true;
|
package/dist/core/runner.js
CHANGED
|
@@ -179,7 +179,7 @@ function runTests(featureGlob, options) {
|
|
|
179
179
|
// 3. SCENARIO REGEX
|
|
180
180
|
// For scenario tags, we need to be more careful about comments
|
|
181
181
|
// We'll process each scenario individually to check for comment lines
|
|
182
|
-
const
|
|
182
|
+
const _scenarioPattern = /(?:((?:@\S+\s*)+))?(?:Scenario|Scenario Outline):\s*(.+)/g;
|
|
183
183
|
let match;
|
|
184
184
|
let foundCount = 0;
|
|
185
185
|
// 3. SCENARIO REGEX
|
|
@@ -221,7 +221,7 @@ function runTests(featureGlob, options) {
|
|
|
221
221
|
if (originalMatch) {
|
|
222
222
|
// Find the exact position of this scenario in the original content
|
|
223
223
|
const scenarioStartPattern = `(?:((?:@\\S+\\s*)+))?\\s*(?:Scenario|Scenario Outline):\\s*${escapeRegExp(scenarioName)}`;
|
|
224
|
-
const
|
|
224
|
+
const _scenarioStartRegex = new RegExp(scenarioStartPattern);
|
|
225
225
|
const scenarioStartMatch = content.match(scenarioStartPattern);
|
|
226
226
|
if (scenarioStartMatch && scenarioStartMatch.index !== undefined) {
|
|
227
227
|
const startIndex = scenarioStartMatch.index + scenarioStartMatch[0].length;
|
|
@@ -304,7 +304,7 @@ function findMatchingStep(text) {
|
|
|
304
304
|
};
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
|
-
catch (
|
|
307
|
+
catch (_e) {
|
|
308
308
|
// Continue to next step if Cucumber Expression fails
|
|
309
309
|
continue;
|
|
310
310
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { runTests } from "./core/runner";
|
|
|
2
2
|
export { Step } from "./core/registry";
|
|
3
3
|
export { getReporters } from "./reporting/index";
|
|
4
4
|
export { runComponentTests } from "./component/index";
|
|
5
|
+
export { setFixtureConfig } from "./backend/utils/fixtures";
|
|
5
6
|
export type { RunnerOptions } from "./core/runner";
|
|
6
7
|
export type { ReportOptions } from "./reporting/index";
|
|
7
8
|
export type { StepAction } from "./core/registry";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAG5D,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,YAAY,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runComponentTests = exports.getReporters = exports.Step = exports.runTests = void 0;
|
|
3
|
+
exports.setFixtureConfig = exports.runComponentTests = exports.getReporters = exports.Step = exports.runTests = void 0;
|
|
4
4
|
var runner_1 = require("./core/runner");
|
|
5
5
|
Object.defineProperty(exports, "runTests", { enumerable: true, get: function () { return runner_1.runTests; } });
|
|
6
6
|
var registry_1 = require("./core/registry");
|
|
@@ -9,3 +9,5 @@ var index_1 = require("./reporting/index");
|
|
|
9
9
|
Object.defineProperty(exports, "getReporters", { enumerable: true, get: function () { return index_1.getReporters; } });
|
|
10
10
|
var index_2 = require("./component/index");
|
|
11
11
|
Object.defineProperty(exports, "runComponentTests", { enumerable: true, get: function () { return index_2.runComponentTests; } });
|
|
12
|
+
var fixtures_1 = require("./backend/utils/fixtures");
|
|
13
|
+
Object.defineProperty(exports, "setFixtureConfig", { enumerable: true, get: function () { return fixtures_1.setFixtureConfig; } });
|