@zohodesk/testinglibrary 2.9.2 → 3.0.1
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/.gitlab-ci.yml +1 -1
- package/README.md +27 -1
- package/build/core/playwright/fixtures.js +24 -0
- package/build/core/playwright/helpers/fileMutex.js +10 -12
- package/build/core/playwright/index.js +10 -23
- package/build/core/playwright/setup/config-creator.js +3 -3
- package/build/core/playwright/setup/config-utils.js +8 -25
- package/build/core/playwright/tagProcessor.js +18 -28
- package/build/core/playwright/test-runner.js +1 -1
- package/build/decorators.d.ts +1 -1
- package/build/decorators.js +1 -1
- package/build/setup-folder-structure/samples/actors-index.js +2 -0
- package/build/setup-folder-structure/samples/auth-setup-sample.js +14 -66
- package/build/setup-folder-structure/samples/editions-index.js +3 -0
- package/build/setup-folder-structure/samples/free-sample.json +25 -0
- package/build/setup-folder-structure/samples/settings.json +7 -0
- package/build/setup-folder-structure/setupProject.js +18 -5
- package/nobdd/uat/conf/nobdd/uat.config.js +1 -2
- package/nobdd/uat.config.js +1 -2
- package/package.json +7 -7
- package/build/bdd-framework/cli/commands/env.js +0 -42
- package/build/bdd-framework/cli/commands/export.js +0 -62
- package/build/bdd-framework/cli/commands/test.js +0 -64
- package/build/bdd-framework/cli/index.js +0 -11
- package/build/bdd-framework/cli/options.js +0 -19
- package/build/bdd-framework/cli/worker.js +0 -13
- package/build/bdd-framework/config/configDir.js +0 -35
- package/build/bdd-framework/config/enrichReporterData.js +0 -23
- package/build/bdd-framework/config/env.js +0 -50
- package/build/bdd-framework/config/index.js +0 -94
- package/build/bdd-framework/config/lang.js +0 -14
- package/build/bdd-framework/cucumber/buildStepDefinition.js +0 -43
- package/build/bdd-framework/cucumber/createTestStep.js +0 -43
- package/build/bdd-framework/cucumber/formatter/EventDataCollector.js +0 -126
- package/build/bdd-framework/cucumber/formatter/GherkinDocumentParser.js +0 -72
- package/build/bdd-framework/cucumber/formatter/PickleParser.js +0 -25
- package/build/bdd-framework/cucumber/formatter/durationHelpers.js +0 -13
- package/build/bdd-framework/cucumber/formatter/getColorFns.js +0 -57
- package/build/bdd-framework/cucumber/formatter/index.js +0 -16
- package/build/bdd-framework/cucumber/formatter/locationHelpers.js +0 -16
- package/build/bdd-framework/cucumber/loadConfig.js +0 -17
- package/build/bdd-framework/cucumber/loadFeatures.js +0 -70
- package/build/bdd-framework/cucumber/loadSnippetBuilder.js +0 -20
- package/build/bdd-framework/cucumber/loadSteps.js +0 -47
- package/build/bdd-framework/cucumber/resolveFeaturePaths.js +0 -62
- package/build/bdd-framework/cucumber/stepArguments.js +0 -21
- package/build/bdd-framework/cucumber/types.js +0 -5
- package/build/bdd-framework/cucumber/valueChecker.js +0 -23
- package/build/bdd-framework/decorators.js +0 -18
- package/build/bdd-framework/gen/fixtures.js +0 -48
- package/build/bdd-framework/gen/formatter.js +0 -167
- package/build/bdd-framework/gen/i18n.js +0 -39
- package/build/bdd-framework/gen/index.js +0 -197
- package/build/bdd-framework/gen/specialTags.js +0 -70
- package/build/bdd-framework/gen/testFile.js +0 -470
- package/build/bdd-framework/gen/testMeta.js +0 -60
- package/build/bdd-framework/gen/testNode.js +0 -35
- package/build/bdd-framework/gen/testPoms.js +0 -133
- package/build/bdd-framework/hooks/scenario.js +0 -130
- package/build/bdd-framework/hooks/worker.js +0 -89
- package/build/bdd-framework/index.js +0 -52
- package/build/bdd-framework/playwright/fixtureParameterNames.js +0 -93
- package/build/bdd-framework/playwright/getLocationInFile.js +0 -79
- package/build/bdd-framework/playwright/loadConfig.js +0 -42
- package/build/bdd-framework/playwright/loadUtils.js +0 -33
- package/build/bdd-framework/playwright/testTypeImpl.js +0 -79
- package/build/bdd-framework/playwright/transform.js +0 -88
- package/build/bdd-framework/playwright/types.js +0 -12
- package/build/bdd-framework/playwright/utils.js +0 -56
- package/build/bdd-framework/reporter/cucumber/base.js +0 -52
- package/build/bdd-framework/reporter/cucumber/custom.js +0 -73
- package/build/bdd-framework/reporter/cucumber/helper.js +0 -12
- package/build/bdd-framework/reporter/cucumber/html.js +0 -40
- package/build/bdd-framework/reporter/cucumber/index.js +0 -74
- package/build/bdd-framework/reporter/cucumber/json.js +0 -312
- package/build/bdd-framework/reporter/cucumber/junit.js +0 -205
- package/build/bdd-framework/reporter/cucumber/message.js +0 -20
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/AttachmentMapper.js +0 -82
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/Builder.js +0 -197
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/GherkinDocument.js +0 -43
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/GherkinDocumentClone.js +0 -52
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/GherkinDocuments.js +0 -105
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/Hook.js +0 -70
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/Meta.js +0 -45
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/Pickles.js +0 -27
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/Projects.js +0 -38
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestCase.js +0 -128
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestCaseRun.js +0 -154
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestCaseRunHooks.js +0 -123
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestStepAttachments.js +0 -67
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestStepRun.js +0 -114
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/index.js +0 -30
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/pwStepUtils.js +0 -70
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/timing.js +0 -35
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/types.js +0 -5
- package/build/bdd-framework/run/StepInvoker.js +0 -69
- package/build/bdd-framework/run/bddData/index.js +0 -59
- package/build/bdd-framework/run/bddData/types.js +0 -5
- package/build/bdd-framework/run/bddFixtures.js +0 -192
- package/build/bdd-framework/run/bddWorld.js +0 -79
- package/build/bdd-framework/run/bddWorldInternal.js +0 -11
- package/build/bdd-framework/snippets/index.js +0 -132
- package/build/bdd-framework/snippets/snippetSyntax.js +0 -43
- package/build/bdd-framework/snippets/snippetSyntaxDecorators.js +0 -26
- package/build/bdd-framework/snippets/snippetSyntaxTs.js +0 -18
- package/build/bdd-framework/stepDefinitions/createBdd.js +0 -66
- package/build/bdd-framework/stepDefinitions/decorators/class.js +0 -68
- package/build/bdd-framework/stepDefinitions/decorators/steps.js +0 -99
- package/build/bdd-framework/stepDefinitions/defineStep.js +0 -62
- package/build/bdd-framework/stepDefinitions/stepConfig.js +0 -24
- package/build/bdd-framework/steps/createBdd.js +0 -78
- package/build/bdd-framework/steps/decorators/class.js +0 -68
- package/build/bdd-framework/steps/decorators/steps.js +0 -98
- package/build/bdd-framework/steps/defineStep.js +0 -62
- package/build/bdd-framework/steps/stepConfig.js +0 -24
- package/build/bdd-framework/utils/AutofillMap.js +0 -20
- package/build/bdd-framework/utils/exit.js +0 -62
- package/build/bdd-framework/utils/index.js +0 -93
- package/build/bdd-framework/utils/jsStringWrap.js +0 -44
- package/build/bdd-framework/utils/logger.js +0 -30
- package/build/bdd-framework/utils/stripAnsiEscapes.js +0 -20
- package/build/setup-folder-structure/samples/authUsers-sample.json +0 -9
- package/build/setup-folder-structure/samples/env-config-sample.json +0 -21
- package/nobdd/src/App.js +0 -7
- package/npm-shrinkwrap.json +0 -6475
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getGherkinExampleRuleMap = getGherkinExampleRuleMap;
|
|
7
|
-
exports.getGherkinScenarioLocationMap = getGherkinScenarioLocationMap;
|
|
8
|
-
exports.getGherkinScenarioMap = getGherkinScenarioMap;
|
|
9
|
-
exports.getGherkinStepMap = getGherkinStepMap;
|
|
10
|
-
var _valueChecker = require("../valueChecker");
|
|
11
|
-
/**
|
|
12
|
-
* Based on: https://github.com/cucumber/cucumber-js/blob/main/src/formatter/helpers/gherkin_document_parser.ts
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
function getGherkinStepMap(gherkinDocument) {
|
|
16
|
-
var _gherkinDocument$feat;
|
|
17
|
-
const result = {};
|
|
18
|
-
(_gherkinDocument$feat = gherkinDocument.feature) === null || _gherkinDocument$feat === void 0 || _gherkinDocument$feat.children.map(extractStepContainers).flat().forEach(x => x.steps.forEach(step => result[step.id] = step));
|
|
19
|
-
return result;
|
|
20
|
-
}
|
|
21
|
-
function extractStepContainers(child) {
|
|
22
|
-
if ((0, _valueChecker.doesHaveValue)(child.background)) {
|
|
23
|
-
return [child.background];
|
|
24
|
-
} else if ((0, _valueChecker.doesHaveValue)(child.rule)) {
|
|
25
|
-
return child.rule.children.map(ruleChild => (0, _valueChecker.doesHaveValue)(ruleChild.background) ? ruleChild.background : ruleChild.scenario).filter(v => !!v);
|
|
26
|
-
} else if ((0, _valueChecker.doesHaveValue)(child.scenario)) {
|
|
27
|
-
return [child.scenario];
|
|
28
|
-
} else {
|
|
29
|
-
throw new Error('Empty step container');
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
function getGherkinScenarioMap(gherkinDocument) {
|
|
33
|
-
var _gherkinDocument$feat2;
|
|
34
|
-
const result = {};
|
|
35
|
-
(_gherkinDocument$feat2 = gherkinDocument.feature) === null || _gherkinDocument$feat2 === void 0 || _gherkinDocument$feat2.children.map(child => {
|
|
36
|
-
if ((0, _valueChecker.doesHaveValue)(child.rule)) {
|
|
37
|
-
return child.rule.children;
|
|
38
|
-
}
|
|
39
|
-
return [child];
|
|
40
|
-
}).flat().forEach(x => {
|
|
41
|
-
if (x.scenario != null) {
|
|
42
|
-
result[x.scenario.id] = x.scenario;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
return result;
|
|
46
|
-
}
|
|
47
|
-
function getGherkinExampleRuleMap(gherkinDocument) {
|
|
48
|
-
var _gherkinDocument$feat3;
|
|
49
|
-
const result = {};
|
|
50
|
-
(_gherkinDocument$feat3 = gherkinDocument.feature) === null || _gherkinDocument$feat3 === void 0 || _gherkinDocument$feat3.children.filter(x => x.rule != null).forEach(x => {
|
|
51
|
-
var _x$rule;
|
|
52
|
-
return x === null || x === void 0 || (_x$rule = x.rule) === null || _x$rule === void 0 ? void 0 : _x$rule.children.filter(child => (0, _valueChecker.doesHaveValue)(child.scenario)).forEach(child => {
|
|
53
|
-
var _child$scenario;
|
|
54
|
-
if (child !== null && child !== void 0 && (_child$scenario = child.scenario) !== null && _child$scenario !== void 0 && _child$scenario.id && x.rule) {
|
|
55
|
-
result[child.scenario.id] = x.rule;
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
return result;
|
|
60
|
-
}
|
|
61
|
-
function getGherkinScenarioLocationMap(gherkinDocument) {
|
|
62
|
-
const locationMap = {};
|
|
63
|
-
const scenarioMap = getGherkinScenarioMap(gherkinDocument);
|
|
64
|
-
Object.keys(scenarioMap).forEach(id => {
|
|
65
|
-
const scenario = scenarioMap[id];
|
|
66
|
-
locationMap[id] = scenario.location;
|
|
67
|
-
if ((0, _valueChecker.doesHaveValue)(scenario.examples)) {
|
|
68
|
-
scenario.examples.forEach(x => x.tableBody.forEach(tableRow => locationMap[tableRow.id] = tableRow.location));
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
return locationMap;
|
|
72
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getPickleStepMap = getPickleStepMap;
|
|
7
|
-
exports.getScenarioDescription = getScenarioDescription;
|
|
8
|
-
exports.getStepKeyword = getStepKeyword;
|
|
9
|
-
function getScenarioDescription({
|
|
10
|
-
pickle,
|
|
11
|
-
gherkinScenarioMap
|
|
12
|
-
}) {
|
|
13
|
-
return pickle.astNodeIds.map(id => gherkinScenarioMap[id]).filter(x => x != null)[0].description;
|
|
14
|
-
}
|
|
15
|
-
function getStepKeyword({
|
|
16
|
-
pickleStep,
|
|
17
|
-
gherkinStepMap
|
|
18
|
-
}) {
|
|
19
|
-
return pickleStep.astNodeIds.map(id => gherkinStepMap[id]).filter(x => x != null)[0].keyword;
|
|
20
|
-
}
|
|
21
|
-
function getPickleStepMap(pickle) {
|
|
22
|
-
const result = {};
|
|
23
|
-
pickle.steps.forEach(pickleStep => result[pickleStep.id] = pickleStep);
|
|
24
|
-
return result;
|
|
25
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.durationToNanoseconds = durationToNanoseconds;
|
|
7
|
-
/**
|
|
8
|
-
* See: https://github.com/cucumber/cucumber-js/blob/main/src/formatter/helpers/duration_helpers.ts#L5
|
|
9
|
-
*/
|
|
10
|
-
const NANOS_IN_SECOND = 1_000_000_000;
|
|
11
|
-
function durationToNanoseconds(duration) {
|
|
12
|
-
return Math.floor(duration.seconds * NANOS_IN_SECOND + duration.nanos);
|
|
13
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = getColorFns;
|
|
8
|
-
var _chalk = _interopRequireDefault(require("chalk"));
|
|
9
|
-
var _supportsColor = require("supports-color");
|
|
10
|
-
var _valueChecker = require("../valueChecker");
|
|
11
|
-
function getColorFns(stream, env, enabled) {
|
|
12
|
-
const support = detectSupport(stream, env, enabled);
|
|
13
|
-
if (support) {
|
|
14
|
-
const chalkInstance = new _chalk.default.Instance(support);
|
|
15
|
-
return {
|
|
16
|
-
forStatus(status) {
|
|
17
|
-
return {
|
|
18
|
-
AMBIGUOUS: chalkInstance.red.bind(_chalk.default),
|
|
19
|
-
FAILED: chalkInstance.red.bind(_chalk.default),
|
|
20
|
-
PASSED: chalkInstance.green.bind(_chalk.default),
|
|
21
|
-
PENDING: chalkInstance.yellow.bind(_chalk.default),
|
|
22
|
-
SKIPPED: chalkInstance.cyan.bind(_chalk.default),
|
|
23
|
-
UNDEFINED: chalkInstance.yellow.bind(_chalk.default),
|
|
24
|
-
UNKNOWN: chalkInstance.yellow.bind(_chalk.default)
|
|
25
|
-
}[status];
|
|
26
|
-
},
|
|
27
|
-
location: chalkInstance.gray.bind(_chalk.default),
|
|
28
|
-
tag: chalkInstance.cyan.bind(_chalk.default),
|
|
29
|
-
diffAdded: chalkInstance.green.bind(_chalk.default),
|
|
30
|
-
diffRemoved: chalkInstance.red.bind(_chalk.default),
|
|
31
|
-
errorMessage: chalkInstance.red.bind(_chalk.default),
|
|
32
|
-
errorStack: chalkInstance.grey.bind(_chalk.default)
|
|
33
|
-
};
|
|
34
|
-
} else {
|
|
35
|
-
return {
|
|
36
|
-
forStatus() {
|
|
37
|
-
return x => x;
|
|
38
|
-
},
|
|
39
|
-
location: x => x,
|
|
40
|
-
tag: x => x,
|
|
41
|
-
diffAdded: x => x,
|
|
42
|
-
diffRemoved: x => x,
|
|
43
|
-
errorMessage: x => x,
|
|
44
|
-
errorStack: x => x
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
function detectSupport(stream, env, enabled) {
|
|
49
|
-
const support = (0, _supportsColor.supportsColor)(stream);
|
|
50
|
-
// if we find FORCE_COLOR, we can let the supports-color library handle that
|
|
51
|
-
if ('FORCE_COLOR' in env || (0, _valueChecker.doesNotHaveValue)(enabled)) {
|
|
52
|
-
return support;
|
|
53
|
-
}
|
|
54
|
-
return enabled ? support || {
|
|
55
|
-
level: 1
|
|
56
|
-
} : false;
|
|
57
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
// simplified Formatter class
|
|
8
|
-
class Formatter {
|
|
9
|
-
options;
|
|
10
|
-
static documentation;
|
|
11
|
-
constructor(options) {
|
|
12
|
-
this.options = options;
|
|
13
|
-
}
|
|
14
|
-
async finished() {}
|
|
15
|
-
}
|
|
16
|
-
exports.default = Formatter;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.formatLocation = formatLocation;
|
|
8
|
-
var _path = _interopRequireDefault(require("path"));
|
|
9
|
-
var _valueChecker = require("../valueChecker");
|
|
10
|
-
function formatLocation(obj, cwd) {
|
|
11
|
-
let uri = obj.uri;
|
|
12
|
-
if ((0, _valueChecker.doesHaveValue)(cwd)) {
|
|
13
|
-
uri = _path.default.relative(cwd, uri);
|
|
14
|
-
}
|
|
15
|
-
return `${uri}:${obj.line.toString()}`;
|
|
16
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.loadConfig = loadConfig;
|
|
7
|
-
var _api = require("@cucumber/cucumber/api");
|
|
8
|
-
const cache = new Map();
|
|
9
|
-
async function loadConfig(options, environment) {
|
|
10
|
-
const cacheKey = JSON.stringify(options);
|
|
11
|
-
let config = cache.get(cacheKey);
|
|
12
|
-
if (!config) {
|
|
13
|
-
config = (0, _api.loadConfiguration)(options, environment);
|
|
14
|
-
cache.set(cacheKey, config);
|
|
15
|
-
}
|
|
16
|
-
return config;
|
|
17
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.FeaturesLoader = void 0;
|
|
7
|
-
var _gherkinStreams = require("@cucumber/gherkin-streams");
|
|
8
|
-
var _gherkinUtils = require("@cucumber/gherkin-utils");
|
|
9
|
-
/**
|
|
10
|
-
* Load features.
|
|
11
|
-
*
|
|
12
|
-
* See: https://github.com/cucumber/cucumber-js/blob/main/src/api/load_sources.ts
|
|
13
|
-
* See: https://github.com/cucumber/cucumber-js/blob/main/src/api/gherkin.ts
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
class FeaturesLoader {
|
|
17
|
-
gherkinQuery = new _gherkinUtils.Query();
|
|
18
|
-
parseErrors = [];
|
|
19
|
-
/**
|
|
20
|
-
* Loads and parses feature files.
|
|
21
|
-
* - featurePaths should be absolute.
|
|
22
|
-
* See: https://github.com/cucumber/gherkin-streams/blob/main/src/GherkinStreams.ts#L36
|
|
23
|
-
* - if options.relativeTo is provided, uri in gherkin documents will be relative to it.
|
|
24
|
-
* See: https://github.com/cucumber/gherkin-streams/blob/main/src/SourceMessageStream.ts#L31
|
|
25
|
-
* - options.defaultDialect is 'en' by default.
|
|
26
|
-
* See: https://github.com/cucumber/gherkin-streams/blob/main/src/makeGherkinOptions.ts#L5
|
|
27
|
-
*/
|
|
28
|
-
async load(featurePaths, options) {
|
|
29
|
-
this.gherkinQuery = new _gherkinUtils.Query();
|
|
30
|
-
this.parseErrors = [];
|
|
31
|
-
await gherkinFromPaths(featurePaths, options, envelope => {
|
|
32
|
-
this.gherkinQuery.update(envelope);
|
|
33
|
-
if (envelope.parseError) {
|
|
34
|
-
this.parseErrors.push(envelope.parseError);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
getDocumentsCount() {
|
|
39
|
-
return this.gherkinQuery.getGherkinDocuments().length;
|
|
40
|
-
}
|
|
41
|
-
getDocumentsWithPickles() {
|
|
42
|
-
return this.gherkinQuery.getGherkinDocuments().map(gherkinDocument => {
|
|
43
|
-
const pickles = this.getDocumentPickles(gherkinDocument);
|
|
44
|
-
return {
|
|
45
|
-
...gherkinDocument,
|
|
46
|
-
pickles
|
|
47
|
-
};
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
getDocumentPickles(gherkinDocument) {
|
|
51
|
-
return this.gherkinQuery.getPickles().filter(pickle => gherkinDocument.uri === pickle.uri).map(pickle => this.getPickleWithLocation(pickle));
|
|
52
|
-
}
|
|
53
|
-
getPickleWithLocation(pickle) {
|
|
54
|
-
const lastAstNodeId = pickle.astNodeIds[pickle.astNodeIds.length - 1];
|
|
55
|
-
const location = this.gherkinQuery.getLocation(lastAstNodeId);
|
|
56
|
-
return {
|
|
57
|
-
...pickle,
|
|
58
|
-
location
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
exports.FeaturesLoader = FeaturesLoader;
|
|
63
|
-
async function gherkinFromPaths(paths, options, onEnvelope) {
|
|
64
|
-
return new Promise((resolve, reject) => {
|
|
65
|
-
const gherkinMessageStream = _gherkinStreams.GherkinStreams.fromPaths(paths, options);
|
|
66
|
-
gherkinMessageStream.on('data', onEnvelope);
|
|
67
|
-
gherkinMessageStream.on('end', resolve);
|
|
68
|
-
gherkinMessageStream.on('error', reject);
|
|
69
|
-
});
|
|
70
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.loadSnippetBuilder = loadSnippetBuilder;
|
|
7
|
-
var _cucumber = require("@cucumber/cucumber");
|
|
8
|
-
/**
|
|
9
|
-
* Loads snippet builder
|
|
10
|
-
* See: https://github.com/cucumber/cucumber-js/blob/main/src/formatter/builder.ts
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
async function loadSnippetBuilder(supportCodeLibrary, snippetInterface, snippetSyntax) {
|
|
14
|
-
return _cucumber.FormatterBuilder.getStepDefinitionSnippetBuilder({
|
|
15
|
-
cwd: process.cwd(),
|
|
16
|
-
snippetInterface,
|
|
17
|
-
snippetSyntax,
|
|
18
|
-
supportCodeLibrary
|
|
19
|
-
});
|
|
20
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.findStepDefinition = findStepDefinition;
|
|
7
|
-
exports.hasTsNodeRegister = hasTsNodeRegister;
|
|
8
|
-
exports.loadSteps = loadSteps;
|
|
9
|
-
var _api = require("@cucumber/cucumber/api");
|
|
10
|
-
var _transform = require("../playwright/transform");
|
|
11
|
-
var _exit = require("../utils/exit");
|
|
12
|
-
const cache = new Map();
|
|
13
|
-
async function loadSteps(runConfiguration, environment = {}) {
|
|
14
|
-
const cacheKey = JSON.stringify(runConfiguration);
|
|
15
|
-
let lib = cache.get(cacheKey);
|
|
16
|
-
if (!lib) {
|
|
17
|
-
// use Playwright's built-in hook to compile TypeScript steps
|
|
18
|
-
const uninstall = !hasTsNodeRegister(runConfiguration) ? (0, _transform.installTransform)() : () => {};
|
|
19
|
-
lib = (0, _api.loadSupport)(runConfiguration, environment).finally(() => uninstall());
|
|
20
|
-
cache.set(cacheKey, lib);
|
|
21
|
-
}
|
|
22
|
-
return lib;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Finds step definition by step text.
|
|
26
|
-
* See: https://github.com/cucumber/cucumber-js/blob/main/src/runtime/assemble_test_cases.ts#L103
|
|
27
|
-
*
|
|
28
|
-
* Handling case when several step definitions found:
|
|
29
|
-
* https://github.com/cucumber/cucumber-js/blob/main/src/runtime/test_case_runner.ts#L313
|
|
30
|
-
*/
|
|
31
|
-
function findStepDefinition(supportCodeLibrary, stepText, file) {
|
|
32
|
-
const matchedSteps = supportCodeLibrary.stepDefinitions.filter(step => {
|
|
33
|
-
return step.matchesStepName(stepText);
|
|
34
|
-
});
|
|
35
|
-
if (matchedSteps.length === 0) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
if (matchedSteps.length > 1) {
|
|
39
|
-
(0, _exit.exit)([`Multiple step definitions matched for text: "${stepText}" (${file})`,
|
|
40
|
-
// todo: print location of every step definition (as in cucumber)
|
|
41
|
-
...matchedSteps.map(s => ` ${s.pattern}`)].join('\n'));
|
|
42
|
-
}
|
|
43
|
-
return matchedSteps[0];
|
|
44
|
-
}
|
|
45
|
-
function hasTsNodeRegister(runConfiguration) {
|
|
46
|
-
return runConfiguration.support.requireModules.includes('ts-node/register');
|
|
47
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.resovleFeaturePaths = resovleFeaturePaths;
|
|
8
|
-
var _fs = _interopRequireDefault(require("fs"));
|
|
9
|
-
var _path = _interopRequireDefault(require("path"));
|
|
10
|
-
var _environment = require("@cucumber/cucumber/lib/api/environment");
|
|
11
|
-
var _console_logger = require("@cucumber/cucumber/lib/api/console_logger");
|
|
12
|
-
var _utils = require("../utils");
|
|
13
|
-
/**
|
|
14
|
-
* Representation of https://github.com/cucumber/cucumber-js/blob/main/src/paths/paths.ts
|
|
15
|
-
* Since Cucumber 10.1 resolvePaths was moved from lib/api/paths to lib/paths/paths.
|
|
16
|
-
* This module makes resolvePaths working with any version of Cucumber.
|
|
17
|
-
* See: https://github.com/cucumber/cucumber-js/pull/2361/files
|
|
18
|
-
*
|
|
19
|
-
* todo: replace with own paths resolution.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Returns list of absolute feature paths.
|
|
24
|
-
*/
|
|
25
|
-
// eslint-disable-next-line max-statements
|
|
26
|
-
async function resovleFeaturePaths(runConfiguration, environment = {}) {
|
|
27
|
-
const {
|
|
28
|
-
cwd,
|
|
29
|
-
stderr,
|
|
30
|
-
debug
|
|
31
|
-
} = (0, _environment.mergeEnvironment)(environment);
|
|
32
|
-
const logger = new _console_logger.ConsoleLogger(stderr, debug);
|
|
33
|
-
const cucumberRoot = (0, _utils.resolvePackageRoot)('@cucumber/cucumber');
|
|
34
|
-
const pathsModuleBefore10_1 = _path.default.join(cucumberRoot, 'lib/api/paths.js');
|
|
35
|
-
const pathsModuleAfter10_1 = _path.default.join(cucumberRoot, 'lib/paths/paths.js');
|
|
36
|
-
const isNewResolvePaths = _fs.default.existsSync(pathsModuleAfter10_1);
|
|
37
|
-
if (isNewResolvePaths) {
|
|
38
|
-
const {
|
|
39
|
-
resolvePaths
|
|
40
|
-
} = require(pathsModuleAfter10_1);
|
|
41
|
-
const {
|
|
42
|
-
sourcePaths,
|
|
43
|
-
unexpandedSourcePaths
|
|
44
|
-
} = await resolvePaths(logger, cwd, runConfiguration.sources);
|
|
45
|
-
return {
|
|
46
|
-
featurePaths: sourcePaths,
|
|
47
|
-
unexpandedFeaturePaths: unexpandedSourcePaths
|
|
48
|
-
};
|
|
49
|
-
} else {
|
|
50
|
-
const {
|
|
51
|
-
resolvePaths
|
|
52
|
-
} = require(pathsModuleBefore10_1);
|
|
53
|
-
const {
|
|
54
|
-
featurePaths,
|
|
55
|
-
unexpandedFeaturePaths
|
|
56
|
-
} = await resolvePaths(logger, cwd, runConfiguration.sources);
|
|
57
|
-
return {
|
|
58
|
-
featurePaths,
|
|
59
|
-
unexpandedFeaturePaths
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.parseStepArgument = parseStepArgument;
|
|
8
|
-
var _util = _interopRequireDefault(require("util"));
|
|
9
|
-
var _valueChecker = require("./valueChecker");
|
|
10
|
-
/**
|
|
11
|
-
* Based on: https://github.com/cucumber/cucumber-js/blob/main/src/step_arguments.ts
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
function parseStepArgument(arg, mapping) {
|
|
15
|
-
if ((0, _valueChecker.doesHaveValue)(arg.dataTable)) {
|
|
16
|
-
return mapping.dataTable(arg.dataTable);
|
|
17
|
-
} else if ((0, _valueChecker.doesHaveValue)(arg.docString)) {
|
|
18
|
-
return mapping.docString(arg.docString);
|
|
19
|
-
}
|
|
20
|
-
throw new Error(`Unknown step argument: ${_util.default.inspect(arg)}`);
|
|
21
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.doesHaveValue = doesHaveValue;
|
|
7
|
-
exports.doesNotHaveValue = doesNotHaveValue;
|
|
8
|
-
exports.valueOrDefault = valueOrDefault;
|
|
9
|
-
/**
|
|
10
|
-
* Based on: https://github.com/cucumber/cucumber-js/blob/main/src/value_checker.ts
|
|
11
|
-
*/
|
|
12
|
-
function doesHaveValue(value) {
|
|
13
|
-
return !doesNotHaveValue(value);
|
|
14
|
-
}
|
|
15
|
-
function doesNotHaveValue(value) {
|
|
16
|
-
return value === null || value === undefined;
|
|
17
|
-
}
|
|
18
|
-
function valueOrDefault(value, defaultValue) {
|
|
19
|
-
if (doesHaveValue(value)) {
|
|
20
|
-
return value;
|
|
21
|
-
}
|
|
22
|
-
return defaultValue;
|
|
23
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "Fixture", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _class.Fixture;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
exports.When = exports.Then = exports.Step = exports.Given = void 0;
|
|
13
|
-
var _class = require("./steps/decorators/class");
|
|
14
|
-
var _steps = require("./steps/decorators/steps");
|
|
15
|
-
const Given = exports.Given = (0, _steps.createStepDecorator)('Given');
|
|
16
|
-
const When = exports.When = (0, _steps.createStepDecorator)('When');
|
|
17
|
-
const Then = exports.Then = (0, _steps.createStepDecorator)('Then');
|
|
18
|
-
const Step = exports.Step = (0, _steps.createStepDecorator)('Unknown');
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.extractFixtureNames = extractFixtureNames;
|
|
7
|
-
exports.extractFixtureNamesFromFnBodyMemo = extractFixtureNamesFromFnBodyMemo;
|
|
8
|
-
var _fixtureParameterNames = require("../playwright/fixtureParameterNames");
|
|
9
|
-
var _bddFixtures = require("../run/bddFixtures");
|
|
10
|
-
var _exit = require("../utils/exit");
|
|
11
|
-
const bodyFixturesSymbol = Symbol('bodyFixtures');
|
|
12
|
-
/**
|
|
13
|
-
* This function is used for playwright-style steps and decorators.
|
|
14
|
-
* It extracts fixtures names from first parameter of function
|
|
15
|
-
* using Playwright's helper.
|
|
16
|
-
*/
|
|
17
|
-
function extractFixtureNames(fn) {
|
|
18
|
-
return (0, _fixtureParameterNames.fixtureParameterNames)(fn).filter(name => !(0, _bddFixtures.isBddAutoInjectFixture)(name));
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* This function is used for cucumber-style steps.
|
|
22
|
-
* It looks for `this.useFixture('xxx')` entries in function body
|
|
23
|
-
* and extracts fixtures names from it.
|
|
24
|
-
*/
|
|
25
|
-
function extractFixtureNamesFromFnBodyMemo(fn) {
|
|
26
|
-
if (typeof fn !== 'function') {
|
|
27
|
-
return [];
|
|
28
|
-
}
|
|
29
|
-
const fnWithFixtures = fn;
|
|
30
|
-
if (!fnWithFixtures[bodyFixturesSymbol]) {
|
|
31
|
-
fnWithFixtures[bodyFixturesSymbol] = extractFixtureNamesFromFnBody(fn).filter(name => !(0, _bddFixtures.isBddAutoInjectFixture)(name));
|
|
32
|
-
}
|
|
33
|
-
return fnWithFixtures[bodyFixturesSymbol];
|
|
34
|
-
}
|
|
35
|
-
function extractFixtureNamesFromFnBody(fn) {
|
|
36
|
-
const matches = fn.toString().matchAll(/this\.useFixture\((.+)\)/gi) || [];
|
|
37
|
-
return [...matches].map(match => getFixtureName(match[1]));
|
|
38
|
-
}
|
|
39
|
-
function getFixtureName(arg) {
|
|
40
|
-
if (!/^['"`]/.test(arg)) {
|
|
41
|
-
// todo: log file location with incorrect useFixture
|
|
42
|
-
(0, _exit.exit)('this.useFixture() can accept only static string as an argument.');
|
|
43
|
-
}
|
|
44
|
-
if (arg.startsWith('`') && arg.includes('${')) {
|
|
45
|
-
(0, _exit.exit)('this.useFixture() can accept only static string as an argument.');
|
|
46
|
-
}
|
|
47
|
-
return arg.replace(/['"`]/g, '');
|
|
48
|
-
}
|