Skip to content

chore: add translation support and e2e translation tests#38

Merged
raven-wing merged 6 commits into
Problematy:mainfrom
raven-wing:translation_test
Jan 24, 2026
Merged

chore: add translation support and e2e translation tests#38
raven-wing merged 6 commits into
Problematy:mainfrom
raven-wing:translation_test

Conversation

@raven-wing

@raven-wing raven-wing commented Jan 21, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Added English and Polish translations for left-panel UI text and help tooltips.
  • Tests

    • Added end-to-end tests covering left-panel translations, language switching, and tooltip translations; updated existing tests and helpers to expect translated labels.
  • Chores

    • Added translation compilation to test setup, introduced a dev dependency for compilation, added a translation directory entry to test config template, and ignored generated translation and test config files.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Jan 21, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Adds translation support and E2E translation tests: new English and Polish PO files, Makefile target to compile translations, dev dependency for Babel, e2e test config templating and .gitignore updates, new Playwright tests for left-panel translations, and test expectations updated to use translated labels.

Changes

Cohort / File(s) Summary
Build & config
Makefile, e2e_test_config.template.yml, pyproject.toml, .gitignore
Add compile-translations Make target; setup-test-data now templates e2e_test_config.yml and invokes compilation; add babel dev-dependency; ignore e2e_test_config.yml and compiled translations/**/messages.mo.
Translation resources
translations/en/LC_MESSAGES/messages.po, translations/pl/LC_MESSAGES/messages.po
Add English and Polish PO files with msgid/msgstr pairs for category names, option labels, and help texts used by E2E tests.
New E2E tests
tests/basic/test_left_panel_translations.py
New Playwright tests validating left-panel translations (English/Polish), language switching, filter labels, category names, and help tooltip text; adds translation helpers and expectations.
Updated tests & helpers
tests/basic/test_left_panel.py, tests/basic/test_map.py, tests/helpers.py
Adjust assertions and expected values from technical keys (type_of_place, accessible_by) to human-readable translated labels (type of place, accessible by) and update tooltip assertions to translated text.

Sequence Diagram(s)

sequenceDiagram
  participant DevCI as Dev/CI
  participant Make as Makefile
  participant PyBabel as pybabel
  participant App as Flask App
  participant Browser as Playwright

  DevCI->>Make: run setup-test-data
  Make->>Make: sed template -> e2e_test_config.yml
  Make->>PyBabel: make compile-translations (pybabel compile -d translations -D messages)
  PyBabel-->>Make: write translations/*/LC_MESSAGES/messages.mo
  DevCI->>App: start server (app loads translations from configured dirs)
  Browser->>App: request pages (E2E)
  App-->>Browser: serve pages with translations
  Browser->>Browser: Playwright asserts translated labels & tooltips
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • feat!: moved to playwright #30 — Modifies Playwright tests and supporting setup (Makefile, pyproject, tests); closely related to translation/test setup changes.

Poem

🐰 I hop through .po files, soft and spry,

Compiling phrases beneath the Makefile sky.
English and Polish, stitched in a row,
Tests click each label — translations go!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: adding translation support infrastructure (Babel, .gitignore patterns, Makefile targets, config template) and end-to-end translation tests for the left panel in multiple languages.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown

🧪 E2E Test Results

📊 View full workflow run
🔗 Commit: 4bdd0d5

⚠️ E2E Stress Test Results

Performance data not found. See workflow logs for details.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@tests/basic/test_left_panel_translations.py`:
- Around line 199-207: The test silently skips when the help icon is missing;
update the block that uses page.get_by_label("Help:
categories_options_help_small bridge") to explicitly assert the element exists
before hovering—check help_icon.count() and fail the test (e.g., raise/assert)
if zero so the test does not pass silently; then proceed to hover
help_icon.first, locate tooltip via page.locator('[role="tooltip"]'), assert
visibility with expect(tooltip).to_be_visible(), read tooltip.inner_text() and
assert the TRANSLATIONS["pl"]["help_texts"]["categories_options_help_small
bridge"] value is contained in the text.
- Around line 182-190: The test silently passes because it conditionally skips
assertions when help_icon.count() == 0; change this to explicitly fail or skip:
assert that page.get_by_label("Help: categories_options_help_small bridge")
(help_icon) exists (e.g., assert help_icon.count() > 0 with a clear message
including the label) before hovering, or call pytest.skip with a message if you
intentionally want to skip; then proceed to hover, locate tooltip and assert
TRANSLATIONS["en"]["help_texts"]["categories_options_help_small bridge"]
(expected) is contained in tooltip.inner_text() as before.
🧹 Nitpick comments (2)
tests/basic/test_left_panel_translations.py (2)

57-61: Potential flakiness after language switch.

The wait_for_load_state("domcontentloaded") may not be sufficient if translations are loaded asynchronously or if the UI updates after DOM is ready. Consider waiting for a specific translated element to appear to ensure the language switch is complete.

♻️ Suggested improvement
 def switch_to_language(page: Page, lang_name: str):
     """Switch to a specific language by clicking the language menu."""
     get_language_button(page).click()
     page.get_by_role("link", name=lang_name).click()
     page.wait_for_load_state("domcontentloaded")
+    # Consider adding: page.wait_for_selector("#filter-form", timeout=10000)

67-72: Redundant viewport setting conflicts with conftest fixture.

The page fixture in tests/conftest.py already sets viewport to 1280x800. This fixture overrides it to 1200x800, creating inconsistency. Either remove the redundant call or document why a different viewport is needed for these translation tests.

♻️ Suggested fix
     `@pytest.fixture`(autouse=True)
     def setup(self, page: Page):
         """Navigate to home page and wait for filter form to load"""
-        page.set_viewport_size({"width": 1200, "height": 800})
         page.goto(BASE_URL, wait_until="domcontentloaded")
         page.wait_for_selector("#filter-form", timeout=10000)

Comment thread tests/basic/test_left_panel_translations.py Outdated
Comment thread tests/basic/test_left_panel_translations.py Outdated
@github-actions

Copy link
Copy Markdown

🧪 E2E Test Results

📊 View full workflow run
🔗 Commit: 4bdd0d5

⚠️ E2E Stress Test Results

Performance data not found. See workflow logs for details.

@github-actions

Copy link
Copy Markdown

🧪 E2E Test Results

📊 View full workflow run
🔗 Commit: 91eb009

📊 E2E Stress Test Performance

Status: PASSED (10895.55ms max < 25000ms limit)

Metric Value
Average Time 10324.44ms
Minimum Time 9958.76ms
Maximum Time 10895.55ms
Completed Runs 5/5
Avg Markers Loaded 76
📈 Individual Run Times
Run Time (ms) Markers
Run 1 9958.76ms 76
Run 2 9981.83ms 76
Run 3 10019.8ms 76
Run 4 10895.55ms 76
Run 5 10766.28ms 76

@raven-wing raven-wing changed the title chore: added more tests chore: add translation support and e2e translation tests Jan 22, 2026
@github-actions

Copy link
Copy Markdown

🧪 E2E Test Results

📊 View full workflow run
🔗 Commit: b7c2969

⚠️ E2E Stress Test Results

Performance data not found. See workflow logs for details.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@tests/basic/test_left_panel_translations.py`:
- Around line 130-170: Replace the fragile wait_for_selector + inner_text +
.lower() assertions in test_switch_from_english_to_polish_updates_category_names
and test_switch_from_polish_to_english_updates_category_names with Playwright's
auto-waiting assertion: use expect(panel).to_contain_text(...) on the locator
bound to "#left-panel" after calling switch_to_language(page, ...); include an
explicit timeout (e.g., 5000–10000 ms) and, if you must ignore case, use a
case-insensitive pattern/regex for the expected strings ("accessible by" and
"dostępny dla") so the assertion retries until translations finish.

Comment thread tests/basic/test_left_panel_translations.py Outdated
@github-actions

Copy link
Copy Markdown

🧪 E2E Test Results

📊 View full workflow run
🔗 Commit: 9fcf12a

📊 E2E Stress Test Performance

Status: PASSED (10769.06ms max < 25000ms limit)

Metric Value
Average Time 10322.09ms
Minimum Time 9418.92ms
Maximum Time 10769.06ms
Completed Runs 5/5
Avg Markers Loaded 70
📈 Individual Run Times
Run Time (ms) Markers
Run 1 9418.92ms 70
Run 2 10765.53ms 70
Run 3 10156.07ms 70
Run 4 10500.85ms 70
Run 5 10769.06ms 70

@github-actions

Copy link
Copy Markdown

🧪 E2E Test Results

📊 View full workflow run
🔗 Commit: 7fb2e10

📊 E2E Stress Test Performance

Status: PASSED (11294.51ms max < 25000ms limit)

Metric Value
Average Time 10561.02ms
Minimum Time 9961.22ms
Maximum Time 11294.51ms
Completed Runs 5/5
Avg Markers Loaded 70
📈 Individual Run Times
Run Time (ms) Markers
Run 1 9961.22ms 70
Run 2 10331.59ms 70
Run 3 10402.36ms 70
Run 4 11294.51ms 70
Run 5 10815.4ms 70

@raven-wing raven-wing merged commit 8abc2e5 into Problematy:main Jan 24, 2026
2 checks passed
@raven-wing raven-wing deleted the translation_test branch January 24, 2026 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant