NEO-129: fix Bruno gather interact check (allowed not success).

Tolerate craft-spine partial progress and node_depleted when the quest
is already completed in the shared CI collection run.
pull/168/head
VinPropane 2026-06-07 21:16:21 -04:00
parent 9ab3a70796
commit 5126e82c4a
1 changed files with 62 additions and 31 deletions

View File

@ -5,7 +5,8 @@ meta {
} }
docs { docs {
NEO-129: accept gather intro, complete via three alpha gathers, GET quest-progress asserts completionRewardSummary; second GET unchanged. NEO-129: accept gather intro, complete via alpha gathers, GET quest-progress asserts completionRewardSummary; second GET unchanged.
Tolerates craft spine (seq 5) partial progress and node_depleted on alpha when quest already completed.
} }
script:pre-request { script:pre-request {
@ -13,54 +14,84 @@ script:pre-request {
const baseUrl = bru.getEnvVar("baseUrl") || bru.getVar("baseUrl"); const baseUrl = bru.getEnvVar("baseUrl") || bru.getVar("baseUrl");
const playerId = bru.getEnvVar("playerId") || bru.getVar("playerId"); const playerId = bru.getEnvVar("playerId") || bru.getVar("playerId");
const headers = { "Content-Type": "application/json" }; const headers = { "Content-Type": "application/json" };
const gatherQuestId = "prototype_quest_gather_intro";
const alphaNodeId = "prototype_resource_node_alpha";
await axios.post( function gatherRow(body) {
`${baseUrl}/game/players/${playerId}/quests/prototype_quest_gather_intro/accept`, return body.quests.find((x) => x.questId === gatherQuestId);
{ schemaVersion: 1 }, }
{ headers, validateStatus: () => true },
);
await axios.post( async function getQuestProgress() {
`${baseUrl}/game/players/${playerId}/move`, const response = await axios.get(
{ `${baseUrl}/game/players/${playerId}/quest-progress`,
schemaVersion: 1, { validateStatus: () => true },
target: { x: 10, y: 0.9, z: -6 }, );
}, if (response.status !== 200) {
{ headers }, throw new Error(`quest-progress GET failed: ${response.status}`);
); }
return response.data;
}
for (let i = 0; i < 3; i += 1) { async function tryGatherAlpha() {
const interact = await axios.post( const interact = await axios.post(
`${baseUrl}/game/players/${playerId}/interact`, `${baseUrl}/game/players/${playerId}/interact`,
{ {
schemaVersion: 1, schemaVersion: 1,
interactableId: "prototype_resource_node_alpha", interactableId: alphaNodeId,
}, },
{ headers, validateStatus: () => true }, { headers, validateStatus: () => true },
); );
if (interact.status !== 200 || !interact.data?.success) { if (interact.status !== 200) {
throw new Error(`expected gather interact to succeed, got ${JSON.stringify(interact.data)}`); throw new Error(`gather interact HTTP ${interact.status}: ${JSON.stringify(interact.data)}`);
} }
if (interact.data?.allowed === true) {
return;
}
if (interact.data?.reasonCode === "node_depleted") {
return;
}
throw new Error(`gather interact denied: ${JSON.stringify(interact.data)}`);
} }
const firstGet = await axios.get( await axios.post(
`${baseUrl}/game/players/${playerId}/quest-progress`, `${baseUrl}/game/players/${playerId}/quests/${gatherQuestId}/accept`,
{ validateStatus: () => true }, { schemaVersion: 1 },
{ headers, validateStatus: () => true },
); );
if (firstGet.status !== 200) {
throw new Error(`expected first GET quest-progress to return 200, got ${firstGet.status}`); let progress = await getQuestProgress();
} let row = gatherRow(progress);
const firstRow = firstGet.data.quests.find( if (!row || row.status === "not_started") {
(x) => x.questId === "prototype_quest_gather_intro", await axios.post(
); `${baseUrl}/game/players/${playerId}/move`,
if (!firstRow || firstRow.status !== "completed" || !firstRow.completionRewardSummary) { {
throw new Error( schemaVersion: 1,
`expected first GET gather intro completed with summary, got ${JSON.stringify(firstRow)}`, target: { x: 10, y: 0.9, z: -6 },
},
{ headers },
); );
} }
for (let attempt = 0; attempt < 8; attempt += 1) {
progress = await getQuestProgress();
row = gatherRow(progress);
if (row?.status === "completed" && row.completionRewardSummary) {
break;
}
await tryGatherAlpha();
}
progress = await getQuestProgress();
row = gatherRow(progress);
if (!row || row.status !== "completed" || !row.completionRewardSummary) {
throw new Error(
`expected gather intro completed with summary, got ${JSON.stringify(row)}`,
);
}
bru.setVar( bru.setVar(
"firstGatherCompletionRewardSummary", "firstGatherCompletionRewardSummary",
JSON.stringify(firstRow.completionRewardSummary), JSON.stringify(row.completionRewardSummary),
); );
} }