@zohodesk/testinglibrary 0.1.8 → 0.1.9-exp-actors

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 (109) hide show
  1. package/.babelrc +3 -0
  2. package/build/bdd-framework/cli/commands/env.js +1 -1
  3. package/build/bdd-framework/config/configDir.js +35 -0
  4. package/build/bdd-framework/config/enrichReporterData.js +23 -0
  5. package/build/bdd-framework/config/index.js +10 -6
  6. package/build/bdd-framework/cucumber/createTestStep.js +43 -0
  7. package/build/bdd-framework/cucumber/formatter/EventDataCollector.js +126 -0
  8. package/build/bdd-framework/cucumber/formatter/GherkinDocumentParser.js +72 -0
  9. package/build/bdd-framework/cucumber/formatter/PickleParser.js +25 -0
  10. package/build/bdd-framework/cucumber/formatter/durationHelpers.js +13 -0
  11. package/build/bdd-framework/cucumber/formatter/getColorFns.js +57 -0
  12. package/build/bdd-framework/cucumber/formatter/index.js +16 -0
  13. package/build/bdd-framework/cucumber/formatter/locationHelpers.js +16 -0
  14. package/build/bdd-framework/cucumber/loadFeatures.js +62 -31
  15. package/build/bdd-framework/cucumber/loadSteps.js +7 -0
  16. package/build/bdd-framework/cucumber/resolveFeaturePaths.js +62 -0
  17. package/build/bdd-framework/cucumber/stepArguments.js +21 -0
  18. package/build/bdd-framework/cucumber/valueChecker.js +23 -0
  19. package/build/bdd-framework/gen/formatter.js +11 -23
  20. package/build/bdd-framework/gen/index.js +41 -20
  21. package/build/bdd-framework/gen/testFile.js +69 -26
  22. package/build/bdd-framework/gen/testMeta.js +60 -0
  23. package/build/bdd-framework/gen/testNode.js +11 -12
  24. package/build/bdd-framework/hooks/scenario.js +29 -6
  25. package/build/bdd-framework/hooks/worker.js +7 -1
  26. package/build/bdd-framework/index.js +8 -1
  27. package/build/bdd-framework/playwright/getLocationInFile.js +36 -9
  28. package/build/bdd-framework/playwright/loadUtils.js +33 -0
  29. package/build/bdd-framework/playwright/transform.js +5 -1
  30. package/build/bdd-framework/reporter/cucumber/base.js +57 -0
  31. package/build/bdd-framework/reporter/cucumber/custom.js +73 -0
  32. package/build/bdd-framework/reporter/cucumber/helper.js +12 -0
  33. package/build/bdd-framework/reporter/cucumber/html.js +35 -0
  34. package/build/bdd-framework/reporter/cucumber/index.js +74 -0
  35. package/build/bdd-framework/reporter/cucumber/json.js +312 -0
  36. package/build/bdd-framework/reporter/cucumber/junit.js +205 -0
  37. package/build/bdd-framework/reporter/cucumber/message.js +20 -0
  38. package/build/bdd-framework/reporter/cucumber/messagesBuilder/AttachmentMapper.js +64 -0
  39. package/build/bdd-framework/reporter/cucumber/messagesBuilder/Builder.js +196 -0
  40. package/build/bdd-framework/reporter/cucumber/messagesBuilder/GherkinDocument.js +43 -0
  41. package/build/bdd-framework/reporter/cucumber/messagesBuilder/GherkinDocumentClone.js +52 -0
  42. package/build/bdd-framework/reporter/cucumber/messagesBuilder/GherkinDocuments.js +105 -0
  43. package/build/bdd-framework/reporter/cucumber/messagesBuilder/Hook.js +70 -0
  44. package/build/bdd-framework/reporter/cucumber/messagesBuilder/Meta.js +45 -0
  45. package/build/bdd-framework/reporter/cucumber/messagesBuilder/Pickles.js +27 -0
  46. package/build/bdd-framework/reporter/cucumber/messagesBuilder/Projects.js +38 -0
  47. package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestCase.js +128 -0
  48. package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestCaseRun.js +126 -0
  49. package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestCaseRunHooks.js +102 -0
  50. package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestStepAttachments.js +50 -0
  51. package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestStepRun.js +88 -0
  52. package/build/bdd-framework/reporter/cucumber/messagesBuilder/index.js +30 -0
  53. package/build/bdd-framework/reporter/cucumber/messagesBuilder/pwUtils.js +51 -0
  54. package/build/bdd-framework/reporter/cucumber/messagesBuilder/timing.js +35 -0
  55. package/build/bdd-framework/reporter/cucumber/messagesBuilder/types.js +5 -0
  56. package/build/bdd-framework/run/StepInvoker.js +21 -26
  57. package/build/bdd-framework/run/bddDataAttachment.js +46 -0
  58. package/build/bdd-framework/run/bddFixtures.js +31 -10
  59. package/build/bdd-framework/run/bddWorld.js +5 -2
  60. package/build/bdd-framework/run/bddWorldInternal.js +15 -0
  61. package/build/bdd-framework/snippets/index.js +3 -7
  62. package/build/bdd-framework/stepDefinitions/defineStep.js +1 -1
  63. package/build/bdd-framework/utils/AutofillMap.js +20 -0
  64. package/build/bdd-framework/utils/index.js +23 -0
  65. package/build/bdd-framework/utils/stripAnsiEscapes.js +20 -0
  66. package/build/core/playwright/builtInFixtures/cacheLayer.js +1 -0
  67. package/build/core/playwright/builtInFixtures/context.js +18 -1
  68. package/build/core/playwright/builtInFixtures/i18N.js +33 -0
  69. package/build/core/playwright/builtInFixtures/index.js +17 -1
  70. package/build/core/playwright/builtInFixtures/page.js +87 -39
  71. package/build/core/playwright/builtInFixtures/unauthenticatedPage.js +18 -0
  72. package/build/core/playwright/clear-caches.js +19 -8
  73. package/build/core/playwright/codegen.js +4 -4
  74. package/build/core/playwright/constants/browserTypes.js +12 -0
  75. package/build/core/playwright/custom-commands.js +1 -1
  76. package/build/core/playwright/env-initializer.js +10 -6
  77. package/build/core/playwright/helpers/auth/accountLogin.js +18 -0
  78. package/build/core/playwright/helpers/auth/checkAuthCookies.js +50 -0
  79. package/build/core/playwright/helpers/auth/getUrlOrigin.js +13 -0
  80. package/build/core/playwright/helpers/auth/getUsers.js +111 -0
  81. package/build/core/playwright/helpers/auth/index.js +70 -0
  82. package/build/core/playwright/helpers/auth/loginSteps.js +36 -0
  83. package/build/core/playwright/helpers/configFileNameProvider.js +24 -0
  84. package/build/core/playwright/helpers/getUserFixtures.js +23 -0
  85. package/build/core/playwright/helpers/mergeObjects.js +13 -0
  86. package/build/core/playwright/helpers/parseUserArgs.js +11 -0
  87. package/build/core/playwright/index.js +63 -1
  88. package/build/core/playwright/readConfigFile.js +23 -12
  89. package/build/core/playwright/report-generator.js +7 -7
  90. package/build/core/playwright/setup/config-creator.js +4 -1
  91. package/build/core/playwright/setup/config-utils.js +43 -7
  92. package/build/core/playwright/setup/custom-reporter.js +3 -2
  93. package/build/core/playwright/test-runner.js +20 -10
  94. package/build/core/playwright/types.js +43 -0
  95. package/build/index.d.ts +39 -2
  96. package/build/index.js +60 -11
  97. package/build/lib/cli.js +12 -3
  98. package/build/lib/post-install.js +18 -10
  99. package/build/setup-folder-structure/helper.js +3 -0
  100. package/build/setup-folder-structure/samples/auth-setup-sample.js +20 -21
  101. package/build/utils/cliArgsToObject.js +5 -1
  102. package/build/utils/fileUtils.js +3 -0
  103. package/build/utils/rootPath.js +16 -9
  104. package/changelog.md +13 -0
  105. package/npm-shrinkwrap.json +18 -12
  106. package/package.json +6 -4
  107. package/build/bdd-framework/config/dir.js +0 -27
  108. package/build/bdd-framework/cucumber/loadSources.js +0 -57
  109. /package/build/bdd-framework/cucumber/{gherkin.d.js → types.js} +0 -0
@@ -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();
package/changelog.md CHANGED
@@ -1,6 +1,19 @@
1
1
  # Testing Framework
2
2
 
3
3
  ## Framework that abstracts the configuration for playwright and Jest
4
+
5
+ # 0.1.9
6
+ **Enhancements**
7
+ - Added option to specify browsers in command line.
8
+ - npm run uat -- --browsers='chrome,firefox'
9
+ - Playwright version updated to 1.41.1
10
+ - Added option to Skip Browser download
11
+ - Added New Command re-run-failed to run only the failed cases
12
+ **Major Change**
13
+ - Default fixtures moved inside the library.(Page, Context, i18N, unauthenticatedPage)
14
+ **Internal Library Change**
15
+ Examples folder updated to latest testing library version.
16
+
4
17
  # 0.1.8
5
18
  **Issue Fixes**
6
19
  - Fix #9 Custom report generate Error on Windows
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/testinglibrary",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
@@ -2074,11 +2074,11 @@
2074
2074
  "integrity": "sha512-Aq58f5HiWdyDlFffbbSjAlv596h/cOnt2DO1w3DOC7OJ5EHs0hd/nycJfiu9RJbT6Yk6F1knnRRXNSpxoIVZ9Q=="
2075
2075
  },
2076
2076
  "@playwright/test": {
2077
- "version": "1.40.1",
2078
- "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.40.1.tgz",
2079
- "integrity": "sha512-EaaawMTOeEItCRvfmkI9v6rBkF1svM8wjl/YPRrg2N2Wmp+4qJYkWtJsbew1szfKKDm6fPLy4YAanBhIlf9dWw==",
2077
+ "version": "1.42.1",
2078
+ "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.42.1.tgz",
2079
+ "integrity": "sha512-Gq9rmS54mjBL/7/MvBaNOBwbfnh7beHvS6oS4srqXFcQHpQCV1+c8JXWE8VLPyRDhgS3H8x8A7hztqI9VnwrAQ==",
2080
2080
  "requires": {
2081
- "playwright": "1.40.1"
2081
+ "playwright": "1.42.1"
2082
2082
  }
2083
2083
  },
2084
2084
  "@sinclair/typebox": {
@@ -5387,18 +5387,18 @@
5387
5387
  }
5388
5388
  },
5389
5389
  "playwright": {
5390
- "version": "1.40.1",
5391
- "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.40.1.tgz",
5392
- "integrity": "sha512-2eHI7IioIpQ0bS1Ovg/HszsN/XKNwEG1kbzSDDmADpclKc7CyqkHw7Mg2JCz/bbCxg25QUPcjksoMW7JcIFQmw==",
5390
+ "version": "1.42.1",
5391
+ "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.42.1.tgz",
5392
+ "integrity": "sha512-PgwB03s2DZBcNRoW+1w9E+VkLBxweib6KTXM0M3tkiT4jVxKSi6PmVJ591J+0u10LUrgxB7dLRbiJqO5s2QPMg==",
5393
5393
  "requires": {
5394
5394
  "fsevents": "2.3.2",
5395
- "playwright-core": "1.40.1"
5395
+ "playwright-core": "1.42.1"
5396
5396
  }
5397
5397
  },
5398
5398
  "playwright-core": {
5399
- "version": "1.40.1",
5400
- "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.40.1.tgz",
5401
- "integrity": "sha512-+hkOycxPiV534c4HhpfX6yrlawqVUzITRKwHAmYfmsVreltEl6fAZJ3DPfLMOODw0H3s1Itd6MDCWmP1fl/QvQ=="
5399
+ "version": "1.42.1",
5400
+ "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.42.1.tgz",
5401
+ "integrity": "sha512-mxz6zclokgrke9p1vtdy/COWBH+eOZgYUVVU34C73M+4j4HLlQJHtfcqiqqxpP0o8HhMkflvfbquLX5dg6wlfA=="
5402
5402
  },
5403
5403
  "pretty-format": {
5404
5404
  "version": "29.7.0",
@@ -6133,6 +6133,12 @@
6133
6133
  "is-typed-array": "^1.1.9"
6134
6134
  }
6135
6135
  },
6136
+ "typescript": {
6137
+ "version": "5.4.2",
6138
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz",
6139
+ "integrity": "sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==",
6140
+ "dev": true
6141
+ },
6136
6142
  "unbox-primitive": {
6137
6143
  "version": "1.0.2",
6138
6144
  "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/testinglibrary",
3
- "version": "0.1.8",
3
+ "version": "0.1.9-exp-actors",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -22,7 +22,7 @@
22
22
  "dependencies": {
23
23
  "@babel/preset-react": "7.22.5",
24
24
  "@cucumber/cucumber": "9.2.0",
25
- "@playwright/test": "1.40.1",
25
+ "@playwright/test": "1.42.1",
26
26
  "@testing-library/jest-dom": "5.11.9",
27
27
  "@testing-library/react": "11.2.7",
28
28
  "@testing-library/react-hooks": "7.0.2",
@@ -32,7 +32,8 @@
32
32
  "jest": "29.6.2",
33
33
  "jest-environment-jsdom": "29.6.2",
34
34
  "msw": "1.2.3",
35
- "playwright": "1.40.1"
35
+ "playwright": "1.42.1",
36
+ "supports-color": "8.1.1"
36
37
  },
37
38
  "bin": {
38
39
  "ZDTestingFramework": "./bin/cli.js"
@@ -50,6 +51,7 @@
50
51
  "@babel/polyfill": "7.12.1",
51
52
  "@babel/preset-env": "7.22.15",
52
53
  "@babel/runtime": "7.22.15",
53
- "commander": "^11.0.0"
54
+ "commander": "^11.0.0",
55
+ "typescript": "^5.4.2"
54
56
  }
55
57
  }
@@ -1,27 +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.getPlaywrightConfigDir = getPlaywrightConfigDir;
8
- var _path = _interopRequireDefault(require("path"));
9
- var _loadConfig = require("../playwright/loadConfig");
10
- var _options = require("../cli/options");
11
- /**
12
- * Store playwright config dir in env to provide access to it in workers.
13
- * Important that in workers there is different process.argv, that's why we save it to env.
14
- * Config dir is needed to resolve all paths.
15
- */
16
-
17
- /**
18
- * Resolve playwright config dir considering cli flags.
19
- */
20
- function getPlaywrightConfigDir() {
21
- if (!process.env.PLAYWRIGHT_BDD_CONFIG_DIR) {
22
- const cliConfigPath = (0, _options.getCliConfigPath)();
23
- const playwrightConfigFile = (0, _loadConfig.resolveConfigFile)(cliConfigPath);
24
- process.env.PLAYWRIGHT_BDD_CONFIG_DIR = playwrightConfigFile ? _path.default.dirname(playwrightConfigFile) : process.cwd();
25
- }
26
- return process.env.PLAYWRIGHT_BDD_CONFIG_DIR;
27
- }
@@ -1,57 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.loadSources = loadSources;
7
- var _paths = require("@cucumber/cucumber/lib/api/paths");
8
- var _messages = require("@cucumber/messages");
9
- var _environment = require("@cucumber/cucumber/lib/api/environment");
10
- var _gherkin = require("@cucumber/cucumber/lib/api/gherkin");
11
- var _console_logger = require("@cucumber/cucumber/lib/api/console_logger");
12
- /**
13
- * Copied from original load_sources, but returns full Pickles.
14
- * See: https://github.com/cucumber/cucumber-js/blob/main/src/api/load_sources.ts
15
- */
16
-
17
- /**
18
- * Load and parse features, produce a filtered and ordered test plan and/or parse errors.
19
- *
20
- * @public
21
- * @param coordinates - Coordinates required to find features
22
- * @param environment - Project environment.
23
- */
24
- async function loadSources(coordinates, environment = {}) {
25
- const {
26
- cwd,
27
- stderr,
28
- debug
29
- } = (0, _environment.mergeEnvironment)(environment);
30
- const logger = new _console_logger.ConsoleLogger(stderr, debug);
31
- const newId = _messages.IdGenerator.uuid();
32
- const {
33
- unexpandedFeaturePaths,
34
- featurePaths
35
- } = await (0, _paths.resolvePaths)(logger, cwd, coordinates);
36
- if (featurePaths.length === 0) {
37
- return {
38
- filteredPickles: [],
39
- parseErrors: []
40
- };
41
- }
42
- const {
43
- filteredPickles,
44
- parseErrors
45
- } = await (0, _gherkin.getFilteredPicklesAndErrors)({
46
- newId,
47
- cwd,
48
- logger,
49
- unexpandedFeaturePaths,
50
- featurePaths,
51
- coordinates
52
- });
53
- return {
54
- filteredPickles,
55
- parseErrors
56
- };
57
- }