@playq/core 0.2.77
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/README.md +41 -0
- package/bin/playq.js +175 -0
- package/cucumber.js +10 -0
- package/dist/exec/featureFileCache.d.ts +21 -0
- package/dist/exec/featureFileCache.js +124 -0
- package/dist/exec/featureFilePreProcess.d.ts +12 -0
- package/dist/exec/featureFilePreProcess.js +208 -0
- package/dist/exec/preLoader.d.ts +1 -0
- package/dist/exec/preLoader.js +72 -0
- package/dist/exec/preProcessEntry.d.ts +1 -0
- package/dist/exec/preProcessEntry.js +83 -0
- package/dist/exec/preProcess_old_todelete.d.ts +1 -0
- package/dist/exec/preProcess_old_todelete.js +258 -0
- package/dist/exec/runner.d.ts +1 -0
- package/dist/exec/runner.js +221 -0
- package/dist/exec/runner_orchestrator.d.ts +1 -0
- package/dist/exec/runner_orchestrator.js +85 -0
- package/dist/exec/sgGenerator.d.ts +11 -0
- package/dist/exec/sgGenerator.js +310 -0
- package/dist/global.d.ts +15 -0
- package/dist/global.js +185 -0
- package/dist/helper/actions/api/apiRequestActions.d.ts +117 -0
- package/dist/helper/actions/api/apiRequestActions.js +374 -0
- package/dist/helper/actions/api/apiValidationActions.d.ts +119 -0
- package/dist/helper/actions/api/apiValidationActions.js +615 -0
- package/dist/helper/actions/apiActions.d.ts +18 -0
- package/dist/helper/actions/apiActions.js +34 -0
- package/dist/helper/actions/apiStepDefs.d.ts +1 -0
- package/dist/helper/actions/apiStepDefs.js +64 -0
- package/dist/helper/actions/comm/commonActions.d.ts +58 -0
- package/dist/helper/actions/comm/commonActions.js +198 -0
- package/dist/helper/actions/comm/utilityActions.d.ts +131 -0
- package/dist/helper/actions/comm/utilityActions.js +351 -0
- package/dist/helper/actions/commActions.d.ts +18 -0
- package/dist/helper/actions/commActions.js +34 -0
- package/dist/helper/actions/commStepDefs.d.ts +1 -0
- package/dist/helper/actions/commStepDefs.js +57 -0
- package/dist/helper/actions/stepGroupStepDefs.d.ts +1 -0
- package/dist/helper/actions/stepGroupStepDefs.js +15 -0
- package/dist/helper/actions/web/alertActions.d.ts +61 -0
- package/dist/helper/actions/web/alertActions.js +224 -0
- package/dist/helper/actions/web/cookieActions.d.ts +45 -0
- package/dist/helper/actions/web/cookieActions.js +186 -0
- package/dist/helper/actions/web/downloadActions.d.ts +40 -0
- package/dist/helper/actions/web/downloadActions.js +153 -0
- package/dist/helper/actions/web/elementReaderActions.d.ts +95 -0
- package/dist/helper/actions/web/elementReaderActions.js +326 -0
- package/dist/helper/actions/web/formActions.d.ts +122 -0
- package/dist/helper/actions/web/formActions.js +423 -0
- package/dist/helper/actions/web/iframeActions.d.ts +23 -0
- package/dist/helper/actions/web/iframeActions.js +108 -0
- package/dist/helper/actions/web/javascriptActions.d.ts +14 -0
- package/dist/helper/actions/web/javascriptActions.js +77 -0
- package/dist/helper/actions/web/keyboardActions.d.ts +35 -0
- package/dist/helper/actions/web/keyboardActions.js +118 -0
- package/dist/helper/actions/web/localStorageActions.d.ts +51 -0
- package/dist/helper/actions/web/localStorageActions.js +163 -0
- package/dist/helper/actions/web/mouseActions.d.ts +240 -0
- package/dist/helper/actions/web/mouseActions.js +609 -0
- package/dist/helper/actions/web/reportingActions.d.ts +34 -0
- package/dist/helper/actions/web/reportingActions.js +58 -0
- package/dist/helper/actions/web/screenshotActions.d.ts +34 -0
- package/dist/helper/actions/web/screenshotActions.js +151 -0
- package/dist/helper/actions/web/testDataActions.d.ts +21 -0
- package/dist/helper/actions/web/testDataActions.js +211 -0
- package/dist/helper/actions/web/validationActions.d.ts +547 -0
- package/dist/helper/actions/web/validationActions.js +1754 -0
- package/dist/helper/actions/web/waitActions.d.ts +191 -0
- package/dist/helper/actions/web/waitActions.js +589 -0
- package/dist/helper/actions/web/webNavigation.d.ts +104 -0
- package/dist/helper/actions/web/webNavigation.js +288 -0
- package/dist/helper/actions/webActions.d.ts +32 -0
- package/dist/helper/actions/webActions.js +48 -0
- package/dist/helper/actions/webStepDefs.d.ts +1 -0
- package/dist/helper/actions/webStepDefs.js +455 -0
- package/dist/helper/browsers/browserManager.d.ts +1 -0
- package/dist/helper/browsers/browserManager.js +56 -0
- package/dist/helper/bundle/defaultEntries.d.ts +6 -0
- package/dist/helper/bundle/defaultEntries.js +200 -0
- package/dist/helper/bundle/env.d.ts +1 -0
- package/dist/helper/bundle/env.js +157 -0
- package/dist/helper/bundle/vars.d.ts +9 -0
- package/dist/helper/bundle/vars.js +375 -0
- package/dist/helper/faker/customFaker.d.ts +55 -0
- package/dist/helper/faker/customFaker.js +45 -0
- package/dist/helper/faker/modules/data/postcodes_valid_sg.json +17 -0
- package/dist/helper/faker/modules/dateTime.d.ts +18 -0
- package/dist/helper/faker/modules/dateTime.js +106 -0
- package/dist/helper/faker/modules/mobile.d.ts +4 -0
- package/dist/helper/faker/modules/mobile.js +59 -0
- package/dist/helper/faker/modules/nric.d.ts +32 -0
- package/dist/helper/faker/modules/nric.js +84 -0
- package/dist/helper/faker/modules/passport.d.ts +3 -0
- package/dist/helper/faker/modules/passport.js +36 -0
- package/dist/helper/faker/modules/person.d.ts +14 -0
- package/dist/helper/faker/modules/person.js +73 -0
- package/dist/helper/faker/modules/postcode.d.ts +6 -0
- package/dist/helper/faker/modules/postcode.js +47 -0
- package/dist/helper/fixtures/locAggregate.d.ts +7 -0
- package/dist/helper/fixtures/locAggregate.js +94 -0
- package/dist/helper/fixtures/logFixture.d.ts +8 -0
- package/dist/helper/fixtures/logFixture.js +56 -0
- package/dist/helper/fixtures/webFixture.d.ts +19 -0
- package/dist/helper/fixtures/webFixture.js +186 -0
- package/dist/helper/fixtures/webLocFixture.d.ts +2 -0
- package/dist/helper/fixtures/webLocFixture.js +144 -0
- package/dist/helper/report/allureStepLogger.d.ts +0 -0
- package/dist/helper/report/allureStepLogger.js +25 -0
- package/dist/helper/report/customiseReport.d.ts +1 -0
- package/dist/helper/report/customiseReport.js +55 -0
- package/dist/helper/report/init.d.ts +1 -0
- package/dist/helper/report/init.js +14 -0
- package/dist/helper/report/report.d.ts +1 -0
- package/dist/helper/report/report.js +102 -0
- package/dist/helper/util/dataLoader.d.ts +10 -0
- package/dist/helper/util/dataLoader.js +73 -0
- package/dist/helper/util/logger.d.ts +4 -0
- package/dist/helper/util/logger.js +61 -0
- package/dist/helper/util/session/sessionUtil.d.ts +26 -0
- package/dist/helper/util/session/sessionUtil.js +729 -0
- package/dist/helper/util/stepHelpers.d.ts +2 -0
- package/dist/helper/util/stepHelpers.js +16 -0
- package/dist/helper/util/test-data/dataLoader.d.ts +7 -0
- package/dist/helper/util/test-data/dataLoader.js +145 -0
- package/dist/helper/util/test-data/dataTest.d.ts +10 -0
- package/dist/helper/util/test-data/dataTest.js +216 -0
- package/dist/helper/util/totp/totpHelper.d.ts +38 -0
- package/dist/helper/util/totp/totpHelper.js +117 -0
- package/dist/helper/util/utilities/cryptoUtil.d.ts +2 -0
- package/dist/helper/util/utilities/cryptoUtil.js +53 -0
- package/dist/helper/util/utilities/schemaGeneratorUtil.d.ts +2 -0
- package/dist/helper/util/utilities/schemaGeneratorUtil.js +129 -0
- package/dist/helper/util/utils.d.ts +2 -0
- package/dist/helper/util/utils.js +22 -0
- package/dist/helper/wrapper/PlaywrightWrappers.d.ts +8 -0
- package/dist/helper/wrapper/PlaywrightWrappers.js +26 -0
- package/dist/helper/wrapper/assert.d.ts +9 -0
- package/dist/helper/wrapper/assert.js +23 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +57 -0
- package/dist/scripts/get-versions.d.ts +1 -0
- package/dist/scripts/get-versions.js +98 -0
- package/dist/scripts/posttest.d.ts +1 -0
- package/dist/scripts/posttest.js +29 -0
- package/dist/scripts/pretest.d.ts +1 -0
- package/dist/scripts/pretest.js +57 -0
- package/dist/scripts/util.d.ts +1 -0
- package/dist/scripts/util.js +376 -0
- package/package.json +68 -0
- package/src/exec/featureFileCache.ts +80 -0
- package/src/exec/featureFilePreProcess.ts +239 -0
- package/src/exec/preLoader.ts +72 -0
- package/src/exec/preProcessEntry.ts +59 -0
- package/src/exec/preProcess_old_todelete.ts +289 -0
- package/src/exec/runner.ts +241 -0
- package/src/exec/runnerCuke.js +90 -0
- package/src/exec/runner_orchestrator.ts +91 -0
- package/src/exec/sgGenerator.ts +373 -0
- package/src/global.ts +130 -0
- package/src/helper/actions/api/apiRequestActions.ts +362 -0
- package/src/helper/actions/api/apiValidationActions.ts +594 -0
- package/src/helper/actions/apiActions.ts +18 -0
- package/src/helper/actions/apiStepDefs.ts +80 -0
- package/src/helper/actions/comm/commonActions.ts +165 -0
- package/src/helper/actions/comm/utilityActions.ts +344 -0
- package/src/helper/actions/commActions.ts +18 -0
- package/src/helper/actions/commStepDefs.ts +72 -0
- package/src/helper/actions/stepGroupStepDefs.ts +17 -0
- package/src/helper/actions/web/alertActions.ts +179 -0
- package/src/helper/actions/web/cookieActions.ts +124 -0
- package/src/helper/actions/web/downloadActions.ts +129 -0
- package/src/helper/actions/web/elementReaderActions.ts +323 -0
- package/src/helper/actions/web/formActions.ts +469 -0
- package/src/helper/actions/web/iframeActions.ts +67 -0
- package/src/helper/actions/web/javascriptActions.ts +38 -0
- package/src/helper/actions/web/keyboardActions.ts +101 -0
- package/src/helper/actions/web/localStorageActions.ts +109 -0
- package/src/helper/actions/web/mouseActions.ts +864 -0
- package/src/helper/actions/web/reportingActions.ts +53 -0
- package/src/helper/actions/web/screenshotActions.ts +124 -0
- package/src/helper/actions/web/testDataActions.ts +162 -0
- package/src/helper/actions/web/validationActions.ts +2287 -0
- package/src/helper/actions/web/waitActions.ts +757 -0
- package/src/helper/actions/web/webNavigation.ts +313 -0
- package/src/helper/actions/webActions.ts +33 -0
- package/src/helper/actions/webStepDefs.ts +505 -0
- package/src/helper/browsers/browserManager.ts +23 -0
- package/src/helper/bundle/defaultEntries.ts +208 -0
- package/src/helper/bundle/env.ts +119 -0
- package/src/helper/bundle/vars.ts +368 -0
- package/src/helper/faker/customFaker.ts +107 -0
- package/src/helper/faker/modules/data/postcodes_valid_sg.json +17 -0
- package/src/helper/faker/modules/dateTime.ts +121 -0
- package/src/helper/faker/modules/mobile.ts +58 -0
- package/src/helper/faker/modules/nric.ts +109 -0
- package/src/helper/faker/modules/passport.ts +34 -0
- package/src/helper/faker/modules/person.ts +93 -0
- package/src/helper/faker/modules/postcode.ts +57 -0
- package/src/helper/fixtures/locAggregate.ts +61 -0
- package/src/helper/fixtures/logFixture.ts +57 -0
- package/src/helper/fixtures/webFixture.ts +206 -0
- package/src/helper/fixtures/webLocFixture.ts +143 -0
- package/src/helper/report/allureStepLogger.ts +26 -0
- package/src/helper/report/customiseReport.ts +61 -0
- package/src/helper/report/init.ts +18 -0
- package/src/helper/report/report.ts +72 -0
- package/src/helper/util/dataLoader.ts +42 -0
- package/src/helper/util/logger.ts +32 -0
- package/src/helper/util/session/sessionUtil.ts +839 -0
- package/src/helper/util/stepHelpers.ts +14 -0
- package/src/helper/util/test-data/dataLoader.ts +108 -0
- package/src/helper/util/test-data/dataTest.ts +191 -0
- package/src/helper/util/test-data/registerUser.json +7 -0
- package/src/helper/util/totp/totpHelper.ts +102 -0
- package/src/helper/util/utilities/cryptoUtil.ts +53 -0
- package/src/helper/util/utilities/schemaGeneratorUtil.ts +143 -0
- package/src/helper/util/utils.ts +28 -0
- package/src/helper/wrapper/PlaywrightWrappers.ts +28 -0
- package/src/helper/wrapper/assert.ts +25 -0
- package/src/index.ts +17 -0
- package/src/scripts/get-versions.ts +68 -0
- package/src/scripts/posttest.ts +32 -0
- package/src/scripts/pretest.ts +48 -0
- package/src/scripts/util.ts +406 -0
- package/tsconfig.json +30 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = [
|
|
4
|
+
// baseUrl
|
|
5
|
+
{
|
|
6
|
+
"name": "config.baseUrl",
|
|
7
|
+
"value": "https://your-app.com",
|
|
8
|
+
"description": "Base URL for the application",
|
|
9
|
+
},
|
|
10
|
+
// cucumber
|
|
11
|
+
{
|
|
12
|
+
"name": "config.cucumber.featureFileCache",
|
|
13
|
+
"value": "false",
|
|
14
|
+
"description": "Cache feature files for faster execution",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "config.cucumber.stepGroupCache",
|
|
18
|
+
"value": "true",
|
|
19
|
+
"description": "Cache step groups during execution",
|
|
20
|
+
},
|
|
21
|
+
// browser
|
|
22
|
+
{
|
|
23
|
+
"name": "config.browser.playwrightSession",
|
|
24
|
+
"value": "shared",
|
|
25
|
+
"description": "Playwright browser session control",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "config.browser.cucumberSession",
|
|
29
|
+
"value": "perScenario",
|
|
30
|
+
"description": "Cucumber browser session control",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "config.browser.headless",
|
|
34
|
+
"value": "true",
|
|
35
|
+
"description": "Run browser in headless mode",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"name": "config.browser.browserType",
|
|
39
|
+
"value": "chromium",
|
|
40
|
+
"description": "Browser type: chromium, firefox or webkit",
|
|
41
|
+
},
|
|
42
|
+
// artifacts
|
|
43
|
+
{
|
|
44
|
+
"name": "config.artifacts.screenshot",
|
|
45
|
+
"value": "true",
|
|
46
|
+
"description": "Capture screenshots",
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "config.artifacts.video",
|
|
50
|
+
"value": "true",
|
|
51
|
+
"description": "Capture videos",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "config.artifacts.trace",
|
|
55
|
+
"value": "true",
|
|
56
|
+
"description": "Capture Playwright traces",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"name": "config.artifacts.onFailureOnly",
|
|
60
|
+
"value": "true",
|
|
61
|
+
"description": "Capture artifacts only on failure",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "config.artifacts.onSuccessOnly",
|
|
65
|
+
"value": "false",
|
|
66
|
+
"description": "Capture artifacts only on success",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"name": "config.artifacts.cleanUpBeforeRun",
|
|
70
|
+
"value": "true",
|
|
71
|
+
"description": "Clean up artifacts before run",
|
|
72
|
+
},
|
|
73
|
+
// testExecution
|
|
74
|
+
{
|
|
75
|
+
"name": "config.testExecution.timeout",
|
|
76
|
+
"value": "80000",
|
|
77
|
+
"description": "Test execution timeout",
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"name": "config.testExecution.actionTimeout",
|
|
81
|
+
"value": "10000",
|
|
82
|
+
"description": "Action timeout in milliseconds",
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"name": "config.testExecution.navigationTimeout",
|
|
86
|
+
"value": "20000",
|
|
87
|
+
"description": "Navigation timeout in milliseconds",
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"name": "config.testExecution.retryOnFailure",
|
|
91
|
+
"value": "true",
|
|
92
|
+
"description": "Retry tests on failure",
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"name": "config.testExecution.parallel",
|
|
96
|
+
"value": "true",
|
|
97
|
+
"description": "Run tests in parallel",
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"name": "config.testExecution.maxInstances",
|
|
101
|
+
"value": "5",
|
|
102
|
+
"description": "Maximum parallel test instances",
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"name": "config.testExecution.maxRetries",
|
|
106
|
+
"value": "2",
|
|
107
|
+
"description": "Maximum number of retries",
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"name": "config.testExecution.retryDelay",
|
|
111
|
+
"value": "1000",
|
|
112
|
+
"description": "Delay between retries in milliseconds",
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"name": "config.testExecution.retryInterval",
|
|
116
|
+
"value": "2000",
|
|
117
|
+
"description": "Interval between retries in milliseconds",
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"name": "config.testExecution.retryTimeout",
|
|
121
|
+
"value": "30000",
|
|
122
|
+
"description": "Total retry timeout in milliseconds",
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"name": "config.testExecution.order",
|
|
126
|
+
"value": "sequential",
|
|
127
|
+
"description": "Test execution order",
|
|
128
|
+
},
|
|
129
|
+
// apiTest
|
|
130
|
+
{
|
|
131
|
+
"name": "config.apiTest.maxUrlRedirects",
|
|
132
|
+
"value": "5",
|
|
133
|
+
"description": "Maximum number of URL redirects",
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"name": "config.apiTest.timeout",
|
|
137
|
+
"value": "10000",
|
|
138
|
+
"description": "API request timeout in milliseconds",
|
|
139
|
+
},
|
|
140
|
+
// patternIq
|
|
141
|
+
{
|
|
142
|
+
"name": "config.patternIq.enable",
|
|
143
|
+
"value": "false",
|
|
144
|
+
"description": "Enable PatternIQ",
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"name": "config.patternIq.config",
|
|
148
|
+
"value": "default",
|
|
149
|
+
"description": "PatternIQ configuration source",
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"name": "config.patternIq.retryInterval",
|
|
153
|
+
"value": "2000",
|
|
154
|
+
"description": "PatternIQ retry interval in milliseconds",
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"name": "config.patternIq.retryTimeout",
|
|
158
|
+
"value": "30000",
|
|
159
|
+
"description": "PatternIQ total retry timeout in milliseconds",
|
|
160
|
+
},
|
|
161
|
+
// smartAi
|
|
162
|
+
{
|
|
163
|
+
"name": "config.smartAi.enable",
|
|
164
|
+
"value": "false",
|
|
165
|
+
"description": "Enable SmartAI",
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"name": "config.smartAi.consoleLog",
|
|
169
|
+
"value": "true",
|
|
170
|
+
"description": "Log SmartAI actions to console",
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"name": "config.smartAi.resolve",
|
|
174
|
+
"value": "smart",
|
|
175
|
+
"description": "SmartAI resolution mode",
|
|
176
|
+
},
|
|
177
|
+
// report
|
|
178
|
+
{
|
|
179
|
+
"name": "report.allure.singleFile",
|
|
180
|
+
"value": "false",
|
|
181
|
+
"description": "Enable Allure single file report",
|
|
182
|
+
},
|
|
183
|
+
// featureFlags
|
|
184
|
+
{
|
|
185
|
+
"name": "config.featureFlags.enableBetaUI",
|
|
186
|
+
"value": "true",
|
|
187
|
+
"description": "Enable Beta UI",
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"name": "config.featureFlags.useMockBackend",
|
|
191
|
+
"value": "false",
|
|
192
|
+
"description": "Use mock backend",
|
|
193
|
+
},
|
|
194
|
+
// supportedLanguages
|
|
195
|
+
{
|
|
196
|
+
"name": "config.supportedLanguages",
|
|
197
|
+
"value": "en,fr,es",
|
|
198
|
+
"description": "Supported languages",
|
|
199
|
+
},
|
|
200
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const loadEnv: (env?: string) => void;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.loadEnv = void 0;
|
|
37
|
+
const dotenv = __importStar(require("dotenv"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const fs = __importStar(require("fs"));
|
|
40
|
+
const loadEnv = (env) => {
|
|
41
|
+
// Setting PlayQ Project Root
|
|
42
|
+
if (!process.env['PLAYQ_PROJECT_ROOT']) {
|
|
43
|
+
process.env['PLAYQ_PROJECT_ROOT'] = findProjectRoot();
|
|
44
|
+
}
|
|
45
|
+
// Setting PlayQ Core Root
|
|
46
|
+
process.env['PLAYQ_CORE_ROOT'] = path.resolve(process.env['PLAYQ_PROJECT_ROOT'], 'src');
|
|
47
|
+
// Setting PlayQ Defaults
|
|
48
|
+
if (!process.env.PLAYQ_REPORT_OPEN)
|
|
49
|
+
process.env.PLAYQ_REPORT_OPEN = 'true';
|
|
50
|
+
// Setting PlayQ Runner
|
|
51
|
+
if (process.env.PLAYQ_RUNNER && ['bdd', 'cuke', 'cucumber'].includes(process.env.PLAYQ_RUNNER.trim())) {
|
|
52
|
+
process.env.PLAYQ_RUNNER = 'cucumber';
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
process.env.PLAYQ_RUNNER = 'playwright';
|
|
56
|
+
}
|
|
57
|
+
let envPath;
|
|
58
|
+
let playqEnvMem = undefined;
|
|
59
|
+
let playqRunnerMem = process.env['PLAYQ_RUNNER'];
|
|
60
|
+
if (process.env['PLAYQ_ENV'])
|
|
61
|
+
playqEnvMem = process.env['PLAYQ_ENV'];
|
|
62
|
+
if (env) {
|
|
63
|
+
envPath = path.resolve(process.env.PLAYQ_PROJECT_ROOT, 'environments', `${env}.env`);
|
|
64
|
+
dotenv.config({
|
|
65
|
+
override: true,
|
|
66
|
+
path: envPath
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
if (process.env.PLAYQ_ENV) {
|
|
71
|
+
process.env.PLAYQ_ENV = process.env.PLAYQ_ENV.trim();
|
|
72
|
+
envPath = path.resolve(process.env.PLAYQ_PROJECT_ROOT, 'environments', `${process.env.PLAYQ_ENV}.env`);
|
|
73
|
+
dotenv.config({
|
|
74
|
+
override: true,
|
|
75
|
+
path: envPath
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
// No explicit env passed. Try to load 'default.env' if it exists.
|
|
80
|
+
// Try several candidate roots to locate default.env. In some cases
|
|
81
|
+
// PLAYQ_PROJECT_ROOT or process.cwd() may differ depending on how
|
|
82
|
+
// Playwright/VSCode started the process, so check a few locations.
|
|
83
|
+
const candidateRoots = [process.env.PLAYQ_PROJECT_ROOT, process.cwd(), findProjectRoot()];
|
|
84
|
+
let loadedDefault = false;
|
|
85
|
+
for (const root of candidateRoots) {
|
|
86
|
+
if (!root)
|
|
87
|
+
continue;
|
|
88
|
+
const candidatePath = path.resolve(root, 'environments', 'default.env');
|
|
89
|
+
if (fs.existsSync(candidatePath)) {
|
|
90
|
+
dotenv.config({ override: true, path: candidatePath });
|
|
91
|
+
process.env.PLAYQ_ENV = 'default';
|
|
92
|
+
console.log(`ℹ️ Loaded default environment from ${candidatePath}`);
|
|
93
|
+
loadedDefault = true;
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (!loadedDefault) {
|
|
98
|
+
// As a last attempt, try walking up from this file's directory to find an 'environments' folder
|
|
99
|
+
let cur = __dirname;
|
|
100
|
+
for (let i = 0; i < 6 && !loadedDefault; i++) {
|
|
101
|
+
const candidatePath = path.resolve(cur, '..'.repeat(i), 'environments', 'default.env');
|
|
102
|
+
if (fs.existsSync(candidatePath)) {
|
|
103
|
+
dotenv.config({ override: true, path: candidatePath });
|
|
104
|
+
process.env.PLAYQ_ENV = 'default';
|
|
105
|
+
console.log(`ℹ️ Loaded default environment from ${candidatePath}`);
|
|
106
|
+
loadedDefault = true;
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (!loadedDefault) {
|
|
112
|
+
console.warn("NO ENVIRONMENTS PASSED : default.env not present or --env is undefined!");
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
process.env['PLAYQ_RUNNER'] = playqRunnerMem; // Override any environment config for PLAYQ_RUNNER.
|
|
117
|
+
if (playqEnvMem)
|
|
118
|
+
process.env['PLAYQ_ENV'] = playqEnvMem;
|
|
119
|
+
// Load variables only when not explicitly disabled and TS loader is present (parent process may not have ts-node)
|
|
120
|
+
try {
|
|
121
|
+
if (process.env.PLAYQ_NO_INIT_VARS === '1') {
|
|
122
|
+
// Parent runner explicitly disables var init; child will handle it.
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
const canRequireTs = !!require.extensions['.ts'];
|
|
126
|
+
if (!canRequireTs) {
|
|
127
|
+
// Defer var loading to the test subprocess (Playwright/Cucumber), which preloads ts-node.
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
const { initVars } = require('./vars');
|
|
131
|
+
if (typeof initVars === 'function') {
|
|
132
|
+
initVars();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
console.warn('Warning: Could not initialize vars:', error.message);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
exports.loadEnv = loadEnv;
|
|
142
|
+
function findProjectRoot() {
|
|
143
|
+
// Method 1: Check for environment variable
|
|
144
|
+
if (process.env.PLAYQ_PROJECT_ROOT) {
|
|
145
|
+
return process.env.PLAYQ_PROJECT_ROOT;
|
|
146
|
+
}
|
|
147
|
+
// Method 2: Walk up from cwd to find package.json
|
|
148
|
+
let currentDir = process.cwd();
|
|
149
|
+
while (currentDir !== path.dirname(currentDir)) {
|
|
150
|
+
if (fs.existsSync(path.join(currentDir, 'package.json'))) {
|
|
151
|
+
return currentDir;
|
|
152
|
+
}
|
|
153
|
+
currentDir = path.dirname(currentDir);
|
|
154
|
+
}
|
|
155
|
+
// Method 3: Fallback to cwd
|
|
156
|
+
return process.cwd();
|
|
157
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare function getValue(key: string, ifEmpty?: boolean): string;
|
|
2
|
+
declare function getConfigValue(key: string, ifEmpty?: boolean): string;
|
|
3
|
+
declare function setValue(key: string, value: string): void;
|
|
4
|
+
declare function replaceVariables(input: any): string;
|
|
5
|
+
declare function debugVars(): void;
|
|
6
|
+
declare function loadFileEntries(file: string, constName: string, prefix?: string): void;
|
|
7
|
+
declare function parseLooseJson(str: string): Record<string, any>;
|
|
8
|
+
declare function initVars(vars?: Record<string, string>): void;
|
|
9
|
+
export { getValue, getConfigValue, setValue, replaceVariables, debugVars, parseLooseJson, loadFileEntries, initVars };
|