diff --git a/src/features/online-board/components/OnlineBoardSearchPage.tsx b/src/features/online-board/components/OnlineBoardSearchPage.tsx index cd1b02af..5d661ec6 100644 --- a/src/features/online-board/components/OnlineBoardSearchPage.tsx +++ b/src/features/online-board/components/OnlineBoardSearchPage.tsx @@ -210,7 +210,7 @@ export const OnlineBoardSearchPage: FC = ({ const { dictionaries } = useDictionaries(language); const { add: addHistory } = useSearchHistory(language); - // Persist this online-board search into the `Вы искали` sidebar + // Persist this online-board search into the `Ранее искали` sidebar // history. The hook dedupes by URL, so re-renders / day-tab clicks // don't bloat storage. useEffect(() => { diff --git a/src/features/schedule/components/ScheduleSearchPage.tsx b/src/features/schedule/components/ScheduleSearchPage.tsx index c2dca818..f58bfaf1 100644 --- a/src/features/schedule/components/ScheduleSearchPage.tsx +++ b/src/features/schedule/components/ScheduleSearchPage.tsx @@ -167,7 +167,7 @@ export const ScheduleSearchPage: FC = ({ params }) => { const activeKind: "outbound" | "inbound" = direction === "inbound" && inbound ? "inbound" : "outbound"; - // Persist this search into the `Вы искали` sidebar history. The hook + // Persist this search into the `Ранее искали` sidebar history. The hook // dedupes by URL so re-renders / week-tab clicks won't bloat storage. useEffect(() => { const url = `/${locale}/${buildScheduleUrl(params)}`; diff --git a/src/i18n/locales/ru/common.json b/src/i18n/locales/ru/common.json index 1841f56b..b4f00646 100644 --- a/src/i18n/locales/ru/common.json +++ b/src/i18n/locales/ru/common.json @@ -36,7 +36,7 @@ "STATUS-PLANNED": "Запланирован", "TIME_DEPARTURE": "Время отправления", "TITLE": "Онлайн-Табло", - "YOU_SEARCH": "Вы искали", + "YOU_SEARCH": "Ранее искали", "LEG": "Перелет", "TOTAL-FLYING-TIME": "Общее время в пути", "DETAILS-TITLE": "Детали рейса", @@ -370,8 +370,8 @@ "INTERMEDIATE-LANDING-PLURAL-OTHER": "Промежуточных посадок", "LANDING": "Посадка", "LANDING-TRANSFER": "Трансфер", - "LAST-SEARCH-BOARD": "Вы искали в Онлайн-Табло", - "LAST-SEARCH-SCHEDULE": "Вы искали в Расписании", + "LAST-SEARCH-BOARD": "Ранее искали в Онлайн-Табло", + "LAST-SEARCH-SCHEDULE": "Ранее искали в Расписании", "LAST-UPDATE": "Последнее обновление", "MAIN": "Главная", "NOTE-SYMBOL": "*", diff --git a/src/ui/layout/SearchHistory.tsx b/src/ui/layout/SearchHistory.tsx index 3fc849f7..91351f00 100644 --- a/src/ui/layout/SearchHistory.tsx +++ b/src/ui/layout/SearchHistory.tsx @@ -1,9 +1,9 @@ /** - * Search history sidebar — `Вы искали` accordion. + * Search history sidebar — `Ранее искали` accordion (TIRREDESIGN-5). * - * Mirrors Angular's `search-history` component: a collapsible - * frame with a `Вы искали` header and a list of recent searches. - * Each row shows a plane icon (online-board) or alarm-clock icon + * Mirrors Angular's `search-history` component: a collapsible frame + * with a `Ранее искали` header and a list of recent searches. Each + * row shows a plane icon (online-board) or alarm-clock icon * (schedule), the city pair (`Москва — Самара`) and a date row * (`20.04.2026 - 26.04.2026`, plus inbound dates for round-trip). * diff --git a/tests/e2e/search-history-label.spec.ts b/tests/e2e/search-history-label.spec.ts new file mode 100644 index 00000000..cdd6c2e0 --- /dev/null +++ b/tests/e2e/search-history-label.spec.ts @@ -0,0 +1,50 @@ +import { test, expect } from "@playwright/test"; + +// TIRREDESIGN-5: the search-history sidebar header must read +// "Ранее искали" (not "Вы искали"). The block exists on Schedule +// and Online-Board start pages once the user has run at least one +// search; we seed a synthetic history entry via localStorage so +// the test is deterministic. + +// Matches `searchHistoryItemSchema` in useSearchHistory.ts. +const SEED = [ + { + type: "schedule-route" as const, + url: "/ru-ru/schedule/route/MOW-LED-20260427-20260503", + label: "Москва — Санкт-Петербург", + params: { + departure: "MOW", + arrival: "LED", + dateFrom: "20260427", + dateTo: "20260503", + }, + }, +]; + +async function seedHistory(page: import("@playwright/test").Page) { + // Storage uses sessionStorage with the `afl_` namespace prefix and is + // keyed `history_${lang}` — see src/shared/hooks/useSearchHistory.ts. + await page.addInitScript((items) => { + window.sessionStorage.setItem("afl_history_ru", JSON.stringify(items)); + }, SEED); +} + +test.describe("Search-history label is 'Ранее искали' (TIRREDESIGN-5)", () => { + test("Schedule start page", async ({ page }) => { + await seedHistory(page); + await page.goto("/ru-ru/schedule"); + const block = page.getByTestId("search-history"); + await expect(block).toBeVisible({ timeout: 15000 }); + await expect(block).toContainText("Ранее искали"); + await expect(block).not.toContainText("Вы искали"); + }); + + test("Online-Board start page", async ({ page }) => { + await seedHistory(page); + await page.goto("/ru-ru/onlineboard"); + const block = page.getByTestId("search-history"); + await expect(block).toBeVisible({ timeout: 15000 }); + await expect(block).toContainText("Ранее искали"); + await expect(block).not.toContainText("Вы искали"); + }); +});