@appliqation/automation-sdk 2.1.6 → 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.6",
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,44 +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
- // STEP 1: Create automation run
147
- const createRunEndpoint = `${sdkConfig.baseUrl.replace(/\/$/, '')}/api/automation/run/create`;
148
-
149
- const runPayload = {
150
- project_key: sdkConfig.projectKey,
151
- scenario_id: sdkConfig.scenarioId || 0,
152
- environment: sdkConfig.environment,
153
- title: sdkConfig.runTitle,
154
- browsers: ['Chrome'], // Default browser for setup
155
- device: 'Desktop',
156
- os: process.platform === 'darwin' ? 'macOS' : process.platform === 'win32' ? 'Windows' : '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
157
150
  };
158
151
 
159
152
  try {
160
- const runResponse = await axios.post(createRunEndpoint, runPayload, {
161
- headers: {
162
- 'Content-Type': 'application/json',
163
- 'X-API-Key': sdkConfig.apiKey,
164
- },
165
- httpsAgent: new https.Agent({
166
- rejectUnauthorized: false, // Allow self-signed certs in dev
167
- }),
168
- validateStatus: (status) => status < 500,
169
- });
170
-
171
- if (runResponse.status !== 200 && runResponse.status !== 201) {
172
- throw new Error(`Run creation failed: ${runResponse.status} - ${runResponse.data?.message || 'Unknown error'}`);
173
- }
174
-
175
- const runId = runResponse.data.run_id;
176
-
177
- // STEP 2: Get browser session JWT token
178
- const jwtEndpoint = `${sdkConfig.baseUrl.replace(/\/$/, '')}/api/auth/jwt/browser`;
179
-
180
- const jwtPayload = {
181
- api_key: sdkConfig.apiKey
182
- };
183
-
184
153
  const jwtResponse = await axios.post(jwtEndpoint, jwtPayload, {
185
154
  headers: {
186
155
  'Content-Type': 'application/json',
@@ -197,7 +166,7 @@ async function getJWTToken(sdkConfig) {
197
166
 
198
167
  return {
199
168
  jwt_token: jwtResponse.data.jwt_token,
200
- run_id: runId,
169
+ run_id: null, // No run created during auth setup
201
170
  user_id: jwtResponse.data.user_id,
202
171
  project_id: jwtResponse.data.project_id,
203
172
  expires_in: jwtResponse.data.expires_in,