@zohodesk/testinglibrary 0.0.7-exp.1 → 0.0.7-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.
- package/.babelrc +7 -2
- package/.eslintrc.js +5 -1
- package/.gitlab-ci.yml +206 -0
- package/README.md +172 -1
- package/build/common/data-generator/steps/DataGenerator.spec.js +19 -0
- package/build/common/data-generator/steps/DataGeneratorStepsHelper.js +19 -0
- package/build/common/multi-actor/steps/multiActorHandling.spec.js +26 -0
- package/build/common/searchFake/helpers/rpcRequestHelper.js +52 -0
- package/build/common/searchFake/steps/searchFake.spec.js +77 -0
- package/build/core/dataGenerator/DataGenerator.js +108 -0
- package/build/core/dataGenerator/DataGeneratorError.js +50 -0
- package/build/core/dataGenerator/DataGeneratorHelper.js +49 -0
- package/build/core/jest/preprocessor/jsPreprocessor.js +3 -9
- package/build/core/jest/setup/index.js +1 -7
- package/build/core/playwright/builtInFixtures/actorContext.js +75 -0
- package/build/core/playwright/builtInFixtures/addTags.js +19 -0
- package/build/core/playwright/builtInFixtures/cacheLayer.js +13 -0
- package/build/core/playwright/builtInFixtures/context.js +32 -0
- package/build/core/playwright/builtInFixtures/executionContext.js +17 -0
- package/build/core/playwright/builtInFixtures/i18N.js +41 -0
- package/build/core/playwright/builtInFixtures/index.js +46 -0
- package/build/core/playwright/builtInFixtures/page.js +38 -0
- package/build/core/playwright/builtInFixtures/unauthenticatedPage.js +18 -0
- package/build/core/playwright/clear-caches.js +49 -0
- package/build/core/playwright/codegen.js +4 -4
- package/build/core/playwright/configuration/Configuration.js +25 -0
- package/build/core/playwright/configuration/ConfigurationHelper.js +43 -0
- package/build/core/playwright/configuration/UserArgs.js +12 -0
- package/build/core/playwright/constants/browserTypes.js +12 -0
- package/build/core/playwright/constants/fileMutexConfig.js +9 -0
- package/build/core/playwright/custom-commands.js +1 -2
- package/build/core/playwright/env-initializer.js +28 -6
- package/build/core/playwright/fixtures.js +24 -0
- package/build/core/playwright/helpers/additionalProfiles.js +25 -0
- package/build/core/playwright/helpers/auth/accountLogin.js +21 -0
- package/build/core/playwright/helpers/auth/checkAuthCookies.js +41 -0
- package/build/core/playwright/helpers/auth/getUrlOrigin.js +13 -0
- package/build/core/playwright/helpers/auth/getUsers.js +118 -0
- package/build/core/playwright/helpers/auth/index.js +76 -0
- package/build/core/playwright/helpers/auth/loginDefaultStepsHelper.js +54 -0
- package/build/core/playwright/helpers/auth/loginSteps.js +51 -0
- package/build/core/playwright/helpers/checkAuthDirectory.js +27 -0
- package/build/core/playwright/helpers/configFileNameProvider.js +31 -0
- package/build/core/playwright/helpers/customFixturesHelper.js +58 -0
- package/build/core/playwright/helpers/fileMutex.js +72 -0
- package/build/core/playwright/helpers/getUserFixtures.js +23 -0
- package/build/core/playwright/helpers/mergeObjects.js +13 -0
- package/build/core/playwright/helpers/parseUserArgs.js +10 -0
- package/build/core/playwright/index.js +10 -98
- package/build/core/playwright/readConfigFile.js +71 -25
- package/build/core/playwright/report-generator.js +9 -8
- package/build/core/playwright/runner/Runner.js +22 -0
- package/build/core/playwright/runner/RunnerHelper.js +43 -0
- package/build/core/playwright/runner/RunnerTypes.js +17 -0
- package/build/core/playwright/runner/SpawnRunner.js +113 -0
- package/build/core/playwright/setup/Project.js +35 -0
- package/build/core/playwright/setup/ProjectConfiguration.js +80 -0
- package/build/core/playwright/setup/config-creator.js +54 -33
- package/build/core/playwright/setup/config-utils.js +99 -16
- package/build/core/playwright/setup/custom-reporter.js +136 -0
- package/build/core/playwright/setup/qc-custom-reporter.js +291 -0
- package/build/core/playwright/tagProcessor.js +69 -0
- package/build/core/playwright/test-runner.js +57 -43
- package/build/core/playwright/types.js +44 -0
- package/build/core/playwright/validateFeature.js +28 -0
- package/build/decorators.d.ts +1 -1
- package/build/decorators.js +1 -1
- package/build/index.d.ts +76 -3
- package/build/index.js +63 -17
- package/build/lib/cli.js +28 -4
- package/build/lib/post-install.js +19 -11
- package/build/parser/parser.js +0 -1
- package/build/setup-folder-structure/helper.js +37 -0
- package/build/setup-folder-structure/reportEnhancement/addonScript.html +25 -0
- package/build/setup-folder-structure/reportEnhancement/reportAlteration.js +25 -0
- package/build/setup-folder-structure/samples/accountLogin-sample.js +19 -0
- package/build/setup-folder-structure/samples/actors-index.js +2 -0
- package/build/setup-folder-structure/samples/auth-setup-sample.js +10 -67
- package/build/setup-folder-structure/samples/editions-index.js +3 -0
- package/build/setup-folder-structure/samples/free-sample.json +25 -0
- package/build/setup-folder-structure/samples/git-ignore.sample.js +8 -4
- package/build/setup-folder-structure/samples/settings.json +7 -0
- package/build/setup-folder-structure/samples/testSetup-sample.js +14 -0
- package/build/setup-folder-structure/samples/uat-config-sample.js +7 -3
- package/build/setup-folder-structure/setupProject.js +34 -12
- package/build/test/core/playwright/__tests__/tagProcessor.test.js +94 -0
- package/build/test/core/playwright/__tests__/validateFeature.test.js +69 -0
- package/build/test/core/playwright/buildInFixtures/__tests__/executionContext.test.js +27 -0
- package/build/test/core/playwright/configuration/__tests__/Configuration.test.js +53 -0
- package/build/test/core/playwright/helpers/__tests__/additionalProfiles.test.js +45 -0
- package/build/test/core/playwright/helpers/__tests__/configFileNameProvider.test.js +34 -0
- package/build/test/core/playwright/helpers/__tests__/customFixturesHelper.test.js +51 -0
- package/build/test/core/playwright/helpers/__tests__/fileMutex.test.js +79 -0
- package/build/test/core/playwright/helpers/__tests__/getUsers_ListOfActors.test.js +80 -0
- package/build/test/core/playwright/runner/__tests__/RunnerHelper.test.js +16 -0
- package/build/test/core/playwright/runner/__tests__/SpawnRunner.test.js +27 -0
- package/build/utils/cliArgsToObject.js +8 -1
- package/build/utils/commonUtils.js +17 -0
- package/build/utils/fileUtils.js +60 -4
- package/build/utils/logger.js +1 -31
- package/build/utils/rootPath.js +16 -9
- package/build/utils/stepDefinitionsFormatter.js +1 -2
- package/changelog.md +167 -0
- package/jest.config.js +29 -11
- package/npm-shrinkwrap.json +9731 -6645
- package/package.json +34 -27
- package/playwright.config.js +0 -50
- package/test-results/.last-run.json +4 -0
- package/unit_reports/unit-report.html +260 -0
- package/Changelog.md +0 -49
- package/build/bdd-framework/cli/commands/env.js +0 -43
- package/build/bdd-framework/cli/commands/export.js +0 -48
- package/build/bdd-framework/cli/commands/test.js +0 -59
- package/build/bdd-framework/cli/index.js +0 -11
- package/build/bdd-framework/cli/options.js +0 -20
- package/build/bdd-framework/cli/worker.js +0 -13
- package/build/bdd-framework/config/dir.js +0 -27
- package/build/bdd-framework/config/env.js +0 -49
- package/build/bdd-framework/config/index.js +0 -91
- package/build/bdd-framework/cucumber/buildStepDefinition.js +0 -43
- package/build/bdd-framework/cucumber/gherkin.d.js +0 -5
- package/build/bdd-framework/cucumber/gherkin.d.ts +0 -45
- package/build/bdd-framework/cucumber/loadConfig.js +0 -17
- package/build/bdd-framework/cucumber/loadFeatures.js +0 -39
- package/build/bdd-framework/cucumber/loadSnippetBuilder.js +0 -20
- package/build/bdd-framework/cucumber/loadSources.js +0 -57
- package/build/bdd-framework/cucumber/loadSteps.js +0 -35
- package/build/bdd-framework/decorators.js +0 -22
- package/build/bdd-framework/gen/formatter.js +0 -88
- package/build/bdd-framework/gen/i18n.js +0 -35
- package/build/bdd-framework/gen/index.js +0 -160
- package/build/bdd-framework/gen/poms.js +0 -46
- package/build/bdd-framework/gen/testFile.js +0 -356
- package/build/bdd-framework/gen/testNode.js +0 -48
- package/build/bdd-framework/gen/testPoms.js +0 -123
- package/build/bdd-framework/index.js +0 -45
- package/build/bdd-framework/playwright/fixtureParameterNames.js +0 -77
- package/build/bdd-framework/playwright/getLocationInFile.js +0 -46
- package/build/bdd-framework/playwright/loadConfig.js +0 -42
- package/build/bdd-framework/playwright/testTypeImpl.js +0 -41
- package/build/bdd-framework/playwright/transform.js +0 -80
- package/build/bdd-framework/playwright/types.js +0 -5
- package/build/bdd-framework/playwright/utils.js +0 -34
- package/build/bdd-framework/run/bddFixtures.js +0 -108
- package/build/bdd-framework/run/bddWorld.js +0 -87
- package/build/bdd-framework/snippets/index.js +0 -131
- package/build/bdd-framework/snippets/snippetSyntax.js +0 -41
- package/build/bdd-framework/snippets/snippetSyntaxDecorators.js +0 -26
- package/build/bdd-framework/snippets/snippetSyntaxTs.js +0 -18
- package/build/bdd-framework/stepDefinitions/createBdd.js +0 -49
- package/build/bdd-framework/stepDefinitions/createDecorators.js +0 -109
- package/build/bdd-framework/stepDefinitions/decorators/poms.js +0 -50
- package/build/bdd-framework/stepDefinitions/decorators/steps.js +0 -94
- package/build/bdd-framework/stepDefinitions/defineStep.js +0 -61
- package/build/bdd-framework/stepDefinitions/stepConfig.js +0 -24
- package/build/bdd-framework/utils/index.js +0 -50
- package/build/bdd-framework/utils/jsStringWrap.js +0 -44
- package/build/bdd-framework/utils/logger.js +0 -29
- package/build/setup-folder-structure/samples/authUsers-sample.json +0 -9
- package/build/setup-folder-structure/samples/env-config-sample.json +0 -21
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _tagProcessor = _interopRequireDefault(require("../../../../../src/core/playwright/tagProcessor"));
|
|
5
|
+
var _logger = require("../../../../utils/logger");
|
|
6
|
+
jest.mock('../../../../utils/logger');
|
|
7
|
+
describe('TagProcessor', () => {
|
|
8
|
+
const editionOrder = ['edition1', 'edition2', 'edition3', 'edition4'];
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
jest.clearAllMocks();
|
|
11
|
+
});
|
|
12
|
+
test('should return tagArgs if no edition is provided', () => {
|
|
13
|
+
const tagProcessor = new _tagProcessor.default(editionOrder);
|
|
14
|
+
const userArgs = {
|
|
15
|
+
tags: 'tag1',
|
|
16
|
+
edition: null
|
|
17
|
+
};
|
|
18
|
+
const result = tagProcessor.processTags(userArgs);
|
|
19
|
+
expect(result).toBe('tag1');
|
|
20
|
+
});
|
|
21
|
+
test('should handle a single edition with <= operator', () => {
|
|
22
|
+
const tagProcessor = new _tagProcessor.default(editionOrder);
|
|
23
|
+
const userArgs = {
|
|
24
|
+
tags: 'tag1',
|
|
25
|
+
edition: '<=edition2'
|
|
26
|
+
};
|
|
27
|
+
const result = tagProcessor.processTags(userArgs);
|
|
28
|
+
expect(result).toBe('tag1 and not (@edition_edition3 or @edition_edition4)');
|
|
29
|
+
});
|
|
30
|
+
test('should handle a single edition with >= operator', () => {
|
|
31
|
+
const tagProcessor = new _tagProcessor.default(editionOrder);
|
|
32
|
+
const userArgs = {
|
|
33
|
+
tags: 'tag1',
|
|
34
|
+
edition: '>=edition2'
|
|
35
|
+
};
|
|
36
|
+
const result = tagProcessor.processTags(userArgs);
|
|
37
|
+
expect(result).toBe('tag1 and not (@edition_edition1)');
|
|
38
|
+
});
|
|
39
|
+
test('should handle a single edition with < operator', () => {
|
|
40
|
+
const tagProcessor = new _tagProcessor.default(editionOrder);
|
|
41
|
+
const userArgs = {
|
|
42
|
+
tags: 'tag1',
|
|
43
|
+
edition: '<edition3'
|
|
44
|
+
};
|
|
45
|
+
const result = tagProcessor.processTags(userArgs);
|
|
46
|
+
expect(result).toBe('tag1 and not (@edition_edition3 or @edition_edition4)');
|
|
47
|
+
});
|
|
48
|
+
test('should handle a single edition with > operator', () => {
|
|
49
|
+
const tagProcessor = new _tagProcessor.default(editionOrder);
|
|
50
|
+
const userArgs = {
|
|
51
|
+
tags: 'tag1',
|
|
52
|
+
edition: '>edition1'
|
|
53
|
+
};
|
|
54
|
+
const result = tagProcessor.processTags(userArgs);
|
|
55
|
+
expect(result).toBe('tag1 and not (@edition_edition1)');
|
|
56
|
+
});
|
|
57
|
+
test('should handle a single edition with no operator', () => {
|
|
58
|
+
const tagProcessor = new _tagProcessor.default(editionOrder);
|
|
59
|
+
const userArgs = {
|
|
60
|
+
tags: 'tag1',
|
|
61
|
+
edition: 'edition2'
|
|
62
|
+
};
|
|
63
|
+
const result = tagProcessor.processTags(userArgs);
|
|
64
|
+
expect(result).toBe('tag1 and not (@edition_edition1 or @edition_edition3 or @edition_edition4)');
|
|
65
|
+
});
|
|
66
|
+
test('should log a message if edition is not found', () => {
|
|
67
|
+
const tagProcessor = new _tagProcessor.default(editionOrder);
|
|
68
|
+
const userArgs = {
|
|
69
|
+
tags: 'tag1',
|
|
70
|
+
edition: 'nonexistentEdition'
|
|
71
|
+
};
|
|
72
|
+
const result = tagProcessor.processTags(userArgs);
|
|
73
|
+
expect(result).toBe('tag1');
|
|
74
|
+
expect(_logger.Logger.log).toHaveBeenCalledWith(_logger.Logger.INFO_TYPE, expect.stringContaining('No matching editions for nonexistentEdition found.'));
|
|
75
|
+
});
|
|
76
|
+
test('should handle multiple editions', () => {
|
|
77
|
+
const tagProcessor = new _tagProcessor.default(editionOrder);
|
|
78
|
+
const userArgs = {
|
|
79
|
+
tags: 'tag1',
|
|
80
|
+
edition: 'edition1,edition3'
|
|
81
|
+
};
|
|
82
|
+
const result = tagProcessor.processTags(userArgs);
|
|
83
|
+
expect(result).toBe('tag1 and not (@edition_edition2 or @edition_edition4)');
|
|
84
|
+
});
|
|
85
|
+
test('should build tags correctly when tags are empty', () => {
|
|
86
|
+
const tagProcessor = new _tagProcessor.default(editionOrder);
|
|
87
|
+
const userArgs = {
|
|
88
|
+
tags: '',
|
|
89
|
+
edition: 'edition1'
|
|
90
|
+
};
|
|
91
|
+
const result = tagProcessor.processTags(userArgs);
|
|
92
|
+
expect(result).toBe('not (@edition_edition2 or @edition_edition3 or @edition_edition4)');
|
|
93
|
+
});
|
|
94
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _validateFeature = _interopRequireDefault(require("../../../../core/playwright/validateFeature"));
|
|
5
|
+
var _parseUserArgs = _interopRequireDefault(require("../../../../core/playwright/helpers/parseUserArgs"));
|
|
6
|
+
var _readConfigFile = require("../../../../core/playwright/readConfigFile");
|
|
7
|
+
var _tagProcessor = _interopRequireDefault(require("../../../../core/playwright/tagProcessor"));
|
|
8
|
+
var _testRunner = require("../../../../core/playwright/test-runner");
|
|
9
|
+
var _logger = require("../../../../utils/logger");
|
|
10
|
+
jest.mock('../../../../core/playwright/helpers/parseUserArgs', () => ({
|
|
11
|
+
__esModule: true,
|
|
12
|
+
default: jest.fn()
|
|
13
|
+
}));
|
|
14
|
+
jest.mock('../../../../core/playwright/readConfigFile');
|
|
15
|
+
jest.mock('../../../../core/playwright/tagProcessor');
|
|
16
|
+
jest.mock('../../../../core/playwright/test-runner');
|
|
17
|
+
jest.mock('../../../../utils/logger', () => ({
|
|
18
|
+
__esModule: true,
|
|
19
|
+
Logger: {
|
|
20
|
+
log: jest.fn(),
|
|
21
|
+
SUCCESS_TYPE: 'success',
|
|
22
|
+
FAILURE_TYPE: 'failure'
|
|
23
|
+
}
|
|
24
|
+
}));
|
|
25
|
+
describe('validateFeatureFiles', () => {
|
|
26
|
+
let tagProcessorInstance;
|
|
27
|
+
beforeEach(() => {
|
|
28
|
+
jest.clearAllMocks();
|
|
29
|
+
tagProcessorInstance = {
|
|
30
|
+
processTags: jest.fn()
|
|
31
|
+
};
|
|
32
|
+
_tagProcessor.default.mockImplementation(() => tagProcessorInstance);
|
|
33
|
+
});
|
|
34
|
+
test('runPreprocessing with correct arguments and log success', async () => {
|
|
35
|
+
const mockUserArgs = {
|
|
36
|
+
mode: 'dev'
|
|
37
|
+
};
|
|
38
|
+
_parseUserArgs.default.mockReturnValue(mockUserArgs);
|
|
39
|
+
const mockConfig = {
|
|
40
|
+
editionOrder: ["beta", "enterprice"]
|
|
41
|
+
};
|
|
42
|
+
_readConfigFile.generateConfigFromFile.mockReturnValue(mockConfig);
|
|
43
|
+
_readConfigFile.isUserConfigFileAvailable.mockReturnValue(true);
|
|
44
|
+
const mockTagArgs = ['@beta_admin'];
|
|
45
|
+
tagProcessorInstance.processTags.mockReturnValue(mockTagArgs);
|
|
46
|
+
_testRunner.runPreprocessing.mockResolvedValueOnce();
|
|
47
|
+
await (0, _validateFeature.default)();
|
|
48
|
+
expect(_parseUserArgs.default).toHaveBeenCalled();
|
|
49
|
+
expect(_readConfigFile.generateConfigFromFile).toHaveBeenCalled();
|
|
50
|
+
expect(_readConfigFile.isUserConfigFileAvailable).toHaveBeenCalled();
|
|
51
|
+
expect(tagProcessorInstance.processTags).toHaveBeenCalledWith(mockUserArgs);
|
|
52
|
+
expect(_testRunner.runPreprocessing).toHaveBeenCalledWith(mockTagArgs, expect.stringContaining('config-creator.js'));
|
|
53
|
+
expect(_logger.Logger.log).toHaveBeenCalledWith(_logger.Logger.SUCCESS_TYPE, 'Feature files validated successfully.');
|
|
54
|
+
});
|
|
55
|
+
test('runPreprocessing with playwright conf', async () => {
|
|
56
|
+
const mockTagArgs = ['@beta_admin'];
|
|
57
|
+
tagProcessorInstance.processTags.mockReturnValue(mockTagArgs);
|
|
58
|
+
_readConfigFile.isUserConfigFileAvailable.mockReturnValue(false);
|
|
59
|
+
_testRunner.runPreprocessing.mockResolvedValueOnce();
|
|
60
|
+
await (0, _validateFeature.default)();
|
|
61
|
+
expect(_testRunner.runPreprocessing).toHaveBeenCalledWith(mockTagArgs, expect.stringContaining('playwright.config.js'));
|
|
62
|
+
});
|
|
63
|
+
test('error when runPreprocessing fails', async () => {
|
|
64
|
+
const mockError = new Error('Test error');
|
|
65
|
+
_testRunner.runPreprocessing.mockRejectedValueOnce(mockError);
|
|
66
|
+
await await (0, _validateFeature.default)();
|
|
67
|
+
expect(_logger.Logger.log).toHaveBeenCalledWith(_logger.Logger.FAILURE_TYPE, `Error while validating the feature files - ${mockError}`);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _customFixturesHelper = require("../../../../../core/playwright/helpers/customFixturesHelper");
|
|
5
|
+
var _executionContext = _interopRequireDefault(require("../../../../../core/playwright/builtInFixtures/executionContext"));
|
|
6
|
+
jest.mock('../../../../../core/playwright/helpers/customFixturesHelper');
|
|
7
|
+
describe('executionContext', () => {
|
|
8
|
+
test('should pass actorInfo with details from getCustomAccountDetails to use', async () => {
|
|
9
|
+
const mockTags = ['tag1', 'tag2'];
|
|
10
|
+
const mockMainActorInfo = {
|
|
11
|
+
id: '1',
|
|
12
|
+
edition: 'enterprise',
|
|
13
|
+
orgName: 'orgName',
|
|
14
|
+
profile: 'admin',
|
|
15
|
+
email: 'xxx.x+uat@zohotest.com'
|
|
16
|
+
};
|
|
17
|
+
_customFixturesHelper.getCustomAccountDetails.mockReturnValue(mockMainActorInfo);
|
|
18
|
+
const use = jest.fn();
|
|
19
|
+
await _executionContext.default.executionContext({
|
|
20
|
+
$tags: mockTags
|
|
21
|
+
}, use);
|
|
22
|
+
expect(_customFixturesHelper.getCustomAccountDetails).toHaveBeenCalledWith(mockTags);
|
|
23
|
+
expect(use).toHaveBeenCalledWith({
|
|
24
|
+
actorInfo: mockMainActorInfo
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const Configuration = require("../../../../../core/playwright/configuration/Configuration");
|
|
4
|
+
const {
|
|
5
|
+
combineConfiguration
|
|
6
|
+
} = require("../../../../../core/playwright/configuration/ConfigurationHelper");
|
|
7
|
+
jest.mock('../../../../../core/playwright/configuration/ConfigurationHelper', () => ({
|
|
8
|
+
combineConfiguration: jest.fn()
|
|
9
|
+
}));
|
|
10
|
+
describe('Configuration Class', () => {
|
|
11
|
+
let config;
|
|
12
|
+
let sampleData;
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
// Sample data as a JSON object
|
|
15
|
+
sampleData = {
|
|
16
|
+
headless: false,
|
|
17
|
+
trace: true,
|
|
18
|
+
video: true,
|
|
19
|
+
bddMode: true
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// Initialize the Configuration instance with sample data
|
|
23
|
+
config = new Configuration(sampleData);
|
|
24
|
+
});
|
|
25
|
+
test('should add new key-value pair to the configuration', () => {
|
|
26
|
+
config.add('newKey', 'newValue');
|
|
27
|
+
expect(config.get('newKey')).toBe('newValue');
|
|
28
|
+
});
|
|
29
|
+
test('should combine configurations correctly using addAll', () => {
|
|
30
|
+
const newConfig = new Configuration({
|
|
31
|
+
newKey1: 'newValue1',
|
|
32
|
+
trace: false // existing key to test override
|
|
33
|
+
});
|
|
34
|
+
const combinedConfig = {
|
|
35
|
+
headless: false,
|
|
36
|
+
trace: false,
|
|
37
|
+
// trace overridden
|
|
38
|
+
video: true,
|
|
39
|
+
bddMode: true,
|
|
40
|
+
newKey1: 'newValue1'
|
|
41
|
+
};
|
|
42
|
+
combineConfiguration.mockReturnValue(combinedConfig);
|
|
43
|
+
config.addAll(newConfig);
|
|
44
|
+
expect(combineConfiguration).toHaveBeenCalledWith(sampleData, newConfig.getAll());
|
|
45
|
+
expect(config.getAll()).toEqual(combinedConfig);
|
|
46
|
+
});
|
|
47
|
+
test('should return correct value for a given key', () => {
|
|
48
|
+
expect(config.get('headless')).toBe(false);
|
|
49
|
+
expect(config.get('trace')).toBe(true);
|
|
50
|
+
expect(config.get('video')).toBe(true);
|
|
51
|
+
expect(config.get('bddMode')).toBe(true);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _additionalProfiles = require("../../../../../core/playwright/helpers/additionalProfiles");
|
|
4
|
+
jest.mock('../../../../../core/playwright/helpers/auth/getUsers', () => ({
|
|
5
|
+
getUserForSelectedEditionAndProfile: jest.fn((edition, profile, betaFeature, portalInfo) => {
|
|
6
|
+
return {
|
|
7
|
+
email: 'manager.m@zohotest.com',
|
|
8
|
+
id: '1',
|
|
9
|
+
edition: edition || 'enterprise',
|
|
10
|
+
orgName: 'orgName',
|
|
11
|
+
profile: profile || 'admin',
|
|
12
|
+
betaFeature: betaFeature || null,
|
|
13
|
+
portalInfo: portalInfo || null
|
|
14
|
+
};
|
|
15
|
+
})
|
|
16
|
+
}));
|
|
17
|
+
const defaultTags = ['@profile_admin', '@edition_enterprise'];
|
|
18
|
+
const editionTags = ['@profile_admin', '@edition_enterprise', '@additional_profile_manager', '@additional_profile_agent'];
|
|
19
|
+
const editionAndPortalTags = ['@profile_admin', '@edition_enterprise', '@beta_parentchild', '@portal_clientuat2', '@additional_profile_manager'];
|
|
20
|
+
describe('additionalProfiles', () => {
|
|
21
|
+
beforeEach(() => {
|
|
22
|
+
jest.clearAllMocks();
|
|
23
|
+
});
|
|
24
|
+
test('should return empty object when no additional profile tags are present', () => {
|
|
25
|
+
const result = (0, _additionalProfiles.additionProfiles)(defaultTags);
|
|
26
|
+
expect(result).toEqual({});
|
|
27
|
+
});
|
|
28
|
+
test('should return additional profile actors when additional profile tags and editionInfo are present', () => {
|
|
29
|
+
const result = (0, _additionalProfiles.additionProfiles)(editionTags);
|
|
30
|
+
expect(Object.keys(result)).toEqual(['manager', 'agent']);
|
|
31
|
+
expect(result.manager).toHaveProperty('email');
|
|
32
|
+
expect(result.agent).toHaveProperty('email');
|
|
33
|
+
expect(result.manager.profile).toBe('manager');
|
|
34
|
+
expect(result.manager.betaFeature).toBe(null);
|
|
35
|
+
expect(result.agent.portalInfo).toBe(null);
|
|
36
|
+
});
|
|
37
|
+
test('should return additional profile actors when all actor details are present', () => {
|
|
38
|
+
const result = (0, _additionalProfiles.additionProfiles)(editionAndPortalTags);
|
|
39
|
+
expect(Object.keys(result)).toEqual(['manager']);
|
|
40
|
+
expect(result.manager).toHaveProperty('email');
|
|
41
|
+
expect(result.manager.profile).toBe('manager');
|
|
42
|
+
expect(result.manager.betaFeature).toBe("parentchild");
|
|
43
|
+
expect(result.manager.portalInfo).toBe("clientuat2");
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _fs = require("fs");
|
|
5
|
+
var _path = _interopRequireDefault(require("path"));
|
|
6
|
+
var _configFileNameProvider = require("../../../../../core/playwright/helpers/configFileNameProvider");
|
|
7
|
+
jest.mock('fs');
|
|
8
|
+
jest.mock('path');
|
|
9
|
+
const mockCwd = '/mock/current/directory';
|
|
10
|
+
_path.default.resolve = jest.fn();
|
|
11
|
+
process.cwd = jest.fn(() => mockCwd);
|
|
12
|
+
describe('getUATFileName', () => {
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
jest.clearAllMocks();
|
|
15
|
+
});
|
|
16
|
+
test('return the pipeline matched config files for pipeline matched files exists', () => {
|
|
17
|
+
const mode = 'cd';
|
|
18
|
+
const mockPath = `${mockCwd}/uat/conf/${mode}/uat.config.js`;
|
|
19
|
+
_fs.existsSync.mockReturnValue(true);
|
|
20
|
+
_path.default.resolve.mockImplementation((...args) => args.join('/'));
|
|
21
|
+
const result = (0, _configFileNameProvider.getUATFileName)(mode);
|
|
22
|
+
expect(_fs.existsSync).toHaveBeenCalledWith(mockPath);
|
|
23
|
+
expect(result).toBe(mockPath);
|
|
24
|
+
});
|
|
25
|
+
test('return the default config files for pipeline matched files not exists', () => {
|
|
26
|
+
const mode = 'ci';
|
|
27
|
+
const defaultPath = `${mockCwd}/uat/conf/default/uat.config.js`;
|
|
28
|
+
_fs.existsSync.mockReturnValue(false);
|
|
29
|
+
_path.default.resolve.mockImplementation((...args) => args.join('/'));
|
|
30
|
+
const result = (0, _configFileNameProvider.getUATFileName)(mode);
|
|
31
|
+
expect(_fs.existsSync).toHaveBeenCalledWith(`${mockCwd}/uat/conf/${mode}/uat.config.js`);
|
|
32
|
+
expect(result).toBe(defaultPath);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _customFixturesHelper = require("../../../../../core/playwright/helpers/customFixturesHelper");
|
|
4
|
+
var _logger = require("../../../../../utils/logger");
|
|
5
|
+
var _getUsers = require("../../../../../core/playwright/helpers/auth/getUsers");
|
|
6
|
+
jest.mock('../../../../../core/playwright/helpers/auth/getUsers', () => ({
|
|
7
|
+
getUserForSelectedEditionAndProfile: jest.fn((edition, profile, betaFeature, portalInfo) => ({
|
|
8
|
+
email: 'manager.m@zohotest.com',
|
|
9
|
+
id: '1',
|
|
10
|
+
edition: edition || 'enterprise',
|
|
11
|
+
orgName: 'orgName',
|
|
12
|
+
profile: profile || 'admin',
|
|
13
|
+
betaFeature: betaFeature || null,
|
|
14
|
+
portalInfo: portalInfo || null
|
|
15
|
+
})),
|
|
16
|
+
getDefaultActor: jest.fn(() => ({
|
|
17
|
+
edition: 'enterprise',
|
|
18
|
+
profile: 'admin'
|
|
19
|
+
}))
|
|
20
|
+
}));
|
|
21
|
+
jest.mock('../../../../../utils/logger', () => ({
|
|
22
|
+
Logger: {
|
|
23
|
+
log: jest.fn(),
|
|
24
|
+
FAILURE_TYPE: 'FAILURE'
|
|
25
|
+
}
|
|
26
|
+
}));
|
|
27
|
+
const mockTags = ['@profile_admin', '@edition_enterprise', '@beta_feature', '@portal_clientuat'];
|
|
28
|
+
describe('getCustomAccountDetails', () => {
|
|
29
|
+
beforeEach(() => {
|
|
30
|
+
jest.clearAllMocks();
|
|
31
|
+
});
|
|
32
|
+
test('returns selected user when any tag info is present', () => {
|
|
33
|
+
const result = (0, _customFixturesHelper.getCustomAccountDetails)(mockTags);
|
|
34
|
+
expect(_getUsers.getUserForSelectedEditionAndProfile).toHaveBeenCalledWith('enterprise', 'admin', 'feature', 'clientuat');
|
|
35
|
+
expect(result).toHaveProperty('email', 'manager.m@zohotest.com');
|
|
36
|
+
});
|
|
37
|
+
test('logs and returns undefined if getCustomAccountDetails function throws', () => {
|
|
38
|
+
const error = new Error('failed to get user');
|
|
39
|
+
_getUsers.getUserForSelectedEditionAndProfile.mockImplementation(() => {
|
|
40
|
+
throw error;
|
|
41
|
+
});
|
|
42
|
+
const result = (0, _customFixturesHelper.getCustomAccountDetails)(mockTags);
|
|
43
|
+
expect(_logger.Logger.log).toHaveBeenCalledWith(_logger.Logger.FAILURE_TYPE, 'Error while getting accounts details:', error);
|
|
44
|
+
expect(result).toBeUndefined();
|
|
45
|
+
});
|
|
46
|
+
test('returns default actor when no tag info is not provided', () => {
|
|
47
|
+
const result = (0, _customFixturesHelper.getCustomAccountDetails)([]);
|
|
48
|
+
expect(_getUsers.getDefaultActor).toHaveBeenCalledTimes(1);
|
|
49
|
+
expect(result).toEqual((0, _getUsers.getDefaultActor)());
|
|
50
|
+
});
|
|
51
|
+
});
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _fileMutex = _interopRequireDefault(require("../../../../../core/playwright/helpers/fileMutex"));
|
|
5
|
+
var _path = _interopRequireDefault(require("path"));
|
|
6
|
+
var _fs = require("fs");
|
|
7
|
+
jest.mock('fs');
|
|
8
|
+
describe('FileMutex', () => {
|
|
9
|
+
const directory = '/tmp/locks';
|
|
10
|
+
const lockFileName = 'test-lock';
|
|
11
|
+
const fileDeletionTimeoutConfig = {
|
|
12
|
+
timeout: 1000
|
|
13
|
+
};
|
|
14
|
+
const lockFilePath = _path.default.resolve(directory, lockFileName + '.lock');
|
|
15
|
+
let fileMutex;
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
jest.clearAllMocks();
|
|
18
|
+
fileMutex = new _fileMutex.default(directory, lockFileName, fileDeletionTimeoutConfig);
|
|
19
|
+
});
|
|
20
|
+
describe('acquire', () => {
|
|
21
|
+
it('should create the lock file if it does not exist', async () => {
|
|
22
|
+
_fs.writeFileSync.mockImplementation(() => {});
|
|
23
|
+
await fileMutex.acquire();
|
|
24
|
+
expect(_fs.writeFileSync).toHaveBeenCalledWith(fileMutex.lockFilePath, 'locked');
|
|
25
|
+
});
|
|
26
|
+
it('should wait for lock file deletion if it exists', async () => {
|
|
27
|
+
_fs.existsSync.mockImplementation(filePath => filePath === fileMutex.lockFilePath);
|
|
28
|
+
_fs.watch.mockImplementation((dir, callback) => {
|
|
29
|
+
setTimeout(() => {
|
|
30
|
+
_fs.existsSync.mockImplementation(() => false);
|
|
31
|
+
callback('rename', fileMutex.lockFileName);
|
|
32
|
+
}, fileDeletionTimeoutConfig);
|
|
33
|
+
return {
|
|
34
|
+
close: jest.fn()
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
await fileMutex.acquire();
|
|
38
|
+
expect(_fs.watch).toHaveBeenCalledWith(directory, expect.any(Function));
|
|
39
|
+
});
|
|
40
|
+
it('should reject if watch timeout exceeds', async () => {
|
|
41
|
+
_fs.existsSync.mockImplementation(filePath => filePath === lockFilePath);
|
|
42
|
+
_fs.watch.mockImplementation(() => {
|
|
43
|
+
return {
|
|
44
|
+
close: jest.fn()
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
await expect(fileMutex.acquire()).rejects.toThrow('Watch timeout exceeded');
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
describe('release', () => {
|
|
51
|
+
it('should delete the lock file if it exists', async () => {
|
|
52
|
+
_fs.existsSync.mockReturnValue(true);
|
|
53
|
+
_fs.unlinkSync.mockImplementation(() => {});
|
|
54
|
+
await fileMutex.release();
|
|
55
|
+
expect(_fs.existsSync).toHaveBeenCalledWith(lockFilePath);
|
|
56
|
+
expect(_fs.unlinkSync).toHaveBeenCalledWith(lockFilePath);
|
|
57
|
+
});
|
|
58
|
+
it('should release lock by deleting lock file', async () => {
|
|
59
|
+
_fs.existsSync.mockReturnValue(true);
|
|
60
|
+
_fs.unlinkSync.mockImplementation(() => {});
|
|
61
|
+
await fileMutex.release();
|
|
62
|
+
expect(_fs.unlinkSync).toHaveBeenCalledWith(lockFilePath);
|
|
63
|
+
});
|
|
64
|
+
it('should not attempt to delete the lock file if it does not exist', async () => {
|
|
65
|
+
_fs.existsSync.mockReturnValue(false);
|
|
66
|
+
await fileMutex.release();
|
|
67
|
+
expect(_fs.existsSync).toHaveBeenCalledWith(lockFilePath);
|
|
68
|
+
expect(_fs.unlinkSync).not.toHaveBeenCalled();
|
|
69
|
+
});
|
|
70
|
+
it('should log an error if deleting the lock file fails', async () => {
|
|
71
|
+
const errorMessage = 'Error deleting lock file';
|
|
72
|
+
_fs.existsSync.mockReturnValue(true);
|
|
73
|
+
_fs.unlinkSync.mockImplementation(() => {
|
|
74
|
+
throw new Error(errorMessage);
|
|
75
|
+
});
|
|
76
|
+
await expect(fileMutex.release()).rejects.toThrow(errorMessage);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
});
|
|
@@ -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
|
+
});
|
|
@@ -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);
|
|
@@ -32,6 +36,9 @@ function cliArgsToObject(cliArgs, isKeyNeedToBeAdded) {
|
|
|
32
36
|
value = true;
|
|
33
37
|
}
|
|
34
38
|
processEnv[key] = value;
|
|
39
|
+
if (!isNaN(parseInt(value))) {
|
|
40
|
+
processEnv[key] = parseInt(value);
|
|
41
|
+
}
|
|
35
42
|
}
|
|
36
43
|
});
|
|
37
44
|
return processEnv;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.copyCommonSpecs = copyCommonSpecs;
|
|
8
|
+
var _fileUtils = require("./fileUtils");
|
|
9
|
+
var _path = _interopRequireDefault(require("path"));
|
|
10
|
+
function copyCommonSpecs() {
|
|
11
|
+
const libraryPath = require.resolve("@zohodesk/testinglibrary");
|
|
12
|
+
// libraryPath will be build/index.js to go to the common specs we need to go one level up
|
|
13
|
+
const commonSpecPath = _path.default.resolve(libraryPath, '../', 'common');
|
|
14
|
+
const destDirectory = _path.default.resolve(process.cwd(), 'uat', 'modules', '.testingLib-common');
|
|
15
|
+
(0, _fileUtils.deleteFolder)(destDirectory);
|
|
16
|
+
(0, _fileUtils.copyDirectory)(commonSpecPath, destDirectory);
|
|
17
|
+
}
|