@resolveio/server-lib 22.3.122 → 22.3.123
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
|
@@ -2677,14 +2677,16 @@ function buildResolveIORunnerQaWorkflowProbeScript() {
|
|
|
2677
2677
|
' const assets = query.$or.length ? await db.collection("assets").find(query).toArray() : [];',
|
|
2678
2678
|
' const yardIds = uniqueStrings([...(context.yard_ids || []), ...assets.map((asset) => asset && asset.current_location && asset.current_location.id), ...assets.map((asset) => asset && asset.id_default_yard), ...assets.flatMap((asset) => Array.isArray(asset && asset.locations) ? asset.locations.map((location) => location && location.id) : [])]);',
|
|
2679
2679
|
' const yardObjectIds = yardIds.filter((id) => /^[a-f0-9]{24}$/i.test(id)).map((id) => new ObjectId(id));',
|
|
2680
|
-
' const
|
|
2680
|
+
' const yardQuery = yardIds.length ? { $or: [{ _id: { $in: yardIds } }, ...(yardObjectIds.length ? [{ _id: { $in: yardObjectIds } }] : [])] } : null;',
|
|
2681
|
+
' const yards = yardQuery ? await db.collection("yards").find(yardQuery).toArray() : [];',
|
|
2681
2682
|
' const yardById = new Map(yards.map((yard) => [String(yard._id), yard]));',
|
|
2682
2683
|
' const rows = assets.map((asset) => {',
|
|
2683
2684
|
' const currentId = asset && asset.current_location && asset.current_location.id ? String(asset.current_location.id) : "";',
|
|
2684
2685
|
' const currentYard = currentId ? yardById.get(currentId) : null;',
|
|
2685
|
-
' const
|
|
2686
|
+
' const defaultYardName = String(asset.default_yard || "");',
|
|
2686
2687
|
' const currentName = asset && asset.current_location && asset.current_location.name ? String(asset.current_location.name) : "";',
|
|
2687
|
-
'
|
|
2688
|
+
' const canonicalName = currentYard && currentYard.name ? String(currentYard.name) : (defaultYardName || currentName);',
|
|
2689
|
+
' return { id: String(asset._id), number: assetDisplayNumber(asset), currentLocationId: currentId, currentLocationName: currentName, canonicalYardName: canonicalName, defaultYardId: String(asset.id_default_yard || ""), defaultYardName, pass: Boolean(canonicalName && currentName === canonicalName) };',
|
|
2688
2690
|
' });',
|
|
2689
2691
|
' return { assetIds, assetNumbers, rows, yards: yards.map((yard) => ({ id: String(yard._id), name: yard.name })) };',
|
|
2690
2692
|
' } finally {',
|
|
@@ -2712,6 +2714,15 @@ function buildResolveIORunnerQaWorkflowProbeScript() {
|
|
|
2712
2714
|
' const expectedNumbers = uniqueStrings(context.asset_numbers).filter((value) => /^\\d+[A-Za-z-]*$/.test(value));',
|
|
2713
2715
|
' const missingNumbers = expectedNumbers.filter((number) => !data.rows.some((row) => row.number === number));',
|
|
2714
2716
|
' const mismatchedRows = data.rows.filter((row) => !row.pass);',
|
|
2717
|
+
' if (expectedNumbers.length) {',
|
|
2718
|
+
' await page.goto(new URL(targetRoute, clientUrl).href, { waitUntil: "domcontentloaded", timeout: 60000 }).catch(() => undefined);',
|
|
2719
|
+
' await page.waitForFunction((numbers) => {',
|
|
2720
|
+
' const text = document.body ? document.body.innerText || "" : "";',
|
|
2721
|
+
' return numbers.every((number) => new RegExp(`\\\\b${String(number).replace(/[.*+?^${}()|[\\\\]\\\\\\\\]/g, "\\\\\\\\$&")}\\\\b`).test(text));',
|
|
2722
|
+
' }, { timeout: Number(process.env.RESOLVEIO_SUPPORT_QA_ROW_WAIT_MS || 15000) }, expectedNumbers).catch(() => undefined);',
|
|
2723
|
+
' routeSummary = await pageSummary(page);',
|
|
2724
|
+
' await page.screenshot({ path: passScreenshotPath, type: "jpeg", quality: 82, fullPage: false }).catch(() => undefined);',
|
|
2725
|
+
' }',
|
|
2715
2726
|
' const listText = String((routeSummary && routeSummary.bodyTextSnippet) || "");',
|
|
2716
2727
|
' const listMissing = expectedNumbers.filter((number) => !new RegExp(`\\\\b${number.replace(/[.*+?^${}()|[\\]\\\\]/g, "\\\\$&")}\\\\b`).test(listText));',
|
|
2717
2728
|
' const staleSeen = staleTerms.filter((term) => new RegExp(term.replace(/[.*+?^${}()|[\\]\\\\]/g, "\\\\$&"), "i").test(listText) || data.rows.some((row) => new RegExp(term.replace(/[.*+?^${}()|[\\]\\\\]/g, "\\\\$&"), "i").test([row.currentLocationName, row.defaultYardName].join(" "))));',
|