@zohodesk/testinglibrary 0.0.5-exp.9 → 0.0.5-n20-experimental

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 (158) hide show
  1. package/.babelrc +9 -1
  2. package/.eslintrc.js +31 -0
  3. package/.gitlab-ci.yml +191 -0
  4. package/.prettierrc +6 -0
  5. package/README.md +151 -1
  6. package/build/common/data-generator/steps/DataGenerator.spec.js +19 -0
  7. package/build/common/data-generator/steps/DataGeneratorStepsHelper.js +19 -0
  8. package/build/common/multi-actor/steps/multiActorHandling.spec.js +26 -0
  9. package/build/common/searchFake/helpers/rpcRequestHelper.js +41 -0
  10. package/build/common/searchFake/steps/searchFake.spec.js +26 -0
  11. package/build/core/dataGenerator/DataGenerator.js +108 -0
  12. package/build/core/dataGenerator/DataGeneratorError.js +50 -0
  13. package/build/core/dataGenerator/DataGeneratorHelper.js +49 -0
  14. package/build/core/jest/preprocessor/jsPreprocessor.js +3 -9
  15. package/build/core/jest/runner/jest-runner.js +1 -0
  16. package/build/core/jest/setup/index.js +1 -7
  17. package/build/core/playwright/builtInFixtures/actorContext.js +75 -0
  18. package/build/core/playwright/builtInFixtures/addTags.js +19 -0
  19. package/build/core/playwright/builtInFixtures/cacheLayer.js +13 -0
  20. package/build/core/playwright/builtInFixtures/context.js +32 -0
  21. package/build/core/playwright/builtInFixtures/executionContext.js +17 -0
  22. package/build/core/playwright/builtInFixtures/i18N.js +41 -0
  23. package/build/core/playwright/builtInFixtures/index.js +46 -0
  24. package/build/core/playwright/builtInFixtures/page.js +38 -0
  25. package/build/core/playwright/builtInFixtures/unauthenticatedPage.js +18 -0
  26. package/build/core/playwright/clear-caches.js +49 -0
  27. package/build/core/playwright/codegen.js +5 -6
  28. package/build/core/playwright/configuration/Configuration.js +25 -0
  29. package/build/core/playwright/configuration/ConfigurationHelper.js +43 -0
  30. package/build/core/playwright/configuration/UserArgs.js +12 -0
  31. package/build/core/playwright/constants/browserTypes.js +12 -0
  32. package/build/core/playwright/constants/fileMutexConfig.js +9 -0
  33. package/build/core/playwright/custom-commands.js +1 -2
  34. package/build/core/playwright/env-initializer.js +28 -6
  35. package/build/core/playwright/fixtures.js +24 -0
  36. package/build/core/playwright/helpers/additionalProfiles.js +25 -0
  37. package/build/core/playwright/helpers/auth/accountLogin.js +21 -0
  38. package/build/core/playwright/helpers/auth/checkAuthCookies.js +41 -0
  39. package/build/core/playwright/helpers/auth/getUrlOrigin.js +13 -0
  40. package/build/core/playwright/helpers/auth/getUsers.js +118 -0
  41. package/build/core/playwright/helpers/auth/index.js +76 -0
  42. package/build/core/playwright/helpers/auth/loginDefaultStepsHelper.js +54 -0
  43. package/build/core/playwright/helpers/auth/loginSteps.js +50 -0
  44. package/build/core/playwright/helpers/checkAuthDirectory.js +27 -0
  45. package/build/core/playwright/helpers/configFileNameProvider.js +31 -0
  46. package/build/core/playwright/helpers/customFixturesHelper.js +58 -0
  47. package/build/core/playwright/helpers/fileMutex.js +71 -0
  48. package/build/core/playwright/helpers/getUserFixtures.js +23 -0
  49. package/build/core/playwright/helpers/mergeObjects.js +13 -0
  50. package/build/core/playwright/helpers/parseUserArgs.js +10 -0
  51. package/build/core/playwright/index.js +10 -89
  52. package/build/core/playwright/readConfigFile.js +97 -14
  53. package/build/core/playwright/report-generator.js +9 -10
  54. package/build/core/playwright/runner/Runner.js +22 -0
  55. package/build/core/playwright/runner/RunnerHelper.js +43 -0
  56. package/build/core/playwright/runner/RunnerTypes.js +17 -0
  57. package/build/core/playwright/runner/SpawnRunner.js +113 -0
  58. package/build/core/playwright/setup/config-creator.js +101 -90
  59. package/build/core/playwright/setup/config-utils.js +188 -0
  60. package/build/core/playwright/setup/custom-reporter.js +136 -0
  61. package/build/core/playwright/setup/qc-custom-reporter.js +291 -0
  62. package/build/core/playwright/tagProcessor.js +69 -0
  63. package/build/core/playwright/test-runner.js +84 -67
  64. package/build/core/playwright/types.js +44 -0
  65. package/build/core/playwright/validateFeature.js +28 -0
  66. package/build/decorators.d.ts +1 -0
  67. package/build/decorators.js +16 -0
  68. package/build/index.d.ts +78 -0
  69. package/build/index.js +73 -5
  70. package/build/lib/cli.js +38 -5
  71. package/build/lib/post-install.js +19 -11
  72. package/build/lint/index.js +3 -6
  73. package/build/parser/parser.js +205 -0
  74. package/build/parser/sample.feature +34 -0
  75. package/build/parser/sample.spec.js +37 -0
  76. package/build/parser/verifier.js +130 -0
  77. package/build/setup-folder-structure/helper.js +37 -0
  78. package/build/setup-folder-structure/reportEnhancement/addonScript.html +25 -0
  79. package/build/setup-folder-structure/reportEnhancement/reportAlteration.js +25 -0
  80. package/build/setup-folder-structure/samples/accountLogin-sample.js +19 -0
  81. package/build/setup-folder-structure/samples/actors-index.js +2 -0
  82. package/build/setup-folder-structure/samples/auth-setup-sample.js +15 -0
  83. package/build/setup-folder-structure/samples/editions-index.js +3 -0
  84. package/build/setup-folder-structure/samples/free-sample.json +25 -0
  85. package/build/setup-folder-structure/samples/git-ignore.sample.js +37 -0
  86. package/build/setup-folder-structure/samples/settings.json +7 -0
  87. package/build/setup-folder-structure/samples/testSetup-sample.js +14 -0
  88. package/build/setup-folder-structure/samples/uat-config-sample.js +46 -0
  89. package/build/setup-folder-structure/setupProject.js +36 -18
  90. package/build/test/core/playwright/__tests__/tagProcessor.test.js +94 -0
  91. package/build/test/core/playwright/__tests__/validateFeature.test.js +69 -0
  92. package/build/test/core/playwright/buildInFixtures/__tests__/executionContext.test.js +27 -0
  93. package/build/test/core/playwright/configuration/__tests__/Configuration.test.js +53 -0
  94. package/build/test/core/playwright/helpers/__tests__/additionalProfiles.test.js +45 -0
  95. package/build/test/core/playwright/helpers/__tests__/configFileNameProvider.test.js +34 -0
  96. package/build/test/core/playwright/helpers/__tests__/customFixturesHelper.test.js +51 -0
  97. package/build/test/core/playwright/helpers/__tests__/fileMutex.test.js +79 -0
  98. package/build/test/core/playwright/helpers/__tests__/getUsers_ListOfActors.test.js +80 -0
  99. package/build/test/core/playwright/runner/__tests__/RunnerHelper.test.js +16 -0
  100. package/build/test/core/playwright/runner/__tests__/SpawnRunner.test.js +27 -0
  101. package/build/utils/cliArgsToObject.js +9 -1
  102. package/build/utils/commonUtils.js +17 -0
  103. package/build/utils/fileUtils.js +109 -0
  104. package/build/utils/logger.js +7 -35
  105. package/build/utils/rootPath.js +16 -9
  106. package/build/utils/stepDefinitionsFormatter.js +11 -0
  107. package/changelog.md +136 -10
  108. package/jest.config.js +29 -11
  109. package/npm-shrinkwrap.json +10241 -6175
  110. package/package.json +40 -26
  111. package/playwright.config.js +5 -55
  112. package/test-results/.last-run.json +4 -0
  113. package/unit_reports/unit-report.html +277 -0
  114. package/build/bdd-framework/cli/commands/env.js +0 -44
  115. package/build/bdd-framework/cli/commands/export.js +0 -47
  116. package/build/bdd-framework/cli/commands/test.js +0 -60
  117. package/build/bdd-framework/cli/index.js +0 -11
  118. package/build/bdd-framework/cli/options.js +0 -21
  119. package/build/bdd-framework/cli/worker.js +0 -13
  120. package/build/bdd-framework/config/dir.js +0 -27
  121. package/build/bdd-framework/config/env.js +0 -49
  122. package/build/bdd-framework/config/index.js +0 -92
  123. package/build/bdd-framework/cucumber/buildStepDefinition.js +0 -45
  124. package/build/bdd-framework/cucumber/gherkin.d.ts +0 -45
  125. package/build/bdd-framework/cucumber/loadConfig.js +0 -17
  126. package/build/bdd-framework/cucumber/loadFeatures.js +0 -39
  127. package/build/bdd-framework/cucumber/loadSnippetBuilder.js +0 -20
  128. package/build/bdd-framework/cucumber/loadSources.js +0 -58
  129. package/build/bdd-framework/cucumber/loadSteps.js +0 -41
  130. package/build/bdd-framework/decorators.js +0 -21
  131. package/build/bdd-framework/gen/formatter.js +0 -92
  132. package/build/bdd-framework/gen/i18n.js +0 -44
  133. package/build/bdd-framework/gen/index.js +0 -150
  134. package/build/bdd-framework/gen/poms.js +0 -47
  135. package/build/bdd-framework/gen/testFile.js +0 -356
  136. package/build/bdd-framework/gen/testNode.js +0 -50
  137. package/build/bdd-framework/index.js +0 -33
  138. package/build/bdd-framework/playwright/fixtureParameterNames.js +0 -103
  139. package/build/bdd-framework/playwright/getLocationInFile.js +0 -50
  140. package/build/bdd-framework/playwright/loadConfig.js +0 -42
  141. package/build/bdd-framework/playwright/testTypeImpl.js +0 -47
  142. package/build/bdd-framework/playwright/transform.js +0 -85
  143. package/build/bdd-framework/playwright/utils.js +0 -24
  144. package/build/bdd-framework/run/bddFixtures.js +0 -109
  145. package/build/bdd-framework/run/bddWorld.js +0 -91
  146. package/build/bdd-framework/snippets/index.js +0 -132
  147. package/build/bdd-framework/snippets/snippetSyntax.js +0 -50
  148. package/build/bdd-framework/snippets/snippetSyntaxDecorators.js +0 -32
  149. package/build/bdd-framework/snippets/snippetSyntaxTs.js +0 -18
  150. package/build/bdd-framework/stepDefinitions/createBdd.js +0 -52
  151. package/build/bdd-framework/stepDefinitions/createDecorators.js +0 -110
  152. package/build/bdd-framework/stepDefinitions/defineStep.js +0 -62
  153. package/build/bdd-framework/utils/index.js +0 -52
  154. package/build/bdd-framework/utils/jsStringWrap.js +0 -44
  155. package/build/bdd-framework/utils/logger.js +0 -21
  156. package/build/setup-folder-structure/env-config-sample.json +0 -17
  157. package/build/setup-folder-structure/uat-config-sample.js +0 -31
  158. package/build/setup-folder-structure/user-example.json +0 -3
@@ -4,40 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.Logger = void 0;
7
- // const SUCCESS_TYPE = 'success';
8
- // const FAILURE_TYPE = 'failure';
9
- // const INFO_TYPE = 'info';
10
-
11
- // function logger() {
12
- // this.colors = {
13
- // 'success': ['\x1b[36m', '\x1b[0m'],
14
- // 'failure': ['\x1b[31m', '\x1b[0m'],
15
- // 'info': ['\x1b[33m', '\x1b[0m']
16
- // }
17
- // this.consoleLogger = console;
18
- // return {
19
- // SUCCESS_TYPE,
20
- // FAILURE_TYPE,
21
- // INFO_TYPE,
22
- // error: () => { },
23
- // info: () => { },
24
- // log: (type, message) => {
25
- // const color = this.colors[type];
26
- // console.log(type, color)
27
- // this.consoleLogger.log(`${color[0]}${message}${color[1]}`)
28
- // }
29
- // }
30
- // }
31
-
32
- // module.exports = {
33
- // Logger: logger()
34
- // }
35
-
36
7
  class LoggerImpl {
37
- SUCCESS_TYPE = 'success';
38
- FAILURE_TYPE = 'failure';
39
- INFO_TYPE = 'info';
40
8
  constructor() {
9
+ this.SUCCESS_TYPE = 'success';
10
+ this.FAILURE_TYPE = 'failure';
11
+ this.INFO_TYPE = 'info';
41
12
  this.colors = {
42
13
  'success': ['\x1b[36m', '\x1b[0m'],
43
14
  'failure': ['\x1b[31m', '\x1b[0m'],
@@ -45,12 +16,13 @@ class LoggerImpl {
45
16
  };
46
17
  this.consoleLogger = console;
47
18
  }
48
- error() {}
19
+ error(err) {
20
+ this.consoleLogger.error(err);
21
+ }
49
22
  info() {}
50
23
  log(type, message) {
51
24
  const color = this.colors[type];
52
25
  this.consoleLogger.log(`${color[0]}${message}${color[1]}`);
53
26
  }
54
27
  }
55
- const Logger = new LoggerImpl();
56
- exports.Logger = Logger;
28
+ const Logger = exports.Logger = new LoggerImpl();
@@ -12,24 +12,31 @@ var _path = _interopRequireDefault(require("path"));
12
12
  var _fs = _interopRequireDefault(require("fs"));
13
13
  var _logger = require("./logger");
14
14
  var _getFilePath = _interopRequireDefault(require("./getFilePath"));
15
- function findBinaryPath(directory, command) {
16
- const binaryPath = _path.default.join(directory, '.bin', (0, _getFilePath.default)(command));
17
- if (_fs.default.existsSync(binaryPath)) {
18
- return binaryPath;
15
+ // TODO: Publish and check this change of finding package.json working fine.
16
+ function findPath(directory, pathToFind) {
17
+ const filePath = _path.default.join(directory, pathToFind);
18
+ if (_fs.default.existsSync(filePath)) {
19
+ return filePath;
19
20
  }
20
-
21
- // Recursively search parent directories. Might be time-consuming ?? Can we look for npm module like which?
22
21
  const parentDir = _path.default.dirname(directory);
23
22
  if (parentDir === directory) {
24
23
  return null;
25
24
  }
26
- return findBinaryPath(parentDir, command);
25
+ return findPath(parentDir, pathToFind);
26
+ }
27
+ function findPackageJSON(startDir) {
28
+ return findPath(startDir, 'package.json');
29
+ }
30
+ function findBinaryPath(directory, command) {
31
+ const binaryPath = _path.default.join('.bin', (0, _getFilePath.default)(command));
32
+ return findPath(directory, binaryPath);
27
33
  }
28
34
  function getRootPath() {
29
- return _path.default.resolve(__dirname, '../', '../');
35
+ return findPackageJSON(_path.default.resolve(__dirname));
30
36
  }
31
37
  function getRootNodeModulesPath() {
32
- return _path.default.resolve(getRootPath(), 'node_modules');
38
+ const rootPath = getRootPath();
39
+ return _path.default.resolve(_path.default.dirname(rootPath), 'node_modules');
33
40
  }
34
41
  function getBinPath(command) {
35
42
  const packageNodeModulesPath = getRootNodeModulesPath();
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.delimiters = void 0;
7
+ exports.findDelimiterFromStep = findDelimiterFromStep;
8
+ const delimiters = exports.delimiters = ["Given", "When", "Then", "And"];
9
+ function findDelimiterFromStep(step) {
10
+ return delimiters.find(delimiter => step.includes(delimiter));
11
+ }
package/changelog.md CHANGED
@@ -1,22 +1,148 @@
1
1
  # Testing Framework
2
2
 
3
3
  ## Framework that abstracts the configuration for playwright and Jest
4
+ # 0.2.4
5
+ - Issue fixes on custom fixtures
6
+ - Page Fixture
7
+ - i18n Fixture
8
+
9
+ # 0.2.1
10
+ **Issue Fixes**
11
+ - Fixes issue in actors configuration
12
+ - Added Error Logger
4
13
 
5
- # 0.0.5-exp.8
14
+ # 0.2.0
15
+ **Major Breaking Change**
16
+ - Removed Env-config.json in favour of conf/*/settings.json
17
+ - Mode in uat.config.js is deprecated. Use command args instead
6
18
 
7
- - Additional pages support added as config
19
+ **Enhancements**
20
+ - Playwright version updated to 1.42.1
21
+ - Playwright-bdd version updated to 6.1.1
22
+ - Tags Support
23
+ - Added getMetaInfo fixture to get the actors Info data
8
24
 
9
- # 0.0.5-exp.5
25
+ **Issue Fixes**
26
+ - Fixes #10- Mode config not working properly
10
27
 
11
- - Added expect timeout and test timeout as an option
28
+ # 0.1.9
29
+ **Enhancements**
30
+ - Added option to specify browsers in command line.
31
+ - npm run uat -- --browsers='chrome,firefox'
32
+ - Playwright version updated to 1.41.1
33
+ - Added option to Skip Browser download
34
+ - Added New Command re-run-failed to run only the failed cases
35
+ **Major Change**
36
+ - Default fixtures moved inside the library.(Page, Context, i18N, unauthenticatedPage)
37
+ **Internal Library Change**
38
+ Examples folder updated to latest testing library version.
12
39
 
13
- # 0.0.5-exp.2
40
+ # 0.1.8
41
+ **Issue Fixes**
42
+ - Fix #9 Custom report generate Error on Windows
43
+ - Add Tags annotations only on bddMode
14
44
 
15
- - Provided Initial Support for cucumber feature files
16
- - Playwright-bdd and cucumber
17
- - Added config bddMode which toggles the feature files processing
18
- - Internal Library change
19
- - Provided support for import/export statements
45
+ **Enhancements**
46
+ - Added Failed steps in test summary
47
+
48
+ # 0.1.7
49
+ **Enhancements**
50
+ - Added option to run teardown logic.
51
+ - Added support for tag based filtering.
52
+ - Playwright-bdd version updated to 5.6.0.
53
+ - New fixture added to add tag as annotations in test report
54
+
55
+ **Issue Fixes**
56
+ - Edition command option. Fixed the edition tags not generated properly
57
+
58
+ # 0.1.6
59
+
60
+ **Enhancements**
61
+ - New Command option Added `--edition`.
62
+ - New Configuration Added `editionOrder`.
63
+ `In uat.config.js, editionOrder: ['Free', 'Express']`
64
+ - Cache Layer added
65
+
66
+ **USAGE**
67
+ - npm run uat --edition="Free"
68
+
69
+
70
+
71
+ # 0.1.5
72
+
73
+ **Enhancements**
74
+
75
+ - Playwright version updated to `1.40.1`
76
+ - And and But Support added
77
+ - Added Code Suggestions support
78
+ - Custom Reporter added. Now the report will be available in json format.
79
+ - New Commands added.
80
+
81
+ `- help: npx ZDTestingFramework help`
82
+
83
+ - Will list down the commands available in the tool
84
+
85
+ `- clearCaches: npx ZDTestingFramework clearCaches`
86
+
87
+ - Will clear the exisiting cookies in the authentication setup
88
+
89
+ **Issue Fixes**
90
+
91
+ - Fixed Issue that occurs while quitting node process.
92
+
93
+ # 0.1.4
94
+
95
+ - `testIdAttribute` config added
96
+ - Fixed issue while reading boolean configuration values
97
+
98
+ # 0.1.3
99
+
100
+ - uat config sample file updated with `bddMode` and `viewport` values
101
+ - user configuration issue fix when the value is undefined
102
+
103
+ # 0.1.2
104
+
105
+ - Bdd version updated to `5.4.0`
106
+ - Playwright version updated to `1.39.0`
107
+
108
+ # 0.1.1
109
+
110
+ - Fixed post install script error
111
+ - Fixed error `@cucumber/gherkin` not found. Cause of this issue is updating @cucumber/cucumber to 9.5.0. Reverting this version to 9.2.0
112
+ - Removed testing library exports
113
+
114
+ # 0.1.0
115
+
116
+ - Removed eslint as dev dependencies as it causes `npm aliases not supported error` for npm version < 6
117
+
118
+ # 0.0.9
119
+
120
+ - Video sized in report adjusted to viewport size
121
+ - Changes in package.json scripts while setting up project
122
+
123
+ # 0.0.8
124
+
125
+ - Tags Support
126
+ - Enable running without bddmode feature
127
+ - viewport configuration
128
+ - Internal Change - Code refactoring
129
+
130
+ # 0.0.7
131
+
132
+ - Removed react and react-dom as dependencies. Added this as peer dependency
133
+
134
+ # 0.0.6
135
+
136
+ ## Provided Initial Support for cucumber feature files
137
+
138
+ - Playwright-bdd and cucumber added as dependencies
139
+ - Added config bddMode which toggles the feature files processing
140
+ - Added expect timeout and test timeout as an option
141
+ - Decorators support for given, when and then. Typescript support needed to use this feature
142
+
143
+ ## Internal Library change
144
+
145
+ - Provided support for import/export statements
20
146
 
21
147
  # 0.0.5
22
148
 
package/jest.config.js CHANGED
@@ -5,8 +5,18 @@ const appPath = process.cwd();
5
5
  const appGlobals = path.resolve(appPath, '__testUtils__', 'globals.js');
6
6
 
7
7
  module.exports = {
8
+ reporters: [
9
+ "default",
10
+ [
11
+ "jest-html-reporter",
12
+ {
13
+ outputPath: "unit_reports/unit-report.html",
14
+ pageTitle: "Unit Report"
15
+ }
16
+ ]
17
+ ],
8
18
  rootDir: process.cwd(),
9
- testEnvironment: 'jsdom',
19
+ testEnvironment: 'node',
10
20
 
11
21
  setupFilesAfterEnv: [
12
22
  existsSync(appGlobals) && appGlobals,
@@ -21,13 +31,21 @@ module.exports = {
21
31
  'jest',
22
32
  'preprocessor',
23
33
  'jsPreprocessor.js'
24
- )
34
+ ),
35
+ '^.+\\.jsx?$': 'babel-jest'
25
36
  },
37
+
38
+ testMatch: ['**/__tests__/**/*.test.js'],
26
39
 
27
40
  modulePathIgnorePatterns: ['/build/'],
28
41
 
29
42
  transformIgnorePatterns: [
30
- '/node_modules/(?!(@zohodesk)/)'
43
+ '/node_modules/',
44
+ '/src/setup-folder-structure/samples/'
45
+ ],
46
+
47
+ coveragePathIgnorePatterns:[
48
+ '/src/setup-folder-structure/samples/'
31
49
  ],
32
50
 
33
51
  testPathIgnorePatterns: [
@@ -48,14 +66,14 @@ module.exports = {
48
66
  collectCoverageFrom: ['src/**/*.js'],
49
67
  coverageDirectory: './build/cov',
50
68
  coverageReporters: ['lcov', 'json', 'html', 'json-summary', 'text'],
51
- coverageThreshold: {
52
- global: {
53
- branches: 100,
54
- functions: 100,
55
- lines: 100,
56
- statements: 100
57
- }
58
- },
69
+ // coverageThreshold: {
70
+ // global: {
71
+ // branches: 100,
72
+ // functions: 100,
73
+ // lines: 100,
74
+ // statements: 100
75
+ // }
76
+ // },
59
77
  globals: {
60
78
  __DEVELOPMENT__: true,
61
79
  __DOCS__: false,