mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
wip: Fix showing final status of a test run
This commit is contained in:
parent
58bd7133c4
commit
0075d87081
|
@ -8,6 +8,7 @@ import { TestRun } from '@/databases/entities/test-run.ee';
|
|||
import type { TestRunErrorCode } from '@/evaluation.ee/test-runner/errors.ee';
|
||||
import { getTestRunFinalResult } from '@/evaluation.ee/test-runner/utils.ee';
|
||||
import type { ListQuery } from '@/requests';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
|
||||
export type TestRunSummary = TestRun & {
|
||||
finalResult: 'success' | 'error' | 'warning';
|
||||
|
@ -89,4 +90,20 @@ export class TestRunRepository extends Repository<TestRun> {
|
|||
return { ...testRun, finalResult };
|
||||
});
|
||||
}
|
||||
|
||||
async getTestRunSummaryById(testDefinitionId: string, testRunId: string) {
|
||||
const testRun = await this.findOne({
|
||||
where: { id: testRunId, testDefinition: { id: testDefinitionId } },
|
||||
relations: ['testCaseExecutions'],
|
||||
});
|
||||
|
||||
if (!testRun) {
|
||||
throw new NotFoundError('Test run not found');
|
||||
}
|
||||
|
||||
const finalResult =
|
||||
testRun.status === 'completed' ? getTestRunFinalResult(testRun.testCaseExecutions) : null;
|
||||
|
||||
return { ...testRun, finalResult };
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,9 +73,11 @@ export class TestRunsController {
|
|||
|
||||
@Get('/:testDefinitionId/runs/:id')
|
||||
async getOne(req: TestRunsRequest.GetOne) {
|
||||
const { testDefinitionId, id } = req.params;
|
||||
|
||||
await this.getTestDefinition(req);
|
||||
|
||||
return await this.getTestRun(req);
|
||||
return await this.testRunRepository.getTestRunSummaryById(testDefinitionId, id);
|
||||
}
|
||||
|
||||
@Get('/:testDefinitionId/runs/:id/cases')
|
||||
|
|
|
@ -25,7 +25,6 @@ const selectedRows = ref<TestRunRecord[]>([]);
|
|||
// Combine test run statuses and finalResult to get the final status
|
||||
const runSummaries = computed(() => {
|
||||
return props.runs.map(({ status, finalResult, ...run }) => {
|
||||
debugger;
|
||||
if (status === 'completed' && finalResult) {
|
||||
return { ...run, status: finalResult };
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue