This commit is contained in:
2025-12-03 16:33:12 +01:00
parent a572e6edce
commit c0fdae3d3c
157 changed files with 7824 additions and 1042 deletions

View File

@@ -1,11 +1,11 @@
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
import { StepId } from 'packages/domain/value-objects/StepId';
import { StepId } from 'packages/automation-domain/value-objects/StepId';
import {
FixtureServer,
PlaywrightAutomationAdapter,
} from 'packages/infrastructure/adapters/automation';
import { IRACING_SELECTORS } from 'packages/infrastructure/adapters/automation/dom/IRacingSelectors';
import { PinoLogAdapter } from 'packages/infrastructure/adapters/logging/PinoLogAdapter';
} from 'packages/automation-infrastructure/adapters/automation';
import { IRACING_SELECTORS } from 'packages/automation-infrastructure/adapters/automation/dom/IRacingSelectors';
import { PinoLogAdapter } from 'packages/automation-infrastructure/adapters/logging/PinoLogAdapter';
describe('Real Playwright hosted-session smoke (fixtures, steps 27)', () => {
let server: FixtureServer;

View File

@@ -1,8 +1,8 @@
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
import { DIContainer } from '../../../apps/companion/main/di-container';
import { StepId } from 'packages/domain/value-objects/StepId';
import type { HostedSessionConfig } from 'packages/domain/entities/HostedSessionConfig';
import { PlaywrightAutomationAdapter } from 'packages/infrastructure/adapters/automation';
import { StepId } from 'packages/automation-domain/value-objects/StepId';
import type { HostedSessionConfig } from 'packages/automation-domain/entities/HostedSessionConfig';
import { PlaywrightAutomationAdapter } from 'packages/automation-infrastructure/adapters/automation';
describe('Companion UI - hosted workflow via fixture-backed real stack', () => {
let container: DIContainer;

View File

@@ -1,13 +1,13 @@
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
import { StepId } from 'packages/domain/value-objects/StepId';
import { StepId } from 'packages/automation-domain/value-objects/StepId';
import {
PlaywrightAutomationAdapter,
} from 'packages/infrastructure/adapters/automation';
} from 'packages/automation-infrastructure/adapters/automation';
import {
IRACING_SELECTORS,
IRACING_TIMEOUTS,
} from 'packages/infrastructure/adapters/automation/dom/IRacingSelectors';
import { PinoLogAdapter } from 'packages/infrastructure/adapters/logging/PinoLogAdapter';
} from 'packages/automation-infrastructure/adapters/automation/dom/IRacingSelectors';
import { PinoLogAdapter } from 'packages/automation-infrastructure/adapters/logging/PinoLogAdapter';
const shouldRun = process.env.HOSTED_REAL_E2E === '1';
const describeMaybe = shouldRun ? describe : describe.skip;

View File

@@ -1,13 +1,13 @@
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
import { StepId } from 'packages/domain/value-objects/StepId';
import { StepId } from 'packages/automation-domain/value-objects/StepId';
import {
PlaywrightAutomationAdapter,
} from 'packages/infrastructure/adapters/automation';
} from 'packages/automation-infrastructure/adapters/automation';
import {
IRACING_SELECTORS,
IRACING_TIMEOUTS,
} from 'packages/infrastructure/adapters/automation/dom/IRacingSelectors';
import { PinoLogAdapter } from 'packages/infrastructure/adapters/logging/PinoLogAdapter';
} from 'packages/automation-infrastructure/adapters/automation/dom/IRacingSelectors';
import { PinoLogAdapter } from 'packages/automation-infrastructure/adapters/logging/PinoLogAdapter';
const shouldRun = process.env.HOSTED_REAL_E2E === '1';

View File

@@ -1,15 +1,15 @@
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
import { promises as fs } from 'fs';
import path from 'path';
import { StepId } from 'packages/domain/value-objects/StepId';
import { StepId } from 'packages/automation-domain/value-objects/StepId';
import {
PlaywrightAutomationAdapter,
} from 'packages/infrastructure/adapters/automation';
} from 'packages/automation-infrastructure/adapters/automation';
import {
IRACING_SELECTORS,
IRACING_TIMEOUTS,
} from 'packages/infrastructure/adapters/automation/dom/IRacingSelectors';
import { PinoLogAdapter } from 'packages/infrastructure/adapters/logging/PinoLogAdapter';
} from 'packages/automation-infrastructure/adapters/automation/dom/IRacingSelectors';
import { PinoLogAdapter } from 'packages/automation-infrastructure/adapters/logging/PinoLogAdapter';
const shouldRun = process.env.HOSTED_REAL_E2E === '1';
const describeMaybe = shouldRun ? describe : describe.skip;

View File

@@ -1,7 +1,7 @@
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import type { StepHarness } from '../support/StepHarness';
import { createStepHarness } from '../support/StepHarness';
import { IRACING_SELECTORS } from 'packages/infrastructure/adapters/automation/dom/IRacingSelectors';
import { IRACING_SELECTORS } from 'packages/automation-infrastructure/adapters/automation/dom/IRacingSelectors';
describe('Step 2 create race', () => {
let harness: StepHarness;

View File

@@ -1,7 +1,7 @@
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import type { StepHarness } from '../support/StepHarness';
import { createStepHarness } from '../support/StepHarness';
import { IRACING_SELECTORS } from 'packages/infrastructure/adapters/automation/dom/IRacingSelectors';
import { IRACING_SELECTORS } from 'packages/automation-infrastructure/adapters/automation/dom/IRacingSelectors';
describe('Step 3 race information', () => {
let harness: StepHarness;

View File

@@ -1,7 +1,7 @@
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import type { StepHarness } from '../support/StepHarness';
import { createStepHarness } from '../support/StepHarness';
import { IRACING_SELECTORS } from 'packages/infrastructure/adapters/automation/dom/IRacingSelectors';
import { IRACING_SELECTORS } from 'packages/automation-infrastructure/adapters/automation/dom/IRacingSelectors';
describe('Step 4 server details', () => {
let harness: StepHarness;

View File

@@ -1,7 +1,7 @@
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import type { StepHarness } from '../support/StepHarness';
import { createStepHarness } from '../support/StepHarness';
import { IRACING_SELECTORS } from 'packages/infrastructure/adapters/automation/dom/IRacingSelectors';
import { IRACING_SELECTORS } from 'packages/automation-infrastructure/adapters/automation/dom/IRacingSelectors';
describe('Step 5 set admins', () => {
let harness: StepHarness;

View File

@@ -1,7 +1,7 @@
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import type { StepHarness } from '../support/StepHarness';
import { createStepHarness } from '../support/StepHarness';
import { IRACING_SELECTORS } from 'packages/infrastructure/adapters/automation/dom/IRacingSelectors';
import { IRACING_SELECTORS } from 'packages/automation-infrastructure/adapters/automation/dom/IRacingSelectors';
describe('Step 6 admins', () => {
let harness: StepHarness;

View File

@@ -1,7 +1,7 @@
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import type { StepHarness } from '../support/StepHarness';
import { createStepHarness } from '../support/StepHarness';
import { IRACING_SELECTORS } from 'packages/infrastructure/adapters/automation/dom/IRacingSelectors';
import { IRACING_SELECTORS } from 'packages/automation-infrastructure/adapters/automation/dom/IRacingSelectors';
describe('Step 7 time limits', () => {
let harness: StepHarness;

View File

@@ -1,7 +1,7 @@
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import type { StepHarness } from '../support/StepHarness';
import { createStepHarness } from '../support/StepHarness';
import { IRACING_SELECTORS } from 'packages/infrastructure/adapters/automation/dom/IRacingSelectors';
import { IRACING_SELECTORS } from 'packages/automation-infrastructure/adapters/automation/dom/IRacingSelectors';
describe('Step 8 cars', () => {
let harness: StepHarness;

View File

@@ -1,7 +1,7 @@
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import type { StepHarness } from '../support/StepHarness';
import { createStepHarness } from '../support/StepHarness';
import { IRACING_SELECTORS } from 'packages/infrastructure/adapters/automation/dom/IRacingSelectors';
import { IRACING_SELECTORS } from 'packages/automation-infrastructure/adapters/automation/dom/IRacingSelectors';
describe('Step 13 track options', () => {
let harness: StepHarness;

View File

@@ -1,7 +1,7 @@
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import type { StepHarness } from '../support/StepHarness';
import { createStepHarness } from '../support/StepHarness';
import { IRACING_SELECTORS } from 'packages/infrastructure/adapters/automation/dom/IRacingSelectors';
import { IRACING_SELECTORS } from 'packages/automation-infrastructure/adapters/automation/dom/IRacingSelectors';
describe('Step 14 time of day', () => {
let harness: StepHarness;

View File

@@ -1,7 +1,7 @@
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import type { StepHarness } from '../support/StepHarness';
import { createStepHarness } from '../support/StepHarness';
import { IRACING_SELECTORS } from 'packages/infrastructure/adapters/automation/dom/IRacingSelectors';
import { IRACING_SELECTORS } from 'packages/automation-infrastructure/adapters/automation/dom/IRacingSelectors';
describe('Step 15 weather', () => {
let harness: StepHarness;

View File

@@ -1,7 +1,7 @@
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import type { StepHarness } from '../support/StepHarness';
import { createStepHarness } from '../support/StepHarness';
import { CheckoutConfirmation } from 'packages/domain/value-objects/CheckoutConfirmation';
import { CheckoutConfirmation } from 'packages/automation-domain/value-objects/CheckoutConfirmation';
describe('Step 17 team driving', () => {
let harness: StepHarness;

View File

@@ -1,6 +1,6 @@
import { StepId } from 'packages/domain/value-objects/StepId';
import type { PlaywrightAutomationAdapter } from 'packages/infrastructure/adapters/automation';
import type { AutomationResult } from 'packages/application/ports/AutomationResults';
import { StepId } from 'packages/automation-domain/value-objects/StepId';
import type { PlaywrightAutomationAdapter } from 'packages/automation-infrastructure/adapters/automation';
import type { AutomationResult } from 'packages/automation-application/ports/AutomationResults';
export function assertAutoNavigationConfig(config: Record<string, unknown>): void {
if ((config as any).__skipFixtureNavigation) {

View File

@@ -1,10 +1,10 @@
import type { AutomationResult } from 'packages/application/ports/AutomationResults';
import { StepId } from 'packages/domain/value-objects/StepId';
import type { AutomationResult } from 'packages/automation-application/ports/AutomationResults';
import { StepId } from 'packages/automation-domain/value-objects/StepId';
import {
PlaywrightAutomationAdapter,
FixtureServer,
} from 'packages/infrastructure/adapters/automation';
import { PinoLogAdapter } from 'packages/infrastructure/adapters/logging/PinoLogAdapter';
} from 'packages/automation-infrastructure/adapters/automation';
import { PinoLogAdapter } from 'packages/automation-infrastructure/adapters/logging/PinoLogAdapter';
export interface StepHarness {
server: FixtureServer;

View File

@@ -2,9 +2,9 @@ import { describe, it, expect, beforeAll, afterAll } from 'vitest';
import {
PlaywrightAutomationAdapter,
FixtureServer,
} from 'packages/infrastructure/adapters/automation';
import { StepId } from 'packages/domain/value-objects/StepId';
import { PinoLogAdapter } from 'packages/infrastructure/adapters/logging/PinoLogAdapter';
} from 'packages/automation-infrastructure/adapters/automation';
import { StepId } from 'packages/automation-domain/value-objects/StepId';
import { PinoLogAdapter } from 'packages/automation-infrastructure/adapters/logging/PinoLogAdapter';
import { executeStepWithAutoNavigationGuard } from '../support/AutoNavGuard';
describe('Hosted validator guards (fixture-backed, real stack)', () => {

View File

@@ -2,10 +2,10 @@ import { describe, it, expect, beforeAll, afterAll } from 'vitest';
import {
PlaywrightAutomationAdapter,
FixtureServer,
} from 'packages/infrastructure/adapters/automation';
import { StepId } from 'packages/domain/value-objects/StepId';
import { PinoLogAdapter } from 'packages/infrastructure/adapters/logging/PinoLogAdapter';
import { IRACING_SELECTORS } from 'packages/infrastructure/adapters/automation/dom/IRacingSelectors';
} from 'packages/automation-infrastructure/adapters/automation';
import { StepId } from 'packages/automation-domain/value-objects/StepId';
import { PinoLogAdapter } from 'packages/automation-infrastructure/adapters/logging/PinoLogAdapter';
import { IRACING_SELECTORS } from 'packages/automation-infrastructure/adapters/automation/dom/IRacingSelectors';
import { executeStepWithAutoNavigationGuard } from '../support/AutoNavGuard';
describe('Workflow hosted session autonav slice (fixture-backed, real stack)', () => {

View File

@@ -2,12 +2,12 @@ import { describe, it, expect, beforeAll, afterAll } from 'vitest';
import {
PlaywrightAutomationAdapter,
FixtureServer,
} from 'packages/infrastructure/adapters/automation';
import { InMemorySessionRepository } from 'packages/infrastructure/repositories/InMemorySessionRepository';
import { AutomationEngineAdapter } from 'packages/infrastructure/adapters/automation/engine/AutomationEngineAdapter';
import { StartAutomationSessionUseCase } from 'packages/application/use-cases/StartAutomationSessionUseCase';
import { StepId } from 'packages/domain/value-objects/StepId';
import { PinoLogAdapter } from 'packages/infrastructure/adapters/logging/PinoLogAdapter';
} from 'packages/automation-infrastructure/adapters/automation';
import { InMemorySessionRepository } from 'packages/automation-infrastructure/repositories/InMemorySessionRepository';
import { AutomationEngineAdapter } from 'packages/automation-infrastructure/adapters/automation/engine/AutomationEngineAdapter';
import { StartAutomationSessionUseCase } from 'packages/automation-application/use-cases/StartAutomationSessionUseCase';
import { StepId } from 'packages/automation-domain/value-objects/StepId';
import { PinoLogAdapter } from 'packages/automation-infrastructure/adapters/logging/PinoLogAdapter';
describe('Workflow hosted session end-to-end (fixture-backed, real stack)', () => {
let server: FixtureServer;

View File

@@ -2,10 +2,10 @@ import { describe, it, expect, beforeAll, afterAll } from 'vitest';
import {
PlaywrightAutomationAdapter,
FixtureServer,
} from 'packages/infrastructure/adapters/automation';
import { StepId } from 'packages/domain/value-objects/StepId';
import { IRACING_SELECTORS } from 'packages/infrastructure/adapters/automation/dom/IRacingSelectors';
import { PinoLogAdapter } from 'packages/infrastructure/adapters/logging/PinoLogAdapter';
} from 'packages/automation-infrastructure/adapters/automation';
import { StepId } from 'packages/automation-domain/value-objects/StepId';
import { IRACING_SELECTORS } from 'packages/automation-infrastructure/adapters/automation/dom/IRacingSelectors';
import { PinoLogAdapter } from 'packages/automation-infrastructure/adapters/logging/PinoLogAdapter';
describe('Workflow steps 79 cars flow (fixture-backed, real stack)', () => {
let adapter: PlaywrightAutomationAdapter;

View File

@@ -77,7 +77,7 @@ describe('Browser Mode Integration - GREEN Phase', () => {
process.env.NODE_ENV = 'production';
const { PlaywrightAutomationAdapter } = await import(
'packages/infrastructure/adapters/automation'
'packages/automation-infrastructure/adapters/automation'
);
adapter = new PlaywrightAutomationAdapter({
@@ -96,7 +96,7 @@ describe('Browser Mode Integration - GREEN Phase', () => {
process.env.NODE_ENV = 'test';
const { PlaywrightAutomationAdapter } = await import(
'packages/infrastructure/adapters/automation'
'packages/automation-infrastructure/adapters/automation'
);
adapter = new PlaywrightAutomationAdapter({
@@ -115,7 +115,7 @@ describe('Browser Mode Integration - GREEN Phase', () => {
delete process.env.NODE_ENV;
const { PlaywrightAutomationAdapter } = await import(
'packages/infrastructure/adapters/automation'
'packages/automation-infrastructure/adapters/automation'
);
adapter = new PlaywrightAutomationAdapter({
@@ -139,7 +139,7 @@ describe('Browser Mode Integration - GREEN Phase', () => {
process.env.NODE_ENV = 'production';
const { PlaywrightAutomationAdapter } = await import(
'packages/infrastructure/adapters/automation'
'packages/automation-infrastructure/adapters/automation'
);
adapter = new PlaywrightAutomationAdapter({
@@ -155,7 +155,7 @@ describe('Browser Mode Integration - GREEN Phase', () => {
process.env.NODE_ENV = 'test';
const { PlaywrightAutomationAdapter } = await import(
'packages/infrastructure/adapters/automation'
'packages/automation-infrastructure/adapters/automation'
);
adapter = new PlaywrightAutomationAdapter({
@@ -187,7 +187,7 @@ describe('Browser Mode Integration - GREEN Phase', () => {
};
const { PlaywrightAutomationAdapter } = await import(
'packages/infrastructure/adapters/automation'
'packages/automation-infrastructure/adapters/automation'
);
adapter = new PlaywrightAutomationAdapter(
@@ -213,7 +213,7 @@ describe('Browser Mode Integration - GREEN Phase', () => {
process.env.NODE_ENV = 'production';
const { PlaywrightAutomationAdapter } = await import(
'packages/infrastructure/adapters/automation'
'packages/automation-infrastructure/adapters/automation'
);
const userDataDir = path.join(process.cwd(), 'test-browser-data');
@@ -239,10 +239,10 @@ describe('Browser Mode Integration - GREEN Phase', () => {
it('reads mode from injected loader and passes headless flag to launcher accordingly', async () => {
process.env.NODE_ENV = 'development';
const { PlaywrightAutomationAdapter } = await import(
'packages/infrastructure/adapters/automation'
'packages/automation-infrastructure/adapters/automation'
);
const { BrowserModeConfigLoader } = await import(
'../../../packages/infrastructure/config/BrowserModeConfig'
'../../../packages/automation-infrastructure/config/BrowserModeConfig'
);
// Create loader and set to headed

View File

@@ -1,7 +1,7 @@
import { describe, it, expect, beforeEach, vi } from 'vitest';
import { Result } from '../../../packages/shared/result/Result';
import { CheckoutPriceExtractor } from '../../../packages/infrastructure/adapters/automation/CheckoutPriceExtractor';
import { CheckoutStateEnum } from '../../../packages/domain/value-objects/CheckoutState';
import { CheckoutPriceExtractor } from '../../../packages/automation-infrastructure/adapters/automation/CheckoutPriceExtractor';
import { CheckoutStateEnum } from '../../../packages/automation-domain/value-objects/CheckoutState';
/**
* CheckoutPriceExtractor Integration Tests - GREEN PHASE

View File

@@ -3,7 +3,7 @@
*/
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
import { FixtureServer, getAllStepFixtureMappings, PlaywrightAutomationAdapter } from 'packages/infrastructure/adapters/automation';
import { FixtureServer, getAllStepFixtureMappings, PlaywrightAutomationAdapter } from 'packages/automation-infrastructure/adapters/automation';
declare const getComputedStyle: any;
declare const document: any;

View File

@@ -1,7 +1,7 @@
import { describe, it, expect, beforeEach } from 'vitest';
import { InMemorySessionRepository } from '../../../packages/infrastructure/repositories/InMemorySessionRepository';
import { AutomationSession } from '../../../packages/domain/entities/AutomationSession';
import { StepId } from '../../../packages/domain/value-objects/StepId';
import { InMemorySessionRepository } from '../../../packages/automation-infrastructure/repositories/InMemorySessionRepository';
import { AutomationSession } from '../../../packages/automation-domain/entities/AutomationSession';
import { StepId } from '../../../packages/automation-domain/value-objects/StepId';
describe('InMemorySessionRepository Integration Tests', () => {
let repository: InMemorySessionRepository;

View File

@@ -1,6 +1,6 @@
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
import { MockBrowserAutomationAdapter } from 'packages/infrastructure/adapters/automation';
import { StepId } from 'packages/domain/value-objects/StepId';
import { MockBrowserAutomationAdapter } from 'packages/automation-infrastructure/adapters/automation';
import { StepId } from 'packages/automation-domain/value-objects/StepId';
describe('MockBrowserAutomationAdapter Integration Tests', () => {
let adapter: MockBrowserAutomationAdapter;

View File

@@ -1,5 +1,5 @@
import { describe, test, expect } from 'vitest'
import { PlaywrightAutomationAdapter } from 'packages/infrastructure/adapters/automation'
import { PlaywrightAutomationAdapter } from 'packages/automation-infrastructure/adapters/automation'
describe('CarsFlow integration', () => {
test('adapter emits panel-attached then action-started then action-complete for performAddCar', async () => {

View File

@@ -1,14 +1,14 @@
import { describe, it, expect } from 'vitest';
import { OverlaySyncService } from 'packages/application/services/OverlaySyncService';
import type { AutomationEvent } from 'packages/application/ports/IAutomationEventPublisher';
import { OverlaySyncService } from 'packages/automation-application/services/OverlaySyncService';
import type { AutomationEvent } from 'packages/automation-application/ports/IAutomationEventPublisher';
import type {
IAutomationLifecycleEmitter,
LifecycleCallback,
} from 'packages/infrastructure/adapters/IAutomationLifecycleEmitter';
} from 'packages/automation-infrastructure/adapters/IAutomationLifecycleEmitter';
import type {
OverlayAction,
ActionAck,
} from 'packages/application/ports/IOverlaySyncPort';
} from 'packages/automation-application/ports/IOverlaySyncPort';
class TestLifecycleEmitter implements IAutomationLifecycleEmitter {
private callbacks: Set<LifecycleCallback> = new Set();

View File

@@ -1,8 +1,8 @@
import { describe, it, expect } from 'vitest';
import { PageStateValidator } from 'packages/domain/services/PageStateValidator';
import { StepTransitionValidator } from 'packages/domain/services/StepTransitionValidator';
import { StepId } from 'packages/domain/value-objects/StepId';
import { SessionState } from 'packages/domain/value-objects/SessionState';
import { PageStateValidator } from 'packages/automation-domain/services/PageStateValidator';
import { StepTransitionValidator } from 'packages/automation-domain/services/StepTransitionValidator';
import { StepId } from 'packages/automation-domain/value-objects/StepId';
import { SessionState } from 'packages/automation-domain/value-objects/SessionState';
describe('Validator conformance (integration)', () => {
describe('PageStateValidator with hosted-session selectors', () => {

View File

@@ -1,8 +1,8 @@
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { DIContainer } from '../../../..//apps/companion/main/di-container';
import type { HostedSessionConfig } from '../../../..//packages/domain/entities/HostedSessionConfig';
import { StepId } from '../../../..//packages/domain/value-objects/StepId';
import { PlaywrightAutomationAdapter } from '../../../..//packages/infrastructure/adapters/automation';
import type { HostedSessionConfig } from '../../../..//packages/automation-domain/entities/HostedSessionConfig';
import { StepId } from '../../../..//packages/automation-domain/value-objects/StepId';
import { PlaywrightAutomationAdapter } from '../../../..//packages/automation-infrastructure/adapters/automation';
describe('companion start automation - browser mode refresh wiring', () => {
const originalEnv = { ...process.env };

View File

@@ -1,8 +1,8 @@
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { DIContainer } from '../../../..//apps/companion/main/di-container';
import type { HostedSessionConfig } from '../../../..//packages/domain/entities/HostedSessionConfig';
import { StepId } from '../../../..//packages/domain/value-objects/StepId';
import { PlaywrightAutomationAdapter } from '../../../..//packages/infrastructure/adapters/automation';
import type { HostedSessionConfig } from '../../../..//packages/automation-domain/entities/HostedSessionConfig';
import { StepId } from '../../../..//packages/automation-domain/value-objects/StepId';
import { PlaywrightAutomationAdapter } from '../../../..//packages/automation-infrastructure/adapters/automation';
describe('companion start automation - browser not connected at step 1', () => {
const originalEnv = { ...process.env };

View File

@@ -1,7 +1,7 @@
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
import { DIContainer } from '../../../..//apps/companion/main/di-container';
import type { HostedSessionConfig } from '../../../..//packages/domain/entities/HostedSessionConfig';
import { PlaywrightAutomationAdapter } from '../../../..//packages/infrastructure/adapters/automation';
import type { HostedSessionConfig } from '../../../..//packages/automation-domain/entities/HostedSessionConfig';
import { PlaywrightAutomationAdapter } from '../../../..//packages/automation-infrastructure/adapters/automation';
describe('companion start automation - browser connection failure before steps', () => {
const originalEnv = { ...process.env };

View File

@@ -1,7 +1,7 @@
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { DIContainer } from '../../../..//apps/companion/main/di-container';
import type { HostedSessionConfig } from '../../../..//packages/domain/entities/HostedSessionConfig';
import { StepId } from '../../../..//packages/domain/value-objects/StepId';
import type { HostedSessionConfig } from '../../../..//packages/automation-domain/entities/HostedSessionConfig';
import { StepId } from '../../../..//packages/automation-domain/value-objects/StepId';
describe('companion start automation - happy path', () => {
const originalEnv = { ...process.env };

View File

@@ -1,8 +1,8 @@
import { describe, it, expect } from 'vitest';
import { MockAutomationLifecycleEmitter } from '../../../mocks/MockAutomationLifecycleEmitter';
import { OverlaySyncService } from 'packages/application/services/OverlaySyncService';
import type { AutomationEvent } from 'packages/application/ports/IAutomationEventPublisher';
import type { OverlayAction } from 'packages/application/ports/IOverlaySyncPort';
import { OverlaySyncService } from 'packages/automation-application/services/OverlaySyncService';
import type { AutomationEvent } from 'packages/automation-application/ports/IAutomationEventPublisher';
import type { OverlayAction } from 'packages/automation-application/ports/IOverlaySyncPort';
type RendererOverlayState =
| { status: 'idle' }

View File

@@ -1,6 +1,6 @@
import { describe, expect, test } from 'vitest'
import { MockAutomationLifecycleEmitter } from '../../../mocks/MockAutomationLifecycleEmitter'
import { OverlaySyncService } from 'packages/application/services/OverlaySyncService'
import { OverlaySyncService } from 'packages/automation-application/services/OverlaySyncService'
describe('renderer overlay integration', () => {
test('renderer shows confirmed only after main acks confirmed', async () => {

View File

@@ -1,13 +1,13 @@
import { describe, it, expect, beforeEach, vi } from 'vitest';
import { DIContainer } from '../../apps/companion/main/di-container';
import { StartAutomationSessionUseCase } from '../../packages/application/use-cases/StartAutomationSessionUseCase';
import { CheckAuthenticationUseCase } from '../../packages/application/use-cases/CheckAuthenticationUseCase';
import { InitiateLoginUseCase } from '../../packages/application/use-cases/InitiateLoginUseCase';
import { ClearSessionUseCase } from '../../packages/application/use-cases/ClearSessionUseCase';
import { ConfirmCheckoutUseCase } from '../../packages/application/use-cases/ConfirmCheckoutUseCase';
import { PlaywrightAutomationAdapter } from 'packages/infrastructure/adapters/automation';
import { InMemorySessionRepository } from '../../packages/infrastructure/repositories/InMemorySessionRepository';
import { NoOpLogAdapter } from '../../packages/infrastructure/adapters/logging/NoOpLogAdapter';
import { StartAutomationSessionUseCase } from '../../packages/automation-application/use-cases/StartAutomationSessionUseCase';
import { CheckAuthenticationUseCase } from '../../packages/automation-application/use-cases/CheckAuthenticationUseCase';
import { InitiateLoginUseCase } from '../../packages/automation-application/use-cases/InitiateLoginUseCase';
import { ClearSessionUseCase } from '../../packages/automation-application/use-cases/ClearSessionUseCase';
import { ConfirmCheckoutUseCase } from '../../packages/automation-application/use-cases/ConfirmCheckoutUseCase';
import { PlaywrightAutomationAdapter } from 'packages/automation-infrastructure/adapters/automation';
import { InMemorySessionRepository } from '../../packages/automation-infrastructure/repositories/InMemorySessionRepository';
import { NoOpLogAdapter } from '../../packages/automation-infrastructure/adapters/logging/NoOpLogAdapter';
// Mock Electron's app module
vi.mock('electron', () => ({

View File

@@ -1,5 +1,5 @@
import { describe, it, expect, afterEach, beforeAll, afterAll } from 'vitest';
import { PlaywrightAutomationAdapter, FixtureServer } from 'packages/infrastructure/adapters/automation';
import { PlaywrightAutomationAdapter, FixtureServer } from 'packages/automation-infrastructure/adapters/automation';
describe('Playwright Adapter Smoke Tests', () => {
let adapter: PlaywrightAutomationAdapter | undefined;

View File

@@ -0,0 +1,205 @@
import { test, expect, Page, Request, Response } from '@playwright/test';
import * as fs from 'fs';
import * as path from 'path';
interface RouteIssue {
route: string;
consoleErrors: string[];
consoleWarnings: string[];
networkFailures: Array<{
url: string;
status?: number;
failure?: string;
}>;
}
/**
* Recursively scans the Next.js app directory to discover all routes.
* Dynamic segments like [id] are replaced with "demo".
*/
function discoverRoutes(appDir: string): string[] {
const routes: Set<string> = new Set();
function scanDirectory(dir: string, routePrefix: string = ''): void {
const entries = fs.readdirSync(dir, { withFileTypes: true });
for (const entry of entries) {
const fullPath = path.join(dir, entry.name);
if (entry.isDirectory()) {
// Handle dynamic segments: [id] -> demo
const segment = entry.name.match(/^\[(.+)\]$/)
? 'demo'
: entry.name;
// Skip special Next.js directories
if (!entry.name.startsWith('_') && !entry.name.startsWith('.')) {
const newPrefix = routePrefix + '/' + segment;
scanDirectory(fullPath, newPrefix);
}
} else if (entry.isFile() && entry.name === 'page.tsx') {
// Found a page component - this defines a route
const route = routePrefix === '' ? '/' : routePrefix;
routes.add(route);
}
}
}
scanDirectory(appDir);
// Return sorted, deduplicated list
return Array.from(routes).sort();
}
/**
* Attaches listeners to capture console errors/warnings and network failures
* for a specific route visit.
*/
function setupIssueCapture(page: Page, issues: RouteIssue): void {
// Capture console errors and warnings
page.on('console', (msg) => {
const type = msg.type();
if (type === 'error') {
issues.consoleErrors.push(msg.text());
} else if (type === 'warning') {
issues.consoleWarnings.push(msg.text());
}
});
// Capture request failures
page.on('requestfailed', (request: Request) => {
issues.networkFailures.push({
url: request.url(),
failure: request.failure()?.errorText || 'Request failed',
});
});
// Capture non-2xx/3xx responses
page.on('response', (response: Response) => {
const status = response.status();
// Consider 4xx and 5xx as failures
if (status >= 400) {
issues.networkFailures.push({
url: response.url(),
status,
});
}
});
}
/**
* Formats aggregated issues into a readable failure report.
*/
function formatFailureReport(failedRoutes: RouteIssue[]): string {
const lines: string[] = [
'',
'========================================',
'SMOKE TEST FAILURES',
'========================================',
'',
];
for (const issue of failedRoutes) {
lines.push(`Route: ${issue.route}`);
lines.push('----------------------------------------');
if (issue.consoleErrors.length > 0) {
lines.push('Console Errors:');
issue.consoleErrors.forEach((err) => {
lines.push(` - ${err}`);
});
lines.push('');
}
if (issue.consoleWarnings.length > 0) {
lines.push('Console Warnings:');
issue.consoleWarnings.forEach((warn) => {
lines.push(` - ${warn}`);
});
lines.push('');
}
if (issue.networkFailures.length > 0) {
lines.push('Network Failures:');
issue.networkFailures.forEach((fail) => {
const statusPart = fail.status ? ` [${fail.status}]` : '';
const failurePart = fail.failure ? ` (${fail.failure})` : '';
lines.push(` - ${fail.url}${statusPart}${failurePart}`);
});
lines.push('');
}
lines.push('');
}
lines.push('========================================');
return lines.join('\n');
}
test.describe('Website Smoke Test', () => {
test.describe.configure({ mode: 'serial' });
let allRoutes: string[];
test.beforeAll(() => {
// Discover all routes from the app directory
const appDir = path.resolve(process.cwd(), 'apps/website/app');
allRoutes = discoverRoutes(appDir);
console.log(`Discovered ${allRoutes.length} routes:`);
allRoutes.forEach((route) => console.log(` ${route}`));
});
test('all pages load without console errors or network failures', async ({ page }) => {
const failedRoutes: RouteIssue[] = [];
for (const route of allRoutes) {
const issues: RouteIssue = {
route,
consoleErrors: [],
consoleWarnings: [],
networkFailures: [],
};
// Setup listeners before navigation
setupIssueCapture(page, issues);
try {
// Navigate to the route and wait for network to settle
await page.goto(route, {
waitUntil: 'networkidle',
timeout: 30000,
});
// Small delay to catch any late console messages
await page.waitForTimeout(500);
} catch (error) {
// Navigation failure itself
issues.networkFailures.push({
url: route,
failure: `Navigation error: ${error instanceof Error ? error.message : String(error)}`,
});
}
// Remove listeners for next iteration
page.removeAllListeners('console');
page.removeAllListeners('requestfailed');
page.removeAllListeners('response');
// Check if this route had any issues
const hasIssues =
issues.consoleErrors.length > 0 ||
issues.consoleWarnings.length > 0 ||
issues.networkFailures.length > 0;
if (hasIssues) {
failedRoutes.push(issues);
}
}
// Report all failures at once
if (failedRoutes.length > 0) {
const report = formatFailureReport(failedRoutes);
expect(failedRoutes, report).toHaveLength(0);
}
});
});

View File

@@ -1,8 +1,8 @@
import { describe, it, expect } from 'vitest';
import { Result } from '@/packages/shared/result/Result';
import { CheckoutConfirmation } from '@/packages/domain/value-objects/CheckoutConfirmation';
import { CheckoutPrice } from '@/packages/domain/value-objects/CheckoutPrice';
import { CheckoutState } from '@/packages/domain/value-objects/CheckoutState';
import { CheckoutConfirmation } from '@/packages/automation-domain/value-objects/CheckoutConfirmation';
import { CheckoutPrice } from '@/packages/automation-domain/value-objects/CheckoutPrice';
import { CheckoutState } from '@/packages/automation-domain/value-objects/CheckoutState';
/**
* Contract tests for ICheckoutConfirmationPort

View File

@@ -1,8 +1,8 @@
import { describe, expect, test } from 'vitest'
import { OverlayAction, ActionAck } from '../../../../packages/application/ports/IOverlaySyncPort'
import { IAutomationEventPublisher, AutomationEvent } from '../../../../packages/application/ports/IAutomationEventPublisher'
import { IAutomationLifecycleEmitter, LifecycleCallback } from '../../../../packages/infrastructure/adapters/IAutomationLifecycleEmitter'
import { OverlaySyncService } from '../../../../packages/application/services/OverlaySyncService'
import { OverlayAction, ActionAck } from '../../../../packages/automation-application/ports/IOverlaySyncPort'
import { IAutomationEventPublisher, AutomationEvent } from '../../../../packages/automation-application/ports/IAutomationEventPublisher'
import { IAutomationLifecycleEmitter, LifecycleCallback } from '../../../../packages/automation-infrastructure/adapters/IAutomationLifecycleEmitter'
import { OverlaySyncService } from '../../../../packages/automation-application/services/OverlaySyncService'
class MockLifecycleEmitter implements IAutomationLifecycleEmitter {
private callbacks: Set<LifecycleCallback> = new Set()

View File

@@ -1,7 +1,7 @@
import { describe, expect, test } from 'vitest'
import { OverlayAction } from '../../../../packages/application/ports/IOverlaySyncPort'
import { IAutomationLifecycleEmitter, LifecycleCallback } from '../../../../packages/infrastructure/adapters/IAutomationLifecycleEmitter'
import { OverlaySyncService } from '../../../../packages/application/services/OverlaySyncService'
import { OverlayAction } from '../../../../packages/automation-application/ports/IOverlaySyncPort'
import { IAutomationLifecycleEmitter, LifecycleCallback } from '../../../../packages/automation-infrastructure/adapters/IAutomationLifecycleEmitter'
import { OverlaySyncService } from '../../../../packages/automation-application/services/OverlaySyncService'
class MockLifecycleEmitter implements IAutomationLifecycleEmitter {
private callbacks: Set<LifecycleCallback> = new Set()

View File

@@ -1,9 +1,9 @@
import { describe, it, expect, beforeEach, vi, Mock } from 'vitest';
import { CheckAuthenticationUseCase } from '../../../../packages/application/use-cases/CheckAuthenticationUseCase';
import { AuthenticationState } from '../../../../packages/domain/value-objects/AuthenticationState';
import { BrowserAuthenticationState } from '../../../../packages/domain/value-objects/BrowserAuthenticationState';
import { CheckAuthenticationUseCase } from '../../../../packages/automation-application/use-cases/CheckAuthenticationUseCase';
import { AuthenticationState } from '../../../../packages/automation-domain/value-objects/AuthenticationState';
import { BrowserAuthenticationState } from '../../../../packages/automation-domain/value-objects/BrowserAuthenticationState';
import { Result } from '../../../../packages/shared/result/Result';
import type { IAuthenticationService } from '../../../../packages/application/ports/IAuthenticationService';
import type { IAuthenticationService } from '../../../../packages/automation-application/ports/IAuthenticationService';
interface ISessionValidator {
validateSession(): Promise<Result<boolean>>;

View File

@@ -1,10 +1,10 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { CompleteRaceCreationUseCase } from '@/packages/application/use-cases/CompleteRaceCreationUseCase';
import { CompleteRaceCreationUseCase } from '@/packages/automation-application/use-cases/CompleteRaceCreationUseCase';
import { Result } from '@/packages/shared/result/Result';
import { RaceCreationResult } from '@/packages/domain/value-objects/RaceCreationResult';
import { CheckoutPrice } from '@/packages/domain/value-objects/CheckoutPrice';
import type { ICheckoutService } from '@/packages/application/ports/ICheckoutService';
import { CheckoutState } from '@/packages/domain/value-objects/CheckoutState';
import { RaceCreationResult } from '@/packages/automation-domain/value-objects/RaceCreationResult';
import { CheckoutPrice } from '@/packages/automation-domain/value-objects/CheckoutPrice';
import type { ICheckoutService } from '@/packages/automation-application/ports/ICheckoutService';
import { CheckoutState } from '@/packages/automation-domain/value-objects/CheckoutState';
describe('CompleteRaceCreationUseCase', () => {
let mockCheckoutService: ICheckoutService;

View File

@@ -1,11 +1,11 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { ConfirmCheckoutUseCase } from '@/packages/application/use-cases/ConfirmCheckoutUseCase';
import { ConfirmCheckoutUseCase } from '@/packages/automation-application/use-cases/ConfirmCheckoutUseCase';
import { Result } from '@/packages/shared/result/Result';
import { CheckoutPrice } from '@/packages/domain/value-objects/CheckoutPrice';
import { CheckoutState } from '@/packages/domain/value-objects/CheckoutState';
import { CheckoutConfirmation } from '@/packages/domain/value-objects/CheckoutConfirmation';
import type { ICheckoutService } from '@/packages/application/ports/ICheckoutService';
import type { ICheckoutConfirmationPort } from '@/packages/application/ports/ICheckoutConfirmationPort';
import { CheckoutPrice } from '@/packages/automation-domain/value-objects/CheckoutPrice';
import { CheckoutState } from '@/packages/automation-domain/value-objects/CheckoutState';
import { CheckoutConfirmation } from '@/packages/automation-domain/value-objects/CheckoutConfirmation';
import type { ICheckoutService } from '@/packages/automation-application/ports/ICheckoutService';
import type { ICheckoutConfirmationPort } from '@/packages/automation-application/ports/ICheckoutConfirmationPort';
describe('ConfirmCheckoutUseCase - Enhanced with Confirmation Port', () => {
let mockCheckoutService: ICheckoutService;

View File

@@ -1,11 +1,11 @@
import { describe, it, expect, beforeEach, vi, Mock } from 'vitest';
import { Result } from '../../../../packages/shared/result/Result';
import { ConfirmCheckoutUseCase } from '../../../../packages/application/use-cases/ConfirmCheckoutUseCase';
import { ICheckoutService, CheckoutInfo } from '../../../../packages/application/ports/ICheckoutService';
import { ICheckoutConfirmationPort } from '../../../../packages/application/ports/ICheckoutConfirmationPort';
import { CheckoutPrice } from '../../../../packages/domain/value-objects/CheckoutPrice';
import { CheckoutState, CheckoutStateEnum } from '../../../../packages/domain/value-objects/CheckoutState';
import { CheckoutConfirmation } from '../../../../packages/domain/value-objects/CheckoutConfirmation';
import { ConfirmCheckoutUseCase } from '../../../../packages/automation-application/use-cases/ConfirmCheckoutUseCase';
import { ICheckoutService, CheckoutInfo } from '../../../../packages/automation-application/ports/ICheckoutService';
import { ICheckoutConfirmationPort } from '../../../../packages/automation-application/ports/ICheckoutConfirmationPort';
import { CheckoutPrice } from '../../../../packages/automation-domain/value-objects/CheckoutPrice';
import { CheckoutState, CheckoutStateEnum } from '../../../../packages/automation-domain/value-objects/CheckoutState';
import { CheckoutConfirmation } from '../../../../packages/automation-domain/value-objects/CheckoutConfirmation';
/**
* ConfirmCheckoutUseCase - GREEN PHASE

View File

@@ -1,9 +1,9 @@
import { describe, it, expect, vi, beforeEach, Mock } from 'vitest';
import { StartAutomationSessionUseCase } from '../../../../packages/application/use-cases/StartAutomationSessionUseCase';
import { IAutomationEngine } from '../../../../packages/application/ports/IAutomationEngine';
import { IScreenAutomation } from '../../../../packages/application/ports/IScreenAutomation';
import { ISessionRepository } from '../../../../packages/application/ports/ISessionRepository';
import { AutomationSession } from '../../../../packages/domain/entities/AutomationSession';
import { StartAutomationSessionUseCase } from '../../../../packages/automation-application/use-cases/StartAutomationSessionUseCase';
import { IAutomationEngine } from '../../../../packages/automation-application/ports/IAutomationEngine';
import { IScreenAutomation } from '../../../../packages/automation-application/ports/IScreenAutomation';
import { ISessionRepository } from '../../../../packages/automation-application/ports/ISessionRepository';
import { AutomationSession } from '../../../../packages/automation-domain/entities/AutomationSession';
describe('StartAutomationSessionUseCase', () => {
let mockAutomationEngine: {

View File

@@ -1,9 +1,9 @@
import { describe, it, expect, beforeEach, vi } from 'vitest';
import { VerifyAuthenticatedPageUseCase } from '../../../../packages/application/use-cases/VerifyAuthenticatedPageUseCase';
import { IAuthenticationService } from '../../../../packages/application/ports/IAuthenticationService';
import { VerifyAuthenticatedPageUseCase } from '../../../../packages/automation-application/use-cases/VerifyAuthenticatedPageUseCase';
import { IAuthenticationService } from '../../../../packages/automation-application/ports/IAuthenticationService';
import { Result } from '../../../../packages/shared/result/Result';
import { BrowserAuthenticationState } from '../../../../packages/domain/value-objects/BrowserAuthenticationState';
import { AuthenticationState } from '../../../../packages/domain/value-objects/AuthenticationState';
import { BrowserAuthenticationState } from '../../../../packages/automation-domain/value-objects/BrowserAuthenticationState';
import { AuthenticationState } from '../../../../packages/automation-domain/value-objects/AuthenticationState';
describe('VerifyAuthenticatedPageUseCase', () => {
let useCase: VerifyAuthenticatedPageUseCase;

View File

@@ -1,7 +1,7 @@
import { describe, it, expect } from 'vitest';
import { AutomationSession } from '../../../../packages/domain/entities/AutomationSession';
import { StepId } from '../../../../packages/domain/value-objects/StepId';
import { SessionState } from '../../../../packages/domain/value-objects/SessionState';
import { AutomationSession } from '../../../../packages/automation-domain/entities/AutomationSession';
import { StepId } from '../../../../packages/automation-domain/value-objects/StepId';
import { SessionState } from '../../../../packages/automation-domain/value-objects/SessionState';
describe('AutomationSession Entity', () => {
describe('create', () => {

View File

@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
import { PageStateValidator } from '../../../../packages/domain/services/PageStateValidator';
import { PageStateValidator } from '../../../../packages/automation-domain/services/PageStateValidator';
describe('PageStateValidator', () => {
const validator = new PageStateValidator();

View File

@@ -1,7 +1,7 @@
import { describe, it, expect } from 'vitest';
import { StepTransitionValidator } from '../../../../packages/domain/services/StepTransitionValidator';
import { StepId } from '../../../../packages/domain/value-objects/StepId';
import { SessionState } from '../../../../packages/domain/value-objects/SessionState';
import { StepTransitionValidator } from '../../../../packages/automation-domain/services/StepTransitionValidator';
import { StepId } from '../../../../packages/automation-domain/value-objects/StepId';
import { SessionState } from '../../../../packages/automation-domain/value-objects/SessionState';
describe('StepTransitionValidator Service', () => {
describe('canTransition', () => {

View File

@@ -1,6 +1,6 @@
import { describe, test, expect } from 'vitest';
import { BrowserAuthenticationState } from '../../../../packages/domain/value-objects/BrowserAuthenticationState';
import { AuthenticationState } from '../../../../packages/domain/value-objects/AuthenticationState';
import { BrowserAuthenticationState } from '../../../../packages/automation-domain/value-objects/BrowserAuthenticationState';
import { AuthenticationState } from '../../../../packages/automation-domain/value-objects/AuthenticationState';
describe('BrowserAuthenticationState', () => {
describe('isFullyAuthenticated()', () => {

View File

@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
import { CheckoutConfirmation } from '../../../../packages/domain/value-objects/CheckoutConfirmation';
import { CheckoutConfirmation } from '../../../../packages/automation-domain/value-objects/CheckoutConfirmation';
describe('CheckoutConfirmation Value Object', () => {
describe('create', () => {

View File

@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
import { CheckoutPrice } from '../../../../packages/domain/value-objects/CheckoutPrice';
import { CheckoutPrice } from '../../../../packages/automation-domain/value-objects/CheckoutPrice';
/**
* CheckoutPrice Value Object - GREEN PHASE

View File

@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
import { CheckoutState, CheckoutStateEnum } from '../../../../packages/domain/value-objects/CheckoutState';
import { CheckoutState, CheckoutStateEnum } from '../../../../packages/automation-domain/value-objects/CheckoutState';
/**
* CheckoutState Value Object - GREEN PHASE

View File

@@ -1,5 +1,5 @@
import { describe, test, expect } from 'vitest';
import { CookieConfiguration } from '../../../../packages/domain/value-objects/CookieConfiguration';
import { CookieConfiguration } from '../../../../packages/automation-domain/value-objects/CookieConfiguration';
describe('CookieConfiguration', () => {
const validTargetUrl = 'https://members-ng.iracing.com/jjwtauth/success';

View File

@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
import { RaceCreationResult } from '../../../../packages/domain/value-objects/RaceCreationResult';
import { RaceCreationResult } from '../../../../packages/automation-domain/value-objects/RaceCreationResult';
describe('RaceCreationResult Value Object', () => {
describe('create', () => {

View File

@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
import { SessionLifetime } from '../../../../packages/domain/value-objects/SessionLifetime';
import { SessionLifetime } from '../../../../packages/automation-domain/value-objects/SessionLifetime';
describe('SessionLifetime Value Object', () => {
describe('Construction', () => {

View File

@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
import { SessionState } from '../../../../packages/domain/value-objects/SessionState';
import { SessionState } from '../../../../packages/automation-domain/value-objects/SessionState';
describe('SessionState Value Object', () => {
describe('create', () => {

View File

@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
import { StepId } from '../../../../packages/domain/value-objects/StepId';
import { StepId } from '../../../../packages/automation-domain/value-objects/StepId';
describe('StepId Value Object', () => {
describe('create', () => {

View File

@@ -1,5 +1,5 @@
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
import { loadAutomationConfig, getAutomationMode, AutomationMode } from '../../../packages/infrastructure/config/AutomationConfig';
import { loadAutomationConfig, getAutomationMode, AutomationMode } from '../../../packages/automation-infrastructure/config/AutomationConfig';
describe('AutomationConfig', () => {
const originalEnv = process.env;

View File

@@ -1,6 +1,6 @@
import { describe, test, expect, beforeEach, vi } from 'vitest';
import type { Page } from 'playwright';
import { AuthenticationGuard } from 'packages/infrastructure/adapters/automation/auth/AuthenticationGuard';
import { AuthenticationGuard } from 'packages/automation-infrastructure/adapters/automation/auth/AuthenticationGuard';
describe('AuthenticationGuard', () => {
let mockPage: Page;

View File

@@ -9,9 +9,9 @@ vi.mock('electron', () => ({
},
}));
import { ElectronCheckoutConfirmationAdapter } from '@/packages/infrastructure/adapters/ipc/ElectronCheckoutConfirmationAdapter';
import { CheckoutPrice } from '@/packages/domain/value-objects/CheckoutPrice';
import { CheckoutState } from '@/packages/domain/value-objects/CheckoutState';
import { ElectronCheckoutConfirmationAdapter } from '@/packages/automation-infrastructure/adapters/ipc/ElectronCheckoutConfirmationAdapter';
import { CheckoutPrice } from '@/packages/automation-domain/value-objects/CheckoutPrice';
import { CheckoutState } from '@/packages/automation-domain/value-objects/CheckoutState';
import { ipcMain } from 'electron';
describe('ElectronCheckoutConfirmationAdapter', () => {

View File

@@ -1,12 +1,12 @@
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import type { Page, BrowserContext } from 'playwright';
import { PlaywrightAuthSessionService } from '../../../packages/infrastructure/adapters/automation/auth/PlaywrightAuthSessionService';
import type { PlaywrightBrowserSession } from '../../../packages/infrastructure/adapters/automation/core/PlaywrightBrowserSession';
import type { SessionCookieStore } from '../../../packages/infrastructure/adapters/automation/auth/SessionCookieStore';
import type { IPlaywrightAuthFlow } from '../../../packages/infrastructure/adapters/automation/auth/PlaywrightAuthFlow';
import type { ILogger } from '../../../packages/application/ports/ILogger';
import { AuthenticationState } from '../../../packages/domain/value-objects/AuthenticationState';
import { Result } from '../../../packages/shared/result/Result';
import { PlaywrightAuthSessionService } from '../../../../packages/automation-infrastructure/adapters/automation/auth/PlaywrightAuthSessionService';
import type { PlaywrightBrowserSession } from '../../../../packages/automation-infrastructure/adapters/automation/core/PlaywrightBrowserSession';
import type { SessionCookieStore } from '../../../../packages/automation-infrastructure/adapters/automation/auth/SessionCookieStore';
import type { IPlaywrightAuthFlow } from '../../../../packages/automation-infrastructure/adapters/automation/auth/PlaywrightAuthFlow';
import type { ILogger } from '../../../../packages/automation-application/ports/ILogger';
import { AuthenticationState } from '../../../../packages/automation-domain/value-objects/AuthenticationState';
import { Result } from '../../../../packages/shared/result/Result';
describe('PlaywrightAuthSessionService.initiateLogin browser mode behaviour', () => {
const originalEnv = { ...process.env };
@@ -98,7 +98,7 @@ describe('PlaywrightAuthSessionService.initiateLogin browser mode behaviour', ()
const result = await service.initiateLogin();
expect(result.isOk()).toBe(true);
expect(mockAuthFlow.getLoginUrl).toHaveBeenCalledTimes(2);
expect(mockAuthFlow.getLoginUrl).toHaveBeenCalledTimes(1);
expect(mockPage.goto).toHaveBeenCalledWith(
'https://members-ng.iracing.com/login',

View File

@@ -1,13 +1,13 @@
import { describe, it, expect, vi } from 'vitest';
import type { Page, Locator } from 'playwright';
import { PlaywrightAuthSessionService } from '../../../packages/infrastructure/adapters/automation/auth/PlaywrightAuthSessionService';
import { AuthenticationState } from '../../../packages/domain/value-objects/AuthenticationState';
import { BrowserAuthenticationState } from '../../../packages/domain/value-objects/BrowserAuthenticationState';
import type { ILogger } from '../../../packages/application/ports/ILogger';
import type { Result } from '../../../packages/shared/result/Result';
import type { PlaywrightBrowserSession } from '../../../packages/infrastructure/adapters/automation/core/PlaywrightBrowserSession';
import type { SessionCookieStore } from '../../../packages/infrastructure/adapters/automation/auth/SessionCookieStore';
import type { IPlaywrightAuthFlow } from '../../../packages/infrastructure/adapters/automation/auth/PlaywrightAuthFlow';
import { PlaywrightAuthSessionService } from '../../../../packages/automation-infrastructure/adapters/automation/auth/PlaywrightAuthSessionService';
import { AuthenticationState } from '../../../../packages/automation-domain/value-objects/AuthenticationState';
import { BrowserAuthenticationState } from '../../../../packages/automation-domain/value-objects/BrowserAuthenticationState';
import type { ILogger } from '../../../../packages/automation-application/ports/ILogger';
import type { Result } from '../../../../packages/shared/result/Result';
import type { PlaywrightBrowserSession } from '../../../../packages/automation-infrastructure/adapters/automation/core/PlaywrightBrowserSession';
import type { SessionCookieStore } from '../../../../packages/automation-infrastructure/adapters/automation/auth/SessionCookieStore';
import type { IPlaywrightAuthFlow } from '../../../../packages/automation-infrastructure/adapters/automation/auth/PlaywrightAuthFlow';
describe('PlaywrightAuthSessionService.verifyPageAuthentication', () => {
function createService(deps: {

View File

@@ -1,5 +1,5 @@
import { describe, test, expect, beforeEach } from 'vitest';
import { SessionCookieStore } from 'packages/infrastructure/adapters/automation/auth/SessionCookieStore';
import { SessionCookieStore } from 'packages/automation-infrastructure/adapters/automation/auth/SessionCookieStore';
import type { Cookie } from 'playwright';
describe('SessionCookieStore - Cookie Validation', () => {

View File

@@ -1,5 +1,5 @@
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { BrowserModeConfigLoader } from '../../../../packages/infrastructure/config/BrowserModeConfig';
import { BrowserModeConfigLoader } from '../../../../packages/automation-infrastructure/config/BrowserModeConfig';
/**
* Unit tests for BrowserModeConfig - GREEN PHASE