@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
@@ -57,40 +57,40 @@ function combineDefaultConfigWithUserConfig(userConfiguration) {
57
57
  };
58
58
  }
59
59
 
60
- /**
61
- * @typedef {Object|null} viewportConfig
62
- * @property {number} width - width of the viewport
63
- * @property {number} height - height of the viewport
60
+ /**
61
+ * @typedef {Object|null} viewportConfig
62
+ * @property {number} width - width of the viewport
63
+ * @property {number} height - height of the viewport
64
64
  */
65
65
 
66
- /**
67
- * Represents the user configuration object.
68
- * @typedef {Object} UserConfig
69
- * @property {string} headless - Headless Browsers mode.
70
- * @property {number} trace - trace for test cases.
71
- * @property {boolean} video - video for test cases,
72
- * @property {boolean} debug - debug mode
73
- * @property {string} mode: mode in which the test cases needs to run
74
- * @property {boolean} isAuthMode - Auth Mode. config whether authentication step needed before running test cases
75
- * @property {string} authFilePath - File Path where the cookies stored
76
- * @property {any} browsers: List of browsers
77
- * @property {string} openReportOn: default Option value (never, on-failure and always)
78
- * @property {any} reportPath : directory where report is generate
79
- * @property {boolean} bddMode: Feature files needs to be processed
80
- * @property {number} expectTimeout: time in milliseconds which the expect condition should fail
81
- * @property {number} testTimeout: time in milliseconds which the test should fail
82
- * @property {Object} additionalPages: custom pages configuration
83
- * @property {string} featureFilesFolder: folder name under which feature-files will be placed. Default is feature-files
84
- * @property {string} stepDefinitionsFolder: folder name under which step implementations will be placed. Default is steps
85
- * @property {viewportConfig} viewport: viewport configuration for the browser. Default is { width: 1280, height: 720 }
86
- * @property {string} testIdAttribute: Change the default data-testid attribute. configure what attribute to search while calling getByTestId
87
- * @property {Array} editionOrder: Order in the form of larger editions in the back. Edition with the most privelages should be last
66
+ /**
67
+ * Represents the user configuration object.
68
+ * @typedef {Object} UserConfig
69
+ * @property {string} headless - Headless Browsers mode.
70
+ * @property {number} trace - trace for test cases.
71
+ * @property {boolean} video - video for test cases,
72
+ * @property {boolean} debug - debug mode
73
+ * @property {string} mode: mode in which the test cases needs to run
74
+ * @property {boolean} isAuthMode - Auth Mode. config whether authentication step needed before running test cases
75
+ * @property {string} authFilePath - File Path where the cookies stored
76
+ * @property {any} browsers: List of browsers
77
+ * @property {string} openReportOn: default Option value (never, on-failure and always)
78
+ * @property {any} reportPath : directory where report is generate
79
+ * @property {boolean} bddMode: Feature files needs to be processed
80
+ * @property {number} expectTimeout: time in milliseconds which the expect condition should fail
81
+ * @property {number} testTimeout: time in milliseconds which the test should fail
82
+ * @property {Object} additionalPages: custom pages configuration
83
+ * @property {string} featureFilesFolder: folder name under which feature-files will be placed. Default is feature-files
84
+ * @property {string} stepDefinitionsFolder: folder name under which step implementations will be placed. Default is steps
85
+ * @property {viewportConfig} viewport: viewport configuration for the browser. Default is { width: 1280, height: 720 }
86
+ * @property {string} testIdAttribute: Change the default data-testid attribute. configure what attribute to search while calling getByTestId
87
+ * @property {Array} editionOrder: Order in the form of larger editions in the back. Edition with the most privelages should be last
88
88
  */
89
89
 
90
- /**
91
- * Generates a configuration object from a file, if it exists.
92
- *
93
- * @returns {UserConfig}
90
+ /**
91
+ * Generates a configuration object from a file, if it exists.
92
+ *
93
+ * @returns {UserConfig}
94
94
  */
95
95
  function generateConfigFromFile() {
96
96
  const filePath = _path.default.resolve(process.cwd(), fileName);
@@ -9,7 +9,8 @@ var _test = require("@playwright/test");
9
9
  var _path = _interopRequireDefault(require("path"));
10
10
  var _readConfigFile = require("../readConfigFile");
11
11
  var _configUtils = require("./config-utils");
12
- const defaultBrowsers = ['Chrome', 'Firefox', 'Edge', 'Safari'];
12
+ var _testDataMap = require("../../../bdd-poc/test/testDataMap");
13
+ var _runner = require("../../../bdd-poc/core-runner/runner");
13
14
  const {
14
15
  browsers,
15
16
  trace,
@@ -22,23 +23,18 @@ const {
22
23
  testTimeout,
23
24
  authFilePath,
24
25
  viewport,
25
- featureFilesFolder,
26
- stepDefinitionsFolder,
27
26
  testIdAttribute
28
27
  } = (0, _readConfigFile.generateConfigFromFile)();
29
- const browserList = process.env.mode === 'ci' ? defaultBrowsers : browsers;
30
28
  const projects = (0, _configUtils.getProjects)({
31
- browsers: browserList,
29
+ browsers,
32
30
  isAuthMode,
33
31
  authFilePath,
34
32
  expectTimeout,
35
33
  testTimeout,
36
34
  viewport
37
35
  });
38
- const testDir = (0, _configUtils.getTestDir)(bddMode, process.cwd(), {
39
- featureFilesFolder,
40
- stepDefinitionsFolder
41
- });
36
+ // const testDir = getTestDir(bddMode, process.cwd(), { featureFilesFolder, stepDefinitionsFolder });
37
+ const testDir = _path.default.resolve(process.cwd(), 'uat', 'feature-gen');
42
38
  const testOptions = (0, _configUtils.getTestUseOptions)({
43
39
  trace,
44
40
  video,
@@ -46,12 +42,17 @@ const testOptions = (0, _configUtils.getTestUseOptions)({
46
42
  testIdAttribute
47
43
  });
48
44
 
49
- /**
50
- * Playwright configuration object
51
- *
52
- * @returns {import('@playwright/test').PlaywrightTestConfig}
45
+ /**
46
+ * Playwright configuration object
47
+ *
48
+ * @returns {import('@playwright/test').PlaywrightTestConfig}
53
49
  */
54
50
  function getPlaywrightConfig() {
51
+ globalThis.globalStepMap = new Map();
52
+ (0, _runner.stepFileMap)();
53
+ (0, _testDataMap.testDataCreation)().then(inputs => {
54
+ globalThis.globalTestdata = inputs;
55
+ });
55
56
  return {
56
57
  testDir,
57
58
  outputDir: _path.default.join(process.cwd(), 'uat', 'test-results'),
@@ -4,18 +4,16 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.getBrowsersList = getBrowsersList;
8
7
  exports.getProjects = getProjects;
9
- exports.getTestDir = getTestDir;
10
8
  exports.getTestUseOptions = getTestUseOptions;
11
9
  var _test = require("@playwright/test");
12
10
  var _path = _interopRequireDefault(require("path"));
13
11
  var _readConfigFile = require("../readConfigFile");
14
- var _bddFramework = require("../../../bdd-framework");
15
- var _logger = require("../../../utils/logger");
16
- /**
17
- ** Playwright project configuration
18
- * @returns {import('@playwright/test').Project}
12
+ // import { defineBddConfig } from '../../../bdd-framework';
13
+
14
+ /**
15
+ ** Playwright project configuration
16
+ * @returns {import('@playwright/test').Project}
19
17
  */
20
18
  function getBrowserConfig({
21
19
  browserName,
@@ -89,10 +87,10 @@ function getBrowserConfig({
89
87
  }
90
88
  }
91
89
 
92
- /**
93
- *
94
- * @param {*} param0
95
- * @returns {import('@playwright/test').Project[]}
90
+ /**
91
+ *
92
+ * @param {*} param0
93
+ * @returns {import('@playwright/test').Project[]}
96
94
  */
97
95
  function getProjects({
98
96
  browsers,
@@ -111,27 +109,19 @@ function getProjects({
111
109
  viewport
112
110
  })).filter(Boolean);
113
111
  }
114
- function getBrowsersList(browserFromArgs) {
115
- if (browserFromArgs) {
116
- if (typeof browserFromArgs === 'string') {
117
- let listOfbrowsers = browserFromArgs.split(',').map(browser => browser.trim().toLowerCase());
118
- _logger.Logger.log(_logger.Logger.INFO_TYPE, '');
119
- return listOfbrowsers;
120
- }
121
- }
122
- return [];
123
- }
124
- function getTestDir(bddMode, cwd, {
125
- stepDefinitionsFolder
126
- }) {
127
- return bddMode ? (0, _bddFramework.defineBddConfig)({
128
- paths: [_path.default.join(cwd, 'uat', '**', '*.feature')],
129
- import: [_path.default.join(cwd, 'uat', '**', stepDefinitionsFolder, '*.spec.js')],
130
- featuresRoot: _path.default.join(cwd, 'uat'),
131
- outputDir: _path.default.join(cwd, 'uat', '.features-gen'),
132
- publish: true
133
- }) : _path.default.join(cwd, 'uat');
134
- }
112
+
113
+ // function getTestDir(bddMode, cwd, { stepDefinitionsFolder }) {
114
+ // return bddMode
115
+ // ? defineBddConfig({
116
+ // paths: [path.join(cwd, 'uat', '**', '*.feature')],
117
+ // import: [path.join(cwd, 'uat', '**', stepDefinitionsFolder, '*.spec.js')],
118
+ // featuresRoot: path.join(cwd, 'uat'),
119
+ // outputDir: path.join(cwd, 'uat', '.features-gen'),
120
+ // publish: true,
121
+ // })
122
+ // : path.join(cwd, 'uat');
123
+ // }
124
+
135
125
  function getTestUseOptions({
136
126
  viewport,
137
127
  trace,
@@ -3,6 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.buildEditionTags = buildEditionTags;
7
+ exports.editionPreprocessing = editionPreprocessing;
6
8
  exports.tagProcessor = tagProcessor;
7
9
  var _logger = require("../../utils/logger");
8
10
  /* eslint-disable dot-notation */
@@ -28,11 +30,11 @@ function editionPreprocessing(editionOrder, selectedEdition) {
28
30
  if (index !== -1) {
29
31
  let resultArray;
30
32
  if (operator === '<=') {
31
- resultArray = editionOrder.slice(index + 1);
33
+ resultArray = editionOrder.slice(0, index + 1);
32
34
  } else if (operator === '>=') {
33
35
  resultArray = editionOrder.slice(0, index);
34
36
  } else if (operator === '<') {
35
- resultArray = editionOrder.slice(index);
37
+ resultArray = editionOrder.slice(0, index);
36
38
  } else if (operator === '>') {
37
39
  resultArray = editionOrder.slice(0, index + 1);
38
40
  } else {
@@ -14,15 +14,12 @@ var _logger = require("../../utils/logger");
14
14
  var _readConfigFile = require("./readConfigFile");
15
15
  var _rootPath = require("../../utils/rootPath");
16
16
  var _tagProcessor = require("./tag-processor");
17
- var _configUtils = require("./setup/config-utils");
17
+ var _bddPoc = require("../../bdd-poc");
18
+ var _tagsHandle = require("../../bdd-poc/test/tagsHandle");
18
19
  function parseUserArgs() {
19
20
  return (0, _cliArgsToObject.cliArgsToObject)(process.argv.slice(2));
20
21
  }
21
22
  function getPlaywrightArgs(userArgsObject, debug, bddMode, tagArgs, headless) {
22
- const {
23
- browsers = null
24
- } = userArgsObject;
25
- let browserList = (0, _configUtils.getBrowsersList)(browsers);
26
23
  const playwrightArgs = (0, _cliArgsToObject.objectToCliArgs)(userArgsObject, key => !_customCommands.CUSTOM_COMMANDS.includes(key));
27
24
  if (debug) {
28
25
  playwrightArgs.push('--debug');
@@ -34,38 +31,38 @@ function getPlaywrightArgs(userArgsObject, debug, bddMode, tagArgs, headless) {
34
31
  if (!headless && !userArgsObject.headed) {
35
32
  playwrightArgs.push('--headed');
36
33
  }
37
- if (browserList && browserList.length > 0) {
38
- browserList.map(browser => playwrightArgs.push(`--project=${browser}`));
39
- }
40
- console.log(playwrightArgs);
41
34
  return playwrightArgs;
42
35
  }
43
- function runPreprocessing(tagArgs, configPath) {
44
- const beforeCommand = 'node';
45
- const bddGenPath = _path.default.resolve(__dirname, '../', '../', 'bdd-framework', 'cli', 'index.js');
46
- const beforeArgs = [bddGenPath, '-c', configPath];
47
- if (tagArgs) {
48
- beforeArgs.push('--tags');
49
- beforeArgs.push(tagArgs);
50
- }
51
- return new Promise((resolve, reject) => {
52
- const childProcessForPreprocessing = (0, _child_process.spawn)(beforeCommand, beforeArgs, {
53
- stdio: 'inherit'
54
- });
55
- childProcessForPreprocessing.on('error', data => {
56
- _logger.Logger.log(_logger.Logger.FAILURE_TYPE, data);
57
- reject();
58
- });
59
- childProcessForPreprocessing.on('exit', code => {
60
- if (code === 0) {
61
- _logger.Logger.log(_logger.Logger.SUCCESS_TYPE, 'Feature Files Processed Successfully');
62
- resolve();
63
- } else {
64
- reject(`BddGen exited with code ${code}`);
65
- }
66
- });
67
- });
68
- }
36
+
37
+ // function runPreprocessing(tagArgs, configPath) {
38
+ // const beforeCommand = 'node';
39
+ // const bddGenPath = path.resolve(__dirname, '../', '../', 'bdd-framework', 'cli', 'index.js');
40
+ // const beforeArgs = [bddGenPath, '-c', configPath];
41
+
42
+ // if (tagArgs) {
43
+ // beforeArgs.push('--tags');
44
+ // beforeArgs.push(tagArgs);
45
+ // }
46
+
47
+ // return new Promise((resolve, reject) => {
48
+ // const childProcessForPreprocessing = spawn(beforeCommand, beforeArgs, { stdio: 'inherit' });
49
+
50
+ // childProcessForPreprocessing.on('error', (data) => {
51
+ // Logger.log(Logger.FAILURE_TYPE, data);
52
+ // reject();
53
+ // });
54
+
55
+ // childProcessForPreprocessing.on('exit', (code) => {
56
+ // if (code === 0) {
57
+ // Logger.log(Logger.SUCCESS_TYPE, 'Feature Files Processed Successfully');
58
+ // resolve();
59
+ // } else {
60
+ // reject(`BddGen exited with code ${code}`);
61
+ // }
62
+ // });
63
+ // });
64
+ // }
65
+
69
66
  function runPlaywright(command, args) {
70
67
  return new Promise((resolve, reject) => {
71
68
  const childProcessForRunningPlaywright = (0, _child_process.spawn)(command, args, {
@@ -112,7 +109,16 @@ function main() {
112
109
  const args = ['test', '--config', configPath].concat(playwrightArgs);
113
110
  let promises = [];
114
111
  if (bddMode) {
115
- promises.push(runPreprocessing(tagArgs, configPath));
112
+ (0, _bddPoc.createCucumberBDD)();
113
+ if (userArgsObject !== null && userArgsObject !== void 0 && userArgsObject.edition || userArgsObject !== null && userArgsObject !== void 0 && userArgsObject.tags) {
114
+ if (userArgsObject !== null && userArgsObject !== void 0 && userArgsObject.edition) {
115
+ playwrightArgs.push('--grep-invert');
116
+ } else {
117
+ playwrightArgs.push('--grep');
118
+ }
119
+ playwrightArgs.push((0, _tagsHandle.allowedTags)(userArgsObject));
120
+ }
121
+ // promises.push(runPreprocessing(tagArgs, configPath));
116
122
  }
117
123
  Promise.all(promises).then(() => runPlaywright(command, args)).catch(err => {
118
124
  _logger.Logger.log(_logger.Logger.FAILURE_TYPE, err);
@@ -1 +1 @@
1
- export * from './bdd-framework/decorators';
1
+ // export * from './bdd-framework/decorators';
@@ -1,16 +1,2 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _decorators = require("./bdd-framework/decorators");
7
- Object.keys(_decorators).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _decorators[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _decorators[key];
14
- }
15
- });
16
- });
1
+ // export * from './bdd-framework/decorators';
2
+ "use strict";
package/build/index.d.ts CHANGED
@@ -1,60 +1,60 @@
1
- import { expect, test } from './core/playwright/index';
2
- import { fireEvent, render } from '@testing-library/react';
3
- import {
4
- PlaywrightTestArgs,
5
- PlaywrightTestOptions,
6
- PlaywrightWorkerArgs,
7
- PlaywrightWorkerOptions,
8
- TestType,
9
- Page
10
- } from '@playwright/test';
11
- import { DefineStepPattern } from '@cucumber/cucumber/lib/support_code_library_builder/types';
12
-
13
- export type KeyValue = { [key: string]: any };
14
-
15
- export type BuiltInFixturesWorker = PlaywrightWorkerArgs &
16
- PlaywrightWorkerOptions;
17
- export type BuiltInFixtures = PlaywrightTestArgs &
18
- PlaywrightTestOptions &
19
- BuiltInFixturesWorker;
20
-
21
- export type FixturesArg<T extends KeyValue = {}, W extends KeyValue = {}> = T &
22
- W &
23
- BuiltInFixtures;
24
-
25
- export declare let hasCustomTest: boolean;
26
-
27
- export declare function createBdd<
28
- T extends KeyValue = BuiltInFixtures,
29
- W extends KeyValue = BuiltInFixturesWorker,
30
- World
31
- >(
32
- customTest?: TestType<T, W> | null,
33
- _CustomWorld?: new (...args: any[]) => World
34
- ): {
35
- Given: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
36
- When: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
37
- Then: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
38
- And: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
39
- But: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
40
- Step: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
41
- Before: any;
42
- After: any;
43
- BeforeAll: any;
44
- AfterAll: any;
45
- };
46
-
47
- type StepFunctionFixturesArg<
48
- T extends KeyValue,
49
- W extends KeyValue
50
- > = FixturesArg<T, W>;
51
- type StepFunction<T extends KeyValue, W extends KeyValue> = (
52
- fixtures: StepFunctionFixturesArg<T, W>,
53
- ...args: any[]
54
- ) => unknown;
55
-
56
- const { Given, Then, When, Step, And, But } = createBdd();
57
-
58
- export { Given, Then, When, Step, And, But, expect, test, createBdd, Page };
59
-
60
- export * from '@playwright/test/types/test';
1
+ import { expect, test } from './core/playwright/index';
2
+ // import { fireEvent, render } from '@testing-library/react';
3
+ import {
4
+ PlaywrightTestArgs,
5
+ PlaywrightTestOptions,
6
+ PlaywrightWorkerArgs,
7
+ PlaywrightWorkerOptions,
8
+ TestType,
9
+ Page
10
+ } from '@playwright/test';
11
+ // import { DefineStepPattern } from '@cucumber/cucumber/lib/support_code_library_builder/types';
12
+
13
+ // export type KeyValue = { [key: string]: any };
14
+
15
+ // export type BuiltInFixturesWorker = PlaywrightWorkerArgs &
16
+ // PlaywrightWorkerOptions;
17
+ // export type BuiltInFixtures = PlaywrightTestArgs &
18
+ // PlaywrightTestOptions &
19
+ // BuiltInFixturesWorker;
20
+
21
+ // export type FixturesArg<T extends KeyValue = {}, W extends KeyValue = {}> = T &
22
+ // W &
23
+ // BuiltInFixtures;
24
+
25
+ // export declare let hasCustomTest: boolean;
26
+
27
+ // export declare function createBdd<
28
+ // T extends KeyValue = BuiltInFixtures,
29
+ // W extends KeyValue = BuiltInFixturesWorker,
30
+ // World
31
+ // >(
32
+ // customTest?: TestType<T, W> | null,
33
+ // _CustomWorld?: new (...args: any[]) => World
34
+ // ): {
35
+ // Given: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
36
+ // When: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
37
+ // Then: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
38
+ // And: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
39
+ // But: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
40
+ // Step: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
41
+ // Before: any;
42
+ // After: any;
43
+ // BeforeAll: any;
44
+ // AfterAll: any;
45
+ // };
46
+
47
+ // type StepFunctionFixturesArg<
48
+ // T extends KeyValue,
49
+ // W extends KeyValue
50
+ // > = FixturesArg<T, W>;
51
+ // type StepFunction<T extends KeyValue, W extends KeyValue> = (
52
+ // fixtures: StepFunctionFixturesArg<T, W>,
53
+ // ...args: any[]
54
+ // ) => unknown;
55
+
56
+ // const { Given, Then, When, Step, And, But } = createBdd();
57
+
58
+ // export { Given, Then, When, Step, And, But, expect, test, createBdd, Page };
59
+
60
+ export * from '@playwright/test/types/test';
package/build/index.js CHANGED
@@ -7,7 +7,13 @@ exports.When = exports.Then = exports.Step = exports.Given = exports.But = expor
7
7
  Object.defineProperty(exports, "createBdd", {
8
8
  enumerable: true,
9
9
  get: function () {
10
- return _index.createBdd;
10
+ return _bddPoc.createBdd;
11
+ }
12
+ });
13
+ Object.defineProperty(exports, "createNativeBDD", {
14
+ enumerable: true,
15
+ get: function () {
16
+ return _bddPoc.createNativeBDD;
11
17
  }
12
18
  });
13
19
  Object.defineProperty(exports, "expect", {
@@ -23,28 +29,17 @@ Object.defineProperty(exports, "test", {
23
29
  }
24
30
  });
25
31
  var _index = require("./core/playwright/index");
26
- // const { expect, test, createBdd } = require('./core/playwright/index');
27
- // const { fireEvent, render } = require('@testing-library/react');
28
-
29
- // module.exports = {
30
- // expect,
31
- // test,
32
- // fireEvent,
33
- // render,
34
- // createBdd
35
- // }
36
-
32
+ var _bddPoc = require("./bdd-poc");
37
33
  // import { fireEvent, render } from '@testing-library/react';
38
-
39
34
  const {
40
35
  Given,
41
36
  Then,
42
37
  When,
43
- Step
44
- } = (0, _index.createBdd)();
45
- exports.Step = Step;
38
+ And
39
+ } = (0, _bddPoc.createBdd)();
40
+ exports.And = And;
46
41
  exports.When = When;
47
42
  exports.Then = Then;
48
43
  exports.Given = Given;
49
- const And = exports.And = Then;
44
+ const Step = exports.Step = Then;
50
45
  const But = exports.But = Then;
@@ -1,34 +1,34 @@
1
- Feature: Home Page
2
-
3
- Scenario: Home Page Default content
4
- Given user is on "<App>" home page
5
- Then user gets a "<App>" bootcamp section
6
- And username is also displayed on right corner
7
-
8
- Examples:
9
- | App |
10
- | GitHub |
11
-
12
- Scenario: GitHub Bootcamp Section
13
- Given user is on "<Site>" home page
14
- When user focuses on "<Site>" Bootcamp Section
15
- Then user gets an option to setup git
16
- And user gets an option to create repository
17
- And user gets an option to Fork Repository
18
- And user gets an option to work together
19
-
20
- Examples:
21
- | Site |
22
- | GitHub |
23
-
24
- Scenario: Top Banner content
25
- Given user is on "<Product>" home page
26
- When user focuses on Top Banner
27
- Then user gets an option of home page
28
- And user gets an option to search
29
- And user gets settings options
30
- And user gets an option to logout
31
-
32
- Examples:
33
- | Product |
34
- | GitHub |
1
+ Feature: Home Page
2
+
3
+ Scenario: Home Page Default content
4
+ Given user is on "<App>" home page
5
+ Then user gets a "<App>" bootcamp section
6
+ And username is also displayed on right corner
7
+
8
+ Examples:
9
+ | App |
10
+ | GitHub |
11
+
12
+ Scenario: GitHub Bootcamp Section
13
+ Given user is on "<Site>" home page
14
+ When user focuses on "<Site>" Bootcamp Section
15
+ Then user gets an option to setup git
16
+ And user gets an option to create repository
17
+ And user gets an option to Fork Repository
18
+ And user gets an option to work together
19
+
20
+ Examples:
21
+ | Site |
22
+ | GitHub |
23
+
24
+ Scenario: Top Banner content
25
+ Given user is on "<Product>" home page
26
+ When user focuses on Top Banner
27
+ Then user gets an option of home page
28
+ And user gets an option to search
29
+ And user gets settings options
30
+ And user gets an option to logout
31
+
32
+ Examples:
33
+ | Product |
34
+ | GitHub |
@@ -2,34 +2,34 @@
2
2
 
3
3
  var _testinglibrary = require("@zohodesk/testinglibrary");
4
4
  _testinglibrary.test.describe('Home Page', () => {
5
- /*
6
- ** Given user is on "<App>" home page
7
- ** Then user gets a "<App>" bootcamp section
8
- ** And username is also displayed on right corner
5
+ /*
6
+ ** Given user is on "<App>" home page
7
+ ** Then user gets a "<App>" bootcamp section
8
+ ** And username is also displayed on right corner
9
9
  */
10
10
  (0, _testinglibrary.test)('Home Page Default content', () => {
11
11
  // Your implementation here
12
12
  });
13
13
 
14
- /*
15
- ** Given user is on "<Site>" home page
16
- ** When user focuses on "<Site>" Bootcamp Section
17
- ** Then user gets an option to setup git
18
- ** And user gets an option to create repository
19
- ** And user gets an option to Fork Repository
20
- ** And user gets an option to work together
14
+ /*
15
+ ** Given user is on "<Site>" home page
16
+ ** When user focuses on "<Site>" Bootcamp Section
17
+ ** Then user gets an option to setup git
18
+ ** And user gets an option to create repository
19
+ ** And user gets an option to Fork Repository
20
+ ** And user gets an option to work together
21
21
  */
22
22
  (0, _testinglibrary.test)('GitHub Bootcamp Section', () => {
23
23
  // Your implementation here
24
24
  });
25
25
 
26
- /*
27
- ** Given user is on "<Product>" home page
28
- ** When user focuses on Top Banner
29
- ** Then user gets an option of home page
30
- ** And user gets an option to search
31
- ** And user gets settings options
32
- ** And user gets an option to logout
26
+ /*
27
+ ** Given user is on "<Product>" home page
28
+ ** When user focuses on Top Banner
29
+ ** Then user gets an option of home page
30
+ ** And user gets an option to search
31
+ ** And user gets settings options
32
+ ** And user gets an option to logout
33
33
  */
34
34
  (0, _testinglibrary.test)('Top Banner content', () => {
35
35
  // Your implementation here