Files
scrying-pool/_bmad-output/tests/integration/epic-3-simple-test.spec.js
T
uberwald 61f362004e Story 4.1: Task 1 Complete - PlayerPrivacyManager Core Logic
- Created src/contracts/privacy-settings.js with:
  - PrivacySettings typedef
  - PRIVACY_SETTINGS_DEFAULT (both flags false)
  - PRIVACY_SETTING_KEYS and FEATURE_NAME_MAP constants
  - createPrivacySettings() factory
  - isValidPrivacySettings() validator
  - validateSettingKey(), validateSettingValue(), validateFeatureName() helpers
- Created src/core/PlayerPrivacyManager.js with:
  - Constructor with FoundryAdapter DI validation
  - getSettings(userId) - retrieves settings from user flags
  - setSetting(userId, key, value) - async, validates, persists via user.setFlag
  - isOptedIn(userId, feature) - convenience method for feature checks
  - getAllSettings() - aggregates all users' settings (GM view)
  - onChange(callback) - subscription pattern for change events
  - teardown() - cleanup
- Created tests/unit/contracts/privacy-settings.test.js - 44 tests
- Created tests/unit/core/PlayerPrivacyManager.test.js - 35 tests
- All tests passing, lint clean
- Updated sprint-status.yaml: 4-1 from ready-for-dev to in-progress
- Updated story file: Task 1 subtasks 1.1-1.8 marked complete

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-05-23 21:11:55 +02:00

100 lines
3.1 KiB
JavaScript

/**
* Simple Epic 3 connectivity test
* Tests basic module loading and ScenePresetManager availability
*/
import { chromium, expect, test } from '@playwright/test';
const CHROME_DEVTOOLS_URL = 'ws://localhost:9222/devtools/browser/1aeaf428-412f-4e20-9f2d-c13533d031ae';
const FOUNDRY_URL = 'https://localhost:31000/game';
test('Connect to Chrome DevTools and verify Foundry page', async () => {
const browser = await chromium.connect({
wsEndpoint: CHROME_DEVTOOLS_URL
});
const pages = await browser.pages();
console.log('Available pages:', pages.length);
const foundryPage = pages.find(p => p.url().includes('localhost:31000/game'));
expect(foundryPage).toBeDefined();
await foundryPage.goto(FOUNDRY_URL);
// Wait for Foundry to load
await foundryPage.waitForFunction(() => window.game?.ready, { timeout: 30000 });
// Verify module is active
const isActive = await foundryPage.evaluate(() => {
const module = game.modules.get('video-view-manager');
return module?.active;
});
expect(isActive).toBe(true);
console.log('✓ Module is active');
// Verify ScenePresetManager exists
const hasPresetManager = await foundryPage.evaluate(() => {
const module = game.modules.get('video-view-manager');
return module?.scenePresetManager !== undefined;
});
expect(hasPresetManager).toBe(true);
console.log('✓ ScenePresetManager exists');
// Verify DirectorsBoard exists
const hasDirectorsBoard = await foundryPage.evaluate(() => {
const module = game.modules.get('video-view-manager');
return module?._directorsBoard !== undefined;
});
expect(hasDirectorsBoard).toBe(true);
console.log('✓ DirectorsBoard exists');
await browser.close();
});
test('Verify ConfirmationBar exists', async () => {
const browser = await chromium.connect({
wsEndpoint: CHROME_DEVTOOLS_URL
});
const pages = await browser.pages();
const foundryPage = pages.find(p => p.url().includes('localhost:31000/game')) || pages[0];
await foundryPage.goto(FOUNDRY_URL);
await foundryPage.waitForFunction(() => window.game?.ready, { timeout: 30000 });
const hasConfirmationBar = await foundryPage.evaluate(() => {
const module = game.modules.get('video-view-manager');
return module?._confirmationBar !== undefined;
});
expect(hasConfirmationBar).toBe(true);
console.log('✓ ConfirmationBar exists');
await browser.close();
});
test('Verify PresetImportExportManager exists', async () => {
const browser = await chromium.connect({
wsEndpoint: CHROME_DEVTOOLS_URL
});
const pages = await browser.pages();
const foundryPage = pages.find(p => p.url().includes('localhost:31000/game')) || pages[0];
await foundryPage.goto(FOUNDRY_URL);
await foundryPage.waitForFunction(() => window.game?.ready, { timeout: 30000 });
const hasImportExportManager = await foundryPage.evaluate(() => {
const module = game.modules.get('video-view-manager');
return module?.presetImportExportManager !== undefined;
});
expect(hasImportExportManager).toBe(true);
console.log('✓ PresetImportExportManager exists');
await browser.close();
});