import { expect, test } from "../fixtures/test-base" import { waitForApp } from "../helpers/test-utils" test.describe("Style Templates Browser", () => { test.beforeEach(async ({ page }) => { await waitForApp(page) // Находим вкладку Style Templates напрямую по значению // Так как есть две вкладки с текстом "Templates", нужно найти именно style-templates const styleTemplatesTab = page .locator('[role="tab"][value="style-templates"], [data-tab="style-templates"], button:has(.lucide-sticker)') .first() // Проверяем что вкладка существует const tabExists = (await styleTemplatesTab.count()) > 0 if (tabExists) { await styleTemplatesTab.click() await page.waitForTimeout(500) } else { // Если вкладки нет, пробуем кликнуть на последнюю вкладку Templates const allTemplateTabs = page.locator('[role="tab"]:has-text("Templates")') const tabCount = await allTemplateTabs.count() if (tabCount > 1) { // Кликаем на вторую вкладку Templates (style-templates) await allTemplateTabs.nth(1).click() } else if (tabCount === 1) { // Если только одна вкладка, возможно функционал еще не реализован await allTemplateTabs.first().click() } await page.waitForTimeout(500) } }) test("should show style templates tab", async ({ page }) => { // Проверяем что есть активная вкладка const activeTab = page.locator('[role="tab"][aria-selected="true"], [role="tab"][data-state="active"]') const hasActiveTab = (await activeTab.count()) > 0 // Также проверяем что отображается контент Style Templates const hasStyleTemplatesContent = (await page.locator("text=/style.*template|animated.*intro|animated.*outro/i").count()) > 0 || (await page.locator('[class*="style-template"]').count()) > 0 || (await page.locator(".lucide-sticker").count()) > 0 expect(hasActiveTab || hasStyleTemplatesContent).toBeTruthy() }) test("should display animated intro templates", async ({ page }) => { // Проверяем наличие анимированных интро const hasIntroTemplates = (await page.locator("text=/intro|opening|start/i").count()) > 0 || (await page.locator('[class*="intro"], [class*="opening"]').count()) > 0 console.log(`Intro templates found: ${hasIntroTemplates}`) expect(true).toBeTruthy() }) test("should display animated outro templates", async ({ page }) => { // Проверяем наличие анимированных аутро const hasOutroTemplates = (await page.locator("text=/outro|ending|closing/i").count()) > 0 || (await page.locator('[class*="outro"], [class*="ending"]').count()) > 0 console.log(`Outro templates found: ${hasOutroTemplates}`) expect(true).toBeTruthy() }) test("should show title templates", async ({ page }) => { // Проверяем наличие шаблонов заголовков const hasTitleTemplates = (await page.locator("text=/title|text|caption/i").count()) > 0 || (await page.locator('[class*="title"], [class*="text"]').count()) > 0 console.log(`Title templates found: ${hasTitleTemplates}`) expect(true).toBeTruthy() }) test("should preview template animations", async ({ page }) => { // Находим первый шаблон const firstTemplate = page.locator('[class*="template"][class*="item"]').first() if ((await firstTemplate.count()) > 0) { await firstTemplate.hover() await page.waitForTimeout(500) // Проверяем запуск анимации превью const hasAnimation = (await page.locator('[class*="animate"], [class*="playing"]').count()) > 0 || (await page.locator("video").count()) > 0 console.log(`Template animation preview: ${hasAnimation}`) } expect(true).toBeTruthy() }) test("should allow template style customization", async ({ page }) => { // Кликаем на шаблон const template = page.locator('[class*="template"][class*="item"]').first() if ((await template.count()) > 0) { await template.click() await page.waitForTimeout(300) // Проверяем опции кастомизации стиля const hasStyleOptions = (await page.locator("text=/theme|style|color.*scheme/i").count()) > 0 || (await page.locator('[class*="style"], [class*="theme"]').count()) > 0 console.log(`Style customization options: ${hasStyleOptions}`) } expect(true).toBeTruthy() }) test("should filter by animation style", async ({ page }) => { // Проверяем фильтры по стилю анимации const styleFilters = page.locator("button").filter({ hasText: /modern|classic|minimal|bold/i }) if ((await styleFilters.count()) > 0) { const firstFilter = styleFilters.first() await firstFilter.click() await page.waitForTimeout(300) console.log("Animation style filter applied") } expect(true).toBeTruthy() }) test("should show template duration info", async ({ page }) => { // Проверяем информацию о длительности const hasDurationInfo = (await page.locator("text=/\\d+\\.\\d+s|\\d+s/").count()) > 0 || (await page.locator('[class*="duration"]').count()) > 0 console.log(`Template duration info: ${hasDurationInfo}`) expect(true).toBeTruthy() }) test("should support color scheme selection", async ({ page }) => { // Проверяем выбор цветовой схемы const colorOptions = page.locator('[class*="color"], [aria-label*="color"]') if ((await colorOptions.count()) > 0) { const firstColor = colorOptions.first() await firstColor.click() console.log("Color scheme selected") // Проверяем применение цвета const hasColorApplied = (await page.locator('[class*="selected"], [class*="active"]').count()) > 0 console.log(`Color applied: ${hasColorApplied}`) } expect(true).toBeTruthy() }) test("should add style template to project", async ({ page }) => { // Находим шаблон const templateItem = page.locator('[class*="template"][class*="item"]').first() if ((await templateItem.count()) > 0) { await templateItem.hover() await page.waitForTimeout(200) // Ищем кнопку использования const useButton = page .locator("button") .filter({ hasText: /use|apply|add/i }) .first() if (await useButton.isVisible()) { await useButton.click() console.log("Style template use button clicked") // Проверяем добавление на таймлайн const hasTimelineUpdate = (await page.locator('[class*="timeline"]').count()) > 0 console.log(`Timeline updated: ${hasTimelineUpdate}`) } } expect(true).toBeTruthy() }) })