@testcollab/cli 1.4.0 → 1.6.0
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
|
@@ -118,18 +118,25 @@ export async function createTestPlan(options) {
|
|
|
118
118
|
|
|
119
119
|
console.log('validating project and other details...');
|
|
120
120
|
try {
|
|
121
|
-
const projectResponse = await projectsApi.
|
|
122
|
-
|
|
123
|
-
id: parsedProjectId
|
|
124
|
-
})
|
|
121
|
+
const projectResponse = await projectsApi.getProject({
|
|
122
|
+
id: parsedProjectId
|
|
125
123
|
});
|
|
126
|
-
if(!projectResponse || !projectResponse.
|
|
124
|
+
if (!projectResponse || !projectResponse.id || projectResponse.id !== parsedProjectId) {
|
|
127
125
|
console.error('❌ Error: Project not found. Ensure you have access to this project.');
|
|
128
126
|
process.exit(1);
|
|
129
127
|
}
|
|
130
128
|
} catch (e) {
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
if (e && typeof e === 'object' && 'status' in e && 'text' in e) {
|
|
130
|
+
try {
|
|
131
|
+
const bodyText = await e.text();
|
|
132
|
+
console.error(`❌ Error: Failed to validate project (HTTP ${e.status} ${e.statusText || ''}${bodyText ? ` - ${bodyText}` : ''})`);
|
|
133
|
+
} catch {
|
|
134
|
+
console.error(`❌ Error: Failed to validate project (HTTP ${e.status} ${e.statusText || ''})`);
|
|
135
|
+
}
|
|
136
|
+
} else {
|
|
137
|
+
const message = e?.message || String(e);
|
|
138
|
+
console.error(`❌ Error: Failed to validate project (${message})`);
|
|
139
|
+
}
|
|
133
140
|
process.exit(1);
|
|
134
141
|
}
|
|
135
142
|
|
|
@@ -256,4 +263,3 @@ export async function createTestPlan(options) {
|
|
|
256
263
|
}
|
|
257
264
|
}
|
|
258
265
|
|
|
259
|
-
|
package/src/commands/report.js
CHANGED
|
@@ -216,7 +216,8 @@ export function extractTestCaseIdFromTitle(title) {
|
|
|
216
216
|
function extractTestCaseIdFromMochawesomeTest(testData) {
|
|
217
217
|
const testTitle = String(testData?.title || '').trim();
|
|
218
218
|
const fullTitle = String(testData?.fullTitle || '').trim();
|
|
219
|
-
|
|
219
|
+
// Prefer fullTitle because some reporters shorten `title` and keep the canonical ID in fullTitle.
|
|
220
|
+
return extractTestCaseIdFromTitle(fullTitle) || extractTestCaseIdFromTitle(testTitle);
|
|
220
221
|
}
|
|
221
222
|
|
|
222
223
|
function prepareMochawesomeRunRecord(testData) {
|
|
@@ -527,6 +528,7 @@ class TcApiClient {
|
|
|
527
528
|
buildUrl(endpoint) {
|
|
528
529
|
const normalized = endpoint.startsWith('/') ? endpoint : `/${endpoint}`;
|
|
529
530
|
const separator = normalized.includes('?') ? '&' : '?';
|
|
531
|
+
// console.log("build url", `${this.baseApiUrl}${normalized}${separator}token=${encodeURIComponent(this.accessToken)}`);
|
|
530
532
|
return `${this.baseApiUrl}${normalized}${separator}token=${encodeURIComponent(this.accessToken)}`;
|
|
531
533
|
}
|
|
532
534
|
|
|
@@ -871,6 +873,11 @@ async function uploadUsingReporterFlow({
|
|
|
871
873
|
|
|
872
874
|
await tcApiInstance.getTestplanConfigs();
|
|
873
875
|
|
|
876
|
+
const userData = await tcApiInstance.getUserInfo();
|
|
877
|
+
if (!userData || !userData.id) {
|
|
878
|
+
throw new Error('User could not be fetched for this API key.');
|
|
879
|
+
}
|
|
880
|
+
|
|
874
881
|
const casesAssigned = await tcApiInstance.getAssignedCases();
|
|
875
882
|
console.log({ 'Total assigned cases found': Array.isArray(casesAssigned) ? casesAssigned.length : 0 });
|
|
876
883
|
|