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 {
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 {
@ -13,54 +14,84 @@ script:pre-request {
const baseUrl = bru.getEnvVar("baseUrl") || bru.getVar("baseUrl");
const playerId = bru.getEnvVar("playerId") || bru.getVar("playerId");
const headers = { "Content-Type": "application/json" };
const gatherQuestId = "prototype_quest_gather_intro";
const alphaNodeId = "prototype_resource_node_alpha";
await axios.post(
`${baseUrl}/game/players/${playerId}/quests/prototype_quest_gather_intro/accept`,
{ schemaVersion: 1 },
{ headers, validateStatus: () => true },
);
function gatherRow(body) {
return body.quests.find((x) => x.questId === gatherQuestId);
}
await axios.post(
`${baseUrl}/game/players/${playerId}/move`,
{
schemaVersion: 1,
target: { x: 10, y: 0.9, z: -6 },
},
{ headers },
);
async function getQuestProgress() {
const response = await axios.get(
`${baseUrl}/game/players/${playerId}/quest-progress`,
{ validateStatus: () => true },
);
if (response.status !== 200) {
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(
`${baseUrl}/game/players/${playerId}/interact`,
{
schemaVersion: 1,
interactableId: "prototype_resource_node_alpha",
interactableId: alphaNodeId,
},
{ headers, validateStatus: () => true },
);
if (interact.status !== 200 || !interact.data?.success) {
throw new Error(`expected gather interact to succeed, got ${JSON.stringify(interact.data)}`);
if (interact.status !== 200) {
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(
`${baseUrl}/game/players/${playerId}/quest-progress`,
{ validateStatus: () => true },
await axios.post(
`${baseUrl}/game/players/${playerId}/quests/${gatherQuestId}/accept`,
{ schemaVersion: 1 },
{ headers, validateStatus: () => true },
);
if (firstGet.status !== 200) {
throw new Error(`expected first GET quest-progress to return 200, got ${firstGet.status}`);
}
const firstRow = firstGet.data.quests.find(
(x) => x.questId === "prototype_quest_gather_intro",
);
if (!firstRow || firstRow.status !== "completed" || !firstRow.completionRewardSummary) {
throw new Error(
`expected first GET gather intro completed with summary, got ${JSON.stringify(firstRow)}`,
let progress = await getQuestProgress();
let row = gatherRow(progress);
if (!row || row.status === "not_started") {
await axios.post(
`${baseUrl}/game/players/${playerId}/move`,
{
schemaVersion: 1,
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(
"firstGatherCompletionRewardSummary",
JSON.stringify(firstRow.completionRewardSummary),
JSON.stringify(row.completionRewardSummary),
);
}