This commit is contained in:
2025-12-01 17:27:56 +01:00
parent e7ada8aa23
commit 98a09a3f2b
41 changed files with 2341 additions and 1525 deletions

View File

@@ -3,7 +3,7 @@ import { HostedSessionConfig } from '../../../../domain/entities/HostedSessionCo
import { StepId } from '../../../../domain/value-objects/StepId';
import type { IBrowserAutomation } from '../../../../application/ports/IScreenAutomation';
import { ISessionRepository } from '../../../../application/ports/ISessionRepository';
import { getStepName } from './templates/IRacingTemplateMap';
import { StepTransitionValidator } from '../../../../domain/services/StepTransitionValidator';
export class MockAutomationEngineAdapter implements IAutomationEngine {
private isRunning = false;
@@ -67,15 +67,13 @@ export class MockAutomationEngineAdapter implements IAutomationEngine {
// Execute current step using the browser automation
if (this.browserAutomation.executeStep) {
// Use real workflow automation with IRacingSelectorMap
const result = await this.browserAutomation.executeStep(
currentStep,
config as unknown as Record<string, unknown>,
);
if (!result.success) {
const errorMessage = `Step ${currentStep.value} (${getStepName(
currentStep.value,
)}) failed: ${result.error}`;
const stepDescription = StepTransitionValidator.getStepDescription(currentStep);
const errorMessage = `Step ${currentStep.value} (${stepDescription}) failed: ${result.error}`;
console.error(errorMessage);
// Stop automation and mark session as failed
@@ -105,9 +103,8 @@ export class MockAutomationEngineAdapter implements IAutomationEngine {
config as unknown as Record<string, unknown>,
);
if (!result.success) {
const errorMessage = `Step ${nextStep.value} (${getStepName(
nextStep.value,
)}) failed: ${result.error}`;
const stepDescription = StepTransitionValidator.getStepDescription(nextStep);
const errorMessage = `Step ${nextStep.value} (${stepDescription}) failed: ${result.error}`;
console.error(errorMessage);
// Don't try to fail terminal session - just log the error
// Session is already in STOPPED_AT_STEP_18 state after transitionToStep()