import { expect, test } from "@playwright/test" test.describe("Smoke Tests", () => { test.skip(process.env.CI === "true", "Skip smoke tests in CI until Tauri setup is fixed") test("application loads without errors", async ({ page }) => { // Слушаем ошибки консоли (исключая предупреждения) const errors: string[] = [] page.on("pageerror", (error) => { errors.push(error.message) }) // Clear localStorage before test await page.goto("/") await page.evaluate(() => { localStorage.clear() }) await page.goto("/") await page.waitForLoadState("networkidle") // Проверяем, что нет критических ошибок const criticalErrors = errors.filter( (error) => !error.includes("Cannot read properties of null") && // Временно игнорируем эти ошибки !error.includes("Cannot read properties of undefined") && !error.includes("ResizeObserver"), // Игнорируем ResizeObserver ошибки ) expect(criticalErrors).toHaveLength(0) // Проверяем, что основной контейнер загрузился await expect(page.locator("div.min-h-screen")).toBeVisible() // Ждем загрузки MediaStudio await page.waitForTimeout(2000) // Проверяем наличие основных элементов интерфейса // Проверяем заголовок страницы await expect(page).toHaveTitle("Timeline Studio") // TopBar должен быть виден (проверяем по наличию кнопок) const topBar = page .locator("div") .filter({ has: page.locator('[data-testid="theme-toggle"]') }) .first() await expect(topBar).toBeVisible({ timeout: 10000 }) }) test("can interact with UI elements", async ({ page }) => { // Clear localStorage before test await page.goto("/") await page.evaluate(() => { localStorage.clear() }) await page.goto("/") await page.waitForLoadState("networkidle") // Ждем загрузки интерфейса await page.waitForTimeout(2000) // Проверяем наличие кнопок в TopBar const themeToggle = page.locator('[data-testid="theme-toggle"]') await expect(themeToggle).toBeVisible({ timeout: 10000 }) // Проверяем кнопку keyboard shortcuts const keyboardButton = page.locator('[data-testid="keyboard-shortcuts-button"]') await expect(keyboardButton).toBeVisible({ timeout: 10000 }) // Проверяем кнопку user settings const userSettingsButton = page.locator('[data-testid="user-settings-button"]') await expect(userSettingsButton).toBeVisible({ timeout: 10000 }) // Проверяем кнопку export const exportButton = page.locator('[data-testid="export-button"]') await expect(exportButton).toBeVisible({ timeout: 10000 }) // Проверяем, что нет ошибок в консоли const errors: string[] = [] page.on("pageerror", (error) => { if (!error.message.includes("ResizeObserver")) { errors.push(error.message) } }) // Даем время на загрузку await page.waitForTimeout(1000) // Проверяем, что нет критических ошибок expect(errors).toHaveLength(0) }) })