@zohodesk/testinglibrary 0.3.1-experimental → 0.3.1
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 +111 -0
- package/README.md +41 -4
- package/build/core/playwright/builtInFixtures/page.js +1 -1
- 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/env-initializer.js +0 -1
- package/build/core/playwright/fixtures.js +24 -0
- package/build/core/playwright/helpers/auth/getUsers.js +34 -35
- package/build/core/playwright/helpers/configFileNameProvider.js +9 -3
- package/build/core/playwright/helpers/parseUserArgs.js +2 -3
- package/build/core/playwright/index.js +10 -23
- package/build/core/playwright/readConfigFile.js +23 -21
- package/build/core/playwright/setup/config-creator.js +8 -6
- package/build/core/playwright/setup/config-utils.js +8 -5
- package/build/core/playwright/setup/custom-reporter.js +39 -13
- package/build/core/playwright/tagProcessor.js +69 -0
- package/build/core/playwright/test-runner.js +28 -12
- package/build/core/playwright/validateFeature.js +28 -0
- package/build/decorators.d.ts +1 -1
- package/build/decorators.js +1 -1
- package/build/lib/cli.js +6 -0
- package/build/setup-folder-structure/samples/actors-index.js +3 -0
- package/build/setup-folder-structure/samples/auth-setup-sample.js +14 -66
- 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/setupProject.js +18 -5
- 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/configuration/__tests__/Configuration.test.js +53 -0
- package/build/test/core/playwright/helpers/__tests__/configFileNameProvider.test.js +34 -0
- package/build/test/core/playwright/helpers/__tests__/getUsers_ListOfActors.test.js +80 -0
- package/build/utils/cliArgsToObject.js +3 -0
- package/jest.config.js +19 -9
- package/nobdd/README.md +1 -0
- package/nobdd/package.json +17 -0
- package/nobdd/uat/conf/default/actors/beta/custom-module.json +24 -0
- package/nobdd/uat/conf/default/actors/beta/index.js +6 -0
- package/nobdd/uat/conf/default/actors/beta/parent-child.json +24 -0
- package/nobdd/uat/conf/default/actors/editions/enterprise.json +24 -0
- package/nobdd/uat/conf/default/actors/editions/index.js +4 -0
- package/nobdd/uat/conf/default/actors/index.js +5 -0
- package/nobdd/uat/conf/default/settings.json +6 -0
- package/nobdd/uat/conf/nobdd/uat.config.js +28 -0
- package/nobdd/uat/env-config.json +20 -0
- package/nobdd/uat/fixtures/auth.setup.js +44 -0
- package/nobdd/uat/fixtures/setup.teardown.js +32 -0
- package/nobdd/uat/modules/nobdd/steps/VerifyNoBDD.feature.spec.js +16 -0
- package/nobdd/uat/shared/commands/_index-custom-fixtures.js +9 -0
- package/nobdd/uat/shared/commands/i18n.js +25 -0
- package/nobdd/uat/shared/commands/unauthenticatedPage.js +8 -0
- package/nobdd/uat/shared/index.js +7 -0
- package/nobdd/uat/shared/onboardings/onboardingUpdate.js +44 -0
- package/nobdd/uat/shared/url-helpers/getUrlOrigin.js +6 -0
- package/nobdd/uat.config.js +30 -0
- package/npm-shrinkwrap.json +5795 -2145
- package/package.json +7 -6
- package/playwright.config.js +1 -1
- 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/core/playwright/tag-processor.js +0 -68
- 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,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,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.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,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
|
+
});
|
package/jest.config.js
CHANGED
|
@@ -5,6 +5,16 @@ const appPath = process.cwd();
|
|
|
5
5
|
const appGlobals = path.resolve(appPath, '__testUtils__', 'globals.js');
|
|
6
6
|
|
|
7
7
|
module.exports = {
|
|
8
|
+
reporters: [
|
|
9
|
+
"default",
|
|
10
|
+
[
|
|
11
|
+
"jest-html-reporter",
|
|
12
|
+
{
|
|
13
|
+
outputPath: "unit_reports/unit-report.html",
|
|
14
|
+
pageTitle: "Unit Report"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
],
|
|
8
18
|
rootDir: process.cwd(),
|
|
9
19
|
testEnvironment: 'node',
|
|
10
20
|
|
|
@@ -22,7 +32,7 @@ module.exports = {
|
|
|
22
32
|
'preprocessor',
|
|
23
33
|
'jsPreprocessor.js'
|
|
24
34
|
),
|
|
25
|
-
'^.+\\.jsx?$': 'babel-jest'
|
|
35
|
+
'^.+\\.jsx?$': 'babel-jest'
|
|
26
36
|
},
|
|
27
37
|
|
|
28
38
|
testMatch: ['**/__tests__/**/*.test.js'],
|
|
@@ -56,14 +66,14 @@ module.exports = {
|
|
|
56
66
|
collectCoverageFrom: ['src/**/*.js'],
|
|
57
67
|
coverageDirectory: './build/cov',
|
|
58
68
|
coverageReporters: ['lcov', 'json', 'html', 'json-summary', 'text'],
|
|
59
|
-
coverageThreshold: {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
},
|
|
69
|
+
// coverageThreshold: {
|
|
70
|
+
// global: {
|
|
71
|
+
// branches: 100,
|
|
72
|
+
// functions: 100,
|
|
73
|
+
// lines: 100,
|
|
74
|
+
// statements: 100
|
|
75
|
+
// }
|
|
76
|
+
// },
|
|
67
77
|
globals: {
|
|
68
78
|
__DEVELOPMENT__: true,
|
|
69
79
|
__DOCS__: false,
|
package/nobdd/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npm install $(npm pack ../ | tail -1)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "testingframeworknobdd",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "collection of examples that we can use for testing",
|
|
5
|
+
"keywords": [],
|
|
6
|
+
"author": "",
|
|
7
|
+
"license": "ISC",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"uat": "ZDTestingFramework test --mode=dev --headed",
|
|
10
|
+
"uatnobdd": "ZDTestingFramework test --mode=nobdd",
|
|
11
|
+
"uat-ci": "ZDTestingFramework test --mode=ci --headed",
|
|
12
|
+
"uat-clean": "ZDTestingFramework clearCaches",
|
|
13
|
+
"uat-debug": "ZDTestingFramework test --mode=dev --debug",
|
|
14
|
+
"uat-report": "ZDTestingFramework report --port=9009",
|
|
15
|
+
"codegen": "ZDTestingFramework codegen deskclientapp.localzoho.com/agent"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "1",
|
|
4
|
+
"edition": "enterprise",
|
|
5
|
+
"orgName": "custommoduleportal",
|
|
6
|
+
"profiles": [
|
|
7
|
+
{
|
|
8
|
+
"profile": "admin",
|
|
9
|
+
"email": "indragith.m+agent@zohotest.com",
|
|
10
|
+
"password": "Paara!2019"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"profile": "agent",
|
|
14
|
+
"email": "indragith.m+agent@zohotest.com",
|
|
15
|
+
"password": "Paara!2019"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"profile": "lightagent",
|
|
19
|
+
"email": "indragith.m+abc1@zohotest.com",
|
|
20
|
+
"password": "Paara!2019"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
]
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "1",
|
|
4
|
+
"edition": "enterprise",
|
|
5
|
+
"orgName": "parentchildportal",
|
|
6
|
+
"profiles": [
|
|
7
|
+
{
|
|
8
|
+
"profile": "admin",
|
|
9
|
+
"email": "indragith.m@zohocorp.com",
|
|
10
|
+
"password": "Paara!2019"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"profile": "agent",
|
|
14
|
+
"email": "indragith.m+agent@zohotest.com",
|
|
15
|
+
"password": "Paara!2019"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"profile": "lightagent",
|
|
19
|
+
"email": "indragith.m+abc1@zohotest.com",
|
|
20
|
+
"password": "Paara!2019"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
]
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "1",
|
|
4
|
+
"edition": "enterprise",
|
|
5
|
+
"orgName": "zohodeskteam",
|
|
6
|
+
"profiles": [
|
|
7
|
+
{
|
|
8
|
+
"profile": "admin",
|
|
9
|
+
"email": "solairaj.m+26jun2023@zohotest.com",
|
|
10
|
+
"password": "Demo@1201"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"profile": "agent",
|
|
14
|
+
"email": "anitha.m+agentat@zohotest.com",
|
|
15
|
+
"password": "Desk@1234"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"profile": "lightagent",
|
|
19
|
+
"email": "anitha.m+admin@zohotest.com",
|
|
20
|
+
"password": "Moon@2018"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
]
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const customFixtures = require('../../shared/commands/_index-custom-fixtures');
|
|
2
|
+
|
|
3
|
+
const { getDefaultActor } = require('@zohodesk/testinglibrary/helpers');
|
|
4
|
+
|
|
5
|
+
function getPrimaryCookiePath() {
|
|
6
|
+
const { email } = getDefaultActor();
|
|
7
|
+
return `uat/playwright/.auth/${email}-cookies.json`;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents the user configuration object.
|
|
12
|
+
* @typedef {import('@zohodesk/testinglibrary').UserConfig} UserConfig
|
|
13
|
+
*/
|
|
14
|
+
module.exports = {
|
|
15
|
+
headless: true,
|
|
16
|
+
openReportOn: 'never',
|
|
17
|
+
browsers: ['Chrome'],
|
|
18
|
+
isAuthMode: false,
|
|
19
|
+
authFilePath: getPrimaryCookiePath(),
|
|
20
|
+
trace: true,
|
|
21
|
+
video: true,
|
|
22
|
+
bddMode: false,
|
|
23
|
+
viewport: { width: 1280, height: 720 },
|
|
24
|
+
testIdAttribute: 'data-id',
|
|
25
|
+
additionalPages: {
|
|
26
|
+
...customFixtures
|
|
27
|
+
}
|
|
28
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"dev": {
|
|
3
|
+
"domain": "https://desk.localzoho.com/agent",
|
|
4
|
+
"orgName": "org-name",
|
|
5
|
+
"deptName": "dept-name",
|
|
6
|
+
"moduleName": "module-name"
|
|
7
|
+
},
|
|
8
|
+
"prod": {
|
|
9
|
+
"domain": "https://desk.localzoho.com/agent/",
|
|
10
|
+
"orgName": "sangeetha.t@zohocorp.com",
|
|
11
|
+
"deptName": "sangeethat",
|
|
12
|
+
"moduleName": "sangeethat"
|
|
13
|
+
},
|
|
14
|
+
"ci": {
|
|
15
|
+
"domain": "https://zdesk-devops08.csez.zohocorpin.com:31007/agent/",
|
|
16
|
+
"orgName": "clientcicdk8",
|
|
17
|
+
"deptName": "clientcicdk8",
|
|
18
|
+
"moduleName": "tickets"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import {
|
|
3
|
+
test as setup,
|
|
4
|
+
expect
|
|
5
|
+
} from '@zohodesk/testinglibrary';
|
|
6
|
+
import {
|
|
7
|
+
getDefaultActor,
|
|
8
|
+
getUserForSelectedEditionAndProfile,
|
|
9
|
+
performLoginSteps
|
|
10
|
+
} from '@zohodesk/testinglibrary/helpers'
|
|
11
|
+
import { SETUP_HOME_PAGE_SELECTORS } from '../modules/Setup/dom-selectors/SetupSelectors';
|
|
12
|
+
import getUrlOrigin from '../shared/url-helpers/getUrlOrigin';
|
|
13
|
+
|
|
14
|
+
const { edition, profile } = getDefaultActor();
|
|
15
|
+
|
|
16
|
+
const user = getUserForSelectedEditionAndProfile(edition, profile);
|
|
17
|
+
|
|
18
|
+
async function verifyPageIsLoaded(page) {
|
|
19
|
+
const urlOrigin = getUrlOrigin(page.url());
|
|
20
|
+
const domainOrigin = getUrlOrigin(process.env.domain);
|
|
21
|
+
if (urlOrigin === domainOrigin) {
|
|
22
|
+
await expect(
|
|
23
|
+
page
|
|
24
|
+
.locator('header')
|
|
25
|
+
.getByLabel(SETUP_HOME_PAGE_SELECTORS.SETUP_ICON_LABEL)
|
|
26
|
+
).toBeVisible();
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
setup(`${user.edition} - Authentication`, async ({ page }) => {
|
|
33
|
+
const { email, password } = user;
|
|
34
|
+
await performLoginSteps(
|
|
35
|
+
{
|
|
36
|
+
page,
|
|
37
|
+
authFilePrefix: email,
|
|
38
|
+
useremail: email,
|
|
39
|
+
password: password
|
|
40
|
+
},
|
|
41
|
+
verifyPageIsLoaded
|
|
42
|
+
);
|
|
43
|
+
//await completeOnboardings({ page });
|
|
44
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import {
|
|
4
|
+
test as teardown,
|
|
5
|
+
expect
|
|
6
|
+
} from '@zohodesk/testinglibrary';
|
|
7
|
+
import { isDevelopmentSetup, loadCookiesIfPresent } from '@zohodesk/testinglibrary/helpers'
|
|
8
|
+
import getUrlOrigin from '../shared/url-helpers/getUrlOrigin';
|
|
9
|
+
|
|
10
|
+
// We are adding teardown logic only in CI mode
|
|
11
|
+
if (!isDevelopmentSetup()) {
|
|
12
|
+
teardown(`Log out scenarios`, async ({ page }) => {
|
|
13
|
+
const authDirectory = path.resolve(
|
|
14
|
+
process.cwd(),
|
|
15
|
+
'uat',
|
|
16
|
+
'playwright',
|
|
17
|
+
'.auth'
|
|
18
|
+
);
|
|
19
|
+
const files = fs.readdirSync(authDirectory);
|
|
20
|
+
const promises = files.map(async file => {
|
|
21
|
+
const authFilePath = path.join(authDirectory, file);
|
|
22
|
+
await loadCookiesIfPresent(page, authFilePath);
|
|
23
|
+
const domainOrigin = getUrlOrigin(process.env.domain);
|
|
24
|
+
await page.goto(`${domainOrigin}/support/logout.sas `);
|
|
25
|
+
await page.waitForNavigation();
|
|
26
|
+
await expect(page.locator('[id="signin_flow"]')).toBeVisible();
|
|
27
|
+
await fs.rmSync(authFilePath);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
await Promise.all(promises);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { test, expect } from "@zohodesk/testinglibrary";
|
|
2
|
+
|
|
3
|
+
test.describe("Verify no authentication required @nobdd", () => {
|
|
4
|
+
|
|
5
|
+
test("Verify the page is not logged in", async ({ page }) => {
|
|
6
|
+
|
|
7
|
+
await page.goto('https://desk.localzoho.com/');
|
|
8
|
+
|
|
9
|
+
await page.waitForSelector('.zgh-accounts');
|
|
10
|
+
|
|
11
|
+
const isLoggedIn = await page.isVisible('.zgh-accounts');
|
|
12
|
+
expect(isLoggedIn).toBe(true);
|
|
13
|
+
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* eslint-disable no-param-reassign */
|
|
2
|
+
|
|
3
|
+
// Note: We are duplicating below method from @zohodesk/i18n. We are not importing it as react package not yet availble in test environment.
|
|
4
|
+
function replaceI18NValuesWithRegex(i18nStr, values) {
|
|
5
|
+
if (typeof values !== 'undefined') {
|
|
6
|
+
if (Array.isArray(values)) {
|
|
7
|
+
for (let i = 0; i < values.length; i++) {
|
|
8
|
+
i18nStr = i18nStr.replace(new RegExp(`\\{${i}\\}`, 'g'), values[i]);
|
|
9
|
+
}
|
|
10
|
+
} else {
|
|
11
|
+
i18nStr = i18nStr.replace(new RegExp('\\{0\\}', 'g'), values);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return i18nStr;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = {
|
|
18
|
+
i18N: async ({ page }, use) => {
|
|
19
|
+
await use(async (key, values) => {
|
|
20
|
+
const i18nValue = await page.evaluate((i18nKey) => window.i18n[i18nKey], key);
|
|
21
|
+
const i18nStr = replaceI18NValuesWithRegex(i18nValue, values)
|
|
22
|
+
return i18nStr;
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
async function get_cookie(page) {
|
|
2
|
+
return page.evaluate(async () => {
|
|
3
|
+
const results = document.cookie.match(`crmcsr=(.*?)(;|$)`);
|
|
4
|
+
if (results) {
|
|
5
|
+
return unescape(results[1]);
|
|
6
|
+
}
|
|
7
|
+
return null;
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async function getOnboardings({ page, cookieVal }) {
|
|
12
|
+
return page.evaluate(
|
|
13
|
+
async (cookieVal) =>
|
|
14
|
+
fetch('/api/v1/onboardingStatus', {
|
|
15
|
+
method: 'GET',
|
|
16
|
+
headers: {
|
|
17
|
+
orgId: window.currentOrg.id,
|
|
18
|
+
'X-ZCSRF-TOKEN': `crmcsrfparam=${cookieVal}`
|
|
19
|
+
}
|
|
20
|
+
}).then((r) => (r.ok ? r.json() : Promise.reject(r))),
|
|
21
|
+
cookieVal
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async function completeOnboardings({ page }) {
|
|
26
|
+
const cookieVal = await get_cookie(page);
|
|
27
|
+
const onboardings = await getOnboardings({ page });
|
|
28
|
+
if (onboardings.pending.length) {
|
|
29
|
+
await page.evaluate(
|
|
30
|
+
async ({ cookieVal, onboardings }) =>
|
|
31
|
+
fetch('/api/v1/onboardingStatus/markComplete', {
|
|
32
|
+
method: 'POST',
|
|
33
|
+
headers: {
|
|
34
|
+
orgId: window.currentOrg.id,
|
|
35
|
+
'X-ZCSRF-TOKEN': `crmcsrfparam=${cookieVal}`
|
|
36
|
+
},
|
|
37
|
+
body: JSON.stringify({ items: onboardings.pending })
|
|
38
|
+
}),
|
|
39
|
+
{ cookieVal, onboardings }
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
module.exports = completeOnboardings;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const customFixtures = require('./uat/shared/commands/_index-custom-fixtures');
|
|
2
|
+
|
|
3
|
+
const { getDefaultActor } = require('@zohodesk/testinglibrary/helpers');
|
|
4
|
+
|
|
5
|
+
function getPrimaryCookiePath() {
|
|
6
|
+
const { email } = getDefaultActor();
|
|
7
|
+
return `uat/playwright/.auth/${email}-cookies.json`;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents the user configuration object.
|
|
12
|
+
* @typedef {import('@zohodesk/testinglibrary').UserConfig} UserConfig
|
|
13
|
+
*/
|
|
14
|
+
module.exports = {
|
|
15
|
+
headless: false,
|
|
16
|
+
openReportOn: 'never',
|
|
17
|
+
browsers: ['Chrome'],
|
|
18
|
+
isAuthMode: true,
|
|
19
|
+
authFilePath: getPrimaryCookiePath(),
|
|
20
|
+
trace: true,
|
|
21
|
+
video: true,
|
|
22
|
+
bddMode: true,
|
|
23
|
+
featureFilesFolder: 'feature-files',
|
|
24
|
+
stepDefinitionsFolder: 'steps',
|
|
25
|
+
viewport: { width: 1280, height: 720 },
|
|
26
|
+
testIdAttribute: 'data-id',
|
|
27
|
+
additionalPages: {
|
|
28
|
+
...customFixtures
|
|
29
|
+
}
|
|
30
|
+
};
|