import { expect, test } from '../fixtures/base'; import { createSettingsStorage } from '../fixtures/test-data/settings'; const SETTINGS_STORAGE = createSettingsStorage(); test.describe('deployment role boundary', () => { test.beforeEach(async ({ page }) => { await page.addInitScript((settings) => { localStorage.setItem('maic:account:settings-storage', settings); localStorage.setItem('locale', 'en-US'); }, SETTINGS_STORAGE); }); test('learner deployment hides and rejects the operations workbench', async ({ page }) => { await page.goto('/'); await expect(page.locator('button:has(svg.lucide-layers)')).toHaveCount(0); await expect(page.locator('button:has(svg.lucide-settings)')).toHaveCount(0); await expect(page.locator('button[aria-label*=" / "]')).toHaveCount(0); const catalogEntry = page.getByRole('button', { name: 'Open learner catalog' }); await expect(catalogEntry).toBeVisible(); await catalogEntry.click(); await expect(page).toHaveURL(/\/learn$/); const response = await page.request.get('/api/courses'); expect(response.status()).toBe(403); await expect(response.json()).resolves.toMatchObject({ success: false, errorCode: 'FORBIDDEN', }); await page.goto('/courses'); await expect(page).toHaveURL(/\/$/); await page.goto('/publish'); await expect(page).toHaveURL(/\/$/); }); test('learner task panel loads single-courseware jobs without probing ops courses', async ({ page, }) => { let courseRequestCount = 0; page.on('request', (request) => { if (new URL(request.url()).pathname === '/api/courses') courseRequestCount += 1; }); await page.route('**/api/generate-classroom?limit=50', async (route) => { await route.fulfill({ contentType: 'application/json', body: JSON.stringify({ items: [ { jobId: 'single-course-job', status: 'queued', step: 'queued', progress: 0, message: 'Waiting', createdAt: '2026-08-15T00:00:00.000Z', requirement: 'A learner-created single courseware', scenesGenerated: 0, done: false, }, ], }), }); }); await page.goto('/tasks'); await expect(page.getByText('A learner-created single courseware')).toBeVisible(); expect(courseRequestCount).toBe(0); }); });