diff --git a/i18n/ru/code.json b/i18n/ru/code.json index bde14f36..ce8dea31 100644 --- a/i18n/ru/code.json +++ b/i18n/ru/code.json @@ -543,5 +543,248 @@ }, "landing.core-features.browsers.versions": { "message": "Нет привязки к версиям браузеров" + }, + "landing.meta.title": { + "message": "Сквозное тестирование в реальных браузерах" + }, + "landing.hero.intro": { + "message": "Testplane — фреймворк с открытым исходным кодом для сквозного, компонентного и визуального тестирования в реальных браузерах." + }, + "landing.install.title": { + "message": "Запустите первый тест" + }, + "landing.install.guide": { + "message": "Перейти к инструкции" + }, + "landing.studio.head": { + "message": "От кода" + }, + "landing.studio.headEnd": { + "message": "к уверенности." + }, + "landing.studio.intro": { + "message": "Создавайте и выпускайте веб-приложения со сквозными тестами в реальных браузерах. Сравнивайте скриншоты и возвращайтесь к шагу, на котором упал тест." + }, + "landing.studio.docs": { + "message": "Документация" + }, + "landing.studio.recordings": { + "message": "Записи работы HTML Reporter" + }, + "landing.studio.suites": { + "message": "Запуски" + }, + "landing.studio.visual": { + "message": "Скриншоты" + }, + "landing.studio.replay": { + "message": "Time Travel" + }, + "landing.studio.replayCaption": { + "message": "Выберите шаг, чтобы увидеть DOM в момент выполнения теста." + }, + "landing.studio.pause": { + "message": "Приостановить запись" + }, + "landing.studio.play": { + "message": "Воспроизвести запись" + }, + "landing.lab.title": { + "message": "Как устроен запуск" + }, + "landing.lab.parallel": { + "message": "Запускайте тесты параллельно" + }, + "landing.lab.parallelBody": { + "message": "Каждый воркер может вести несколько браузерных сессий одновременно. Настройте лимит сессий для каждого браузера и распределите большой набор тестов между задачами CI." + }, + "landing.lab.one": { + "message": "1 воркер" + }, + "landing.lab.three": { + "message": "3 воркера" + }, + "landing.lab.workersLabel": { + "message": "Количество воркеров" + }, + "landing.lab.compare": { + "message": "Сравнить эталонный и текущий скриншоты" + }, + "landing.lab.diff": { + "message": "Замечайте визуальные изменения" + }, + "landing.lab.time": { + "message": "Вернитесь к нужной команде" + }, + "landing.lab.timeBody": { + "message": "Выберите момент на шкале времени. Time Travel сохраняет снимки DOM, чтобы вы могли изучить состояние страницы на каждом шаге." + }, + "landing.lab.play": { + "message": "Воспроизвести три снимка" + }, + "landing.atlas.suitesCaption": { + "message": "Отфильтруйте дерево тестов, чтобы увидеть три успешные проверки." + }, + "landing.atlas.visualCaption": { + "message": "Посмотрите, какие пиксели изменились в периоде обращения Сатурна." + }, + "landing.atlas.diffBody": { + "message": "Сравнивайте скриншот элемента или всей видимой области с эталоном с помощью {command}. Исключайте динамические области, изучайте изменённые пиксели и принимайте новые эталоны в Testplane UI." + }, + "landing.network.local": { + "message": "Локально" + }, + "landing.network.grid": { + "message": "Удалённый грид" + }, + "landing.network.device": { + "message": "Устройства" + }, + "landing.network.control": { + "message": "Среда запуска" + }, + "landing.network.title": { + "message": "Один набор тестов для разных браузеров" + }, + "landing.network.copy": { + "message": "Запускайте Chrome, Firefox, Edge и Safari на нужных платформах. Используйте одни и те же тесты на ноутбуке, в гриде CI и на реальном телефоне." + }, + "landing.network.guide": { + "message": "Выбрать среду запуска" + }, + "landing.spec.open": { + "message": "Открыть каталог" + }, + "landing.spec.select": { + "message": "Выбрать Сатурн" + }, + "landing.spec.check": { + "message": "Проверить вид" + }, + "landing.spec.control": { + "message": "Шаг теста" + }, + "landing.spec.title": { + "message": "Браузерный тест по шагам" + }, + "landing.spec.intro": { + "message": "Пройдите по шагам теста каталога из отчёта. Каждая команда работает со страницей, которую видит пользователь." + }, + "landing.spec.guide": { + "message": "Написать тест" + }, + "landing.spec.jupiter": { + "message": "Карточка Юпитера в Orbital Atlas" + }, + "landing.spec.saturn": { + "message": "Карточка Сатурна в Orbital Atlas" + }, + "landing.agent.browse": { + "message": "Работа с приложением" + }, + "landing.agent.triage": { + "message": "Разбор запуска" + }, + "landing.agent.title": { + "message": "CLI для ИИ-агентов" + }, + "landing.agent.control": { + "message": "Сценарий CLI" + }, + "landing.agent.copy": { + "message": "Дайте агенту браузер и компактный снимок DOM. Агент может проверить селектор, получить эквивалентный код Testplane и изучить причину падения теста прямо в HTML-отчёте." + }, + "landing.agent.guide": { + "message": "Изучить Testplane CLI" + }, + "landing.diff.mode": { + "message": "Режим сравнения" + }, + "landing.diff.swipe": { + "message": "Разделитель" + }, + "landing.diff.pixels": { + "message": "Пиксельная разница" + }, + "landing.diff.alt": { + "message": "Изменившиеся пиксели в поле орбитального периода" + }, + "landing.diff.actual": { + "message": "Текущая карточка Сатурна" + }, + "landing.guide.parallel": { + "message": "Как работает параллелизм" + }, + "landing.guide.visual": { + "message": "Изучить визуальное тестирование" + }, + "landing.guide.replay": { + "message": "Изучить Time Travel" + }, + "landing.selectivity.title": { + "message": "Перезапускайте только затронутые тесты" + }, + "landing.selectivity.copy": { + "message": "Селективность учитывает модули Node.js, которые загрузил тест, и исходные файлы, код которых он выполнил в браузере. Отметьте изменённые файлы и посмотрите, какие тесты запустятся снова." + }, + "landing.selectivity.guide": { + "message": "Как работает селективность" + }, + "landing.selectivity.home": { + "message": "Открыть главную" + }, + "landing.selectivity.about": { + "message": "Перейти с главной на страницу About" + }, + "landing.selectivity.contact": { + "message": "Открыть контакты" + }, + "landing.selectivity.count": { + "message": "Выбрано тестов: {count} из {total}" + }, + "landing.selectivity.files": { + "message": "Изменённые файлы" + }, + "landing.selectivity.next": { + "message": "Следующий запуск" + }, + "landing.selectivity.run": { + "message": "Запуск" + }, + "landing.selectivity.skip": { + "message": "Пропуск" + }, + "landing.workers.single": { + "message": "Один воркер одновременно управляет всеми шестью сессиями браузеров" + }, + "landing.workers.multiple": { + "message": "Три воркера, каждый из которых одновременно управляет двумя сессиями браузеров" + }, + "landing.workers.suite": { + "message": "Тесты" + }, + "landing.workers.processes": { + "message": "Воркеры" + }, + "landing.workers.sessions": { + "message": "Сессии браузеров" + }, + "landing.workers.worker": { + "message": "Воркер {n}" + }, + "landing.network.localAlt": { + "message": "Четыре браузера на локальной машине" + }, + "landing.network.gridAlt": { + "message": "Пример удалённого грида с 12 сессиями каждого браузера: Chrome, Firefox, Edge и Safari" + }, + "landing.network.devicesAlt": { + "message": "Chrome на Android и Safari на iOS" + }, + "landing.diff.hint": { + "message": "Нажмите на изображение, чтобы обвести изменение" + }, + "landing.diff.locate": { + "message": "Обвести изменённые пиксели" } } diff --git a/src/components/pages/LandingPage/AgentConsole.tsx b/src/components/pages/LandingPage/AgentConsole.tsx new file mode 100644 index 00000000..ed51ef31 --- /dev/null +++ b/src/components/pages/LandingPage/AgentConsole.tsx @@ -0,0 +1,91 @@ +import React, { useState } from "react"; +import Translate, { translate } from "@docusaurus/Translate"; +import Link from "@docusaurus/Link"; +import { ArrowRight, Terminal } from "@gravity-ui/icons"; +import styles from "./landing.module.scss"; + +const workflows = [ + { + title: translate({ id: "landing.agent.browse", message: "Explore an app" }), + commands: ["navigate http://localhost:3000", "snapshot", "click '[data-planet=Saturn]'"], + output: 'await browser.$("[data-planet=Saturn]").click();', + outputTitle: "Testplane Code", + }, + { + title: translate({ id: "landing.agent.triage", message: "Investigate a run" }), + commands: ["test-results ./report --status failed --fields name,browser"], + output: "Total tests: 4; total attempts: 4; matched tests: 1\n\n1. chrome\n Orbital Atlas Visual checks matches the Saturn reference", + outputTitle: "Test results in report: ./report", + }, +]; + +export function AgentConsole() { + const [selected, setSelected] = useState(0); + return ( +
+
+
+

+ A CLI for coding agents +

+

+ + Give your agent a real browser and a compact DOM snapshot. It can try a + selector, read the equivalent Testplane code, or investigate a failed + run straight from its HTML report. + +

+ + Explore Testplane CLI + + +
+
+
+ + @testplane/cli +
+
+ {workflows.map(({ title }, i) => ( + + ))} +
+
+ {workflows.map((flow, index) => ( +
+ {flow.commands.map((command, i) => ( +
+ + npx @testplane/cli {command} +
+ ))} +
+ {flow.outputTitle} +
{flow.output}
+
+
+ ))} +
+
+
+
+ ); +} diff --git a/src/components/pages/LandingPage/BrowserNetwork.tsx b/src/components/pages/LandingPage/BrowserNetwork.tsx new file mode 100644 index 00000000..e00ded95 --- /dev/null +++ b/src/components/pages/LandingPage/BrowserNetwork.tsx @@ -0,0 +1,267 @@ +import React, { useState } from "react"; +import Translate, { translate } from "@docusaurus/Translate"; +import Link from "@docusaurus/Link"; +import { ArrowRight, Cloud, Display, Smartphone } from "@gravity-ui/icons"; +import styles from "./landing.module.scss"; + +const environments = [ + { + kind: "local", + description: translate({ + id: "landing.network.localAlt", + message: "Four browsers on a local machine", + }), + label: translate({ id: "landing.network.local", message: "Local machine" }), + icon: Display, + targets: ["Chrome", "Firefox", "Edge", "Safari"], + connection: 'gridUrl: "local"', + }, + { + kind: "grid", + description: translate({ + id: "landing.network.gridAlt", + message: + "Example remote grid with 12 sessions each for Chrome, Firefox, Edge, and Safari", + }), + label: translate({ id: "landing.network.grid", message: "Remote grid" }), + icon: Cloud, + targets: ["Chrome", "Firefox", "Edge", "Safari"], + connection: "gridUrl: process.env.GRID_URL", + }, + { + kind: "devices", + description: translate({ + id: "landing.network.devicesAlt", + message: "Chrome on Android and Safari on iOS", + }), + label: translate({ id: "landing.network.device", message: "Real devices" }), + icon: Smartphone, + targets: ["Android · Chrome", "iOS · Safari"], + connection: "gridUrl: process.env.APPIUM_URL", + }, +]; + +const anchors = [ + [130, 60], + [454, 66], + [107, 185], + [472, 196], +]; +const paths = [ + "M262 116Q222 61 130 60", + "M314 118Q360 64 454 66", + "M259 151Q213 184 107 185", + "M315 151Q388 202 472 196", +]; + +const pools = [ + [115, 62], + [465, 62], + [115, 178], + [465, 178], +]; +const gridRoutes = [ + "M249 132H220Q212 132 212 124V70Q212 62 204 62H185", + "M325 132H360Q368 132 368 124V70Q368 62 376 62H391", + "M249 132H220Q212 132 212 140V170Q212 178 204 178H185", + "M325 132H360Q368 132 368 140V170Q368 178 376 178H391", +]; +const poolSize = 12; + +function BrowserLabel({ name, x, y = 0 }: { name: string; x: number; y?: number }) { + return ( + + + + {name} + + + ); +} + +function GridPool({ name }: { name: string }) { + return ( + + + + + ×{poolSize} + + {Array.from({ length: poolSize }, (_, i) => ( + + + + + ))} + + ); +} + +export function BrowserNetwork() { + const [selected, setSelected] = useState(() => + environments.findIndex(env => env.kind === "grid"), + ); + const { targets, connection, kind, description, icon: Icon } = environments[selected]; + const grid = kind === "grid"; + return ( +
+
+
+

+ One suite, any browser +

+

+ + Run Chrome, Firefox, Edge, and Safari on the platforms you support. Keep + the same tests when you move from your laptop to a CI grid or a real + phone. + +

+ + + Explore browser environments + + + +
+
+
+ {environments.map(({ label, icon: Item }, i) => ( + + ))} +
+ + + + + + + + {!grid && ( + + + + + + )} + + {targets.map((name, i) => { + const node = kind === "devices" ? i * 3 : i; + const [x, y] = grid ? pools[i] : anchors[node]; + const route = grid ? gridRoutes[i] : paths[node]; + const width = kind === "devices" ? 144 : 94; + return ( + + + + + {grid ? ( + + ) : ( + <> + + + + )} + + + ); + })} + + + + + + + +
+ testplane.config.ts + {connection} +
+
+
+
+ ); +} diff --git a/src/components/pages/LandingPage/FeatureLab.tsx b/src/components/pages/LandingPage/FeatureLab.tsx new file mode 100644 index 00000000..56962698 --- /dev/null +++ b/src/components/pages/LandingPage/FeatureLab.tsx @@ -0,0 +1,347 @@ +import React, { useEffect, useRef, useState } from "react"; +import Translate, { translate } from "@docusaurus/Translate"; +import useBaseUrl from "@docusaurus/useBaseUrl"; +import Link from "@docusaurus/Link"; +import { ArrowRight, PlayFill } from "@gravity-ui/icons"; +import { WorkerDiagram } from "./WorkerDiagram"; +import styles from "./landing.module.scss"; + +function GuideLink({ path, children }: { path: string; children: React.ReactNode }) { + return ( + + {children} + + + ); +} + +// The single cluster reported by looks-same in the 430 × 206 field-card screenshots. +const periodCluster = { left: 170, top: 177, right: 241, bottom: 190 }; +const bubblePosition = { + left: `${((periodCluster.left + periodCluster.right) / 2 / 430) * 100}%`, + top: `${((periodCluster.top + periodCluster.bottom) / 2 / 206) * 100}%`, + width: `${(Math.hypot(periodCluster.right - periodCluster.left + 1, periodCluster.bottom - periodCluster.top + 1) / 430) * 100}%`, +}; + +function DiffDiagram() { + const [position, setPosition] = useState(52); + const [pixels, setPixels] = useState(false); + const root = useBaseUrl("/img/landing/atlas-"); + const [pulse, setPulse] = useState(0); + const drag = useRef<{ id: number; start: number; moved: boolean } | null>(null); + + useEffect(() => { + if (!pulse) return; + const timer = window.setTimeout(() => setPulse(0), 1000); + return () => window.clearTimeout(timer); + }, [pulse]); + return ( +
+
+ + +
+
+ { + {!pixels && ( + <> + + + setPosition(Number(e.target.value))} + aria-label={translate({ + id: "landing.lab.compare", + message: "Compare reference and current screenshot", + })} + /> + + )} +
+

+ Click the image to circle the change +

+
+ ); +} + +const commands = ["url('/catalog')", "setValue('Saturn')", "click()"]; +function SnapshotDiagram() { + const [frame, setFrame] = useState(0); + const [playing, setPlaying] = useState(false); + useEffect(() => { + if (!playing) return; + const timer = window.setTimeout(() => { + if (frame === 2) { + setPlaying(false); + } else { + setFrame(frame + 1); + } + }, 850); + return () => window.clearTimeout(timer); + }, [frame, playing]); + return ( +
+ +
+ +
+ {commands.map((cmd, i) => ( + + ))} +
+ {commands[frame]} +
+
+ ); +} + +export function FeatureLab() { + const ref = useRef(null); + useEffect(() => { + if (!ref.current) return; + const observer = new IntersectionObserver( + ([entry]) => { + if (entry.isIntersecting) { + entry.target.setAttribute("data-visible", "true"); + observer.disconnect(); + } + }, + { threshold: 0.1 }, + ); + observer.observe(ref.current); + return () => observer.disconnect(); + }, []); + return ( +
+

+ Inside a test run +

+
+
+

+ Run tests in parallel +

+

+ + Each worker can run several browser sessions at once. Set concurrency + limits per browser and shard large suites across CI jobs. + +

+ + Explore parallelism + +
+ +
+
+
+ +
+

+ Catch the visual change +

+

+ assertView }} + > + { + "Compare an element or the whole viewport against a reference screenshot with {command}. Ignore dynamic regions, review changed pixels, and approve new references in Testplane UI." + } + +

+ + Explore visual testing + +
+
+
+ +
+

+ Rewind to a command +

+

+ + Pick a point on the timeline. Time travel records DOM snapshots so + you can inspect the browser at each step. + +

+ + Explore Time Travel + +
+
+
+
+ ); +} diff --git a/src/components/pages/LandingPage/GlyphVignette.tsx b/src/components/pages/LandingPage/GlyphVignette.tsx new file mode 100644 index 00000000..a6a1a0d8 --- /dev/null +++ b/src/components/pages/LandingPage/GlyphVignette.tsx @@ -0,0 +1,148 @@ +import React, { useEffect, useRef } from "react"; +import styles from "./landing.module.scss"; + +const alphabet = Array.from("01Z7<>:∴∆⌁⋮+×/アイカサタナハミメユヨラリ"); +const character = (n: number) => alphabet[Math.floor(n * alphabet.length)]; + +function makeField(width: number, height: number, seed: number, right: boolean) { + let state = seed; + const random = () => { + state = (state * 1664525 + 1013904223) % 4294967296; + return state / 4294967296; + }; + const cells = []; + for (let x = 5; x < width; x += 11) { + const u = (right ? width - x : x) / width; + const center = height * (0.51 + 0.16 * Math.sin(5 * u + seed)); + const spread = height * (0.23 + 0.13 * random()) * (1 - u * u); + const drift = Math.round(random() * 5); + for (let y = 6 + drift; y < height; y += 14) { + const weight = Math.max(0, 1 - Math.abs(y - center) / spread) * (1 - u * u); + if (weight < 0.04 || random() > 0.47 + 0.5 * weight) continue; + cells.push({ + x, + y, + glyph: character(random()), + alpha: weight * (0.1 + 0.15 * random()), + }); + } + } + return cells; +} + +function GlyphPatch({ seed, right = false }: { seed: number; right?: boolean }) { + const ref = useRef(null); + + useEffect(() => { + const canvas = ref.current; + const ctx = canvas?.getContext("2d"); + const section = canvas?.closest("section"); + if (!canvas || !ctx || !section) return; + + let field: ReturnType = []; + let lit = new Set(); + let frame = 0; + let change: { index: number; from: string; started: number } | undefined; + const motion = window.matchMedia("(prefers-reduced-motion: reduce)"); + + const paint = (now: number) => { + frame = 0; + ctx.clearRect(0, 0, canvas.clientWidth, canvas.clientHeight); + const progress = change ? Math.min(1, (now - change.started) / 900) : 1; + for (const [i, cell] of field.entries()) { + const alpha = cell.alpha + (lit.has(i) ? 0.23 : 0); + ctx.globalAlpha = alpha; + if (i === change?.index && progress < 1) { + ctx.globalAlpha = alpha * (1 - progress); + ctx.fillText(change.from, cell.x, cell.y); + ctx.globalAlpha = alpha * progress; + } + ctx.fillText(cell.glyph, cell.x, cell.y); + } + if (progress < 1) frame = requestAnimationFrame(paint); + else change = undefined; + }; + const schedule = () => { + if (!frame) frame = requestAnimationFrame(paint); + }; + const resize = () => { + const { clientWidth: width, clientHeight: height } = canvas; + const dpr = Math.min(window.devicePixelRatio || 1, 2); + canvas.width = Math.round(width * dpr); + canvas.height = Math.round(height * dpr); + ctx.setTransform(dpr, 0, 0, dpr, 0, 0); + ctx.fillStyle = getComputedStyle(canvas).color; + ctx.font = "10px ui-monospace, monospace"; + ctx.textAlign = "center"; + field = makeField(width, height, seed, right); + change = undefined; + lit.clear(); + schedule(); + }; + const clear = () => { + if (!lit.size) return; + lit.clear(); + schedule(); + }; + const point = (event: PointerEvent) => { + if (motion.matches || event.pointerType === "touch") return; + const box = canvas.getBoundingClientRect(); + const x = event.clientX - box.left, + y = event.clientY - box.top; + if (x < 0 || x > box.width || y < 0 || y > box.height) return clear(); + const near = field + .map((cell, i) => ({ i, d: (cell.x - x) ** 2 + (cell.y - y) ** 2 })) + .filter(({ d }) => d < 46 ** 2) + .sort((a, b) => a.d - b.d) + .slice(0, 8); + if (near.length === lit.size && near.every(({ i }) => lit.has(i))) return; + lit = new Set(near.map(({ i }) => i)); + schedule(); + }; + + const size = new ResizeObserver(resize); + size.observe(canvas); + // Swap just one visible character per interval. Idle fields need no render loop. + const interval = window.setInterval( + () => { + if (motion.matches || document.hidden || !field.length) return; + const box = canvas.getBoundingClientRect(); + if (box.bottom < 0 || box.top > window.innerHeight) return; + const i = Math.floor(Math.random() * field.length); + change = { index: i, from: field[i].glyph, started: performance.now() }; + field[i].glyph = character(Math.random()); + schedule(); + }, + 10500 + seed * 93, + ); + section.addEventListener("pointermove", point, { passive: true }); + section.addEventListener("pointerleave", clear); + motion.addEventListener("change", clear); + return () => { + cancelAnimationFrame(frame); + clearInterval(interval); + size.disconnect(); + section.removeEventListener("pointermove", point); + section.removeEventListener("pointerleave", clear); + motion.removeEventListener("change", clear); + }; + }, [right, seed]); + + return ( +