@zohodesk/testinglibrary 0.1.4-exp.1 → 0.1.4-exp.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -60,7 +60,7 @@ function getPlaywrightConfig() {
60
60
  reporter: [['html', {
61
61
  outputFolder: reportPath,
62
62
  open: openReportOn
63
- }], ['list'], ['./src/reporter.js']],
63
+ }], ['list'], ['./custom-reporter.js']],
64
64
  timeout: testTimeout,
65
65
  expect: {
66
66
  timeout: expectTimeout
@@ -29,7 +29,9 @@ class JSONSummaryReporter {
29
29
  const fileName = [];
30
30
  let clean = true;
31
31
  for (const s of test.titlePath()) {
32
- if (s === '' && clean) continue;
32
+ if (s === '' && clean) {
33
+ continue;
34
+ }
33
35
  clean = false;
34
36
  title.push(s);
35
37
  if (s.includes('.ts') || s.includes('.js')) {
@@ -59,7 +61,9 @@ class JSONSummaryReporter {
59
61
  });
60
62
  // removing duplicate tests from the failed array
61
63
  this.failed = this.failed.filter((element, index) => {
62
- if (!this.passed.includes(element)) return this.failed.indexOf(element) === index;
64
+ if (!this.passed.includes(element)) {
65
+ return this.failed.indexOf(element) === index;
66
+ }
63
67
  });
64
68
  // removing duplicate tests from the skipped array
65
69
  this.skipped = this.skipped.filter((element, index) => {
package/build/index.d.ts CHANGED
@@ -1,5 +1,58 @@
1
- import { Given, Then, When, Step, expect, test, createBdd } from './core/playwright/index';
1
+ import { expect, test } from './core/playwright/index';
2
2
  import { fireEvent, render } from '@testing-library/react';
3
+ import {
4
+ PlaywrightTestArgs,
5
+ PlaywrightTestOptions,
6
+ PlaywrightWorkerArgs,
7
+ PlaywrightWorkerOptions,
8
+ TestType
9
+ } from '@playwright/test';
3
10
 
4
- export { Given, Then, When, Step, expect, test, createBdd, fireEvent, render };
5
- export * from '@playwright/test/types/test';
11
+ export type KeyValue = { [key: string]: any };
12
+
13
+ export type BuiltInFixturesWorker = PlaywrightWorkerArgs &
14
+ PlaywrightWorkerOptions;
15
+ export type BuiltInFixtures = PlaywrightTestArgs &
16
+ PlaywrightTestOptions &
17
+ BuiltInFixturesWorker;
18
+
19
+ export type FixturesArg<T extends KeyValue = {}, W extends KeyValue = {}> = T &
20
+ W &
21
+ BuiltInFixtures;
22
+
23
+ export declare let hasCustomTest: boolean;
24
+
25
+ export declare function createBdd<
26
+ T extends KeyValue = BuiltInFixtures,
27
+ W extends KeyValue = BuiltInFixturesWorker,
28
+ World
29
+ >(
30
+ customTest?: TestType<T, W> | null,
31
+ _CustomWorld?: new (...args: any[]) => World
32
+ ): {
33
+ Given: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
34
+ When: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
35
+ Then: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
36
+ And: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
37
+ But: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
38
+ Step: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
39
+ Before: any;
40
+ After: any;
41
+ BeforeAll: any;
42
+ AfterAll: any;
43
+ };
44
+
45
+ type StepFunctionFixturesArg<
46
+ T extends KeyValue,
47
+ W extends KeyValue
48
+ > = FixturesArg<T, W>;
49
+ type StepFunction<T extends KeyValue, W extends KeyValue> = (
50
+ fixtures: StepFunctionFixturesArg<T, W>,
51
+ ...args: any[]
52
+ ) => unknown;
53
+
54
+ const { Given, Then, When, Step, And, But } = createBdd();
55
+
56
+ export { Given, Then, When, Step, And, But, expect, test, createBdd };
57
+
58
+ export * from '@playwright/test/types/test';
package/build/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.When = exports.Then = exports.Step = exports.Given = void 0;
6
+ exports.When = exports.Then = exports.Step = exports.Given = exports.But = exports.And = void 0;
7
7
  Object.defineProperty(exports, "createBdd", {
8
8
  enumerable: true,
9
9
  get: function () {
@@ -45,4 +45,8 @@ const {
45
45
  exports.Step = Step;
46
46
  exports.When = When;
47
47
  exports.Then = Then;
48
- exports.Given = Given;
48
+ exports.Given = Given;
49
+ const And = Then;
50
+ exports.And = And;
51
+ const But = Then;
52
+ exports.But = But;
package/build/lib/cli.js CHANGED
@@ -8,6 +8,7 @@ var _logger = require("../utils/logger");
8
8
  var _setupProject = _interopRequireDefault(require("../setup-folder-structure/setupProject"));
9
9
  var _parser = require("../parser/parser");
10
10
  var _clearCaches = _interopRequireDefault(require("../core/playwright/clear-caches"));
11
+ var _helper = _interopRequireDefault(require("../setup-folder-structure/helper"));
11
12
  // import createJestRunner from '../core/jest/runner/jest-runner';
12
13
 
13
14
  const [,, option, ...otherOptions] = process.argv;
@@ -53,6 +54,11 @@ switch (option) {
53
54
  (0, _clearCaches.default)();
54
55
  break;
55
56
  }
57
+ case 'help':
58
+ {
59
+ (0, _helper.default)();
60
+ break;
61
+ }
56
62
  default:
57
63
  {
58
64
  _logger.Logger.log(_logger.Logger.SUCCESS_TYPE, 'Supported Commands test and report');
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _commander = require("commander");
9
+ var _fs = require("fs");
10
+ var _path = _interopRequireDefault(require("path"));
11
+ var _logger = require("../utils/logger");
12
+ function helpercmd() {
13
+ const packageJsonPath = _path.default.resolve(process.cwd(), './package.json');
14
+ if ((0, _fs.existsSync)(packageJsonPath) && process.argv.includes('--version')) {
15
+ const {
16
+ dependencies
17
+ } = require(packageJsonPath);
18
+ _logger.Logger.log(_logger.Logger.SUCCESS_TYPE, `zohodesk/testinglibrary Version : ${dependencies['@zohodesk/testinglibrary']}`);
19
+ _commander.program.version(dependencies['@zohodesk/testinglibrary'] || '0.0.1');
20
+ return;
21
+ }
22
+ _logger.Logger.log(_logger.Logger.SUCCESS_TYPE, 'Supported Commands...');
23
+ _commander.program.name('npx ZDTestingFramework');
24
+ _commander.program.command('test').description('This command is used to execute tests');
25
+ _commander.program.command('init').description('This command will initialize Project');
26
+ _commander.program.command('report').description('This command is used to generate a report summarizing the results of executed tests.');
27
+ _commander.program.command('codegen').description('This command is used to assist developer to write test case');
28
+ _commander.program.option('--headed', 'Run tests with a headed browser.');
29
+ _commander.program.option('--debug', 'This command is used to initiate a debugging session');
30
+ _commander.program.option('--tags', 'Run specific test case with mentioned tags (Useage: -- --tags="@live")');
31
+ _commander.program.parse(process.argv);
32
+ }
33
+ var _default = helpercmd;
34
+ exports.default = _default;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/testinglibrary",
3
- "version": "0.1.4",
3
+ "version": "0.1.4-exp.2",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
@@ -2577,20 +2577,20 @@
2577
2577
  "integrity": "sha512-Aq58f5HiWdyDlFffbbSjAlv596h/cOnt2DO1w3DOC7OJ5EHs0hd/nycJfiu9RJbT6Yk6F1knnRRXNSpxoIVZ9Q=="
2578
2578
  },
2579
2579
  "@playwright/test": {
2580
- "version": "1.39.0",
2581
- "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.39.0.tgz",
2582
- "integrity": "sha512-3u1iFqgzl7zr004bGPYiN/5EZpRUSFddQBra8Rqll5N0/vfpqlP9I9EXqAoGacuAbX6c9Ulg/Cjqglp5VkK6UQ==",
2580
+ "version": "1.40.0",
2581
+ "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.40.0.tgz",
2582
+ "integrity": "sha512-PdW+kn4eV99iP5gxWNSDQCbhMaDVej+RXL5xr6t04nbKLCBwYtA046t7ofoczHOm8u6c+45hpDKQVZqtqwkeQg==",
2583
2583
  "requires": {
2584
- "playwright": "1.39.0"
2584
+ "playwright": "1.40.0"
2585
2585
  },
2586
2586
  "dependencies": {
2587
2587
  "playwright": {
2588
- "version": "1.39.0",
2589
- "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.39.0.tgz",
2590
- "integrity": "sha512-naE5QT11uC/Oiq0BwZ50gDmy8c8WLPRTEWuSSFVG2egBka/1qMoSqYQcROMT9zLwJ86oPofcTH2jBY/5wWOgIw==",
2588
+ "version": "1.40.0",
2589
+ "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.40.0.tgz",
2590
+ "integrity": "sha512-gyHAgQjiDf1m34Xpwzaqb76KgfzYrhK7iih+2IzcOCoZWr/8ZqmdBw+t0RU85ZmfJMgtgAiNtBQ/KS2325INXw==",
2591
2591
  "requires": {
2592
2592
  "fsevents": "2.3.2",
2593
- "playwright-core": "1.39.0"
2593
+ "playwright-core": "1.40.0"
2594
2594
  }
2595
2595
  }
2596
2596
  }
@@ -3572,7 +3572,8 @@
3572
3572
  "commander": {
3573
3573
  "version": "11.0.0",
3574
3574
  "resolved": "https://registry.npmjs.org/commander/-/commander-11.0.0.tgz",
3575
- "integrity": "sha512-9HMlXtt/BNoYr8ooyjjNRdIilOTkVJXB+GhxMTtOKwk0R4j4lS4NpjuqmRxroBfnfTSHQIHQB7wryHhXarNjmQ=="
3575
+ "integrity": "sha512-9HMlXtt/BNoYr8ooyjjNRdIilOTkVJXB+GhxMTtOKwk0R4j4lS4NpjuqmRxroBfnfTSHQIHQB7wryHhXarNjmQ==",
3576
+ "dev": true
3576
3577
  },
3577
3578
  "commondir": {
3578
3579
  "version": "1.0.1",
@@ -6724,9 +6725,9 @@
6724
6725
  }
6725
6726
  },
6726
6727
  "playwright-core": {
6727
- "version": "1.39.0",
6728
- "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.39.0.tgz",
6729
- "integrity": "sha512-+k4pdZgs1qiM+OUkSjx96YiKsXsmb59evFoqv8SKO067qBA+Z2s/dCzJij/ZhdQcs2zlTAgRKfeiiLm8PQ2qvw=="
6728
+ "version": "1.40.0",
6729
+ "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.40.0.tgz",
6730
+ "integrity": "sha512-fvKewVJpGeca8t0ipM56jkVSU6Eo0RmFvQ/MaCQNDYm+sdvKkMBBWTE1FdeMqIdumRaXXjZChWHvIzCGM/tA/Q=="
6730
6731
  },
6731
6732
  "pretty-format": {
6732
6733
  "version": "29.7.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/testinglibrary",
3
- "version": "0.1.4-exp.1",
3
+ "version": "0.1.4-exp.2",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -22,13 +22,12 @@
22
22
  "dependencies": {
23
23
  "@babel/preset-react": "7.22.5",
24
24
  "@cucumber/cucumber": "9.2.0",
25
- "@playwright/test": "1.39.0",
25
+ "@playwright/test": "1.40.0",
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",
29
29
  "babel-jest": "29.6.2",
30
30
  "babel-plugin-transform-dynamic-import": "2.1.0",
31
- "commander": "11.0.0",
32
31
  "fast-glob": "3.3.1",
33
32
  "jest": "29.6.2",
34
33
  "jest-environment-jsdom": "29.6.2",
@@ -49,6 +48,7 @@
49
48
  "@babel/plugin-transform-runtime": "7.22.15",
50
49
  "@babel/polyfill": "7.12.1",
51
50
  "@babel/preset-env": "7.22.15",
52
- "@babel/runtime": "7.22.15"
51
+ "@babel/runtime": "7.22.15",
52
+ "commander": "^11.0.0"
53
53
  }
54
- }
54
+ }