|
1 |
| -"""Using Axe-core, scan the Kitchen Sink pages for accessibility violations.""" |
| 1 | +"""Build minimal test sites with sphinx_build_factory and test them with Playwright.""" |
2 | 2 |
|
3 | 3 | from pathlib import Path
|
4 | 4 | from urllib.parse import urljoin
|
|
9 | 9 | playwright = pytest.importorskip("playwright")
|
10 | 10 | from playwright.sync_api import Page, expect # noqa: E402
|
11 | 11 |
|
12 |
| -path_repo = Path(__file__).parent.parent |
| 12 | +path_repo = Path(__file__).parents[1] |
13 | 13 | path_docs_build = path_repo / "docs" / "_build" / "html"
|
14 | 14 |
|
15 | 15 |
|
@@ -44,16 +44,18 @@ def test_version_switcher_highlighting(page: Page, url_base: str) -> None:
|
44 | 44 |
|
45 | 45 | def test_breadcrumb_expansion(page: Page, url_base: str) -> None:
|
46 | 46 | """Test breadcrumb text-overflow."""
|
| 47 | + # wide viewport width → no truncation |
47 | 48 | page.set_viewport_size({"width": 1440, "height": 720})
|
48 | 49 | page.goto(urljoin(url_base, "community/topics/config.html"))
|
49 | 50 | expect(page.get_by_label("Breadcrumb").get_by_role("list")).to_contain_text(
|
50 | 51 | "Update Sphinx configuration during the build"
|
51 | 52 | )
|
52 | 53 | el = page.get_by_text("Update Sphinx configuration during the build").nth(1)
|
53 |
| - assert not _is_overflowing(el) |
54 | 54 | expect(el).to_have_css("overflow-x", "hidden")
|
55 | 55 | expect(el).to_have_css("text-overflow", "ellipsis")
|
56 |
| - page.set_viewport_size({"width": 20, "height": 720}) |
| 56 | + assert not _is_overflowing(el) |
| 57 | + # narrow viewport width → truncation |
| 58 | + page.set_viewport_size({"width": 150, "height": 720}) |
57 | 59 | assert _is_overflowing(el)
|
58 | 60 |
|
59 | 61 |
|
|
0 commit comments