krona-front/e2e/08-view-builder.spec.ts

43 lines
1.6 KiB
TypeScript

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');
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 or notification
await expect(page.locator('text=сохранено').or(page.locator('text=Сохранить вид')).first()).toBeVisible({ timeout: 5000 });
// Reload page to verify persistence
await page.reload();
await page.waitForLoadState('domcontentloaded');
await expect(columnPills.first()).toBeVisible({ timeout: 15000 });
});
});