@zohodesk/testinglibrary 0.1.8-exp.4 → 0.1.8-exp.6
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.
- package/.babelrc +3 -0
- package/build/core/playwright/clear-caches.js +19 -8
- package/build/core/playwright/codegen.js +4 -4
- package/build/core/playwright/constants/browserTypes.js +12 -0
- package/build/core/playwright/env-initializer.js +10 -6
- package/build/core/playwright/helpers/configFileNameProvider.js +13 -0
- package/build/core/playwright/helpers/mergeObjects.js +13 -0
- package/build/core/playwright/readConfigFile.js +10 -11
- package/build/core/playwright/report-generator.js +7 -7
- package/build/core/playwright/setup/config-creator.js +2 -2
- package/build/core/playwright/setup/config-utils.js +6 -5
- package/build/core/playwright/test-runner.js +2 -1
- package/build/index.js +0 -11
- package/build/lib/cli.js +0 -3
- package/build/lib/post-install.js +15 -10
- package/build/setup-folder-structure/helper.js +1 -0
- package/build/utils/cliArgsToObject.js +5 -1
- package/build/utils/fileUtils.js +3 -0
- package/build/utils/rootPath.js +16 -9
- package/changelog.md +1 -0
- package/npm-shrinkwrap.json +12 -12
- package/package.json +3 -3
package/.babelrc
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
"targets": {
|
|
7
7
|
"node": "14"
|
|
8
8
|
},
|
|
9
|
+
// We are adding plugin @babel/plugin-transform-destructuring to ensure babel does not transform the destructing
|
|
10
|
+
// as playwright does not allow parameters without destrucring
|
|
9
11
|
"exclude": ["@babel/plugin-transform-destructuring"]
|
|
10
12
|
}
|
|
11
13
|
]
|
|
@@ -13,6 +15,7 @@
|
|
|
13
15
|
"plugins": [
|
|
14
16
|
["@babel/plugin-transform-runtime"]
|
|
15
17
|
],
|
|
18
|
+
// Ignored as these are setup files needed during init script. Files inside that folder are copied not transformed
|
|
16
19
|
"ignore": [
|
|
17
20
|
"./src/setup-folder-structure/samples"
|
|
18
21
|
]
|
|
@@ -9,21 +9,32 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
9
9
|
var _fileUtils = require("../../utils/fileUtils");
|
|
10
10
|
var _logger = require("../../utils/logger");
|
|
11
11
|
var _readConfigFile = require("./readConfigFile");
|
|
12
|
+
function deleteAuthFiles(authFilePath) {
|
|
13
|
+
authFilePath.split('/').pop();
|
|
14
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, `Deleting auth files present in ${authFilePath}`);
|
|
15
|
+
(0, _fileUtils.deleteFolder)(_path.default.resolve(process.cwd(), authFilePath));
|
|
16
|
+
}
|
|
17
|
+
function deletePlaywrightReport(reportPath) {
|
|
18
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, `Deleting Playwright report ${reportPath}`);
|
|
19
|
+
(0, _fileUtils.deleteFolder)(reportPath);
|
|
20
|
+
}
|
|
21
|
+
function deleteGeneratedFeatures() {
|
|
22
|
+
const featuresGenPath = _path.default.resolve(process.cwd(), 'uat', '.features-gen');
|
|
23
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, `Deleting generated features at ${featuresGenPath}`);
|
|
24
|
+
(0, _fileUtils.deleteFolder)(featuresGenPath);
|
|
25
|
+
}
|
|
12
26
|
function clearCaches() {
|
|
13
27
|
try {
|
|
14
28
|
const {
|
|
15
29
|
authFilePath,
|
|
16
30
|
reportPath
|
|
17
31
|
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
18
|
-
authFilePath
|
|
19
|
-
|
|
20
|
-
(
|
|
21
|
-
_logger.Logger.log(_logger.Logger.
|
|
22
|
-
(0, _fileUtils.deleteFolder)(reportPath);
|
|
23
|
-
(0, _fileUtils.deleteFolder)(_path.default.resolve(process.cwd(), 'uat', '.features-gen'));
|
|
24
|
-
_logger.Logger.log(_logger.Logger.SUCCESS_TYPE, 'Caches Cleared');
|
|
32
|
+
deleteAuthFiles(authFilePath);
|
|
33
|
+
deletePlaywrightReport(reportPath);
|
|
34
|
+
deleteGeneratedFeatures();
|
|
35
|
+
_logger.Logger.log(_logger.Logger.SUCCESS_TYPE, 'Caches Cleared. Now you can try running npm run uat');
|
|
25
36
|
} catch (err) {
|
|
26
|
-
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, 'Error While clearing cookies');
|
|
37
|
+
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, 'Error While clearing cookies. Try manually delete folder uat/playwright and uat/playwright-report');
|
|
27
38
|
}
|
|
28
39
|
}
|
|
29
40
|
var _default = exports.default = clearCaches;
|
|
@@ -9,11 +9,11 @@ var _child_process = require("child_process");
|
|
|
9
9
|
var _path = _interopRequireDefault(require("path"));
|
|
10
10
|
var _logger = require("../../utils/logger");
|
|
11
11
|
var _rootPath = require("../../utils/rootPath");
|
|
12
|
-
const userArgs = process.argv.slice(3);
|
|
13
|
-
const playwrightPath = _path.default.resolve((0, _rootPath.getExecutableBinaryPath)('playwright'));
|
|
14
|
-
const command = playwrightPath;
|
|
15
|
-
const args = ['codegen'].concat(userArgs);
|
|
16
12
|
function generateCodegen() {
|
|
13
|
+
const domainUrl = process.argv.slice(3);
|
|
14
|
+
const playwrightPath = _path.default.resolve((0, _rootPath.getExecutableBinaryPath)('playwright'));
|
|
15
|
+
const command = playwrightPath;
|
|
16
|
+
const args = ['codegen'].concat(domainUrl);
|
|
17
17
|
const childProcess = (0, _child_process.spawn)(command, args, {
|
|
18
18
|
stdio: 'inherit'
|
|
19
19
|
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.BROWSER_PROJECT_MAPPING = void 0;
|
|
7
|
+
const BROWSER_PROJECT_MAPPING = exports.BROWSER_PROJECT_MAPPING = {
|
|
8
|
+
CHROME: 'chromium',
|
|
9
|
+
EDGE: 'Microsoft Edge',
|
|
10
|
+
FIREFOX: 'firefox',
|
|
11
|
+
SAFARI: 'webkit'
|
|
12
|
+
};
|
|
@@ -7,15 +7,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.initializeEnvConfig = initializeEnvConfig;
|
|
8
8
|
var _fs = require("fs");
|
|
9
9
|
var _path = _interopRequireDefault(require("path"));
|
|
10
|
+
var _configFileNameProvider = require("./helpers/configFileNameProvider");
|
|
11
|
+
function setEnvironmentVariables(mode, configJSON) {
|
|
12
|
+
process.env.mode = mode;
|
|
13
|
+
for (const key in configJSON[mode]) {
|
|
14
|
+
process.env[key] = configJSON[mode][key];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
10
17
|
function initializeEnvConfig(mode = 'dev') {
|
|
11
18
|
try {
|
|
12
|
-
const configFile = (0, _fs.readFileSync)(_path.default.resolve(process.cwd(),
|
|
19
|
+
const configFile = (0, _fs.readFileSync)(_path.default.resolve(process.cwd(), `./${(0, _configFileNameProvider.getEnvConfigFilePath)()}`));
|
|
13
20
|
const configJSON = JSON.parse(configFile);
|
|
14
|
-
|
|
15
|
-
for (const key in configJSON[mode]) {
|
|
16
|
-
process.env[key] = configJSON[mode][key];
|
|
17
|
-
}
|
|
21
|
+
setEnvironmentVariables(mode, configJSON);
|
|
18
22
|
} catch (err) {
|
|
19
|
-
throw new Error(
|
|
23
|
+
throw new Error(`Config File Not Exists. Please provide a config file ${(0, _configFileNameProvider.getEnvConfigFilePath)()} to intiailize the environment variables`);
|
|
20
24
|
}
|
|
21
25
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getEnvConfigFilePath = getEnvConfigFilePath;
|
|
7
|
+
exports.getUATFileName = getUATFileName;
|
|
8
|
+
function getUATFileName() {
|
|
9
|
+
return 'uat.config.js';
|
|
10
|
+
}
|
|
11
|
+
function getEnvConfigFilePath() {
|
|
12
|
+
return `uat/env-config.json`;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.mergeObjects = mergeObjects;
|
|
7
|
+
// Utility function to merge objects using spread operator
|
|
8
|
+
function mergeObjects(obj1, obj2) {
|
|
9
|
+
return {
|
|
10
|
+
...obj1,
|
|
11
|
+
...obj2
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -4,14 +4,16 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.fileName = void 0;
|
|
8
7
|
exports.generateConfigFromFile = generateConfigFromFile;
|
|
9
8
|
exports.getAuthFilePath = getAuthFilePath;
|
|
10
9
|
exports.isUserConfigFileAvailable = isUserConfigFileAvailable;
|
|
11
10
|
var _fs = require("fs");
|
|
12
11
|
var _path = _interopRequireDefault(require("path"));
|
|
13
12
|
var _logger = require("../../utils/logger");
|
|
14
|
-
|
|
13
|
+
var _configFileNameProvider = require("./helpers/configFileNameProvider");
|
|
14
|
+
var _mergeObjects = require("./helpers/mergeObjects");
|
|
15
|
+
// const fileName = 'uat.config.js';
|
|
16
|
+
|
|
15
17
|
function getDefaultConfig() {
|
|
16
18
|
return {
|
|
17
19
|
headless: false,
|
|
@@ -51,16 +53,13 @@ function combineDefaultConfigWithUserConfig(userConfiguration) {
|
|
|
51
53
|
_logger.Logger.log(_logger.Logger.INFO_TYPE, `key - ${configKey} is not yet supported in uat configuration. This will not be used while creating playwright configuration`);
|
|
52
54
|
}
|
|
53
55
|
});
|
|
54
|
-
return
|
|
55
|
-
...defaultConfig,
|
|
56
|
-
...configurationObj
|
|
57
|
-
};
|
|
56
|
+
return (0, _mergeObjects.mergeObjects)(defaultConfig, configurationObj);
|
|
58
57
|
}
|
|
59
58
|
|
|
60
59
|
/**
|
|
61
60
|
* @typedef {Object|null} viewportConfig
|
|
62
61
|
* @property {number} width - width of the viewport
|
|
63
|
-
* @property {number} height - height of the viewport
|
|
62
|
+
* @property {number} height - height of the viewport
|
|
64
63
|
*/
|
|
65
64
|
|
|
66
65
|
/**
|
|
@@ -74,7 +73,7 @@ function combineDefaultConfigWithUserConfig(userConfiguration) {
|
|
|
74
73
|
* @property {boolean} isAuthMode - Auth Mode. config whether authentication step needed before running test cases
|
|
75
74
|
* @property {string} authFilePath - File Path where the cookies stored
|
|
76
75
|
* @property {any} browsers: List of browsers
|
|
77
|
-
* @property {string} openReportOn: default Option value (never, on-failure and always)
|
|
76
|
+
* @property {string} openReportOn: default Option value (never, on-failure and always)
|
|
78
77
|
* @property {any} reportPath : directory where report is generate
|
|
79
78
|
* @property {boolean} bddMode: Feature files needs to be processed
|
|
80
79
|
* @property {number} expectTimeout: time in milliseconds which the expect condition should fail
|
|
@@ -91,9 +90,9 @@ function combineDefaultConfigWithUserConfig(userConfiguration) {
|
|
|
91
90
|
* Generates a configuration object from a file, if it exists.
|
|
92
91
|
*
|
|
93
92
|
* @returns {UserConfig}
|
|
94
|
-
*/
|
|
93
|
+
*/
|
|
95
94
|
function generateConfigFromFile() {
|
|
96
|
-
const filePath = _path.default.resolve(process.cwd(),
|
|
95
|
+
const filePath = _path.default.resolve(process.cwd(), (0, _configFileNameProvider.getUATFileName)());
|
|
97
96
|
if ((0, _fs.existsSync)(filePath)) {
|
|
98
97
|
/** @type {UserConfig} */
|
|
99
98
|
const config = require(filePath);
|
|
@@ -103,7 +102,7 @@ function generateConfigFromFile() {
|
|
|
103
102
|
return {};
|
|
104
103
|
}
|
|
105
104
|
function isUserConfigFileAvailable() {
|
|
106
|
-
const filePath = _path.default.resolve(process.cwd(),
|
|
105
|
+
const filePath = _path.default.resolve(process.cwd(), (0, _configFileNameProvider.getUATFileName)());
|
|
107
106
|
if ((0, _fs.existsSync)(filePath)) {
|
|
108
107
|
return true;
|
|
109
108
|
}
|
|
@@ -10,15 +10,15 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
10
10
|
var _logger = require("../../utils/logger");
|
|
11
11
|
var _rootPath = require("../../utils/rootPath");
|
|
12
12
|
var _readConfigFile = require("./readConfigFile");
|
|
13
|
-
const userArgs = process.argv.slice(3);
|
|
14
|
-
const playwrightPath = _path.default.resolve((0, _rootPath.getExecutableBinaryPath)('playwright'));
|
|
15
|
-
const command = playwrightPath;
|
|
16
|
-
const {
|
|
17
|
-
reportPath: htmlPath
|
|
18
|
-
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
19
|
-
const args = ['show-report', htmlPath].concat(userArgs);
|
|
20
13
|
async function generateReport() {
|
|
21
14
|
// await preProcessReport()
|
|
15
|
+
const userArgs = process.argv.slice(3);
|
|
16
|
+
const playwrightPath = _path.default.resolve((0, _rootPath.getExecutableBinaryPath)('playwright'));
|
|
17
|
+
const command = playwrightPath;
|
|
18
|
+
const {
|
|
19
|
+
reportPath: htmlPath
|
|
20
|
+
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
21
|
+
const args = ['show-report', htmlPath].concat(userArgs);
|
|
22
22
|
const childProcess = (0, _child_process.spawn)(command, args, {
|
|
23
23
|
stdio: 'inherit'
|
|
24
24
|
});
|
|
@@ -9,7 +9,7 @@ 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
|
|
12
|
+
const defaultCIBrowsers = ['Chrome', 'Firefox', 'Edge', 'Safari'];
|
|
13
13
|
const {
|
|
14
14
|
browsers,
|
|
15
15
|
trace,
|
|
@@ -26,7 +26,7 @@ const {
|
|
|
26
26
|
stepDefinitionsFolder,
|
|
27
27
|
testIdAttribute
|
|
28
28
|
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
29
|
-
const browserList = process.env.mode === 'ci' ?
|
|
29
|
+
const browserList = process.env.mode === 'ci' ? defaultCIBrowsers : browsers;
|
|
30
30
|
const projects = (0, _configUtils.getProjects)({
|
|
31
31
|
browsers: browserList,
|
|
32
32
|
isAuthMode,
|
|
@@ -13,6 +13,7 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
13
13
|
var _readConfigFile = require("../readConfigFile");
|
|
14
14
|
var _bddFramework = require("../../../bdd-framework");
|
|
15
15
|
var _logger = require("../../../utils/logger");
|
|
16
|
+
var _browserTypes = require("../constants/browserTypes");
|
|
16
17
|
/**
|
|
17
18
|
** Playwright project configuration
|
|
18
19
|
* @returns {import('@playwright/test').Project}
|
|
@@ -33,7 +34,7 @@ function getBrowserConfig({
|
|
|
33
34
|
const dependencies = isAuthMode ? ['setup'] : [];
|
|
34
35
|
if (browser === 'chrome') {
|
|
35
36
|
return {
|
|
36
|
-
name:
|
|
37
|
+
name: _browserTypes.BROWSER_PROJECT_MAPPING.CHROME,
|
|
37
38
|
use: {
|
|
38
39
|
..._test.devices['Desktop Chrome'],
|
|
39
40
|
...commonConfig
|
|
@@ -46,7 +47,7 @@ function getBrowserConfig({
|
|
|
46
47
|
};
|
|
47
48
|
} else if (browser === 'edge') {
|
|
48
49
|
return {
|
|
49
|
-
name:
|
|
50
|
+
name: _browserTypes.BROWSER_PROJECT_MAPPING.EDGE,
|
|
50
51
|
timeout: testTimeout,
|
|
51
52
|
expect: {
|
|
52
53
|
timeout: expectTimeout
|
|
@@ -60,7 +61,7 @@ function getBrowserConfig({
|
|
|
60
61
|
};
|
|
61
62
|
} else if (browser === 'firefox') {
|
|
62
63
|
return {
|
|
63
|
-
name:
|
|
64
|
+
name: _browserTypes.BROWSER_PROJECT_MAPPING.FIREFOX,
|
|
64
65
|
timeout: 2 * testTimeout,
|
|
65
66
|
expect: {
|
|
66
67
|
timeout: 2 * expectTimeout
|
|
@@ -73,7 +74,7 @@ function getBrowserConfig({
|
|
|
73
74
|
};
|
|
74
75
|
} else if (browser === 'safari') {
|
|
75
76
|
return {
|
|
76
|
-
name:
|
|
77
|
+
name: _browserTypes.BROWSER_PROJECT_MAPPING.SAFARI,
|
|
77
78
|
timeout: 4 * testTimeout,
|
|
78
79
|
expect: {
|
|
79
80
|
timeout: 4 * expectTimeout
|
|
@@ -115,7 +116,7 @@ function getBrowsersList(browserFromArgs) {
|
|
|
115
116
|
if (browserFromArgs) {
|
|
116
117
|
if (typeof browserFromArgs === 'string') {
|
|
117
118
|
let listOfbrowsers = browserFromArgs.split(',').map(browser => browser.trim().toLowerCase());
|
|
118
|
-
_logger.Logger.log(_logger.Logger.INFO_TYPE, '');
|
|
119
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, 'Using browsers from command line args');
|
|
119
120
|
return listOfbrowsers;
|
|
120
121
|
}
|
|
121
122
|
}
|
|
@@ -15,6 +15,7 @@ var _readConfigFile = require("./readConfigFile");
|
|
|
15
15
|
var _rootPath = require("../../utils/rootPath");
|
|
16
16
|
var _tagProcessor = require("./tag-processor");
|
|
17
17
|
var _configUtils = require("./setup/config-utils");
|
|
18
|
+
var _browserTypes = require("./constants/browserTypes");
|
|
18
19
|
function parseUserArgs() {
|
|
19
20
|
return (0, _cliArgsToObject.cliArgsToObject)(process.argv.slice(2));
|
|
20
21
|
}
|
|
@@ -35,7 +36,7 @@ function getPlaywrightArgs(userArgsObject, debug, bddMode, tagArgs, headless) {
|
|
|
35
36
|
playwrightArgs.push('--headed');
|
|
36
37
|
}
|
|
37
38
|
if (browserList && browserList.length > 0) {
|
|
38
|
-
browserList.map(browser => playwrightArgs.push(`--project=${browser}`));
|
|
39
|
+
browserList.map(browser => playwrightArgs.push(`--project=${_browserTypes.BROWSER_PROJECT_MAPPING[browser.toUpperCase()]}`));
|
|
39
40
|
}
|
|
40
41
|
console.log(playwrightArgs);
|
|
41
42
|
return playwrightArgs;
|
package/build/index.js
CHANGED
|
@@ -23,17 +23,6 @@ Object.defineProperty(exports, "test", {
|
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
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
|
-
|
|
37
26
|
// import { fireEvent, render } from '@testing-library/react';
|
|
38
27
|
|
|
39
28
|
const {
|
package/build/lib/cli.js
CHANGED
|
@@ -12,9 +12,6 @@ var _helper = _interopRequireDefault(require("../setup-folder-structure/helper")
|
|
|
12
12
|
// import createJestRunner from '../core/jest/runner/jest-runner';
|
|
13
13
|
|
|
14
14
|
const [,, option, ...otherOptions] = process.argv;
|
|
15
|
-
// const args = process.argv.slice(3);
|
|
16
|
-
// const appPath = process.cwd();
|
|
17
|
-
|
|
18
15
|
switch (option) {
|
|
19
16
|
case 'test':
|
|
20
17
|
{
|
|
@@ -5,13 +5,18 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
5
5
|
var _child_process = require("child_process");
|
|
6
6
|
var _logger = require("../utils/logger");
|
|
7
7
|
var _rootPath = require("../utils/rootPath");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
// We are adding NODE_ENV to production in react-cli
|
|
9
|
+
if (process.env.NODE_ENV !== 'production' || process.env.SKIP_BROWSER_DOWNLOAD === true) {
|
|
10
|
+
const playwrightPath = _path.default.resolve((0, _rootPath.getExecutableBinaryPath)('playwright'));
|
|
11
|
+
const command = playwrightPath;
|
|
12
|
+
const args = ['install'];
|
|
13
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, 'Downloading browsers for running tests');
|
|
14
|
+
const childProcess = (0, _child_process.spawn)(command, args, {
|
|
15
|
+
stdio: 'inherit'
|
|
16
|
+
});
|
|
17
|
+
childProcess.on('error', error => {
|
|
18
|
+
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, error);
|
|
19
|
+
});
|
|
20
|
+
} else {
|
|
21
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, 'Skipping browsers download in production mode');
|
|
22
|
+
}
|
|
@@ -29,6 +29,7 @@ function helpercmd() {
|
|
|
29
29
|
_commander.program.option('--debug', 'This command is used to initiate a debugging session');
|
|
30
30
|
_commander.program.option('--tags', 'Run specific test case with mentioned tags (Usage: -- --tags="@live")');
|
|
31
31
|
_commander.program.option('--workers', 'Specify number of workers to run the test case parallely (Usage: -- --workers=2)');
|
|
32
|
+
_commander.program.option('--edition', 'Specify edition to run the test cases (Usage: -- --edition="standard". This will run the test cases with either no edition mentioned or edition standard)');
|
|
32
33
|
_commander.program.option('--browsers', 'Specify the browsers on which the test case should run (Usage: -- --browsers="chrome,firefox,safari")');
|
|
33
34
|
_commander.program.parse(process.argv);
|
|
34
35
|
}
|
|
@@ -5,6 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.cliArgsToObject = cliArgsToObject;
|
|
7
7
|
exports.objectToCliArgs = objectToCliArgs;
|
|
8
|
+
function isMatchForOption(option) {
|
|
9
|
+
return /^--./.test(option);
|
|
10
|
+
}
|
|
11
|
+
|
|
8
12
|
/**
|
|
9
13
|
* Converts an array of command-line arguments into an object.
|
|
10
14
|
*
|
|
@@ -23,7 +27,7 @@ exports.objectToCliArgs = objectToCliArgs;
|
|
|
23
27
|
function cliArgsToObject(cliArgs, isKeyNeedToBeAdded) {
|
|
24
28
|
const processEnv = {};
|
|
25
29
|
cliArgs.forEach(option => {
|
|
26
|
-
if (
|
|
30
|
+
if (isMatchForOption(option)) {
|
|
27
31
|
const equIndex = option.indexOf('=');
|
|
28
32
|
let key = option.slice(2, equIndex);
|
|
29
33
|
let value = option.slice(equIndex + 1);
|
package/build/utils/fileUtils.js
CHANGED
|
@@ -11,6 +11,7 @@ exports.readFileContents = readFileContents;
|
|
|
11
11
|
exports.writeFileContents = writeFileContents;
|
|
12
12
|
var _fs = _interopRequireDefault(require("fs"));
|
|
13
13
|
var _path = _interopRequireDefault(require("path"));
|
|
14
|
+
var _logger = require("./logger");
|
|
14
15
|
function checkIfFileExists(file) {
|
|
15
16
|
try {
|
|
16
17
|
_fs.default.accessSync(file, _fs.default.constants.F_OK);
|
|
@@ -49,6 +50,8 @@ function deleteFile(filePath) {
|
|
|
49
50
|
} catch (err) {
|
|
50
51
|
throw new Error(`Error while deleting the test data file: ${filePath}`);
|
|
51
52
|
}
|
|
53
|
+
} else {
|
|
54
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, `File Does not Exist in the path ${filePath}`);
|
|
52
55
|
}
|
|
53
56
|
}
|
|
54
57
|
function deleteFolder(folderPath) {
|
package/build/utils/rootPath.js
CHANGED
|
@@ -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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
|
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
|
-
|
|
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
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/testinglibrary",
|
|
3
|
-
"version": "0.1.8",
|
|
3
|
+
"version": "0.1.8-exp.6",
|
|
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.
|
|
2078
|
-
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.
|
|
2079
|
-
"integrity": "sha512-
|
|
2077
|
+
"version": "1.41.2",
|
|
2078
|
+
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.41.2.tgz",
|
|
2079
|
+
"integrity": "sha512-qQB9h7KbibJzrDpkXkYvsmiDJK14FULCCZgEcoe2AvFAS64oCirWTwzTlAYEbKaRxWs5TFesE1Na6izMv3HfGg==",
|
|
2080
2080
|
"requires": {
|
|
2081
|
-
"playwright": "1.
|
|
2081
|
+
"playwright": "1.41.2"
|
|
2082
2082
|
}
|
|
2083
2083
|
},
|
|
2084
2084
|
"@sinclair/typebox": {
|
|
@@ -5387,18 +5387,18 @@
|
|
|
5387
5387
|
}
|
|
5388
5388
|
},
|
|
5389
5389
|
"playwright": {
|
|
5390
|
-
"version": "1.
|
|
5391
|
-
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.
|
|
5392
|
-
"integrity": "sha512-
|
|
5390
|
+
"version": "1.41.2",
|
|
5391
|
+
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.41.2.tgz",
|
|
5392
|
+
"integrity": "sha512-v0bOa6H2GJChDL8pAeLa/LZC4feoAMbSQm1/jF/ySsWWoaNItvrMP7GEkvEEFyCTUYKMxjQKaTSg5up7nR6/8A==",
|
|
5393
5393
|
"requires": {
|
|
5394
5394
|
"fsevents": "2.3.2",
|
|
5395
|
-
"playwright-core": "1.
|
|
5395
|
+
"playwright-core": "1.41.2"
|
|
5396
5396
|
}
|
|
5397
5397
|
},
|
|
5398
5398
|
"playwright-core": {
|
|
5399
|
-
"version": "1.
|
|
5400
|
-
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.
|
|
5401
|
-
"integrity": "sha512
|
|
5399
|
+
"version": "1.41.2",
|
|
5400
|
+
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.41.2.tgz",
|
|
5401
|
+
"integrity": "sha512-VaTvwCA4Y8kxEe+kfm2+uUUw5Lubf38RxF7FpBxLPmGe5sdNkSg5e3ChEigaGrX7qdqT3pt2m/98LiyvU2x6CA=="
|
|
5402
5402
|
},
|
|
5403
5403
|
"pretty-format": {
|
|
5404
5404
|
"version": "29.7.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/testinglibrary",
|
|
3
|
-
"version": "0.1.8-exp.
|
|
3
|
+
"version": "0.1.8-exp.6",
|
|
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.
|
|
25
|
+
"@playwright/test": "1.41.2",
|
|
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,7 @@
|
|
|
32
32
|
"jest": "29.6.2",
|
|
33
33
|
"jest-environment-jsdom": "29.6.2",
|
|
34
34
|
"msw": "1.2.3",
|
|
35
|
-
"playwright": "1.
|
|
35
|
+
"playwright": "1.41.2"
|
|
36
36
|
},
|
|
37
37
|
"bin": {
|
|
38
38
|
"ZDTestingFramework": "./bin/cli.js"
|