import { test, expect } from '@playwright/test'; test.describe('Scenario 08: View Builder & Column Reordering', () => { test('reorders columns in View Builder, saves view, and verifies persistence across reload', async ({ page }) => { await page.goto('/settings/entities/deal/views', { waitUntil: 'domcontentloaded' }); await page.waitForLoadState('domcontentloaded'); // Wait for view builder to load await expect(page.locator('text=Конструктор представлений').first()).toBeVisible({ timeout: 15000 }); const columnPills = page.locator('[data-testid^="column-pill-"]'); await expect(columnPills.first()).toBeVisible({ timeout: 10000 }); const count = await columnPills.count(); expect(count).toBeGreaterThan(1); // Get first column key const firstPill = columnPills.first(); const secondPill = columnPills.nth(1); // Reorder via move button or drag-and-drop const moveRightBtn = firstPill.locator('button[title="Вправо"]'); if (await moveRightBtn.isVisible()) { await moveRightBtn.click(); } else { await secondPill.dragTo(firstPill); } // Save view const saveBtn = page.locator('[data-testid="save-view-btn"]'); await expect(saveBtn).toBeVisible(); await saveBtn.click(); // Verify toast notification that view was saved to IndexedDB await expect(page.locator('text=сохранено').first()).toBeVisible({ timeout: 10000 }); // Reload page to verify persistence await page.reload({ waitUntil: 'domcontentloaded' }); await page.waitForLoadState('domcontentloaded'); await expect(page.locator('text=Конструктор представлений').first()).toBeVisible({ timeout: 15000 }); await expect(columnPills.first()).toBeVisible({ timeout: 15000 }); }); });