@zohodesk/testinglibrary 2.9.1 → 3.0.2
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 +16 -23
- package/README.md +32 -1
- package/build/core/playwright/constants/fileMutexConfig.js +11 -0
- package/build/core/playwright/fixtures.js +24 -0
- package/build/core/playwright/helpers/auth/checkAuthCookies.js +2 -8
- package/build/core/playwright/helpers/auth/loginSteps.js +25 -18
- package/build/core/playwright/helpers/checkAuthDirectory.js +17 -0
- package/build/core/playwright/helpers/fileMutex.js +58 -0
- 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/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/build/test/core/playwright/helpers/__tests__/fileMutex.test.js +94 -0
- package/nobdd/uat/conf/default/actors/index.js +1 -4
- package/nobdd/uat/conf/default/settings.json +1 -1
- package/nobdd/uat/conf/nobdd/uat.config.js +11 -4
- package/nobdd/uat/env-config.json +3 -3
- package/nobdd/uat/fixtures/setup.teardown.js +2 -1
- package/nobdd/uat/modules/nobdd/steps/VerifyNoBDD.feature.spec.js +3 -3
- package/nobdd/uat.config.js +8 -3
- package/package.json +8 -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/uat/conf/default/actors/beta/custom-module.json +0 -24
- package/nobdd/uat/conf/default/actors/beta/index.js +0 -6
- package/nobdd/uat/conf/default/actors/beta/parent-child.json +0 -24
- package/npm-shrinkwrap.json +0 -6475
|
@@ -1,94 +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.defaults = void 0;
|
|
8
|
-
exports.defineBddConfig = defineBddConfig;
|
|
9
|
-
exports.extractCucumberConfig = extractCucumberConfig;
|
|
10
|
-
var _path = _interopRequireDefault(require("path"));
|
|
11
|
-
var _env = require("./env");
|
|
12
|
-
var _configDir = require("./configDir");
|
|
13
|
-
var _utils = require("../utils");
|
|
14
|
-
/**
|
|
15
|
-
* BDD Config.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
const defaults = exports.defaults = {
|
|
19
|
-
outputDir: '.features-gen',
|
|
20
|
-
verbose: false,
|
|
21
|
-
examplesTitleFormat: 'Example #<_index_>',
|
|
22
|
-
publishQuiet: true,
|
|
23
|
-
quotes: 'double'
|
|
24
|
-
};
|
|
25
|
-
function defineBddConfig(inputConfig) {
|
|
26
|
-
const isMainProcess = !process.env.TEST_WORKER_INDEX;
|
|
27
|
-
const configDir = (0, _configDir.getPlaywrightConfigDir)({
|
|
28
|
-
resolveAndSave: isMainProcess
|
|
29
|
-
});
|
|
30
|
-
const config = getConfig(configDir, inputConfig);
|
|
31
|
-
// In main process store config in env to be accessible by workers
|
|
32
|
-
if (isMainProcess) {
|
|
33
|
-
(0, _env.saveConfigToEnv)(config);
|
|
34
|
-
}
|
|
35
|
-
return config.outputDir;
|
|
36
|
-
}
|
|
37
|
-
function getConfig(configDir, inputConfig) {
|
|
38
|
-
const config = Object.assign({}, defaults, inputConfig);
|
|
39
|
-
const featuresRoot = config.featuresRoot ? _path.default.resolve(configDir, config.featuresRoot) : configDir;
|
|
40
|
-
return {
|
|
41
|
-
...config,
|
|
42
|
-
// important to resolve outputDir as it is used as unique key for input configs
|
|
43
|
-
outputDir: _path.default.resolve(configDir, config.outputDir),
|
|
44
|
-
importTestFrom: resolveImportTestFrom(configDir, config.importTestFrom),
|
|
45
|
-
featuresRoot
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
function extractCucumberConfig(config) {
|
|
49
|
-
// todo: find more strict way to omit own config fields
|
|
50
|
-
// see: https://bobbyhadz.com/blog/typescript-object-remove-property
|
|
51
|
-
const omitProps = {
|
|
52
|
-
outputDir: true,
|
|
53
|
-
importTestFrom: true,
|
|
54
|
-
verbose: true,
|
|
55
|
-
skip: true,
|
|
56
|
-
examplesTitleFormat: true,
|
|
57
|
-
quotes: true,
|
|
58
|
-
tags: true,
|
|
59
|
-
featuresRoot: true,
|
|
60
|
-
enrichReporterData: true
|
|
61
|
-
};
|
|
62
|
-
const keys = Object.keys(omitProps);
|
|
63
|
-
const cucumberConfig = {
|
|
64
|
-
...config
|
|
65
|
-
};
|
|
66
|
-
keys.forEach(key => delete cucumberConfig[key]);
|
|
67
|
-
stripPublishQuiet(cucumberConfig);
|
|
68
|
-
return cucumberConfig;
|
|
69
|
-
}
|
|
70
|
-
function resolveImportTestFrom(configDir, importTestFrom) {
|
|
71
|
-
if (importTestFrom) {
|
|
72
|
-
const {
|
|
73
|
-
file,
|
|
74
|
-
varName
|
|
75
|
-
} = typeof importTestFrom === 'string' ? {
|
|
76
|
-
file: importTestFrom
|
|
77
|
-
} : importTestFrom;
|
|
78
|
-
return {
|
|
79
|
-
file: _path.default.resolve(configDir, file),
|
|
80
|
-
varName
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
function stripPublishQuiet(cucumberConfig) {
|
|
85
|
-
const cucumberVersion = (0, _utils.getPackageVersion)('@cucumber/cucumber');
|
|
86
|
-
// Playwright-bdd supports Cucumber from v9+
|
|
87
|
-
// publishQuiet was deprecated in Cucumber 9.4.0.
|
|
88
|
-
// See: https://github.com/cucumber/cucumber-js/pull/2311
|
|
89
|
-
// Remove publishQuite from Cucumber config to hide deprecation warning.
|
|
90
|
-
// See: https://github.com/vitalets/playwright-bdd/pull/47
|
|
91
|
-
if (!/^9\.[0123]\./.test(cucumberVersion)) {
|
|
92
|
-
delete cucumberConfig.publishQuiet;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.LANG_EN = void 0;
|
|
7
|
-
exports.isEnglish = isEnglish;
|
|
8
|
-
/**
|
|
9
|
-
* Helpers for Cucumber language option.
|
|
10
|
-
*/
|
|
11
|
-
const LANG_EN = exports.LANG_EN = 'en';
|
|
12
|
-
function isEnglish(lang) {
|
|
13
|
-
return !lang || lang === LANG_EN;
|
|
14
|
-
}
|
|
@@ -1,43 +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.buildStepDefinition = buildStepDefinition;
|
|
8
|
-
var _messages = require("@cucumber/messages");
|
|
9
|
-
var _cucumberExpressions = require("@cucumber/cucumber-expressions");
|
|
10
|
-
var _step_definition = _interopRequireDefault(require("@cucumber/cucumber/lib/models/step_definition"));
|
|
11
|
-
/**
|
|
12
|
-
* Extracted from cucumber SupportCodeLibraryBuilder.
|
|
13
|
-
* See: https://github.com/cucumber/cucumber-js/blob/main/src/support_code_library_builder/index.ts
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
const newId = _messages.IdGenerator.uuid();
|
|
17
|
-
function buildStepDefinition({
|
|
18
|
-
keyword,
|
|
19
|
-
pattern,
|
|
20
|
-
code,
|
|
21
|
-
line,
|
|
22
|
-
options,
|
|
23
|
-
uri
|
|
24
|
-
}, supportCodeLibrary) {
|
|
25
|
-
// todo: handle error.undefinedParameterTypeName as it's done in cucumber?
|
|
26
|
-
const expression = typeof pattern === 'string' ? new _cucumberExpressions.CucumberExpression(pattern, supportCodeLibrary.parameterTypeRegistry) : new _cucumberExpressions.RegularExpression(pattern, supportCodeLibrary.parameterTypeRegistry);
|
|
27
|
-
// skip wrapping code as it is not needed for decorator steps
|
|
28
|
-
// const wrappedCode = this.wrapCode({
|
|
29
|
-
// code,
|
|
30
|
-
// wrapperOptions: options.wrapperOptions,
|
|
31
|
-
// })
|
|
32
|
-
return new _step_definition.default({
|
|
33
|
-
code,
|
|
34
|
-
expression,
|
|
35
|
-
id: newId(),
|
|
36
|
-
line,
|
|
37
|
-
options,
|
|
38
|
-
keyword,
|
|
39
|
-
pattern,
|
|
40
|
-
unwrappedCode: code,
|
|
41
|
-
uri
|
|
42
|
-
});
|
|
43
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createTestStep = createTestStep;
|
|
7
|
-
/**
|
|
8
|
-
* Creates partial TestStep for usage in reporter.
|
|
9
|
-
* It is partial, b/c final pickleStepId will be known only in reporter.
|
|
10
|
-
*
|
|
11
|
-
* See: https://github.com/cucumber/cucumber-js/blob/main/src/runtime/assemble_test_cases.ts#L93
|
|
12
|
-
*/
|
|
13
|
-
function createTestStep(stepDefinition, stepText) {
|
|
14
|
-
const result = stepDefinition.expression.match(stepText);
|
|
15
|
-
if (!result) {
|
|
16
|
-
// this should not happen as stepDefinition is already matched
|
|
17
|
-
throw Error(`Step definition didn't match step "${stepText}"`);
|
|
18
|
-
}
|
|
19
|
-
const stepMatchArguments = result.map(arg => {
|
|
20
|
-
return {
|
|
21
|
-
group: mapArgumentGroup(arg.group),
|
|
22
|
-
parameterTypeName: arg.parameterType.name
|
|
23
|
-
};
|
|
24
|
-
});
|
|
25
|
-
return {
|
|
26
|
-
// id will be generated in reporter, no need to generate it here
|
|
27
|
-
id: '',
|
|
28
|
-
// looks like it's useless to store stepDefinitionIds here
|
|
29
|
-
// b/c they will be different in reporter
|
|
30
|
-
// stepDefinitionIds: [stepDefinition.id],
|
|
31
|
-
stepMatchArgumentsLists: [{
|
|
32
|
-
stepMatchArguments
|
|
33
|
-
}]
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function mapArgumentGroup(group) {
|
|
37
|
-
var _group$children;
|
|
38
|
-
return {
|
|
39
|
-
start: group.start,
|
|
40
|
-
value: group.value,
|
|
41
|
-
children: (_group$children = group.children) === null || _group$children === void 0 ? void 0 : _group$children.map(child => mapArgumentGroup(child))
|
|
42
|
-
};
|
|
43
|
-
}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var messages = _interopRequireWildcard(require("@cucumber/messages"));
|
|
8
|
-
var _valueChecker = require("../valueChecker");
|
|
9
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
-
/**
|
|
12
|
-
* Groups Cucumber messages for easier access.
|
|
13
|
-
* Based on Cucumber, with some changes due to strictNullChecks errors.
|
|
14
|
-
* See: https://github.com/cucumber/cucumber-js/blob/main/src/formatter/helpers/event_data_collector.ts
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
class EventDataCollector {
|
|
18
|
-
gherkinDocumentMap = {};
|
|
19
|
-
pickleMap = {};
|
|
20
|
-
testCaseMap = {};
|
|
21
|
-
testCaseAttemptDataMap = {};
|
|
22
|
-
undefinedParameterTypes = [];
|
|
23
|
-
constructor(eventBroadcaster) {
|
|
24
|
-
eventBroadcaster.on('envelope', this.parseEnvelope.bind(this));
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* @public
|
|
28
|
-
*/
|
|
29
|
-
getGherkinDocument(uri) {
|
|
30
|
-
return this.gherkinDocumentMap[uri];
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* @public
|
|
34
|
-
*/
|
|
35
|
-
getPickle(pickleId) {
|
|
36
|
-
return this.pickleMap[pickleId];
|
|
37
|
-
}
|
|
38
|
-
getTestCaseAttempts() {
|
|
39
|
-
return Object.keys(this.testCaseAttemptDataMap).map(testCaseStartedId => {
|
|
40
|
-
return this.getTestCaseAttempt(testCaseStartedId);
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
getTestCaseAttempt(testCaseStartedId) {
|
|
44
|
-
const testCaseAttemptData = this.testCaseAttemptDataMap[testCaseStartedId];
|
|
45
|
-
const testCase = this.testCaseMap[testCaseAttemptData.testCaseId];
|
|
46
|
-
const pickle = this.pickleMap[testCase.pickleId];
|
|
47
|
-
return {
|
|
48
|
-
gherkinDocument: this.gherkinDocumentMap[pickle.uri],
|
|
49
|
-
pickle,
|
|
50
|
-
testCase,
|
|
51
|
-
attempt: testCaseAttemptData.attempt,
|
|
52
|
-
willBeRetried: testCaseAttemptData.willBeRetried,
|
|
53
|
-
stepAttachments: testCaseAttemptData.stepAttachments,
|
|
54
|
-
stepResults: testCaseAttemptData.stepResults,
|
|
55
|
-
worstTestStepResult: testCaseAttemptData.worstTestStepResult
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
parseEnvelope(envelope) {
|
|
59
|
-
var _envelope$gherkinDocu;
|
|
60
|
-
if ((0, _valueChecker.doesHaveValue)((_envelope$gherkinDocu = envelope.gherkinDocument) === null || _envelope$gherkinDocu === void 0 ? void 0 : _envelope$gherkinDocu.uri)) {
|
|
61
|
-
this.gherkinDocumentMap[envelope.gherkinDocument.uri] = envelope.gherkinDocument;
|
|
62
|
-
} else if ((0, _valueChecker.doesHaveValue)(envelope.pickle)) {
|
|
63
|
-
this.pickleMap[envelope.pickle.id] = envelope.pickle;
|
|
64
|
-
} else if ((0, _valueChecker.doesHaveValue)(envelope.undefinedParameterType)) {
|
|
65
|
-
this.undefinedParameterTypes.push(envelope.undefinedParameterType);
|
|
66
|
-
} else if ((0, _valueChecker.doesHaveValue)(envelope.testCase)) {
|
|
67
|
-
this.testCaseMap[envelope.testCase.id] = envelope.testCase;
|
|
68
|
-
} else if ((0, _valueChecker.doesHaveValue)(envelope.testCaseStarted)) {
|
|
69
|
-
this.initTestCaseAttempt(envelope.testCaseStarted);
|
|
70
|
-
} else if ((0, _valueChecker.doesHaveValue)(envelope.attachment)) {
|
|
71
|
-
this.storeAttachment(envelope.attachment);
|
|
72
|
-
} else if ((0, _valueChecker.doesHaveValue)(envelope.testStepFinished)) {
|
|
73
|
-
this.storeTestStepResult(envelope.testStepFinished);
|
|
74
|
-
} else if ((0, _valueChecker.doesHaveValue)(envelope.testCaseFinished)) {
|
|
75
|
-
this.storeTestCaseResult(envelope.testCaseFinished);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
initTestCaseAttempt(testCaseStarted) {
|
|
79
|
-
this.testCaseAttemptDataMap[testCaseStarted.id] = {
|
|
80
|
-
attempt: testCaseStarted.attempt,
|
|
81
|
-
willBeRetried: false,
|
|
82
|
-
testCaseId: testCaseStarted.testCaseId,
|
|
83
|
-
stepAttachments: {},
|
|
84
|
-
stepResults: {},
|
|
85
|
-
worstTestStepResult: {
|
|
86
|
-
duration: {
|
|
87
|
-
seconds: 0,
|
|
88
|
-
nanos: 0
|
|
89
|
-
},
|
|
90
|
-
status: messages.TestStepResultStatus.UNKNOWN
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
storeAttachment(attachment) {
|
|
95
|
-
const {
|
|
96
|
-
testCaseStartedId,
|
|
97
|
-
testStepId
|
|
98
|
-
} = attachment;
|
|
99
|
-
// TODO: we shouldn't have to check if these properties have values - they are non-nullable
|
|
100
|
-
if ((0, _valueChecker.doesHaveValue)(testCaseStartedId) && (0, _valueChecker.doesHaveValue)(testStepId)) {
|
|
101
|
-
const {
|
|
102
|
-
stepAttachments
|
|
103
|
-
} = this.testCaseAttemptDataMap[testCaseStartedId];
|
|
104
|
-
if ((0, _valueChecker.doesNotHaveValue)(stepAttachments[testStepId])) {
|
|
105
|
-
stepAttachments[testStepId] = [];
|
|
106
|
-
}
|
|
107
|
-
stepAttachments[testStepId].push(attachment);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
storeTestStepResult({
|
|
111
|
-
testCaseStartedId,
|
|
112
|
-
testStepId,
|
|
113
|
-
testStepResult
|
|
114
|
-
}) {
|
|
115
|
-
this.testCaseAttemptDataMap[testCaseStartedId].stepResults[testStepId] = testStepResult;
|
|
116
|
-
}
|
|
117
|
-
storeTestCaseResult({
|
|
118
|
-
testCaseStartedId,
|
|
119
|
-
willBeRetried
|
|
120
|
-
}) {
|
|
121
|
-
const stepResults = Object.values(this.testCaseAttemptDataMap[testCaseStartedId].stepResults);
|
|
122
|
-
this.testCaseAttemptDataMap[testCaseStartedId].worstTestStepResult = messages.getWorstTestStepResult(stepResults);
|
|
123
|
-
this.testCaseAttemptDataMap[testCaseStartedId].willBeRetried = willBeRetried;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
exports.default = EventDataCollector;
|
|
@@ -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
|
-
}
|