@zohodesk/testinglibrary 0.1.9 → 0.1.16-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 +4 -2
- package/.claude/settings.local.json +14 -0
- package/.gitlab-ci.yml +206 -0
- package/README.md +264 -1
- package/build/common/data-generator/steps/DataGenerator.spec.js +19 -0
- package/build/common/data-generator/steps/DataGeneratorStepsHelper.js +21 -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 +85 -0
- package/build/core/dataGenerator/DataGenerator.js +161 -0
- package/build/core/dataGenerator/DataGeneratorError.js +60 -0
- package/build/core/dataGenerator/DataGeneratorHelper.js +121 -0
- package/build/core/dataGenerator/authenticator/Authenticator.js +37 -0
- package/build/core/dataGenerator/authenticator/CookieAuthenticator.js +48 -0
- package/build/core/dataGenerator/authenticator/JWTauthenticator.js +59 -0
- package/build/core/dataGenerator/authenticator/OAuthAuthenticator.js +26 -0
- package/build/core/dataGenerator/authenticator/OrgOAuthAuthenticator.js +26 -0
- package/build/core/dataGenerator/authenticator/cookieAuthConfig.js +11 -0
- package/build/core/jest/preprocessor/jsPreprocessor.js +2 -7
- package/build/core/jest/setup/index.js +1 -7
- package/build/core/playwright/builtInFixtures/actorContext.js +78 -0
- package/build/core/playwright/builtInFixtures/caseTimeout.js +20 -0
- package/build/core/playwright/builtInFixtures/context.js +34 -16
- package/build/core/playwright/builtInFixtures/executionContext.js +17 -0
- package/build/core/playwright/builtInFixtures/i18N.js +8 -0
- package/build/core/playwright/builtInFixtures/index.js +7 -1
- package/build/core/playwright/builtInFixtures/page.js +22 -66
- package/build/core/playwright/clear-caches.js +17 -5
- package/build/core/playwright/codegen.js +4 -21
- package/build/core/playwright/configuration/Configuration.js +25 -0
- package/build/core/playwright/configuration/ConfigurationHelper.js +45 -0
- package/build/core/playwright/configuration/UserArgs.js +12 -0
- package/build/core/playwright/constants/configConstants.js +17 -0
- package/build/core/playwright/constants/failureTagConstants.js +17 -0
- package/build/core/playwright/constants/fileMutexConfig.js +9 -0
- package/build/core/playwright/constants/reporterConstants.js +20 -0
- package/build/core/playwright/constants/retryConstants.js +8 -0
- package/build/core/playwright/custom-commands.js +1 -1
- package/build/core/playwright/env-initializer.js +28 -9
- 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 +4 -1
- package/build/core/playwright/helpers/auth/checkAuthCookies.js +27 -23
- package/build/core/playwright/helpers/auth/getUsers.js +92 -45
- package/build/core/playwright/helpers/auth/index.js +30 -5
- package/build/core/playwright/helpers/auth/loginDefaultStepsHelper.js +62 -0
- package/build/core/playwright/helpers/auth/loginSteps.js +40 -22
- package/build/core/playwright/helpers/browserTimeoutFactor.js +16 -0
- package/build/core/playwright/helpers/caseTimeoutResolver.js +37 -0
- package/build/core/playwright/helpers/checkAuthDirectory.js +27 -0
- package/build/core/playwright/helpers/configFileNameProvider.js +26 -5
- package/build/core/playwright/helpers/configPathResolver.js +38 -0
- package/build/core/playwright/helpers/contextFailureHandler.js +81 -0
- package/build/core/playwright/helpers/customFixturesHelper.js +58 -0
- package/build/core/playwright/helpers/failureTagClassifier.js +197 -0
- package/build/core/playwright/helpers/fileMutex.js +71 -0
- package/build/core/playwright/helpers/logCollector.js +147 -0
- package/build/core/playwright/helpers/parseUserArgs.js +2 -3
- package/build/core/playwright/helpers/runtimeLogAnnotator.js +140 -0
- package/build/core/playwright/helpers/runtimeLogPath.js +61 -0
- package/build/core/playwright/helpers/runtimeLogReader.js +54 -0
- package/build/core/playwright/helpers/thirdPartyLib.js +13 -0
- package/build/core/playwright/index.js +8 -76
- package/build/core/playwright/patterns/casePatterns.js +9 -0
- package/build/core/playwright/patterns/codePatterns.js +9 -0
- package/build/core/playwright/patterns/environmentPatterns.js +15 -0
- package/build/core/playwright/patterns/index.js +33 -0
- package/build/core/playwright/patterns/logCollectorIgnorePatterns.js +15 -0
- package/build/core/playwright/patterns/toolPatterns.js +26 -0
- package/build/core/playwright/readConfigFile.js +49 -16
- package/build/core/playwright/reporter/PlaywrightReporter.js +58 -0
- package/build/core/playwright/reporter/Reporter.js +60 -0
- package/build/core/playwright/reporter/ShardReporter.js +62 -0
- package/build/core/playwright/reporter/UnitReporter.js +27 -0
- package/build/core/playwright/reporter/helpers/mergeAbortedTests.js +78 -0
- package/build/core/playwright/runCommand.js +71 -0
- 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 +93 -0
- package/build/core/playwright/setup/Project.js +35 -0
- package/build/core/playwright/setup/ProjectConfiguration.js +66 -0
- package/build/core/playwright/setup/config-creator.js +58 -40
- package/build/core/playwright/setup/config-utils.js +68 -37
- package/build/core/playwright/setup/custom-reporter.js +137 -14
- package/build/core/playwright/setup/merge-config.js +32 -0
- package/build/core/playwright/setup/qc-custom-reporter.js +342 -0
- package/build/core/playwright/tagProcessor.js +69 -0
- package/build/core/playwright/test-runner.js +44 -98
- package/build/core/playwright/types.js +4 -1
- 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 +17 -19
- package/build/index.js +28 -6
- package/build/lib/cli.js +42 -7
- package/build/setup-folder-structure/helper.js +2 -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/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 -2
- package/build/setup-folder-structure/setupProject.js +23 -5
- package/build/test/core/dataGenerator/__tests__/DataGenerator.test.js +311 -0
- package/build/test/core/dataGenerator/__tests__/DataGeneratorHelper.test.js +204 -0
- package/build/test/core/dataGenerator/__tests__/DataGeneratorResolution.test.js +126 -0
- package/build/test/core/dataGenerator/authenticator/__tests__/Authenticator.test.js +88 -0
- package/build/test/core/dataGenerator/authenticator/__tests__/JWTauthenticator.test.js +136 -0
- package/build/test/core/dataGenerator/authenticator/__tests__/OAuthAuthenticator.test.js +39 -0
- package/build/test/core/dataGenerator/authenticator/__tests__/OrgOAuthAuthenticator.test.js +39 -0
- package/build/test/core/playwright/__tests__/runCommand.test.js +148 -0
- package/build/test/core/playwright/__tests__/tagProcessor.test.js +94 -0
- package/build/test/core/playwright/__tests__/validateFeature.test.js +72 -0
- package/build/test/core/playwright/buildInFixtures/__tests__/caseTimeout.test.js +96 -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 +75 -0
- package/build/test/core/playwright/helpers/__tests__/configPathResolver.test.js +55 -0
- package/build/test/core/playwright/helpers/__tests__/customFixturesHelper.test.js +51 -0
- package/build/test/core/playwright/helpers/__tests__/failureTagClassifier.test.js +604 -0
- package/build/test/core/playwright/helpers/__tests__/fileMutex.test.js +79 -0
- package/build/test/core/playwright/helpers/__tests__/getUsers_ListOfActors.test.js +83 -0
- package/build/test/core/playwright/helpers/__tests__/logCollector.test.js +163 -0
- package/build/test/core/playwright/helpers/__tests__/runtimeLogReader.test.js +112 -0
- package/build/test/core/playwright/helpers/auth/__tests__/checkAuthCookies.test.js +120 -0
- package/build/test/core/playwright/runner/__tests__/RunnerHelper.test.js +19 -0
- package/build/test/core/playwright/runner/__tests__/SpawnRunner.test.js +30 -0
- package/build/utils/cliArgsToObject.js +3 -0
- package/build/utils/commonUtils.js +20 -0
- package/build/utils/fileUtils.js +43 -1
- package/build/utils/logger.js +1 -30
- package/changelog.md +23 -0
- package/docs/CODE-REVIEW-AGENT.md +399 -0
- package/docs/code-review-instructions.md +157 -0
- package/jest.config.js +29 -11
- package/npm-shrinkwrap.json +13478 -4778
- package/package.json +39 -28
- package/playwright.config.js +13 -57
- package/unit_reports/unit-report.html +277 -0
- package/build/bdd-framework/cli/commands/env.js +0 -42
- package/build/bdd-framework/cli/commands/export.js +0 -47
- 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 -123
- package/build/bdd-framework/gen/i18n.js +0 -39
- package/build/bdd-framework/gen/index.js +0 -185
- package/build/bdd-framework/gen/testFile.js +0 -465
- package/build/bdd-framework/gen/testMeta.js +0 -60
- package/build/bdd-framework/gen/testNode.js +0 -60
- 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 -61
- package/build/bdd-framework/playwright/transform.js +0 -88
- package/build/bdd-framework/playwright/types.js +0 -5
- package/build/bdd-framework/playwright/utils.js +0 -34
- package/build/bdd-framework/reporter/cucumber/base.js +0 -57
- 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 -35
- 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 -64
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/Builder.js +0 -196
- 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 -126
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestCaseRunHooks.js +0 -102
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestStepAttachments.js +0 -50
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestStepRun.js +0 -88
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/index.js +0 -30
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/pwUtils.js +0 -51
- 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 -68
- package/build/bdd-framework/run/bddDataAttachment.js +0 -46
- package/build/bdd-framework/run/bddFixtures.js +0 -191
- package/build/bdd-framework/run/bddWorld.js +0 -79
- package/build/bdd-framework/run/bddWorldInternal.js +0 -15
- 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/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/report-generator.js +0 -42
- 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
package/.babelrc
CHANGED
|
@@ -13,10 +13,12 @@
|
|
|
13
13
|
]
|
|
14
14
|
],
|
|
15
15
|
"plugins": [
|
|
16
|
-
["@babel/plugin-transform-runtime"]
|
|
16
|
+
["@babel/plugin-transform-runtime"],
|
|
17
|
+
["@babel/plugin-transform-modules-commonjs"]
|
|
17
18
|
],
|
|
18
19
|
// Ignored as these are setup files needed during init script. Files inside that folder are copied not transformed
|
|
19
20
|
"ignore": [
|
|
20
|
-
"./src/setup-folder-structure/samples"
|
|
21
|
+
"./src/setup-folder-structure/samples",
|
|
22
|
+
"./src/common/**"
|
|
21
23
|
]
|
|
22
24
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(cd /Users/muthu-19817/git/pipeline_scripts/CLIENTUAT && echo \"=== src/desk_client_app.sh \\(worker + run_uat part\\) ===\" && grep -n -A3 -B1 -E \"WORKERS|run_uat|is_cd_execution|shard\" src/desk_client_app.sh)",
|
|
5
|
+
"Read(//Users/muthu-19817/git/pipeline_scripts/CLIENTUAT/**)",
|
|
6
|
+
"Bash(curl -s \"https://api.github.com/repos/vitalets/playwright-timeline-reporter\")",
|
|
7
|
+
"Bash(python3 -c \"import json,sys; d=json.load\\(sys.stdin\\); print\\({k:d.get\\(k\\) for k in ['full_name','description','stargazers_count','forks_count','open_issues_count','created_at','updated_at','pushed_at','license','archived','default_branch','homepage']}\\)\")",
|
|
8
|
+
"Bash(mkdir -p \"/private/tmp/claude-502/-Users-muthu-19817-git-testing-framework/04916d48-1c69-4008-947c-820f8c6cc4da/scratchpad\")",
|
|
9
|
+
"Bash(curl -sS -L --max-time 60 \"https://raw.githubusercontent.com/vitalets/playwright-timeline-reporter/main/README.md\" -o \"/private/tmp/claude-502/-Users-muthu-19817-git-testing-framework/04916d48-1c69-4008-947c-820f8c6cc4da/scratchpad/README.md\")",
|
|
10
|
+
"Bash(curl -s \"https://api.github.com/repos/vitalets/playwright-timeline-reporter/commits?per_page=25\" -o commits.json)",
|
|
11
|
+
"Bash(python3 -c ' *)"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
package/.gitlab-ci.yml
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
image: zdesk-auto13.csez.zohocorpin.com/long-term-storage/node20-npm10:v1
|
|
2
|
+
|
|
3
|
+
workflow:
|
|
4
|
+
rules:
|
|
5
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
6
|
+
when: always
|
|
7
|
+
- if: $CI_PIPELINE_SOURCE == "web"
|
|
8
|
+
when: always
|
|
9
|
+
|
|
10
|
+
stages:
|
|
11
|
+
- build
|
|
12
|
+
- unit
|
|
13
|
+
- uat
|
|
14
|
+
|
|
15
|
+
default:
|
|
16
|
+
cache:
|
|
17
|
+
key: build-cache
|
|
18
|
+
paths:
|
|
19
|
+
- node_modules
|
|
20
|
+
- build
|
|
21
|
+
- npm-shrinkwrap.json
|
|
22
|
+
|
|
23
|
+
# Install dependencies stage
|
|
24
|
+
build:
|
|
25
|
+
stage: build
|
|
26
|
+
script:
|
|
27
|
+
- npm -v
|
|
28
|
+
- node -v
|
|
29
|
+
- npm install --ignore-scripts
|
|
30
|
+
- npm run build
|
|
31
|
+
- npm install
|
|
32
|
+
- npm shrinkwrap
|
|
33
|
+
- npm run build
|
|
34
|
+
- npm pack . --pack-destination .
|
|
35
|
+
- cd examples && npm install ../zohodesk-testinglibrary-*.tgz && cd ..
|
|
36
|
+
- cd nobdd && npm install ../zohodesk-testinglibrary-*.tgz && cd ..
|
|
37
|
+
artifacts:
|
|
38
|
+
paths:
|
|
39
|
+
- zohodesk-testinglibrary-*.tgz
|
|
40
|
+
- examples/node_modules
|
|
41
|
+
- nobdd/node_modules
|
|
42
|
+
|
|
43
|
+
# Unit tests stage
|
|
44
|
+
unit:
|
|
45
|
+
stage: unit
|
|
46
|
+
script:
|
|
47
|
+
- npm run test
|
|
48
|
+
artifacts:
|
|
49
|
+
when: always
|
|
50
|
+
paths:
|
|
51
|
+
- unit_reports
|
|
52
|
+
|
|
53
|
+
# UAT tests stage — node_modules from build artifact; browsers from runner cache
|
|
54
|
+
.uat_base:
|
|
55
|
+
stage: uat
|
|
56
|
+
timeout: 20m
|
|
57
|
+
cache:
|
|
58
|
+
key: playwright-browsers
|
|
59
|
+
paths:
|
|
60
|
+
- .playwright-browsers
|
|
61
|
+
variables:
|
|
62
|
+
PLAYWRIGHT_BROWSERS_PATH: $CI_PROJECT_DIR/.playwright-browsers
|
|
63
|
+
before_script:
|
|
64
|
+
- npx --prefix examples playwright install chromium
|
|
65
|
+
needs:
|
|
66
|
+
- job: build
|
|
67
|
+
artifacts: true
|
|
68
|
+
artifacts:
|
|
69
|
+
when: always
|
|
70
|
+
|
|
71
|
+
uat-auth:
|
|
72
|
+
extends: .uat_base
|
|
73
|
+
script:
|
|
74
|
+
- cd examples
|
|
75
|
+
- npm run uatauth || true
|
|
76
|
+
- node ../ValidateUATReport.js examples
|
|
77
|
+
|
|
78
|
+
artifacts:
|
|
79
|
+
paths:
|
|
80
|
+
- examples/test-slices/uat/playwright-report
|
|
81
|
+
|
|
82
|
+
uat-noauth:
|
|
83
|
+
extends: .uat_base
|
|
84
|
+
script:
|
|
85
|
+
- cd examples
|
|
86
|
+
- npm run uatnoauth || true
|
|
87
|
+
- node ../ValidateUATReport.js examples
|
|
88
|
+
|
|
89
|
+
artifacts:
|
|
90
|
+
paths:
|
|
91
|
+
- examples/test-slices/uat/playwright-report
|
|
92
|
+
|
|
93
|
+
uat-profile:
|
|
94
|
+
extends: .uat_base
|
|
95
|
+
script:
|
|
96
|
+
- cd examples
|
|
97
|
+
- npm run uatprofile || true
|
|
98
|
+
- node ../ValidateUATReport.js examples
|
|
99
|
+
|
|
100
|
+
artifacts:
|
|
101
|
+
paths:
|
|
102
|
+
- examples/test-slices/uat/playwright-report
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
uat-unauth:
|
|
106
|
+
extends: .uat_base
|
|
107
|
+
script:
|
|
108
|
+
- cd examples
|
|
109
|
+
- npm run uatunauth || true
|
|
110
|
+
- node ../ValidateUATReport.js examples
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
artifacts:
|
|
114
|
+
paths:
|
|
115
|
+
- examples/test-slices/uat/playwright-report
|
|
116
|
+
|
|
117
|
+
uat-nobdd:
|
|
118
|
+
extends: .uat_base
|
|
119
|
+
script:
|
|
120
|
+
- cd nobdd
|
|
121
|
+
- npm run uatnobdd -- --headless || true
|
|
122
|
+
- node ../ValidateUATReport.js nobdd
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
artifacts:
|
|
126
|
+
paths:
|
|
127
|
+
- nobdd/test-slices/uat/playwright-report
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
uatmodule:
|
|
131
|
+
extends: .uat_base
|
|
132
|
+
script:
|
|
133
|
+
- cd examples
|
|
134
|
+
- npm run uatmodule || true
|
|
135
|
+
- node ../ValidateUATReport.js examples
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
artifacts:
|
|
139
|
+
paths:
|
|
140
|
+
- examples/test-slices/uat/playwright-report
|
|
141
|
+
|
|
142
|
+
uatconfigmodule:
|
|
143
|
+
extends: .uat_base
|
|
144
|
+
script:
|
|
145
|
+
- cd examples
|
|
146
|
+
- npm run uatconfigmodule || true
|
|
147
|
+
- node ../ValidateUATReport.js examples
|
|
148
|
+
|
|
149
|
+
artifacts:
|
|
150
|
+
paths:
|
|
151
|
+
- examples/test-slices/uat/playwright-report
|
|
152
|
+
|
|
153
|
+
uat-smoketest:
|
|
154
|
+
extends: .uat_base
|
|
155
|
+
script:
|
|
156
|
+
- cd examples
|
|
157
|
+
- npm run uat-smoketest || true
|
|
158
|
+
- node ../ValidateUATReport.js examples
|
|
159
|
+
|
|
160
|
+
artifacts:
|
|
161
|
+
paths:
|
|
162
|
+
- examples/test-slices/uat/playwright-report
|
|
163
|
+
|
|
164
|
+
uat-multiactor:
|
|
165
|
+
extends: .uat_base
|
|
166
|
+
script:
|
|
167
|
+
- cd examples
|
|
168
|
+
- npm run uat-multiactor || true
|
|
169
|
+
- node ../ValidateUATReport.js examples
|
|
170
|
+
|
|
171
|
+
artifacts:
|
|
172
|
+
paths:
|
|
173
|
+
- examples/test-slices/uat/playwright-report
|
|
174
|
+
|
|
175
|
+
uat-data_generator:
|
|
176
|
+
extends: .uat_base
|
|
177
|
+
script:
|
|
178
|
+
- cd examples
|
|
179
|
+
- npm run uat-data_generator || true
|
|
180
|
+
- node ../ValidateUATReport.js examples
|
|
181
|
+
|
|
182
|
+
artifacts:
|
|
183
|
+
paths:
|
|
184
|
+
- examples/test-slices/uat/playwright-report
|
|
185
|
+
|
|
186
|
+
uat-data_generator_v2:
|
|
187
|
+
extends: .uat_base
|
|
188
|
+
script:
|
|
189
|
+
- cd examples
|
|
190
|
+
- npm run uat-data_generator_v2 || true
|
|
191
|
+
- node ../ValidateUATReport.js examples
|
|
192
|
+
|
|
193
|
+
artifacts:
|
|
194
|
+
paths:
|
|
195
|
+
- examples/test-slices/uat/playwright-report
|
|
196
|
+
|
|
197
|
+
uat-search_indexing:
|
|
198
|
+
extends: .uat_base
|
|
199
|
+
script:
|
|
200
|
+
- cd examples
|
|
201
|
+
- npm run uat-search_indexing || true
|
|
202
|
+
- node ../ValidateUATReport.js examples
|
|
203
|
+
|
|
204
|
+
artifacts:
|
|
205
|
+
paths:
|
|
206
|
+
- examples/test-slices/uat/playwright-report
|
package/README.md
CHANGED
|
@@ -12,7 +12,270 @@
|
|
|
12
12
|
### Run TestCase
|
|
13
13
|
|
|
14
14
|
- npm run test
|
|
15
|
+
|
|
15
16
|
### Generate Report
|
|
16
17
|
|
|
17
18
|
- npm run report
|
|
18
|
-
|
|
19
|
+
|
|
20
|
+
### v4.2.0/v3.4.0 - 22-07-2026
|
|
21
|
+
|
|
22
|
+
#### Feature
|
|
23
|
+
- Error segregation support for failing tests.
|
|
24
|
+
- Failures are classified into `CODE`, `CASE`, `TOOL`, and `ENVIRONMENT` using pattern-based matching on runtime browser logs and test stdout/stderr.
|
|
25
|
+
- Controlled via the `failureSegregation` option in `uat-config` (default: `true`). When enabled, runtime logs are collected on failure and used for classification.
|
|
26
|
+
|
|
27
|
+
### v4.1.9/v3.3.5 - 03-07-2026
|
|
28
|
+
|
|
29
|
+
#### Feature
|
|
30
|
+
- PortalDomain option provided in the settings.json.
|
|
31
|
+
- This lets customer portal and related UAT flows resolve the portal URL from configuration instead of hardcoding environment-specific links.
|
|
32
|
+
- It simplifies switching between setups such as dev, QA, and UAT without changing test code.
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### v4.1.5/v3.3.3 - 19-06-2026
|
|
36
|
+
|
|
37
|
+
#### Refactor
|
|
38
|
+
- Authenticator module refactored to use static imports instead of dynamic imports
|
|
39
|
+
- Removed unnecessary `extends Authenticator` from concrete authenticator classes (`JWTauthenticator`, `OAuthAuthenticator`, `OrgOAuthAuthenticator`, `CookieAuthenticator`) to eliminate circular dependency
|
|
40
|
+
- Unit test cases updated to align with actual source behavior
|
|
41
|
+
|
|
42
|
+
### v4.1.4/v3.3.3 - 18-06-2026
|
|
43
|
+
|
|
44
|
+
#### Bugfix
|
|
45
|
+
- Dependency project failure stats pushed into custom reporter
|
|
46
|
+
- `stepDefinitionsFolder` hardcoded changes removed
|
|
47
|
+
|
|
48
|
+
### v4.1.3/v3.3.2 - 08-06-2026
|
|
49
|
+
|
|
50
|
+
#### Features
|
|
51
|
+
- Scenario-Based Timeouts: Define custom execution limits directly in your feature files using Gherkin tags (e.g., @timeout_180).
|
|
52
|
+
|
|
53
|
+
### v4.1.2/v3.3.1 - 21-05-2026
|
|
54
|
+
|
|
55
|
+
#### Features
|
|
56
|
+
- Supported UnitTest via testing-framework
|
|
57
|
+
|
|
58
|
+
### v4.1.1/v3.3.0 - 28-01-2026
|
|
59
|
+
|
|
60
|
+
#### Features
|
|
61
|
+
- Supported E2E configuration in testing-framework
|
|
62
|
+
|
|
63
|
+
### v4.0.6/v3.2.21 - 22-01-2026
|
|
64
|
+
|
|
65
|
+
#### Bug fix
|
|
66
|
+
- Retry added for Missing Step Definitions Issue in the Feature Files
|
|
67
|
+
|
|
68
|
+
### v4.0.5 - 08-01-2026
|
|
69
|
+
|
|
70
|
+
#### Bug fix
|
|
71
|
+
- @cucumber/cucumber depedency removed from testing-framework package.json
|
|
72
|
+
|
|
73
|
+
### v4.0.4/v3.2.20 - 19-12-2025
|
|
74
|
+
|
|
75
|
+
#### Enhancement
|
|
76
|
+
- New common step provided for search index with the data generated entity
|
|
77
|
+
|
|
78
|
+
### v4.0.3/v3.2.19 - 17-12-2025
|
|
79
|
+
|
|
80
|
+
#### Enhancement
|
|
81
|
+
- Cookie storage prefix support is provided in this version.
|
|
82
|
+
|
|
83
|
+
### v4.0.2 - 16-12-2025
|
|
84
|
+
|
|
85
|
+
#### Bug Fixes
|
|
86
|
+
|
|
87
|
+
- Deprecated the react and react hooks from dependencies
|
|
88
|
+
- @cucumber/cucumber - 10.9.0 version downgraded due to Missing Step Definition Issue
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
### v4.0.0 - 04-12-2025
|
|
92
|
+
|
|
93
|
+
#### Features
|
|
94
|
+
- Supported node 20 for the testing-framework
|
|
95
|
+
|
|
96
|
+
- Below package versions are updated in this release.
|
|
97
|
+
- playwright - 1.56.1,
|
|
98
|
+
- playwright-bdd - 8.4.2,
|
|
99
|
+
- @playwright/test - 1.56.1,
|
|
100
|
+
- @cucumber/cucumber - 12.2.0
|
|
101
|
+
|
|
102
|
+
### v3.2.15 - 14-11-2025
|
|
103
|
+
|
|
104
|
+
#### Enhancement
|
|
105
|
+
|
|
106
|
+
- Aborted test results are now merged into the `.last-run.json` file.
|
|
107
|
+
This ensures that any timed-out tests are included in the next retry cycle.
|
|
108
|
+
|
|
109
|
+
### v3.2.13 - 30-10-2025
|
|
110
|
+
|
|
111
|
+
#### Enhancement
|
|
112
|
+
|
|
113
|
+
- A teardown option has been introduced in the configuration to manage and clean up login sessions stored in the NFS environment.
|
|
114
|
+
|
|
115
|
+
### Issue fix
|
|
116
|
+
|
|
117
|
+
- Custom teardown comment provided
|
|
118
|
+
|
|
119
|
+
### v3.2.11 - 13-10-2025
|
|
120
|
+
|
|
121
|
+
### Feature
|
|
122
|
+
|
|
123
|
+
- New step a search entity using {string} provided for search indexing, This step will use run time data generation response as input for the indexing
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
### v3.2.9 - 26-09-2025
|
|
127
|
+
|
|
128
|
+
### Enhancement
|
|
129
|
+
|
|
130
|
+
- Authentication deatils for data generation can be configured in org level
|
|
131
|
+
- reference link : https://learn.zoho.in/portal/zohocorp/knowledge/manual/client-uat/article/data-generation#_Tocpd3n7yt9ngeg
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
### v3.2.8 - 18-09-2025
|
|
135
|
+
|
|
136
|
+
### Bug fix
|
|
137
|
+
|
|
138
|
+
- Default profile switching handled in Multi actor – Improved handling of default profile switching to ensure smoother execution flow.
|
|
139
|
+
|
|
140
|
+
- QC Report tags issue fixed – Resolved an issue where QC Report tags were not displaying correctly in reports.
|
|
141
|
+
|
|
142
|
+
### v3.2.7 - 10-09-2025
|
|
143
|
+
|
|
144
|
+
### Bug fix
|
|
145
|
+
- Fixed a bug where the default profile page was not being handled properly in `this`.
|
|
146
|
+
|
|
147
|
+
### v3.2.6 - 05-09-2025
|
|
148
|
+
|
|
149
|
+
#### Feature
|
|
150
|
+
|
|
151
|
+
- Multi-actor execution support – now possible to switch between multiple profile agents within scenarios using the predefined step: - `access the {string} profile page`
|
|
152
|
+
|
|
153
|
+
### Bug fix
|
|
154
|
+
|
|
155
|
+
- Fixed the issue where localapp and hcapp UAT were not running properly.
|
|
156
|
+
|
|
157
|
+
### v3.2.5 - 28-08-2025
|
|
158
|
+
|
|
159
|
+
#### Enhancement
|
|
160
|
+
|
|
161
|
+
- Removed the searchFake dependency from the project level and adopted it inside the framework, reducing project-side maintenance. use this predefined step: - `Given (a search entity)`
|
|
162
|
+
|
|
163
|
+
### v3.2.4 - 29-07-2025
|
|
164
|
+
|
|
165
|
+
#### Feature
|
|
166
|
+
- Data Generator steps are now supported directly via the framework.
|
|
167
|
+
|
|
168
|
+
### Bug fix
|
|
169
|
+
- Feature File Root Directory not found issue fixed
|
|
170
|
+
|
|
171
|
+
### v3.2.3 - 29-07-2025
|
|
172
|
+
|
|
173
|
+
#### Feature
|
|
174
|
+
- Added support for running Smoke Tests in the UAT stage.
|
|
175
|
+
|
|
176
|
+
### v3.2.0 - 22-06-2025
|
|
177
|
+
|
|
178
|
+
#### Feature
|
|
179
|
+
- Default required spec files are now auto-imported from the library into the project.
|
|
180
|
+
|
|
181
|
+
### v3.1.13 - 02-07-2025
|
|
182
|
+
|
|
183
|
+
#### Enhancement
|
|
184
|
+
- Below package versions are updated in this release.
|
|
185
|
+
- @cucumber/Cucumber - 11.3.0
|
|
186
|
+
- Playwright/test - 1.53.2
|
|
187
|
+
- Playwright - 1.53.2
|
|
188
|
+
- Playwright-bdd - 8.3.1
|
|
189
|
+
- QC custom reporter changes have been adopted into the framework.
|
|
190
|
+
|
|
191
|
+
### v3.1.5 - 22-05-2025
|
|
192
|
+
|
|
193
|
+
#### Feature
|
|
194
|
+
- Added support for Module Based Execution UAT stage.
|
|
195
|
+
|
|
196
|
+
### v3.1.4 - 12-05-2025
|
|
197
|
+
|
|
198
|
+
#### Enhancement
|
|
199
|
+
- Playwright version 1.52.0 adopted in testing framework
|
|
200
|
+
|
|
201
|
+
### v3.1.3 - 25-04-2025
|
|
202
|
+
|
|
203
|
+
#### Enhancement
|
|
204
|
+
- Playwright version 1.51.0 adopted in testing framework
|
|
205
|
+
|
|
206
|
+
### v0.2.8 - 26-09-2024
|
|
207
|
+
|
|
208
|
+
#### Feature
|
|
209
|
+
- Added support for writing unitcases for framework implementations
|
|
210
|
+
|
|
211
|
+
### Bug fix
|
|
212
|
+
- Updated the custom-reported to include the errors in tests during the executions. It will help us avoid the stage passed without the actual test execution.
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
### v3.0.8 - 25-12-2024
|
|
216
|
+
|
|
217
|
+
#### Enhancement
|
|
218
|
+
- Added support to disable headless mode using command line arguments
|
|
219
|
+
- Proper validation added for node 14 build process
|
|
220
|
+
- Removed unwanted uat.config.js files in test projects (examples / nobdd)
|
|
221
|
+
|
|
222
|
+
### v0.2.9.2 - 22-11-2024
|
|
223
|
+
|
|
224
|
+
#### BugFix
|
|
225
|
+
- Implemented synchronization for the login process. This fix will help avoid login session-related failures in UAT.
|
|
226
|
+
|
|
227
|
+
### v0.3.1 - 13-11-2024
|
|
228
|
+
|
|
229
|
+
#### Issue Fix
|
|
230
|
+
- Adding bddmode to get the fixtures.
|
|
231
|
+
|
|
232
|
+
### v0.2.9.1 - 14-11-2024
|
|
233
|
+
|
|
234
|
+
#### Enhancement
|
|
235
|
+
- Beta feature Actors and edition configurations are unified
|
|
236
|
+
|
|
237
|
+
### v0.2.9 - 25-10-2024
|
|
238
|
+
|
|
239
|
+
#### Feature
|
|
240
|
+
- Added support for scenario level tag support
|
|
241
|
+
- Added a new cli optin like uat-validate to validate the feature files using playwright-bdd
|
|
242
|
+
- Mode based configuration implementations
|
|
243
|
+
- @only option enabled in dev pipeline
|
|
244
|
+
- Latest setup related configuration changed for init option
|
|
245
|
+
|
|
246
|
+
### v0.3.0 - 25-10-2024
|
|
247
|
+
|
|
248
|
+
#### Features
|
|
249
|
+
- Added support for scenario level tag support
|
|
250
|
+
- Updated the configuration for `video` and `trace` to accept Playwright-specific values instead of boolean values.
|
|
251
|
+
- Below package versions are updated in this release.
|
|
252
|
+
- playwright - 1.48.0,
|
|
253
|
+
- playwright-bdd - 7.5.0,
|
|
254
|
+
- @playwright/test - 1.48.0,
|
|
255
|
+
- @cucumber/cucumber - 11.0.1
|
|
256
|
+
- From this version, We adopt the playwright-bdd as library instead of modified source
|
|
257
|
+
- Published on 11-11-2024
|
|
258
|
+
|
|
259
|
+
#### Deprecations
|
|
260
|
+
- **Deprecated**: Passing `video` and `trace` as boolean (`true`/`false`) in project configuration.
|
|
261
|
+
- **New Approach**: Use Playwright values for `video` and `trace` options, such as `'on'`, `'retain-on-failure'`, or `'off'`.
|
|
262
|
+
|
|
263
|
+
### v0.3.1 - 13-11-2024
|
|
264
|
+
|
|
265
|
+
#### Issue Fix
|
|
266
|
+
- Adding bddmode to get the fixtures.
|
|
267
|
+
|
|
268
|
+
### v0.3.3 - 27-11-2024
|
|
269
|
+
|
|
270
|
+
#### Feature
|
|
271
|
+
- Custom report integration support (ReportPortal)
|
|
272
|
+
|
|
273
|
+
### v0.2.9.1 - 14-11-2024
|
|
274
|
+
|
|
275
|
+
#### Enhancement
|
|
276
|
+
- Beta feature Actors and edition configurations are unified
|
|
277
|
+
|
|
278
|
+
### v0.2.9.2 - 22-11-2024
|
|
279
|
+
|
|
280
|
+
#### BugFix
|
|
281
|
+
- Implemented synchronization for the login process. This fix will help avoid login session-related failures in UAT.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createBdd , test } from '@zohodesk/testinglibrary';
|
|
2
|
+
import { generateAndCacheTestData } from './DataGeneratorStepsHelper';
|
|
3
|
+
|
|
4
|
+
const { Given } = createBdd();
|
|
5
|
+
|
|
6
|
+
Given('generate a {string} entity {string} with generator {string}', async ({ page, context, i18N, cacheLayer, executionContext}, module, entityName, generatorName, dataTable) => {
|
|
7
|
+
await generateAndCacheTestData({ executionContext, type: "template", identifier: generatorName, dataTable, cacheLayer, entityName, page });
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
Given('generate a {string} entity {string} with API {string}', async ({ page, context, i18N, cacheLayer, executionContext}, module, entityName, operationId, dataTable) => {
|
|
11
|
+
await generateAndCacheTestData({ executionContext, type: "API", identifier: operationId, dataTable, cacheLayer, entityName, page });
|
|
12
|
+
});
|
|
13
|
+
Given('generate a {string} entity {string} with generator {string} using {string} profile', async ({ page, context, i18N, cacheLayer, executionContext}, module, entityName, generatorName, profile, dataTable) => {
|
|
14
|
+
await generateAndCacheTestData({ executionContext, type: "template", identifier: generatorName, dataTable, cacheLayer, entityName, profile, page });
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
Given('generate a {string} entity {string} with API {string} using {string} profile', async ({ page, context, i18N, cacheLayer, executionContext}, module, entityName, operationId, profile, dataTable) => {
|
|
18
|
+
await generateAndCacheTestData({ executionContext, type: "API", identifier: operationId, dataTable, cacheLayer, entityName, profile, page });
|
|
19
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { test } from '@zohodesk/testinglibrary';
|
|
2
|
+
import DataGenerator from '@zohodesk/testinglibrary/DataGenerator';
|
|
3
|
+
import {getUserForSelectedEditionAndProfile} from '@zohodesk/testinglibrary/helpers'
|
|
4
|
+
|
|
5
|
+
const dataGenerator = new DataGenerator();
|
|
6
|
+
|
|
7
|
+
export async function generateAndCacheTestData({ executionContext, type, identifier, dataTable, cacheLayer, entityName, profile = null, page = null }) {
|
|
8
|
+
let actorInfo;
|
|
9
|
+
const testInfo = test.info();
|
|
10
|
+
const scenarioName = testInfo.title.split('/').pop() || 'Unknown Scenario';
|
|
11
|
+
|
|
12
|
+
if (profile) {
|
|
13
|
+
const { edition, orgName: portal, beta } = executionContext.actorInfo;
|
|
14
|
+
actorInfo = await getUserForSelectedEditionAndProfile(edition, profile, beta, portal);
|
|
15
|
+
} else {
|
|
16
|
+
actorInfo = executionContext.actorInfo;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const generatedData = await dataGenerator.generate(testInfo, actorInfo, type, identifier, scenarioName, dataTable ? dataTable.hashes() : [], page);
|
|
20
|
+
await cacheLayer.set(entityName, generatedData.data);
|
|
21
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createBdd } from '@zohodesk/testinglibrary';
|
|
2
|
+
const { BeforeScenario, Given } = createBdd();
|
|
3
|
+
|
|
4
|
+
BeforeScenario(async function({ page, context, browser, cacheLayer, executionContext, actorContext }) {
|
|
5
|
+
// This will run before each scenario and set all the fixtures into this context
|
|
6
|
+
this.page = page;
|
|
7
|
+
this.context = context;
|
|
8
|
+
this.browser = browser;
|
|
9
|
+
this.cacheLayer = cacheLayer;
|
|
10
|
+
this.executionContext = executionContext;
|
|
11
|
+
this.setActor = async (role) => {
|
|
12
|
+
const userPage = actorContext.actorsObj[role];
|
|
13
|
+
if (userPage) {
|
|
14
|
+
this.page = userPage.page;
|
|
15
|
+
this.context = userPage.context;
|
|
16
|
+
this.browser = userPage.browser;
|
|
17
|
+
this.executionContext = userPage.executionContext;
|
|
18
|
+
} else {
|
|
19
|
+
throw new Error(`Actor "${role}" not found in user pages.`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
Given("access the {string} profile page", async function({ page }, userRole) {
|
|
25
|
+
await this.setActor(userRole);
|
|
26
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { expect } from '@zohodesk/testinglibrary';
|
|
2
|
+
|
|
3
|
+
async function executeRpcRequest(page, payload) {
|
|
4
|
+
|
|
5
|
+
const url = new URL(page.url());
|
|
6
|
+
const baseUrl = `${url.protocol}//${url.host}`;
|
|
7
|
+
const invokeURL = `${baseUrl}/api/testing/acceptanceTest/rpc/invoke`;
|
|
8
|
+
|
|
9
|
+
try {
|
|
10
|
+
const response = await page.request.post(invokeURL, {
|
|
11
|
+
headers: {'Content-Type': 'application/json'},
|
|
12
|
+
data: payload
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
if (!response.ok()) {
|
|
16
|
+
throw new Error(`HTTP ${response.status()}: ${response.statusText()}`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const responseData = await response.json();
|
|
20
|
+
expect(responseData.data).toHaveProperty('status', 'success');
|
|
21
|
+
|
|
22
|
+
} catch (error) {
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
async function entityIdReConstructor(payload) {
|
|
29
|
+
|
|
30
|
+
if (typeof payload !== 'object' || payload === null) {
|
|
31
|
+
throw new Error('Invalid payload. It must be a non-null object.');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (!payload.arguments || (!payload.arguments.entityId)) {
|
|
35
|
+
throw new Error('Invalid payload.arguments.entityId. It must be a non-empty string or array of strings.');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const entityId = payload.arguments.entityId;
|
|
39
|
+
|
|
40
|
+
// If it's already an array, validate and clean it
|
|
41
|
+
if (Array.isArray(entityId)) {
|
|
42
|
+
payload.arguments.entityId = entityId.map(id => id.trim());
|
|
43
|
+
}
|
|
44
|
+
// If it's a string, split and convert to array
|
|
45
|
+
else if (typeof entityId === 'string') {
|
|
46
|
+
payload.arguments.entityId = entityId.split(',').map(id => id.trim());
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return payload;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
module.exports = { executeRpcRequest, entityIdReConstructor };
|