@zohodesk/testinglibrary 0.1.8-exp.4 → 0.1.8-stb-bdd-v1

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 (88) hide show
  1. package/.babelrc +18 -18
  2. package/.eslintrc.js +31 -31
  3. package/.prettierrc +5 -5
  4. package/README.md +17 -17
  5. package/bin/cli.js +2 -2
  6. package/build/bdd-framework/cli/commands/env.js +3 -3
  7. package/build/bdd-framework/cli/options.js +4 -4
  8. package/build/bdd-framework/cli/worker.js +3 -3
  9. package/build/bdd-framework/config/dir.js +6 -6
  10. package/build/bdd-framework/config/env.js +3 -3
  11. package/build/bdd-framework/config/index.js +2 -2
  12. package/build/bdd-framework/config/lang.js +2 -2
  13. package/build/bdd-framework/cucumber/buildStepDefinition.js +3 -3
  14. package/build/bdd-framework/cucumber/loadSnippetBuilder.js +3 -3
  15. package/build/bdd-framework/cucumber/loadSources.js +9 -9
  16. package/build/bdd-framework/gen/fixtures.js +8 -8
  17. package/build/bdd-framework/gen/formatter.js +7 -7
  18. package/build/bdd-framework/gen/i18n.js +3 -3
  19. package/build/bdd-framework/gen/index.js +2 -2
  20. package/build/bdd-framework/gen/testFile.js +16 -16
  21. package/build/bdd-framework/gen/testNode.js +3 -3
  22. package/build/bdd-framework/gen/testPoms.js +31 -31
  23. package/build/bdd-framework/hooks/scenario.js +6 -6
  24. package/build/bdd-framework/hooks/worker.js +4 -4
  25. package/build/bdd-framework/playwright/fixtureParameterNames.js +3 -3
  26. package/build/bdd-framework/playwright/getLocationInFile.js +4 -4
  27. package/build/bdd-framework/playwright/loadConfig.js +3 -3
  28. package/build/bdd-framework/playwright/testTypeImpl.js +11 -11
  29. package/build/bdd-framework/playwright/transform.js +4 -4
  30. package/build/bdd-framework/playwright/utils.js +2 -2
  31. package/build/bdd-framework/run/StepInvoker.js +2 -2
  32. package/build/bdd-framework/run/bddWorld.js +15 -15
  33. package/build/bdd-framework/snippets/index.js +2 -2
  34. package/build/bdd-framework/snippets/snippetSyntaxTs.js +4 -4
  35. package/build/bdd-framework/stepDefinitions/createBdd.js +2 -2
  36. package/build/bdd-framework/stepDefinitions/decorators/class.js +7 -7
  37. package/build/bdd-framework/stepDefinitions/decorators/steps.js +6 -6
  38. package/build/bdd-framework/stepDefinitions/defineStep.js +3 -3
  39. package/build/bdd-framework/stepDefinitions/stepConfig.js +5 -5
  40. package/build/bdd-framework/utils/exit.js +18 -22
  41. package/build/bdd-framework/utils/index.js +9 -9
  42. package/build/bdd-framework/utils/jsStringWrap.js +9 -9
  43. package/build/bdd-framework/utils/logger.js +2 -2
  44. package/build/bdd-poc/config/pathConfig.js +20 -0
  45. package/build/bdd-poc/core-runner/exportMethods.js +20 -0
  46. package/build/bdd-poc/core-runner/main.js +10 -0
  47. package/build/bdd-poc/core-runner/runner.js +20 -0
  48. package/build/bdd-poc/core-runner/stepDefinitions.js +52 -0
  49. package/build/bdd-poc/index.js +26 -0
  50. package/build/bdd-poc/test/cucumber/featureFileParer.js +84 -0
  51. package/build/bdd-poc/test/cucumber/parserCucumber.js +15 -0
  52. package/build/bdd-poc/test/stepGenerate/extractTestInputs.js +36 -0
  53. package/build/bdd-poc/test/stepGenerate/stepFileGenerate.js +38 -0
  54. package/build/bdd-poc/test/stepGenerate/stepsnippets.js +58 -0
  55. package/build/bdd-poc/test/tagsHandle.js +69 -0
  56. package/build/bdd-poc/test/testDataMap.js +97 -0
  57. package/build/bdd-poc/test/testStructure.js +98 -0
  58. package/build/bdd-poc/utils/stringManipulation.js +26 -0
  59. package/build/core/playwright/builtInFixtures/addTags.js +1 -1
  60. package/build/core/playwright/builtInFixtures/index.js +4 -3
  61. package/build/core/playwright/custom-commands.js +1 -1
  62. package/build/core/playwright/index.js +6 -17
  63. package/build/core/playwright/readConfigFile.js +30 -30
  64. package/build/core/playwright/setup/config-creator.js +14 -13
  65. package/build/core/playwright/setup/config-utils.js +22 -32
  66. package/build/core/playwright/tag-processor.js +4 -2
  67. package/build/core/playwright/test-runner.js +42 -36
  68. package/build/decorators.d.ts +1 -1
  69. package/build/decorators.js +2 -16
  70. package/build/index.d.ts +60 -60
  71. package/build/index.js +12 -17
  72. package/build/parser/sample.feature +34 -34
  73. package/build/parser/sample.spec.js +18 -18
  74. package/build/setup-folder-structure/helper.js +0 -1
  75. package/build/setup-folder-structure/reportEnhancement/addonScript.html +24 -24
  76. package/build/setup-folder-structure/samples/auth-setup-sample.js +72 -72
  77. package/build/setup-folder-structure/samples/authUsers-sample.json +8 -8
  78. package/build/setup-folder-structure/samples/env-config-sample.json +20 -20
  79. package/build/setup-folder-structure/samples/git-ignore.sample.js +36 -36
  80. package/build/setup-folder-structure/samples/uat-config-sample.js +44 -44
  81. package/build/utils/cliArgsToObject.js +25 -25
  82. package/build/utils/fileUtils.js +19 -1
  83. package/build/utils/getFilePath.js +2 -1
  84. package/changelog.md +131 -137
  85. package/jest.config.js +63 -63
  86. package/npm-shrinkwrap.json +5980 -6469
  87. package/package.json +54 -55
  88. package/playwright.config.js +112 -112
@@ -7,10 +7,10 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.getLocationInFile = getLocationInFile;
8
8
  var _url = _interopRequireDefault(require("url"));
9
9
  var _utils = require("./utils");
10
- /**
11
- * Inspects stacktrace and finds call location in provided file.
12
- * This function is based on Playwright's getLocationByStacktrace().
13
- * See: https://github.com/microsoft/playwright/blob/main/packages/playwright-test/src/common/transform.ts#L229
10
+ /**
11
+ * Inspects stacktrace and finds call location in provided file.
12
+ * This function is based on Playwright's getLocationByStacktrace().
13
+ * See: https://github.com/microsoft/playwright/blob/main/packages/playwright-test/src/common/transform.ts#L229
14
14
  */
15
15
  function getLocationInFile(filePath) {
16
16
  const filePathUrl = _url.default.pathToFileURL(filePath).toString();
@@ -11,9 +11,9 @@ var _fs = _interopRequireDefault(require("fs"));
11
11
  var _utils = require("./utils");
12
12
  var _transform = require("./transform");
13
13
  var _exit = require("../utils/exit");
14
- /**
15
- * Loading Playwright config.
16
- * See: https://github.com/microsoft/playwright/blob/main/packages/playwright-test/src/common/configLoader.ts
14
+ /**
15
+ * Loading Playwright config.
16
+ * See: https://github.com/microsoft/playwright/blob/main/packages/playwright-test/src/common/configLoader.ts
17
17
  */
18
18
 
19
19
  async function loadConfig(cliConfigPath) {
@@ -7,14 +7,14 @@ exports.isTestContainsSubtest = isTestContainsSubtest;
7
7
  exports.runStepWithCustomLocation = runStepWithCustomLocation;
8
8
  var _test = require("@playwright/test");
9
9
  var _utils = require("../utils");
10
- /**
11
- * Helpers to deal with Playwright test internal stuff.
12
- * See: https://github.com/microsoft/playwright/blob/main/packages/playwright-test/src/common/testType.ts
10
+ /**
11
+ * Helpers to deal with Playwright test internal stuff.
12
+ * See: https://github.com/microsoft/playwright/blob/main/packages/playwright-test/src/common/testType.ts
13
13
  */
14
14
 
15
15
  const testTypeSymbol = (0, _utils.getSymbolByName)(_test.test, 'testType');
16
- /**
17
- * Returns test fixtures using Symbol.
16
+ /**
17
+ * Returns test fixtures using Symbol.
18
18
  */
19
19
  function getTestFixtures(test) {
20
20
  return getTestImpl(test).fixtures;
@@ -22,8 +22,8 @@ function getTestFixtures(test) {
22
22
  function getTestImpl(test) {
23
23
  return test[testTypeSymbol];
24
24
  }
25
- /**
26
- * Run step with location pointing to Given, When, Then call.
25
+ /**
26
+ * Run step with location pointing to Given, When, Then call.
27
27
  */
28
28
  // eslint-disable-next-line max-params
29
29
  async function runStepWithCustomLocation(test, stepText, location, body) {
@@ -38,10 +38,10 @@ async function runStepWithCustomLocation(test, stepText, location, body) {
38
38
  return await body();
39
39
  });
40
40
  }
41
- /**
42
- * Returns true if test contains all fixtures of subtest.
43
- * - test was extended from subtest
44
- * - test is a result of mergeTests(subtest, ...)
41
+ /**
42
+ * Returns true if test contains all fixtures of subtest.
43
+ * - test was extended from subtest
44
+ * - test is a result of mergeTests(subtest, ...)
45
45
  */
46
46
  function isTestContainsSubtest(test, subtest) {
47
47
  if (test === subtest) {
@@ -11,10 +11,10 @@ var _fs = _interopRequireDefault(require("fs"));
11
11
  var _path = _interopRequireDefault(require("path"));
12
12
  var _utils = require("./utils");
13
13
  /* eslint-disable max-params */
14
- /**
15
- * Installs require hook to transform ts.
16
- * Extracted from playwright.
17
- * See: https://github.com/microsoft/playwright/blob/main/packages/playwright-test/src/transform/transform.ts
14
+ /**
15
+ * Installs require hook to transform ts.
16
+ * Extracted from playwright.
17
+ * See: https://github.com/microsoft/playwright/blob/main/packages/playwright-test/src/transform/transform.ts
18
18
  */
19
19
  function installTransform() {
20
20
  const {
@@ -11,8 +11,8 @@ var _path = _interopRequireDefault(require("path"));
11
11
  var _utils = require("../utils");
12
12
  // cache playwright root
13
13
  let playwrightRoot = '';
14
- /**
15
- * Requires Playwright's internal module that is not exported via package.exports.
14
+ /**
15
+ * Requires Playwright's internal module that is not exported via package.exports.
16
16
  */
17
17
  function requirePlaywrightModule(modulePath) {
18
18
  const absPath = _path.default.isAbsolute(modulePath) ? modulePath : getPlaywrightModulePath(modulePath);
@@ -9,8 +9,8 @@ var _getLocationInFile = require("../playwright/getLocationInFile");
9
9
  var _testTypeImpl = require("../playwright/testTypeImpl");
10
10
  var _defineStep = require("../stepDefinitions/defineStep");
11
11
  var _lang = require("../config/lang");
12
- /**
13
- * Class to invoke steps in generated files.
12
+ /**
13
+ * Class to invoke steps in generated files.
14
14
  */
15
15
 
16
16
  class StepInvoker {
@@ -13,21 +13,21 @@ class BddWorld extends _cucumber.World {
13
13
  super(options);
14
14
  this.options = options;
15
15
  }
16
- /**
17
- * Use particular fixture in cucumber-style steps.
18
- *
19
- * Note: TS does not support partial generic inference,
20
- * that's why we can't use this.useFixture<typeof test>('xxx');
21
- * The solution is to pass TestType as a generic to BddWorld
22
- * and call useFixture without explicit generic params.
23
- * Finally, it looks even better as there is no need to pass `typeof test`
24
- * in every `this.useFixture` call.
25
- *
26
- * The downside - it's impossible to pass fixtures type directly to `this.useFixture`
27
- * like it's done in @Fixture decorator.
28
- *
29
- * See: https://stackoverflow.com/questions/45509621/specify-only-first-type-argument
30
- * See: https://github.com/Microsoft/TypeScript/pull/26349
16
+ /**
17
+ * Use particular fixture in cucumber-style steps.
18
+ *
19
+ * Note: TS does not support partial generic inference,
20
+ * that's why we can't use this.useFixture<typeof test>('xxx');
21
+ * The solution is to pass TestType as a generic to BddWorld
22
+ * and call useFixture without explicit generic params.
23
+ * Finally, it looks even better as there is no need to pass `typeof test`
24
+ * in every `this.useFixture` call.
25
+ *
26
+ * The downside - it's impossible to pass fixtures type directly to `this.useFixture`
27
+ * like it's done in @Fixture decorator.
28
+ *
29
+ * See: https://stackoverflow.com/questions/45509621/specify-only-first-type-argument
30
+ * See: https://github.com/Microsoft/TypeScript/pull/26349
31
31
  */
32
32
  useFixture(fixtureName) {
33
33
  return this.stepFixtures[fixtureName];
@@ -8,8 +8,8 @@ var _url = require("url");
8
8
  var _loadSnippetBuilder = require("../cucumber/loadSnippetBuilder");
9
9
  var _logger = require("../utils/logger");
10
10
  var _stepConfig = require("../stepDefinitions/stepConfig");
11
- /**
12
- * Generate and show snippets for undefined steps
11
+ /**
12
+ * Generate and show snippets for undefined steps
13
13
  */
14
14
 
15
15
  class Snippets {
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _snippetSyntax = _interopRequireDefault(require("./snippetSyntax"));
9
- /**
10
- * Playwright-style snippet syntax for typescript.
11
- * Important to use separate file as it's simplest way to distinguish between js/ts
12
- * without hooking into cucumber machinery.
9
+ /**
10
+ * Playwright-style snippet syntax for typescript.
11
+ * Important to use separate file as it's simplest way to distinguish between js/ts
12
+ * without hooking into cucumber machinery.
13
13
  */
14
14
 
15
15
  class _default extends _snippetSyntax.default {
@@ -11,8 +11,8 @@ var _defineStep = require("./defineStep");
11
11
  var _exit = require("../utils/exit");
12
12
  var _scenario = require("../hooks/scenario");
13
13
  var _worker = require("../hooks/worker");
14
- /**
15
- * Stuff related to writing steps in Playwright-style.
14
+ /**
15
+ * Stuff related to writing steps in Playwright-style.
16
16
  */
17
17
 
18
18
  // Global flag showing that custom test was passed.
@@ -7,17 +7,17 @@ exports.Fixture = Fixture;
7
7
  exports.getPomNodeByFixtureName = getPomNodeByFixtureName;
8
8
  var _steps = require("./steps");
9
9
  var _exit = require("../../utils/exit");
10
- /**
11
- * Class level @Fixture decorator.
10
+ /**
11
+ * Class level @Fixture decorator.
12
12
  */
13
13
 
14
- /**
15
- * Graph of POM class inheritance.
16
- * Allows to guess correct fixture by step text.
14
+ /**
15
+ * Graph of POM class inheritance.
16
+ * Allows to guess correct fixture by step text.
17
17
  */
18
18
  const pomGraph = new Map();
19
- /**
20
- * @Fixture decorator.
19
+ /**
20
+ * @Fixture decorator.
21
21
  */
22
22
  function Fixture(fixtureName) {
23
23
  // context parameter is required for decorator by TS even though it's not used
@@ -9,8 +9,8 @@ exports.linkStepsWithPomNode = linkStepsWithPomNode;
9
9
  var _bddFixtures = require("../../run/bddFixtures");
10
10
  var _buildStepDefinition = require("../../cucumber/buildStepDefinition");
11
11
  var _defineStep = require("../defineStep");
12
- /**
13
- * Define steps via decorators.
12
+ /**
13
+ * Define steps via decorators.
14
14
  */
15
15
 
16
16
  // initially we sotre step data inside method,
@@ -18,8 +18,8 @@ var _defineStep = require("../defineStep");
18
18
  const decoratedStepSymbol = Symbol('decoratedStep');
19
19
  // global list of all decorator steps
20
20
  const decoratedSteps = new Set();
21
- /**
22
- * Creates @Given, @When, @Then decorators.
21
+ /**
22
+ * Creates @Given, @When, @Then decorators.
23
23
  */
24
24
  function createStepDecorator(keyword) {
25
25
  return pattern => {
@@ -49,8 +49,8 @@ function linkStepsWithPomNode(Ctor, pomNode) {
49
49
  decoratedSteps.add(stepConfig);
50
50
  });
51
51
  }
52
- /**
53
- * Append decorator steps to Cucumber's supportCodeLibrary.
52
+ /**
53
+ * Append decorator steps to Cucumber's supportCodeLibrary.
54
54
  */
55
55
  function appendDecoratorSteps(supportCodeLibrary) {
56
56
  decoratedSteps.forEach(stepConfig => {
@@ -8,9 +8,9 @@ exports.defineStep = defineStep;
8
8
  exports.getStepCode = getStepCode;
9
9
  var _cucumber = require("@cucumber/cucumber");
10
10
  var _exit = require("../utils/exit");
11
- /**
12
- * Defines step by config.
13
- * Calls cucumber's Given(), When(), Then() under the hood.
11
+ /**
12
+ * Defines step by config.
13
+ * Calls cucumber's Given(), When(), Then() under the hood.
14
14
  */
15
15
  function defineStep(stepConfig) {
16
16
  const {
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getStepConfig = getStepConfig;
7
7
  exports.isDecorator = isDecorator;
8
8
  exports.isPlaywrightStyle = isPlaywrightStyle;
9
- /**
10
- * Playwright-bdd's step config.
9
+ /**
10
+ * Playwright-bdd's step config.
11
11
  */
12
12
  function getStepConfig(step) {
13
13
  return step.code.stepConfig;
@@ -15,9 +15,9 @@ function getStepConfig(step) {
15
15
  function isDecorator(stepConfig) {
16
16
  return Boolean(stepConfig === null || stepConfig === void 0 ? void 0 : stepConfig.pomNode);
17
17
  }
18
- /**
19
- * Cucumber-style steps don't have stepConfig
20
- * b/c they created directly via cucumber's Given, When, Then.
18
+ /**
19
+ * Cucumber-style steps don't have stepConfig
20
+ * b/c they created directly via cucumber's Given, When, Then.
21
21
  */
22
22
  function isPlaywrightStyle(stepConfig) {
23
23
  return Boolean(stepConfig);
@@ -6,23 +6,23 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.exit = exit;
7
7
  exports.withExitHandler = withExitHandler;
8
8
  var _worker_threads = require("worker_threads");
9
- /**
10
- * Exit utils.
11
- *
12
- * When calling process.exit() in worker thread used for test-file generation,
13
- * logs are not flushed (https://github.com/vitalets/playwright-bdd/issues/59).
14
- * That's why instead of process.exit we throw ExitError
15
- * that just sets process.exitCode = 1 and allow program to exit normally.
16
- * This esnured by wrapping code with withExitHandler().
17
- *
18
- * On the other hand, when running in the main thread, especially inside Playwright,
19
- * thrown error is captured by Playwright and show with additional messages (e.g. no tests found).
20
- * That's why in main thread we to call process.exit() to show only needed error.
21
- *
22
- * Relevant discussions:
23
- * - https://github.com/nodejs/node/issues/6379
24
- * - https://github.com/nodejs/node-v0.x-archive/issues/3737
25
- * - https://github.com/cucumber/cucumber-js/pull/123
9
+ /**
10
+ * Exit utils.
11
+ *
12
+ * When calling process.exit() in worker thread used for test-file generation,
13
+ * logs are not flushed (https://github.com/vitalets/playwright-bdd/issues/59).
14
+ * That's why instead of process.exit we throw ExitError
15
+ * that just sets process.exitCode = 1 and allow program to exit normally.
16
+ * This esnured by wrapping code with withExitHandler().
17
+ *
18
+ * On the other hand, when running in the main thread, especially inside Playwright,
19
+ * thrown error is captured by Playwright and show with additional messages (e.g. no tests found).
20
+ * That's why in main thread we to call process.exit() to show only needed error.
21
+ *
22
+ * Relevant discussions:
23
+ * - https://github.com/nodejs/node/issues/6379
24
+ * - https://github.com/nodejs/node-v0.x-archive/issues/3737
25
+ * - https://github.com/cucumber/cucumber-js/pull/123
26
26
  */
27
27
 
28
28
  class ExitError extends Error {
@@ -48,12 +48,8 @@ async function withExitHandler(fn) {
48
48
  function exit(...messages) {
49
49
  messages = messages.filter(Boolean);
50
50
  if (_worker_threads.isMainThread) {
51
- // use console.error() here instead of logger.error() to have less stack
52
- // for flushing messages to stderr.
53
-
54
51
  if (messages.length) {
55
- // eslint-disable-next-line no-console, max-depth
56
- console.error('Error:', ...messages);
52
+ logger.error('Error:', ...messages);
57
53
  }
58
54
  process.exit(1);
59
55
  } else {
@@ -15,9 +15,9 @@ var _fs = _interopRequireDefault(require("fs"));
15
15
  var _path = _interopRequireDefault(require("path"));
16
16
  var _util = require("util");
17
17
  const setTimeoutPromise = (0, _util.promisify)(setTimeout);
18
- /**
19
- * Returns Symbol by name.
20
- * See: https://stackoverflow.com/questions/50453640/how-can-i-get-the-value-of-a-symbol-property
18
+ /**
19
+ * Returns Symbol by name.
20
+ * See: https://stackoverflow.com/questions/50453640/how-can-i-get-the-value-of-a-symbol-property
21
21
  */
22
22
  function getSymbolByName(target, name) {
23
23
  const ownKeys = Reflect.ownKeys(target);
@@ -27,18 +27,18 @@ function getSymbolByName(target, name) {
27
27
  }
28
28
  return symbol;
29
29
  }
30
- /**
31
- * Inserts params into template.
32
- * Params defined as <param>.
30
+ /**
31
+ * Inserts params into template.
32
+ * Params defined as <param>.
33
33
  */
34
34
  function template(t, params = {}) {
35
35
  return t.replace(/<(.+?)>/g, (match, key) => {
36
36
  return params[key] !== undefined ? String(params[key]) : match;
37
37
  });
38
38
  }
39
- /**
40
- * Extracts all template params from string.
41
- * Params defined as <param>.
39
+ /**
40
+ * Extracts all template params from string.
41
+ * Params defined as <param>.
42
42
  */
43
43
  function extractTemplateParams(t) {
44
44
  return [...t.matchAll(/<(.+?)>/g)].map(m => m[1]);
@@ -4,15 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.jsStringWrap = jsStringWrap;
7
- /**
8
- * Adopted version of https://github.com/joliss/js-string-escape
9
- * - added support of backticks
10
- * - added 'quotes' option to indicate which quotes to escape
11
- * - wrap result string with provided quotes
12
- *
13
- * Considered alternative is https://github.com/mathiasbynens/jsesc,
14
- * but it provides additional functionality and much slower
15
- * See: https://github.com/mathiasbynens/jsesc/issues/16
7
+ /**
8
+ * Adopted version of https://github.com/joliss/js-string-escape
9
+ * - added support of backticks
10
+ * - added 'quotes' option to indicate which quotes to escape
11
+ * - wrap result string with provided quotes
12
+ *
13
+ * Considered alternative is https://github.com/mathiasbynens/jsesc,
14
+ * but it provides additional functionality and much slower
15
+ * See: https://github.com/mathiasbynens/jsesc/issues/16
16
16
  */
17
17
  function jsStringWrap(str, {
18
18
  quotes = 'single'
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.logger = exports.Logger = void 0;
7
- /**
8
- * Simple logger
7
+ /**
8
+ * Simple logger
9
9
  */
10
10
  class Logger {
11
11
  options;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getFeatureFilePath = getFeatureFilePath;
7
+ exports.getStepFilePath = getStepFilePath;
8
+ var _readConfigFile = require("../../../core/playwright/readConfigFile");
9
+ var _getFilePath = require("../../utils/getFilePath");
10
+ var _stringManipulation = require("../utils/stringManipulation");
11
+ const {
12
+ featureFilesFolder,
13
+ stepDefinitionsFolder
14
+ } = (0, _readConfigFile.generateConfigFromFile)();
15
+ function getFeatureFilePath() {
16
+ return (0, _stringManipulation.filePathPattern)(path.resolve(process.cwd(), 'uat', 'modules', '**', '**', featureFilesFolder, '**', '**', '**', '**', '**', '*.feature'), _getFilePath.isWindows);
17
+ }
18
+ function getStepFilePath() {
19
+ return (0, _stringManipulation.filePathPattern)(path.resolve(process.cwd(), 'uat', 'modules', '**', '**', stepDefinitionsFolder, '**', '**', '**', '**', '**', '*.spec.js'), _getFilePath.isWindows);
20
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createBdd = createBdd;
7
+ function Given(description, callback) {
8
+ globalStepMap.set(description, callback);
9
+ }
10
+ const Then = Given;
11
+ const When = Given;
12
+ const And = Given;
13
+ function createBdd() {
14
+ return {
15
+ Given,
16
+ When,
17
+ Then,
18
+ And
19
+ };
20
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createCucumberBDD = createCucumberBDD;
7
+ var _stepFileGenerate = require("../test/stepGenerate/stepFileGenerate");
8
+ async function createCucumberBDD() {
9
+ await (0, _stepFileGenerate.generateSpecFiles)();
10
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.stepFileMap = stepFileMap;
8
+ var _fastGlob = require("fast-glob");
9
+ var _path = _interopRequireDefault(require("path"));
10
+ var _pathConfig = require("../config/pathConfig");
11
+ async function stepFileMap() {
12
+ const actualSpecPattern = (0, _pathConfig.getStepFilePath)();
13
+ await (0, _fastGlob.globSync)(actualSpecPattern, {
14
+ dot: true,
15
+ cwd: process.cwd()
16
+ }).forEach(FilePath => {
17
+ const specFilePath = _path.default.resolve(process.cwd(), FilePath);
18
+ require(specFilePath);
19
+ });
20
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createNativeBDD = createNativeBDD;
7
+ function $Given(description) {
8
+ const stepFunction = globalStepMap.get(description);
9
+ if (stepFunction === undefined) {
10
+ process.exit(1);
11
+ }
12
+ return function (pages, ...argument) {
13
+ const finalInput = getInputArray(description, argument);
14
+ return stepFunction(pages, ...finalInput);
15
+ };
16
+ }
17
+ function getInputArray(description, argument) {
18
+ const specInput = globalTestdata.get(description);
19
+ if (specInput.input && specInput.steptable) {
20
+ const stepInput = Object.values(specInput.currentArgument).pop() || 'null';
21
+ return [stepInput, specInput.dataTableStep];
22
+ }
23
+ if (specInput.input) {
24
+ return Object.values(specInput.currentArgument) || [];
25
+ }
26
+ if (specInput.steptable) {
27
+ return [specInput.dataTableStep];
28
+ }
29
+ if (specInput.scenarioTable) {
30
+ var exceedParam = specInput.inputParameter[0];
31
+ const extracted = argument.map(element => {
32
+ return exceedParam[element];
33
+ });
34
+ const duplicate = Object.assign({}, specInput);
35
+ const extractInput = duplicate.inputParameter.shift();
36
+ duplicate.inputParameter.push(extractInput);
37
+ globalTestdata.set(description, Object.assign({}, duplicate));
38
+ return extracted;
39
+ }
40
+ return [];
41
+ }
42
+ const $When = $Given;
43
+ const $And = $Given;
44
+ const $Then = $Given;
45
+ function createNativeBDD() {
46
+ return {
47
+ $Given,
48
+ $When,
49
+ $And,
50
+ $Then
51
+ };
52
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "createBdd", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _exportMethods.createBdd;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "createCucumberBDD", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _main.createCucumberBDD;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "createNativeBDD", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _stepDefinitions.createNativeBDD;
22
+ }
23
+ });
24
+ var _exportMethods = require("./core-runner/exportMethods");
25
+ var _stepDefinitions = require("./core-runner/stepDefinitions");
26
+ var _main = require("./core-runner/main");