Skip to content

Commit

Permalink
fix Story Status after Scenario execution
Browse files Browse the repository at this point in the history
  • Loading branch information
jonycoo committed Oct 26, 2023
1 parent 27d3518 commit 10f0138
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions backend/src/serverHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,17 @@ async function updateStoryTestStatus(storyId, storyLastTestStatus, scenarioStatu

async function updateScenarioTestStatus(uploadedReport) {
try {
await mongo.updateScenarioStatus(uploadedReport.storyId, uploadedReport.scenarioId, uploadedReport.status);
let storyStatus = uploadedReport.status;
if (uploadedReport.status === true) {
const scenarios = await mongo.getOneStory(uploadedReport.storyId).then((story) => story.scenarios);
const updateIndex = scenarios.findIndex((scen) => scen.scenario_id === uploadedReport.scenarioId);
console.log(scenarios, storyStatus, updateIndex, uploadedReport.scenarioId);
scenarios[updateIndex].lastTestPassed = uploadedReport.status;
storyStatus = scenarios.every((scen) => !!scen.lastTestPassed === true);
}
updateStoryTestStatus(uploadedReport.storyId, storyStatus, [{ scenarioId: uploadedReport.scenarioId, status: uploadedReport.status }]);
} catch (e) {
console.log('Could not Update Scenario LastTestPassed.');
console.log('Could not Update Scenario LastTestPassed.', e);
}
}

Expand Down

0 comments on commit 10f0138

Please sign in to comment.