import { test, expect } from '@playwright/test';
import { login } from './helpers/auth';

/**
 * Classic Split layout — verifies the right column visibility guard.
 *
 * The right column (DropZone + NeedsMetadata queue) is only rendered when
 * `canWrite === true` or there are incomplete docs. A read-only user with a
 * complete archive must never see an empty 300px ghost column.
 */

test.describe('Dashboard Classic Split — write user', () => {
	test('right column is visible for admin user', async ({ page }) => {
		await page.goto('/');
		await expect(page.getByTestId('dashboard-right-column')).toBeVisible();
	});
});

test.describe('Dashboard Classic Split — read-only user', () => {
	test.use({ storageState: { cookies: [], origins: [] } });

	test.beforeEach(async ({ page }) => {
		await login(page, 'reader', 'reader123');
	});

	test('right column is absent for read-only user with no incomplete docs', async ({ page }) => {
		await expect(page.getByTestId('dashboard-right-column')).not.toBeVisible();
	});
});
