@zohodesk/testinglibrary 0.4.57-n14-experimental → 0.4.57-n18-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/.gitlab-ci.yml +2 -2
- package/README.md +54 -1
- package/build/core/playwright/clear-caches.js +7 -0
- package/build/core/playwright/fixtures.js +24 -0
- package/build/core/playwright/helpers/auth/loginSteps.js +4 -1
- package/build/core/playwright/helpers/configFileNameProvider.js +1 -1
- package/build/core/playwright/helpers/fileMutex.js +0 -1
- package/build/core/playwright/index.js +10 -23
- package/build/core/playwright/runner/SpawnRunner.js +2 -2
- package/build/core/playwright/setup/config-creator.js +15 -8
- package/build/core/playwright/setup/config-utils.js +8 -25
- package/build/core/playwright/tagProcessor.js +5 -7
- package/build/core/playwright/test-runner.js +2 -2
- package/build/decorators.d.ts +1 -1
- package/build/decorators.js +1 -1
- package/build/index.js +6 -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 -68
- 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/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 +3 -1
- package/build/setup-folder-structure/setupProject.js +22 -5
- package/build/test/core/playwright/__tests__/tagProcessor.test.js +18 -19
- package/build/test/core/playwright/buildInFixtures/__tests__/executionContext.test.js +27 -0
- package/build/test/core/playwright/helpers/__tests__/configFileNameProvider.test.js +1 -1
- package/build/test/core/playwright/helpers/__tests__/fileMutex.test.js +19 -2
- package/npm-shrinkwrap.json +6522 -2258
- package/package.json +10 -9
- package/playwright.config.js +0 -48
- package/build/bdd-framework/cli/commands/env.js +0 -42
- package/build/bdd-framework/cli/commands/export.js +0 -62
- package/build/bdd-framework/cli/commands/test.js +0 -64
- package/build/bdd-framework/cli/index.js +0 -11
- package/build/bdd-framework/cli/options.js +0 -19
- package/build/bdd-framework/cli/worker.js +0 -13
- package/build/bdd-framework/config/configDir.js +0 -35
- package/build/bdd-framework/config/enrichReporterData.js +0 -23
- package/build/bdd-framework/config/env.js +0 -50
- package/build/bdd-framework/config/index.js +0 -94
- package/build/bdd-framework/config/lang.js +0 -14
- package/build/bdd-framework/cucumber/buildStepDefinition.js +0 -43
- package/build/bdd-framework/cucumber/createTestStep.js +0 -43
- package/build/bdd-framework/cucumber/formatter/EventDataCollector.js +0 -126
- package/build/bdd-framework/cucumber/formatter/GherkinDocumentParser.js +0 -72
- package/build/bdd-framework/cucumber/formatter/PickleParser.js +0 -25
- package/build/bdd-framework/cucumber/formatter/durationHelpers.js +0 -13
- package/build/bdd-framework/cucumber/formatter/getColorFns.js +0 -57
- package/build/bdd-framework/cucumber/formatter/index.js +0 -16
- package/build/bdd-framework/cucumber/formatter/locationHelpers.js +0 -16
- package/build/bdd-framework/cucumber/loadConfig.js +0 -17
- package/build/bdd-framework/cucumber/loadFeatures.js +0 -70
- package/build/bdd-framework/cucumber/loadSnippetBuilder.js +0 -20
- package/build/bdd-framework/cucumber/loadSteps.js +0 -47
- package/build/bdd-framework/cucumber/resolveFeaturePaths.js +0 -62
- package/build/bdd-framework/cucumber/stepArguments.js +0 -21
- package/build/bdd-framework/cucumber/types.js +0 -5
- package/build/bdd-framework/cucumber/valueChecker.js +0 -23
- package/build/bdd-framework/decorators.js +0 -18
- package/build/bdd-framework/gen/fixtures.js +0 -48
- package/build/bdd-framework/gen/formatter.js +0 -167
- package/build/bdd-framework/gen/i18n.js +0 -39
- package/build/bdd-framework/gen/index.js +0 -197
- package/build/bdd-framework/gen/specialTags.js +0 -70
- package/build/bdd-framework/gen/testFile.js +0 -470
- package/build/bdd-framework/gen/testMeta.js +0 -60
- package/build/bdd-framework/gen/testNode.js +0 -35
- package/build/bdd-framework/gen/testPoms.js +0 -133
- package/build/bdd-framework/hooks/scenario.js +0 -130
- package/build/bdd-framework/hooks/worker.js +0 -89
- package/build/bdd-framework/index.js +0 -52
- package/build/bdd-framework/playwright/fixtureParameterNames.js +0 -93
- package/build/bdd-framework/playwright/getLocationInFile.js +0 -79
- package/build/bdd-framework/playwright/loadConfig.js +0 -42
- package/build/bdd-framework/playwright/loadUtils.js +0 -33
- package/build/bdd-framework/playwright/testTypeImpl.js +0 -79
- package/build/bdd-framework/playwright/transform.js +0 -88
- package/build/bdd-framework/playwright/types.js +0 -12
- package/build/bdd-framework/playwright/utils.js +0 -56
- package/build/bdd-framework/reporter/cucumber/base.js +0 -52
- package/build/bdd-framework/reporter/cucumber/custom.js +0 -73
- package/build/bdd-framework/reporter/cucumber/helper.js +0 -12
- package/build/bdd-framework/reporter/cucumber/html.js +0 -40
- package/build/bdd-framework/reporter/cucumber/index.js +0 -74
- package/build/bdd-framework/reporter/cucumber/json.js +0 -312
- package/build/bdd-framework/reporter/cucumber/junit.js +0 -205
- package/build/bdd-framework/reporter/cucumber/message.js +0 -20
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/AttachmentMapper.js +0 -82
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/Builder.js +0 -197
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/GherkinDocument.js +0 -43
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/GherkinDocumentClone.js +0 -52
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/GherkinDocuments.js +0 -105
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/Hook.js +0 -70
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/Meta.js +0 -45
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/Pickles.js +0 -27
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/Projects.js +0 -38
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestCase.js +0 -128
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestCaseRun.js +0 -154
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestCaseRunHooks.js +0 -123
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestStepAttachments.js +0 -67
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestStepRun.js +0 -114
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/index.js +0 -30
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/pwStepUtils.js +0 -70
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/timing.js +0 -35
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/types.js +0 -5
- package/build/bdd-framework/run/StepInvoker.js +0 -69
- package/build/bdd-framework/run/bddData/index.js +0 -59
- package/build/bdd-framework/run/bddData/types.js +0 -5
- package/build/bdd-framework/run/bddFixtures.js +0 -192
- package/build/bdd-framework/run/bddWorld.js +0 -79
- package/build/bdd-framework/run/bddWorldInternal.js +0 -11
- package/build/bdd-framework/snippets/index.js +0 -132
- package/build/bdd-framework/snippets/snippetSyntax.js +0 -43
- 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 -66
- package/build/bdd-framework/stepDefinitions/decorators/class.js +0 -68
- package/build/bdd-framework/stepDefinitions/decorators/steps.js +0 -99
- package/build/bdd-framework/stepDefinitions/defineStep.js +0 -62
- package/build/bdd-framework/stepDefinitions/stepConfig.js +0 -24
- package/build/bdd-framework/steps/createBdd.js +0 -78
- package/build/bdd-framework/steps/decorators/class.js +0 -68
- package/build/bdd-framework/steps/decorators/steps.js +0 -98
- package/build/bdd-framework/steps/defineStep.js +0 -62
- package/build/bdd-framework/steps/stepConfig.js +0 -24
- package/build/bdd-framework/utils/AutofillMap.js +0 -20
- package/build/bdd-framework/utils/exit.js +0 -62
- package/build/bdd-framework/utils/index.js +0 -93
- package/build/bdd-framework/utils/jsStringWrap.js +0 -44
- package/build/bdd-framework/utils/logger.js +0 -30
- package/build/bdd-framework/utils/stripAnsiEscapes.js +0 -20
- package/build/setup-folder-structure/samples/authUsers-sample.json +0 -9
- package/build/setup-folder-structure/samples/env-config-sample.json +0 -21
- package/unit_reports/unit-report.html +0 -260
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
var _tagProcessor = _interopRequireDefault(require("../../../../../src/core/playwright/tagProcessor"));
|
|
5
|
-
var _Configuration = _interopRequireDefault(require("../../../../../src/core/playwright/configuration/Configuration.js"));
|
|
6
5
|
var _logger = require("../../../../utils/logger");
|
|
7
6
|
jest.mock('../../../../utils/logger');
|
|
8
7
|
describe('TagProcessor', () => {
|
|
@@ -12,83 +11,83 @@ describe('TagProcessor', () => {
|
|
|
12
11
|
});
|
|
13
12
|
test('should return tagArgs if no edition is provided', () => {
|
|
14
13
|
const tagProcessor = new _tagProcessor.default(editionOrder);
|
|
15
|
-
const userArgs =
|
|
14
|
+
const userArgs = {
|
|
16
15
|
tags: 'tag1',
|
|
17
16
|
edition: null
|
|
18
|
-
}
|
|
17
|
+
};
|
|
19
18
|
const result = tagProcessor.processTags(userArgs);
|
|
20
19
|
expect(result).toBe('tag1');
|
|
21
20
|
});
|
|
22
21
|
test('should handle a single edition with <= operator', () => {
|
|
23
22
|
const tagProcessor = new _tagProcessor.default(editionOrder);
|
|
24
|
-
const userArgs =
|
|
23
|
+
const userArgs = {
|
|
25
24
|
tags: 'tag1',
|
|
26
25
|
edition: '<=edition2'
|
|
27
|
-
}
|
|
26
|
+
};
|
|
28
27
|
const result = tagProcessor.processTags(userArgs);
|
|
29
28
|
expect(result).toBe('tag1 and not (@edition_edition3 or @edition_edition4)');
|
|
30
29
|
});
|
|
31
30
|
test('should handle a single edition with >= operator', () => {
|
|
32
31
|
const tagProcessor = new _tagProcessor.default(editionOrder);
|
|
33
|
-
const userArgs =
|
|
32
|
+
const userArgs = {
|
|
34
33
|
tags: 'tag1',
|
|
35
34
|
edition: '>=edition2'
|
|
36
|
-
}
|
|
35
|
+
};
|
|
37
36
|
const result = tagProcessor.processTags(userArgs);
|
|
38
37
|
expect(result).toBe('tag1 and not (@edition_edition1)');
|
|
39
38
|
});
|
|
40
39
|
test('should handle a single edition with < operator', () => {
|
|
41
40
|
const tagProcessor = new _tagProcessor.default(editionOrder);
|
|
42
|
-
const userArgs =
|
|
41
|
+
const userArgs = {
|
|
43
42
|
tags: 'tag1',
|
|
44
43
|
edition: '<edition3'
|
|
45
|
-
}
|
|
44
|
+
};
|
|
46
45
|
const result = tagProcessor.processTags(userArgs);
|
|
47
46
|
expect(result).toBe('tag1 and not (@edition_edition3 or @edition_edition4)');
|
|
48
47
|
});
|
|
49
48
|
test('should handle a single edition with > operator', () => {
|
|
50
49
|
const tagProcessor = new _tagProcessor.default(editionOrder);
|
|
51
|
-
const userArgs =
|
|
50
|
+
const userArgs = {
|
|
52
51
|
tags: 'tag1',
|
|
53
52
|
edition: '>edition1'
|
|
54
|
-
}
|
|
53
|
+
};
|
|
55
54
|
const result = tagProcessor.processTags(userArgs);
|
|
56
55
|
expect(result).toBe('tag1 and not (@edition_edition1)');
|
|
57
56
|
});
|
|
58
57
|
test('should handle a single edition with no operator', () => {
|
|
59
58
|
const tagProcessor = new _tagProcessor.default(editionOrder);
|
|
60
|
-
const userArgs =
|
|
59
|
+
const userArgs = {
|
|
61
60
|
tags: 'tag1',
|
|
62
61
|
edition: 'edition2'
|
|
63
|
-
}
|
|
62
|
+
};
|
|
64
63
|
const result = tagProcessor.processTags(userArgs);
|
|
65
64
|
expect(result).toBe('tag1 and not (@edition_edition1 or @edition_edition3 or @edition_edition4)');
|
|
66
65
|
});
|
|
67
66
|
test('should log a message if edition is not found', () => {
|
|
68
67
|
const tagProcessor = new _tagProcessor.default(editionOrder);
|
|
69
|
-
const userArgs =
|
|
68
|
+
const userArgs = {
|
|
70
69
|
tags: 'tag1',
|
|
71
70
|
edition: 'nonexistentEdition'
|
|
72
|
-
}
|
|
71
|
+
};
|
|
73
72
|
const result = tagProcessor.processTags(userArgs);
|
|
74
73
|
expect(result).toBe('tag1');
|
|
75
74
|
expect(_logger.Logger.log).toHaveBeenCalledWith(_logger.Logger.INFO_TYPE, expect.stringContaining('No matching editions for nonexistentEdition found.'));
|
|
76
75
|
});
|
|
77
76
|
test('should handle multiple editions', () => {
|
|
78
77
|
const tagProcessor = new _tagProcessor.default(editionOrder);
|
|
79
|
-
const userArgs =
|
|
78
|
+
const userArgs = {
|
|
80
79
|
tags: 'tag1',
|
|
81
80
|
edition: 'edition1,edition3'
|
|
82
|
-
}
|
|
81
|
+
};
|
|
83
82
|
const result = tagProcessor.processTags(userArgs);
|
|
84
83
|
expect(result).toBe('tag1 and not (@edition_edition2 or @edition_edition4)');
|
|
85
84
|
});
|
|
86
85
|
test('should build tags correctly when tags are empty', () => {
|
|
87
86
|
const tagProcessor = new _tagProcessor.default(editionOrder);
|
|
88
|
-
const userArgs =
|
|
87
|
+
const userArgs = {
|
|
89
88
|
tags: '',
|
|
90
89
|
edition: 'edition1'
|
|
91
|
-
}
|
|
90
|
+
};
|
|
92
91
|
const result = tagProcessor.processTags(userArgs);
|
|
93
92
|
expect(result).toBe('not (@edition_edition2 or @edition_edition3 or @edition_edition4)');
|
|
94
93
|
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _page = require("../../../../../core/playwright/builtInFixtures/page");
|
|
5
|
+
var _executionContext = _interopRequireDefault(require("../../../../../core/playwright/builtInFixtures/executionContext"));
|
|
6
|
+
jest.mock('../../../../../core/playwright/builtInFixtures/page');
|
|
7
|
+
describe('executionContext', () => {
|
|
8
|
+
test('should pass actorInfo with details from getCustomAccountDetails to use', async () => {
|
|
9
|
+
const mockTags = ['tag1', 'tag2'];
|
|
10
|
+
const mockActorInfo = {
|
|
11
|
+
id: '1',
|
|
12
|
+
edition: 'enterprise',
|
|
13
|
+
orgName: 'orgName',
|
|
14
|
+
profile: 'admin',
|
|
15
|
+
email: 'xxx.x+uat@zohotest.com'
|
|
16
|
+
};
|
|
17
|
+
_page.getCustomAccountDetails.mockReturnValue(mockActorInfo);
|
|
18
|
+
const use = jest.fn();
|
|
19
|
+
await _executionContext.default.executionContext({
|
|
20
|
+
$tags: mockTags
|
|
21
|
+
}, use);
|
|
22
|
+
expect(_page.getCustomAccountDetails).toHaveBeenCalledWith(mockTags);
|
|
23
|
+
expect(use).toHaveBeenCalledWith({
|
|
24
|
+
actorInfo: mockActorInfo
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -24,7 +24,7 @@ describe('getUATFileName', () => {
|
|
|
24
24
|
});
|
|
25
25
|
test('return the default config files for pipeline matched files not exists', () => {
|
|
26
26
|
const mode = 'ci';
|
|
27
|
-
const defaultPath = `${mockCwd}/uat.config.js`;
|
|
27
|
+
const defaultPath = `${mockCwd}/uat/conf/default/uat.config.js`;
|
|
28
28
|
_fs.existsSync.mockReturnValue(false);
|
|
29
29
|
_path.default.resolve.mockImplementation((...args) => args.join('/'));
|
|
30
30
|
const result = (0, _configFileNameProvider.getUATFileName)(mode);
|
|
@@ -8,6 +8,8 @@ jest.mock('fs');
|
|
|
8
8
|
describe('FileMutex', () => {
|
|
9
9
|
const directory = '/tmp/locks';
|
|
10
10
|
const lockFileName = 'test-lock';
|
|
11
|
+
const email = 'test@example.com';
|
|
12
|
+
const authFile = '/tmp/authFile';
|
|
11
13
|
const fileDeletionTimeoutConfig = {
|
|
12
14
|
timeout: 1000
|
|
13
15
|
};
|
|
@@ -15,14 +17,27 @@ describe('FileMutex', () => {
|
|
|
15
17
|
let fileMutex;
|
|
16
18
|
beforeEach(() => {
|
|
17
19
|
jest.clearAllMocks();
|
|
18
|
-
fileMutex = new _fileMutex.default(directory, lockFileName, fileDeletionTimeoutConfig);
|
|
20
|
+
fileMutex = new _fileMutex.default(directory, lockFileName, email, authFile, fileDeletionTimeoutConfig);
|
|
19
21
|
});
|
|
20
22
|
describe('acquire', () => {
|
|
23
|
+
it('should create directory if it does not exist', async () => {
|
|
24
|
+
_fs.existsSync.mockReturnValue(false);
|
|
25
|
+
await fileMutex.createDirectoryIfNotExist();
|
|
26
|
+
expect(_fs.mkdirSync).toHaveBeenCalledWith(directory, {
|
|
27
|
+
recursive: true
|
|
28
|
+
});
|
|
29
|
+
});
|
|
21
30
|
it('should create the lock file if it does not exist', async () => {
|
|
31
|
+
_fs.existsSync.mockImplementation(filePath => filePath === authFile ? false : false);
|
|
22
32
|
_fs.writeFileSync.mockImplementation(() => {});
|
|
23
33
|
await fileMutex.acquire();
|
|
24
34
|
expect(_fs.writeFileSync).toHaveBeenCalledWith(fileMutex.lockFilePath, 'locked');
|
|
25
35
|
});
|
|
36
|
+
it('should resolve immediately if auth file exists', async () => {
|
|
37
|
+
_fs.existsSync.mockImplementation(filePath => filePath === authFile);
|
|
38
|
+
await fileMutex.acquire();
|
|
39
|
+
expect(_fs.existsSync).toHaveBeenCalledWith(authFile);
|
|
40
|
+
});
|
|
26
41
|
it('should wait for lock file deletion if it exists', async () => {
|
|
27
42
|
_fs.existsSync.mockImplementation(filePath => filePath === fileMutex.lockFilePath);
|
|
28
43
|
_fs.watch.mockImplementation((dir, callback) => {
|
|
@@ -73,7 +88,9 @@ describe('FileMutex', () => {
|
|
|
73
88
|
_fs.unlinkSync.mockImplementation(() => {
|
|
74
89
|
throw new Error(errorMessage);
|
|
75
90
|
});
|
|
76
|
-
|
|
91
|
+
console.error = jest.fn();
|
|
92
|
+
await fileMutex.release();
|
|
93
|
+
expect(console.error).toHaveBeenCalledWith(`Error deleting lock file: ${errorMessage}`);
|
|
77
94
|
});
|
|
78
95
|
});
|
|
79
96
|
});
|