@appliqation/automation-sdk 2.1.7 → 2.1.8
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appliqation/automation-sdk",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.8",
|
|
4
4
|
"description": "Appliqation Automation SDK with API key authentication, custom run titles, and framework-specific reporters",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -71,8 +71,7 @@ async function globalSetup(config) {
|
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
console.log(`✅ JWT token received (expires in 1 hour)`);
|
|
75
|
-
console.log(` Run ID: ${jwtData.run_id}\n`);
|
|
74
|
+
console.log(`✅ JWT token received (expires in 1 hour)\n`);
|
|
76
75
|
|
|
77
76
|
// Step 2: Setup browser with JWT
|
|
78
77
|
console.log('🌐 Setting up browser session with JWT...');
|
|
@@ -82,9 +81,8 @@ async function globalSetup(config) {
|
|
|
82
81
|
console.log('📄 Authenticated state saved to: .auth/jwt.json\n');
|
|
83
82
|
console.log('✨ Tests will run with JWT authentication!\n');
|
|
84
83
|
|
|
85
|
-
// Store for use in tests
|
|
84
|
+
// Store for use in tests (run_id will be set by reporter when tests execute)
|
|
86
85
|
process.env.APPLIQATION_JWT_TOKEN = jwtData.jwt_token;
|
|
87
|
-
process.env.APPLIQATION_RUN_ID = jwtData.run_id;
|
|
88
86
|
|
|
89
87
|
} catch (error) {
|
|
90
88
|
console.error('\n❌ JWT authentication setup failed:', error.message);
|
|
@@ -143,46 +141,15 @@ function extractSDKConfig(config) {
|
|
|
143
141
|
* @returns {Promise<Object>} JWT data { jwt_token, run_id, user_id, project_id }
|
|
144
142
|
*/
|
|
145
143
|
async function getJWTToken(sdkConfig) {
|
|
146
|
-
//
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
environment: sdkConfig.environment,
|
|
153
|
-
title: sdkConfig.runTitle,
|
|
154
|
-
browsers: ['Chrome'], // Default browser for setup
|
|
155
|
-
device: 'Desktop',
|
|
156
|
-
// IMPORTANT: Always use Windows for JWT setup run to avoid WSL2/Linux detection issues
|
|
157
|
-
// The actual test runs will detect the correct OS from browser user agents
|
|
158
|
-
os: process.platform === 'darwin' ? 'macOS' : 'Windows', // Default to Windows (not Linux)
|
|
144
|
+
// Get browser session JWT token directly (no need to create run matrix)
|
|
145
|
+
// The SDK reporter will create run matrices automatically when tests execute
|
|
146
|
+
const jwtEndpoint = `${sdkConfig.baseUrl.replace(/\/$/, '')}/api/auth/jwt/browser`;
|
|
147
|
+
|
|
148
|
+
const jwtPayload = {
|
|
149
|
+
api_key: sdkConfig.apiKey
|
|
159
150
|
};
|
|
160
151
|
|
|
161
152
|
try {
|
|
162
|
-
const runResponse = await axios.post(createRunEndpoint, runPayload, {
|
|
163
|
-
headers: {
|
|
164
|
-
'Content-Type': 'application/json',
|
|
165
|
-
'X-API-Key': sdkConfig.apiKey,
|
|
166
|
-
},
|
|
167
|
-
httpsAgent: new https.Agent({
|
|
168
|
-
rejectUnauthorized: false, // Allow self-signed certs in dev
|
|
169
|
-
}),
|
|
170
|
-
validateStatus: (status) => status < 500,
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
if (runResponse.status !== 200 && runResponse.status !== 201) {
|
|
174
|
-
throw new Error(`Run creation failed: ${runResponse.status} - ${runResponse.data?.message || 'Unknown error'}`);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
const runId = runResponse.data.run_id;
|
|
178
|
-
|
|
179
|
-
// STEP 2: Get browser session JWT token
|
|
180
|
-
const jwtEndpoint = `${sdkConfig.baseUrl.replace(/\/$/, '')}/api/auth/jwt/browser`;
|
|
181
|
-
|
|
182
|
-
const jwtPayload = {
|
|
183
|
-
api_key: sdkConfig.apiKey
|
|
184
|
-
};
|
|
185
|
-
|
|
186
153
|
const jwtResponse = await axios.post(jwtEndpoint, jwtPayload, {
|
|
187
154
|
headers: {
|
|
188
155
|
'Content-Type': 'application/json',
|
|
@@ -199,7 +166,7 @@ async function getJWTToken(sdkConfig) {
|
|
|
199
166
|
|
|
200
167
|
return {
|
|
201
168
|
jwt_token: jwtResponse.data.jwt_token,
|
|
202
|
-
run_id:
|
|
169
|
+
run_id: null, // No run created during auth setup
|
|
203
170
|
user_id: jwtResponse.data.user_id,
|
|
204
171
|
project_id: jwtResponse.data.project_id,
|
|
205
172
|
expires_in: jwtResponse.data.expires_in,
|