@zohodesk/testinglibrary 0.4.7-experimental → 0.4.8-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 (55) hide show
  1. package/.gitlab-ci.yml +35 -20
  2. package/README.md +6 -1
  3. package/build/core/playwright/builtInFixtures/page.js +7 -0
  4. package/build/core/playwright/helpers/auth/getUsers.js +12 -25
  5. package/build/core/playwright/runner/Runner.js +22 -0
  6. package/build/core/playwright/runner/RunnerHelper.js +43 -0
  7. package/build/core/playwright/runner/RunnerTypes.js +17 -0
  8. package/build/core/playwright/runner/SpawnRunner.js +110 -0
  9. package/build/core/playwright/test-runner.js +8 -34
  10. package/build/setup-folder-structure/samples/actors-index.js +0 -1
  11. package/build/setup-folder-structure/samples/settings.json +1 -1
  12. package/build/test/Test.js +11 -0
  13. package/build/test/core/playwright/helpers/__tests__/getUsers_ListOfActors.test.js +80 -0
  14. package/build/test/core/playwright/runner/__tests__/RunnerHelper.test.js +16 -0
  15. package/build/test/core/playwright/runner/__tests__/SpawnRunner.test.js +27 -0
  16. package/nobdd/src/App.js +7 -0
  17. package/nobdd/uat/conf/default/actors/index.js +1 -4
  18. package/nobdd/uat/conf/default/settings.json +1 -1
  19. package/nobdd/uat/conf/nobdd/uat.config.js +3 -2
  20. package/nobdd/uat/env-config.json +3 -3
  21. package/nobdd/uat/fixtures/setup.teardown.js +2 -1
  22. package/nobdd/uat/modules/nobdd/steps/VerifyNoBDD.feature.spec.js +3 -3
  23. package/nobdd/uat/playwright/.auth/anitha.m+clientat@zohotest.com-cookies.json +276 -0
  24. package/nobdd/uat/playwright/.auth/anitha.m+clientattest@zohotest.com-cookies.json +3 -0
  25. package/nobdd/uat/playwright/.auth/anitha.m+uat@zohotest.com-cookies.json +3 -0
  26. package/nobdd/uat/playwright/.auth/skumaresan@zohotest.com-cookies.json +503 -0
  27. package/nobdd/uat/playwright/.auth/solairaj.m+26jun2023@zohotest.com-cookies.json +173 -0
  28. package/nobdd/uat/playwright/.auth/sridhar.parthasarathy@zohotest.com-cookies.json +520 -0
  29. package/nobdd/uat/playwright-report/data/15676399fddfec429bc2935c407212f42cfa65b2.webm +0 -0
  30. package/nobdd/uat/playwright-report/data/7be7af3de16a483f32cdcb86b3a290f584e21f76.zip +0 -0
  31. package/nobdd/uat/playwright-report/index.html +68 -0
  32. package/nobdd/uat/playwright-report/test-summary.json +17 -0
  33. package/nobdd/uat/playwright-report/trace/assets/codeMirrorModule-BK3t1EEu.js +24 -0
  34. package/nobdd/uat/playwright-report/trace/assets/wsPort-964mA9MZ.js +69 -0
  35. package/nobdd/uat/playwright-report/trace/codeMirrorModule.Hs9-1ZG4.css +1 -0
  36. package/nobdd/uat/playwright-report/trace/codicon.zGuYmc9o.ttf +0 -0
  37. package/nobdd/uat/playwright-report/trace/index.-g_5lMbJ.css +1 -0
  38. package/nobdd/uat/playwright-report/trace/index.cbtHmFgM.js +2 -0
  39. package/nobdd/uat/playwright-report/trace/index.html +26 -0
  40. package/nobdd/uat/playwright-report/trace/playwright-logo.svg +9 -0
  41. package/nobdd/uat/playwright-report/trace/snapshot.html +21 -0
  42. package/nobdd/uat/playwright-report/trace/sw.bundle.js +4 -0
  43. package/nobdd/uat/playwright-report/trace/uiMode.fcU_T5Nf.js +10 -0
  44. package/nobdd/uat/playwright-report/trace/uiMode.html +17 -0
  45. package/nobdd/uat/playwright-report/trace/uiMode.pWy0Re7G.css +1 -0
  46. package/nobdd/uat/playwright-report/trace/wsPort.zR1WIy9-.css +1 -0
  47. package/nobdd/uat/playwright-report/trace/xtermModule.0lwXJFHT.css +32 -0
  48. package/nobdd/uat/test-results/modules-nobdd-steps-ExamplesForTestData.featur-a74c6-required-nobdd-Verify-the-page-is-not-logged-in-chromium/trace.zip +0 -0
  49. package/nobdd/uat/test-results/modules-nobdd-steps-ExamplesForTestData.featur-a74c6-required-nobdd-Verify-the-page-is-not-logged-in-chromium/video.webm +0 -0
  50. package/nobdd/uat.config.js +3 -2
  51. package/package.json +1 -1
  52. package/nobdd/uat/conf/default/actors/beta/custom-module.json +0 -24
  53. package/nobdd/uat/conf/default/actors/beta/index.js +0 -6
  54. package/nobdd/uat/conf/default/actors/beta/parent-child.json +0 -24
  55. package/npm-shrinkwrap.json +0 -10125
package/.gitlab-ci.yml CHANGED
@@ -1,29 +1,35 @@
1
1
  image: repository.desk.csez.zohocorpin.com/base-image/testing-framework-gitlab-runne-base:v3
2
2
 
3
- #workflow:
4
- # rules:
5
- # - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
3
+ workflow:
4
+ rules:
5
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
6
+ when: always
7
+ - if: $CI_PIPELINE_SOURCE == "web"
8
+ when: always
6
9
 
7
10
  stages:
8
11
  - build
9
12
  - unit
10
13
  - uat
11
14
 
15
+ default:
16
+ cache:
17
+ key: build-cache
18
+ paths:
19
+ - node_modules
20
+ - build
21
+
12
22
  # Install dependencies stage
13
23
  build:
14
24
  stage: build
15
- image: repository.desk.csez.zohocorpin.com/base-image/testing-framework-gitlab-runne-base:v3
16
25
  script:
26
+ - npm install --ignore-scripts
27
+ - npm run build
17
28
  - npm install
18
- artifacts:
19
- paths:
20
- - node_modules/
21
-
22
29
 
23
30
  # Unit tests stage
24
31
  unit:
25
32
  stage: unit
26
- image: repository.desk.csez.zohocorpin.com/base-image/testing-framework-gitlab-runne-base:v3
27
33
  script:
28
34
  - npm run test
29
35
  artifacts:
@@ -34,10 +40,7 @@ unit:
34
40
  # UAT tests stage
35
41
  uat-auth:
36
42
  stage: uat
37
- image: repository.desk.csez.zohocorpin.com/base-image/testing-framework-gitlab-runne-base:v3
38
43
  script:
39
- - npm install
40
- - npm run build
41
44
  - cd examples
42
45
  - npm install $(npm pack ../../testing-framework | tail -1)
43
46
  - output=$(npm run uatauth)
@@ -53,10 +56,7 @@ uat-auth:
53
56
 
54
57
  uat-noauth:
55
58
  stage: uat
56
- image: repository.desk.csez.zohocorpin.com/base-image/testing-framework-gitlab-runne-base:v3
57
59
  script:
58
- - npm install
59
- - npm run build
60
60
  - cd examples
61
61
  - npm install $(npm pack ../../testing-framework | tail -1)
62
62
  - output=$(npm run uatnoauth)
@@ -72,10 +72,7 @@ uat-noauth:
72
72
 
73
73
  uat-profile:
74
74
  stage: uat
75
- image: repository.desk.csez.zohocorpin.com/base-image/testing-framework-gitlab-runne-base:v3
76
75
  script:
77
- - npm install
78
- - npm run build
79
76
  - cd examples
80
77
  - npm install $(npm pack ../../testing-framework | tail -1)
81
78
  - output=$(npm run uatprofile)
@@ -89,12 +86,30 @@ uat-profile:
89
86
  paths:
90
87
  - examples/uat/playwright-report
91
88
 
92
- uat-nobdd:
89
+
90
+ uat-unauth:
93
91
  stage: uat
94
- image: repository.desk.csez.zohocorpin.com/base-image/testing-framework-gitlab-runne-base:v3
92
+ image: repository.desk.csez.zohocorpin.com/base-image/testing-framework-gitlab-runne-base:v2
95
93
  script:
96
94
  - npm install
97
95
  - npm run build
96
+ - cd examples
97
+ - npm install $(npm pack ../../testing-framework | tail -1)
98
+ - output=$(npm run uatunauth)
99
+ - echo "$output"
100
+ - if [[ "$output" == *"failed"* ]]; then
101
+ - exit 1
102
+ - fi
103
+
104
+
105
+ artifacts:
106
+ when: always
107
+ paths:
108
+ - examples/uat/playwright-report
109
+
110
+ uat-nobdd:
111
+ stage: uat
112
+ script:
98
113
  - cd nobdd
99
114
  - npm install $(npm pack ../../testing-framework | tail -1)
100
115
  - output=$(npm run uatnobdd)
package/README.md CHANGED
@@ -58,4 +58,9 @@
58
58
  ### v0.3.1 - 13-11-2024
59
59
 
60
60
  #### Issue Fix
61
- - Adding bddmode to get the fixtures.
61
+ - Adding bddmode to get the fixtures.
62
+
63
+ ### v0.2.9.1 - 14-11-2024
64
+
65
+ #### Enhancement
66
+ - Beta feature Actors and edition configurations are unified
@@ -70,6 +70,13 @@ var _default = exports.default = {
70
70
  await use(page);
71
71
  return;
72
72
  }
73
+
74
+ //This block is used to skip the login process if the @unauthenticated tag is added to the script
75
+ if ($tags.includes('@unauthenticated')) {
76
+ await context.clearCookies();
77
+ await use(page);
78
+ return;
79
+ }
73
80
  const testPortalDetails = getCustomAccountDetails($tags);
74
81
  if (testPortalDetails === null) {
75
82
  await performDefaultPageSteps({
@@ -52,14 +52,22 @@ function getDefaultActor() {
52
52
  } = getDefaultActorConf();
53
53
  return getUserForSelectedEditionAndProfile(edition, profile);
54
54
  }
55
- function getListOfActors() {
55
+ function getListOfActors(betaFeature) {
56
56
  const {
57
57
  uatDirectory
58
58
  } = (0, _readConfigFile.generateConfigFromFile)();
59
59
  const mode = getRunMode();
60
60
  let configFile = _path.default.join(uatDirectory, `conf/${mode}/actors/index.js`);
61
+ let betaReference = mode;
61
62
  if (!(0, _fs.existsSync)(configFile)) {
62
63
  configFile = _path.default.join(uatDirectory, `conf/default/actors/index.js`);
64
+ betaReference = "default";
65
+ }
66
+ if (betaFeature) {
67
+ configFile = _path.default.join(uatDirectory, `conf/${betaReference}/actors/beta/${betaFeature}/index.js`);
68
+ if (!(0, _fs.existsSync)(configFile)) {
69
+ throw new Error(`There is no beta feature configured with the name "${betaFeature}"`);
70
+ }
63
71
  }
64
72
  try {
65
73
  return require(configFile);
@@ -68,42 +76,21 @@ function getListOfActors() {
68
76
  }
69
77
  }
70
78
  function getUserForSelectedEditionAndProfile(preferedEdition, preferredProfile, betaFeature, testDataPortal = null) {
71
- const actorsData = getListOfActors();
79
+ const actorsData = getListOfActors(betaFeature);
72
80
  if (!actorsData || !actorsData.editions) {
73
81
  throw new Error("The actors data is missing.");
74
82
  }
75
83
  const {
76
- editions: userdata,
77
- beta: betaPortals
84
+ editions: userdata
78
85
  } = actorsData;
79
86
  const defaultConf = getDefaultActorConf();
80
87
  const edition = preferedEdition || defaultConf.edition;
81
88
  const profile = preferredProfile || defaultConf.profile;
82
89
  let selectedProfile = {};
83
- if (betaFeature && betaFeature !== null) {
84
- if (!betaPortals.hasOwnProperty(betaFeature)) {
85
- throw new Error(`There is no "${betaFeature}" beta feature configured.`);
86
- }
87
- const betaEdition = betaPortals[betaFeature].find(portal => portal.edition === edition);
88
- if (!betaEdition) {
89
- throw new Error(`There is no "${edition}" edition configured in "${betaFeature}" beta feature.`);
90
- }
91
- const {
92
- profiles: betaProfiles,
93
- ...betaEditionData
94
- } = betaEdition;
95
- selectedProfile = betaProfiles.find(user => user.profile === profile);
96
- if (!selectedProfile) {
97
- throw new Error(`There is no "${profile}" configured in edition of "${edition}" in "${betaFeature}" beta features.`);
98
- }
99
- return {
100
- ...betaEditionData,
101
- ...selectedProfile
102
- };
103
- }
104
90
 
105
91
  // TODO: We are returning the first data from array. We need to check the possiblity of having multiple users for same profile and possibly round robin
106
92
  // For this we need to get the data from ci environment.
93
+
107
94
  let testingPortal = null;
108
95
  if (!userdata.hasOwnProperty(edition)) {
109
96
  throw new Error(`There is no "${edition}" edition configured.`);
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ class Runner {
4
+ constructor(config) {
5
+ this.tagArgs = "";
6
+ this.userArgs = "";
7
+ this.config = config;
8
+ }
9
+ setUserArgs(userArgs) {
10
+ this.userArgs = userArgs;
11
+ }
12
+ setTagArgs(tagArgs) {
13
+ this.tagArgs = tagArgs;
14
+ }
15
+ setConfig(config) {
16
+ this.config = config;
17
+ }
18
+ run() {
19
+ throw new Error("Method 'run()' must be implemented.");
20
+ }
21
+ }
22
+ module.exports = Runner;
@@ -0,0 +1,43 @@
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 _RunnerTypes = _interopRequireDefault(require("./RunnerTypes"));
9
+ var _configUtils = require("../setup/config-utils");
10
+ var _cliArgsToObject = require("../../../utils/cliArgsToObject");
11
+ var _browserTypes = require("../constants/browserTypes");
12
+ var _customCommands = require("../custom-commands");
13
+ class RunnerHelper {
14
+ static createRunner(type, runnerObj) {
15
+ const runnerClass = _RunnerTypes.default.getRunnerClass(type, runnerObj);
16
+ if (!runnerClass) {
17
+ throw new Error("Invalid runner type");
18
+ }
19
+ return runnerClass;
20
+ }
21
+ static getPlaywrightArgs(userArgsObject, debug, bddMode, tagArgs, headless) {
22
+ const {
23
+ browsers = null
24
+ } = userArgsObject;
25
+ let browserList = (0, _configUtils.getBrowsersList)(browsers);
26
+ const playwrightArgs = (0, _cliArgsToObject.objectToCliArgs)(userArgsObject, key => !_customCommands.CUSTOM_COMMANDS.includes(key));
27
+ if (debug) {
28
+ playwrightArgs.push('--debug');
29
+ }
30
+ if (!bddMode && tagArgs) {
31
+ playwrightArgs.push('--grep');
32
+ playwrightArgs.push(tagArgs);
33
+ }
34
+ if (!headless && !userArgsObject.headed) {
35
+ playwrightArgs.push('--headed');
36
+ }
37
+ if (browserList && browserList.length > 0) {
38
+ browserList.map(browser => playwrightArgs.push(`--project=${_browserTypes.BROWSER_PROJECT_MAPPING[browser.toUpperCase()]}`));
39
+ }
40
+ return playwrightArgs;
41
+ }
42
+ }
43
+ var _default = exports.default = RunnerHelper;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _SpawnRunner = _interopRequireDefault(require("./SpawnRunner"));
5
+ class RunnerTypes {
6
+ static getRunnerClass(type, runnerObj) {
7
+ const RunnerClass = this.runnerTypes[type];
8
+ if (!RunnerClass) {
9
+ throw new Error("Invalid runner type");
10
+ }
11
+ return new RunnerClass(runnerObj);
12
+ }
13
+ static runnerTypes = {
14
+ spawn: _SpawnRunner.default //require("./SpawnRunner"), // used lazy loading to reduce circular dependencies
15
+ };
16
+ }
17
+ module.exports = RunnerTypes;
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _readConfigFile = require("../readConfigFile");
5
+ var _rootPath = require("../../../utils/rootPath");
6
+ var _path = _interopRequireDefault(require("path"));
7
+ var _logger = require("../../../utils/logger");
8
+ var _child_process = require("child_process");
9
+ var _RunnerHelper = _interopRequireDefault(require("./RunnerHelper"));
10
+ var _Runner = _interopRequireDefault(require("./Runner"));
11
+ class SpawnRunner extends _Runner.default {
12
+ constructor(runnerObj) {
13
+ super(runnerObj);
14
+ this.runnerObj = runnerObj;
15
+ }
16
+ run() {
17
+ const {
18
+ config
19
+ } = this.runnerObj;
20
+ let promises = [];
21
+ const {
22
+ bddMode
23
+ } = config.getAll();
24
+ if (bddMode) {
25
+ promises.push(this.runPreprocessing());
26
+ }
27
+ Promise.all(promises).then(() => this.runPlaywright()).catch(err => {
28
+ _logger.Logger.error(err);
29
+ process.exit();
30
+ });
31
+ }
32
+ runPreprocessing() {
33
+ const {
34
+ tagArgs
35
+ } = this.runnerObj;
36
+ const configPath = (0, _readConfigFile.isUserConfigFileAvailable)() ? _path.default.resolve(__dirname, '../', 'setup', 'config-creator.js') : _path.default.resolve('../', '../', '../', '../', 'playwrightConfig.js');
37
+ const beforeCommand = 'node';
38
+ const bddGenPath = _path.default.resolve(__dirname, '../', '../', '../', 'bdd-framework', 'cli', 'index.js');
39
+ const beforeArgs = [bddGenPath, '-c', require.resolve(configPath)];
40
+ if (tagArgs) {
41
+ beforeArgs.push('--tags');
42
+ beforeArgs.push(tagArgs);
43
+ }
44
+ return new Promise((resolve, reject) => {
45
+ const childProcessForPreprocessing = (0, _child_process.spawn)(beforeCommand, beforeArgs, {
46
+ stdio: 'inherit',
47
+ env: {
48
+ ...process.env
49
+ }
50
+ });
51
+ childProcessForPreprocessing.on('error', data => {
52
+ _logger.Logger.log(_logger.Logger.FAILURE_TYPE, data);
53
+ reject(data);
54
+ });
55
+ childProcessForPreprocessing.on('exit', code => {
56
+ if (code === 0) {
57
+ _logger.Logger.log(_logger.Logger.SUCCESS_TYPE, 'Feature Files Processed Successfully');
58
+ resolve();
59
+ } else {
60
+ reject(`BddGen exited with code ${code}`);
61
+ }
62
+ });
63
+ });
64
+ }
65
+ runPlaywright() {
66
+ const {
67
+ tagArgs,
68
+ config,
69
+ userArgs
70
+ } = this.runnerObj;
71
+ const {
72
+ debug,
73
+ bddMode = false,
74
+ headless = false
75
+ } = config.getAll();
76
+ const playwrightArgs = _RunnerHelper.default.getPlaywrightArgs(userArgs, debug, bddMode, tagArgs, headless);
77
+ const playwrightPath = _path.default.resolve((0, _rootPath.getExecutableBinaryPath)('playwright'));
78
+ const command = playwrightPath;
79
+ const configPath = (0, _readConfigFile.isUserConfigFileAvailable)() ? _path.default.resolve(__dirname, '../', 'setup', 'config-creator.js') : _path.default.resolve('../', '../', '../', '../', 'playwrightConfig.js');
80
+ const args = ['test', '--config', require.resolve(configPath)].concat(playwrightArgs);
81
+ return new Promise((resolve, reject) => {
82
+ const childProcessForRunningPlaywright = (0, _child_process.spawn)(command, args, {
83
+ stdio: 'inherit',
84
+ env: {
85
+ ...process.env
86
+ }
87
+ });
88
+ childProcessForRunningPlaywright.on('error', error => {
89
+ _logger.Logger.log(_logger.Logger.FAILURE_TYPE, error);
90
+ });
91
+ childProcessForRunningPlaywright.on('exit', (code, signal) => {
92
+ if (code !== 0) {
93
+ reject(`Child Process Exited with Code ${code} and Signal ${signal}`);
94
+ } else {
95
+ _logger.Logger.log(_logger.Logger.SUCCESS_TYPE, 'Test Ran Successfully');
96
+ resolve();
97
+ }
98
+ });
99
+ process.on('exit', () => {
100
+ childProcessForRunningPlaywright.kill();
101
+ reject('Terminating Playwright Process...');
102
+ });
103
+ process.on('SIGINT', () => {
104
+ childProcessForRunningPlaywright.kill();
105
+ reject('Cleaning up...');
106
+ });
107
+ });
108
+ }
109
+ }
110
+ module.exports = SpawnRunner;
@@ -20,27 +20,8 @@ var _browserTypes = require("./constants/browserTypes");
20
20
  var _ConfigurationHelper = require("./configuration/ConfigurationHelper");
21
21
  var _Configuration = _interopRequireDefault(require("./configuration/Configuration"));
22
22
  var _UserArgs = _interopRequireDefault(require("./configuration/UserArgs"));
23
- function getPlaywrightArgs(userArgsObject, debug, bddMode, tagArgs, headless) {
24
- const {
25
- browsers = null
26
- } = userArgsObject;
27
- let browserList = (0, _configUtils.getBrowsersList)(browsers);
28
- const playwrightArgs = (0, _cliArgsToObject.objectToCliArgs)(userArgsObject, key => !_customCommands.CUSTOM_COMMANDS.includes(key));
29
- if (debug) {
30
- playwrightArgs.push('--debug');
31
- }
32
- if (!bddMode && tagArgs) {
33
- playwrightArgs.push('--grep');
34
- playwrightArgs.push(tagArgs);
35
- }
36
- if (!headless && !userArgsObject.headed) {
37
- playwrightArgs.push('--headed');
38
- }
39
- if (browserList && browserList.length > 0) {
40
- browserList.map(browser => playwrightArgs.push(`--project=${_browserTypes.BROWSER_PROJECT_MAPPING[browser.toUpperCase()]}`));
41
- }
42
- return playwrightArgs;
43
- }
23
+ var _RunnerHelper = _interopRequireDefault(require("./runner/RunnerHelper"));
24
+ var _Runner = _interopRequireDefault(require("./runner/Runner"));
44
25
  function runPreprocessing(tagArgs, configPath) {
45
26
  const beforeCommand = 'node';
46
27
  const bddGenPath = _path.default.resolve((0, _rootPath.getExecutableBinaryPath)('bddgen'));
@@ -124,18 +105,11 @@ function main() {
124
105
  const userArgsObject = userArgConfig.getAll();
125
106
  const tagProcessor = new _tagProcessor.default(editionOrder);
126
107
  const tagArgs = tagProcessor.processTags(userArgsObject);
127
- const playwrightArgs = getPlaywrightArgs(userArgsObject, debug, bddMode, tagArgs, headless);
128
- const playwrightPath = _path.default.resolve((0, _rootPath.getExecutableBinaryPath)('playwright'));
129
- const command = playwrightPath;
130
- const configPath = (0, _readConfigFile.isUserConfigFileAvailable)() ? require.resolve('./setup/config-creator.js') : require.resolve('../../../playwright.config.js');
131
- const args = ['test', '--config', configPath].concat(playwrightArgs);
132
- let promises = [];
133
- if (bddMode) {
134
- promises.push(runPreprocessing(tagArgs, configPath));
135
- }
136
- Promise.all(promises).then(() => runPlaywright(command, args)).catch(err => {
137
- _logger.Logger.error(err);
138
- process.exit();
139
- });
108
+ const runnerObj = new _Runner.default();
109
+ runnerObj.setTagArgs(tagArgs);
110
+ runnerObj.setUserArgs(userArgsObject);
111
+ runnerObj.setConfig(uatConfig);
112
+ const runner = _RunnerHelper.default.createRunner('spawn', runnerObj);
113
+ runner.run();
140
114
  }
141
115
  var _default = exports.default = main;
@@ -1,3 +1,2 @@
1
1
  const editions = require('./editions/index');
2
-
3
2
  module.exports = { editions }
@@ -2,6 +2,6 @@
2
2
  "environment": "dev",
3
3
  "edition": "enterprise",
4
4
  "profile": "admin",
5
- "domain": "https://desk.localzoho.com/agent",
5
+ "domain": "https://zdesk-devops16.csez.zohocorpin.com:31025/agent",
6
6
  "devUrl" : ""
7
7
  }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _Runner = _interopRequireDefault(require("../core/playwright/runner/Runner"));
5
+ delete require.cache[require.resolve('../core/playwright/runner/Runner')];
6
+ function test() {
7
+ console.log("inside runner");
8
+ const runner = _Runner.default.createRunner('spawn');
9
+ runner.run(tagArgs);
10
+ }
11
+ test();
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _fs = require("fs");
5
+ var _path = _interopRequireDefault(require("path"));
6
+ jest.mock('fs');
7
+ jest.mock('path');
8
+ jest.mock('../../../../../core/playwright/readConfigFile', () => ({
9
+ generateConfigFromFile: jest.fn(() => ({
10
+ uatDirectory: '/test/directory'
11
+ })),
12
+ getRunMode: jest.fn(() => 'dev')
13
+ }));
14
+ const {
15
+ getListOfActors
16
+ } = require('../../../../../core/playwright/helpers/auth/getUsers');
17
+ describe('getListOfActors', () => {
18
+ beforeEach(() => {
19
+ jest.clearAllMocks();
20
+ _path.default.join.mockImplementation((...args) => args.join('/'));
21
+ });
22
+ test('throws an error when config file cannot be loaded', () => {
23
+ _fs.existsSync.mockReturnValueOnce(true); // Main config file exists
24
+
25
+ jest.mock('/test/directory/conf/dev/actors/index.js', () => {
26
+ throw new Error('Loading error');
27
+ }, {
28
+ virtual: true
29
+ });
30
+ expect(() => getListOfActors()).toThrow('Error loading actor configuration from /test/directory/conf/dev/actors/index.js');
31
+ });
32
+ test('throws an error when beta feature config does not exist', () => {
33
+ _fs.existsSync.mockReturnValueOnce(true) // Main config file exists
34
+ .mockReturnValueOnce(false); // Beta feature config does not exist in either path
35
+
36
+ const betaFeature = 'nonExistentFeature';
37
+ expect(() => getListOfActors(betaFeature)).toThrow(`There is no beta feature configured with the name "${betaFeature}"`);
38
+ });
39
+ test('loads main configuration when betaFeature is not provided and main config file exists', () => {
40
+ _fs.existsSync.mockReturnValueOnce(true);
41
+ jest.doMock('/test/directory/conf/dev/actors/index.js', () => ({
42
+ actors: []
43
+ }), {
44
+ virtual: true
45
+ });
46
+ const result = getListOfActors();
47
+ expect(result).toEqual({
48
+ actors: []
49
+ });
50
+ });
51
+ test('falls back to default configuration if main config file does not exist', () => {
52
+ _fs.existsSync.mockReturnValueOnce(false).mockReturnValueOnce(true);
53
+ jest.doMock('/test/directory/conf/default/actors/index.js', () => ({
54
+ actors: []
55
+ }), {
56
+ virtual: true
57
+ });
58
+ const result = getListOfActors();
59
+ expect(result).toEqual({
60
+ actors: []
61
+ });
62
+ });
63
+ test('loads beta feature configuration when betaFeature is provided', () => {
64
+ _fs.existsSync.mockReturnValueOnce(true) // Main config file exists
65
+ .mockReturnValueOnce(true); // Beta feature config exists
66
+
67
+ const betaFeature = 'parentchild';
68
+ const betaFeaturePath = `/test/directory/conf/dev/actors/beta/${betaFeature}/index.js`;
69
+ jest.doMock(betaFeaturePath, () => ({
70
+ betaActors: []
71
+ }), {
72
+ virtual: true
73
+ });
74
+ const result = getListOfActors(betaFeature);
75
+ expect(result).toEqual({
76
+ betaActors: []
77
+ });
78
+ expect(_path.default.join).toHaveBeenCalledWith('/test/directory', `conf/dev/actors/beta/${betaFeature}/index.js`);
79
+ });
80
+ });
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _RunnerHelper = _interopRequireDefault(require("../../../../../core/playwright/runner/RunnerHelper"));
5
+ var _SpawnRunner = _interopRequireDefault(require("../../../../../core/playwright/runner/SpawnRunner"));
6
+ describe('RunnerHelper', () => {
7
+ describe('createRunner', () => {
8
+ it('should throw error on invalid runner type', () => {
9
+ expect(() => _RunnerHelper.default.createRunner('invalid-type', {})).toThrow("Invalid runner type");
10
+ });
11
+ it('should create a valid runner class', () => {
12
+ const runnerInstance = _RunnerHelper.default.createRunner('spawn', {});
13
+ expect(runnerInstance).toBeInstanceOf(_SpawnRunner.default); // Directly pass the result
14
+ });
15
+ });
16
+ });
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _RunnerHelper = _interopRequireDefault(require("../../../../../core/playwright/runner/RunnerHelper"));
5
+ var _Runner = _interopRequireDefault(require("../../../../../core/playwright/runner/Runner"));
6
+ var _Configuration = _interopRequireDefault(require("../../../../../core/playwright/configuration/Configuration"));
7
+ jest.mock('child_process');
8
+ jest.mock('../../../../../utils/logger');
9
+ describe('SpawnRunner', () => {
10
+ let spawnRunner;
11
+ const runnerObj = new _Runner.default();
12
+ beforeEach(() => {
13
+ const config = new _Configuration.default({});
14
+ config.add("bddMode", true);
15
+ runnerObj.setConfig(config);
16
+ runnerObj.setTagArgs(["--headed"]);
17
+ spawnRunner = _RunnerHelper.default.createRunner('spawn', runnerObj);
18
+ });
19
+ describe('run', () => {
20
+ it('should call runPreprocessing when bddMode is true', () => {
21
+ const runPreprocessingSpy = jest.spyOn(spawnRunner, 'runPreprocessing').mockResolvedValue();
22
+ const runPlaywrightSpy = jest.spyOn(spawnRunner, 'runPlaywright').mockResolvedValue();
23
+ spawnRunner.run();
24
+ expect(runPreprocessingSpy).toHaveBeenCalled();
25
+ });
26
+ });
27
+ });
@@ -0,0 +1,7 @@
1
+ export function add(a, b) {
2
+ return a + b;
3
+ }
4
+
5
+ export function greet(name) {
6
+ return `Hello, ${name}!`;
7
+ }
@@ -1,5 +1,2 @@
1
1
  const editions = require('./editions/index');
2
- const beta = require('./beta/index');
3
-
4
-
5
- module.exports = { editions, beta }
2
+ module.exports = { editions }
@@ -2,5 +2,5 @@
2
2
  "environment": "ci",
3
3
  "edition": "enterprise",
4
4
  "profile": "admin",
5
- "domain": "https://zdesk-devops08.csez.zohocorpin.com:31007/agent"
5
+ "domain": "https://zdesk-devops16.csez.zohocorpin.com:31025/agent"
6
6
  }
@@ -17,8 +17,9 @@ module.exports = {
17
17
  browsers: ['Chrome'],
18
18
  isAuthMode: false,
19
19
  authFilePath: getPrimaryCookiePath(),
20
- trace: true,
21
- video: true,
20
+ trace: 'on-first-retry',
21
+ video: 'on-first-retry',
22
+ retries:1,
22
23
  bddMode: false,
23
24
  viewport: { width: 1280, height: 720 },
24
25
  testIdAttribute: 'data-id',
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "dev": {
3
- "domain": "https://desk.localzoho.com/agent",
3
+ "domain": "https://zdesk-devops16.csez.zohocorpin.com:31025/agent",
4
4
  "orgName": "org-name",
5
5
  "deptName": "dept-name",
6
6
  "moduleName": "module-name"
7
7
  },
8
8
  "prod": {
9
- "domain": "https://desk.localzoho.com/agent/",
9
+ "domain": "https://zdesk-devops16.csez.zohocorpin.com:31025/agent",
10
10
  "orgName": "sangeetha.t@zohocorp.com",
11
11
  "deptName": "sangeethat",
12
12
  "moduleName": "sangeethat"
13
13
  },
14
14
  "ci": {
15
- "domain": "https://zdesk-devops08.csez.zohocorpin.com:31007/agent/",
15
+ "domain": "https://zdesk-devops16.csez.zohocorpin.com:31025/agent",
16
16
  "orgName": "clientcicdk8",
17
17
  "deptName": "clientcicdk8",
18
18
  "moduleName": "tickets"