|
| 1 | +""" |
| 2 | +Navigation structure tests — verify sidebar and navbar match the April 2026 wireframe. |
| 3 | +
|
| 4 | +These tests verify the structural changes from PRs #89 (nav restructure) |
| 5 | +and #90 (accordion menus). |
| 6 | +""" |
| 7 | +import pytest |
| 8 | +from conftest import SITE_URL |
| 9 | + |
| 10 | + |
| 11 | +class TestSidebarSections: |
| 12 | + """Sidebar should show the wireframe's section names.""" |
| 13 | + |
| 14 | + def test_sidebar_shows_architecture_and_vocabularies(self, page): |
| 15 | + page.goto(f"{SITE_URL}/about.html", wait_until="domcontentloaded") |
| 16 | + sidebar = page.locator(".sidebar-navigation") |
| 17 | + assert sidebar.get_by_text("Architecture and Vocabularies").count() > 0 |
| 18 | + |
| 19 | + def test_sidebar_does_not_show_old_information_architecture(self, page): |
| 20 | + page.goto(f"{SITE_URL}/about.html", wait_until="domcontentloaded") |
| 21 | + sidebar = page.locator(".sidebar-navigation") |
| 22 | + assert sidebar.get_by_text("Information Architecture").count() == 0 |
| 23 | + |
| 24 | + def test_sidebar_shows_research_and_resources(self, page): |
| 25 | + page.goto(f"{SITE_URL}/about.html", wait_until="domcontentloaded") |
| 26 | + sidebar = page.locator(".sidebar-navigation") |
| 27 | + assert sidebar.get_by_text("Research & Resources").count() > 0 |
| 28 | + |
| 29 | + def test_sidebar_does_not_show_separate_published_research(self, page): |
| 30 | + page.goto(f"{SITE_URL}/about.html", wait_until="domcontentloaded") |
| 31 | + sidebar = page.locator(".sidebar-navigation") |
| 32 | + assert sidebar.get_by_text("Published Research", exact=True).count() == 0 |
| 33 | + |
| 34 | + def test_sidebar_does_not_show_separate_resources(self, page): |
| 35 | + page.goto(f"{SITE_URL}/about.html", wait_until="domcontentloaded") |
| 36 | + sidebar = page.locator(".sidebar-navigation") |
| 37 | + # "Resources" alone shouldn't appear as a section header |
| 38 | + # (it's OK inside "Research & Resources") |
| 39 | + sections = sidebar.locator(".sidebar-section .sidebar-section-header") |
| 40 | + texts = [s.text_content().strip() for s in sections.all()] |
| 41 | + assert "Resources" not in texts |
| 42 | + |
| 43 | + |
| 44 | +class TestSidebarHowToUse: |
| 45 | + """How to Use section should have 5 sub-items matching wireframe.""" |
| 46 | + |
| 47 | + def test_how_to_use_has_overview(self, page): |
| 48 | + page.goto(f"{SITE_URL}/how-to-use.html", wait_until="domcontentloaded") |
| 49 | + sidebar = page.locator(".sidebar-navigation") |
| 50 | + assert sidebar.get_by_text("Overview", exact=True).count() > 0 |
| 51 | + |
| 52 | + def test_how_to_use_has_deep_dive(self, page): |
| 53 | + page.goto(f"{SITE_URL}/how-to-use.html", wait_until="domcontentloaded") |
| 54 | + sidebar = page.locator(".sidebar-navigation") |
| 55 | + assert sidebar.get_by_text("Deep-Dive Analysis").count() > 0 |
| 56 | + |
| 57 | + def test_how_to_use_has_globe_viz(self, page): |
| 58 | + page.goto(f"{SITE_URL}/how-to-use.html", wait_until="domcontentloaded") |
| 59 | + sidebar = page.locator(".sidebar-navigation") |
| 60 | + assert sidebar.get_by_text("3D Globe Visualization").count() > 0 |
| 61 | + |
| 62 | + def test_how_to_use_has_search_explorer(self, page): |
| 63 | + page.goto(f"{SITE_URL}/how-to-use.html", wait_until="domcontentloaded") |
| 64 | + sidebar = page.locator(".sidebar-navigation") |
| 65 | + assert sidebar.get_by_text("Search Explorer").count() > 0 |
| 66 | + |
| 67 | + def test_how_to_use_has_narrow_vs_wide(self, page): |
| 68 | + page.goto(f"{SITE_URL}/how-to-use.html", wait_until="domcontentloaded") |
| 69 | + sidebar = page.locator(".sidebar-navigation") |
| 70 | + assert sidebar.get_by_text("Technical: Narrow vs Wide").count() > 0 |
| 71 | + |
| 72 | + |
| 73 | +class TestSidebarAbout: |
| 74 | + """About section should have 4 items matching wireframe.""" |
| 75 | + |
| 76 | + def test_about_has_objectives(self, page): |
| 77 | + page.goto(f"{SITE_URL}/about.html", wait_until="domcontentloaded") |
| 78 | + sidebar = page.locator(".sidebar-navigation") |
| 79 | + assert sidebar.get_by_text("Objectives", exact=True).count() > 0 |
| 80 | + |
| 81 | + def test_about_has_pis_and_contributors(self, page): |
| 82 | + page.goto(f"{SITE_URL}/about.html", wait_until="domcontentloaded") |
| 83 | + sidebar = page.locator(".sidebar-navigation") |
| 84 | + assert sidebar.get_by_text("PIs and Contributors").count() > 0 |
| 85 | + |
| 86 | + def test_about_has_photo_gallery(self, page): |
| 87 | + page.goto(f"{SITE_URL}/about.html", wait_until="domcontentloaded") |
| 88 | + sidebar = page.locator(".sidebar-navigation") |
| 89 | + assert sidebar.get_by_text("Photo Gallery").count() > 0 |
| 90 | + |
| 91 | + def test_about_has_background_history(self, page): |
| 92 | + page.goto(f"{SITE_URL}/about.html", wait_until="domcontentloaded") |
| 93 | + sidebar = page.locator(".sidebar-navigation") |
| 94 | + assert sidebar.get_by_text("Background & History").count() > 0 |
| 95 | + |
| 96 | + |
| 97 | +class TestSidebarResearchResources: |
| 98 | + """Research & Resources should have 3 items matching wireframe.""" |
| 99 | + |
| 100 | + def test_has_publications_and_conferences(self, page): |
| 101 | + page.goto(f"{SITE_URL}/about.html", wait_until="domcontentloaded") |
| 102 | + sidebar = page.locator(".sidebar-navigation") |
| 103 | + assert sidebar.get_by_text("Publications & Conferences").count() > 0 |
| 104 | + |
| 105 | + def test_has_zenodo_community(self, page): |
| 106 | + page.goto(f"{SITE_URL}/about.html", wait_until="domcontentloaded") |
| 107 | + sidebar = page.locator(".sidebar-navigation") |
| 108 | + assert sidebar.get_by_text("Zenodo Community").count() > 0 |
| 109 | + |
| 110 | + def test_has_github_repositories(self, page): |
| 111 | + page.goto(f"{SITE_URL}/about.html", wait_until="domcontentloaded") |
| 112 | + sidebar = page.locator(".sidebar-navigation") |
| 113 | + assert sidebar.get_by_text("Github Repositories").count() > 0 |
| 114 | + |
| 115 | + |
| 116 | +class TestNavbar: |
| 117 | + """Top navbar should have the 4 main items.""" |
| 118 | + |
| 119 | + def test_navbar_has_home(self, page): |
| 120 | + page.goto(SITE_URL, wait_until="domcontentloaded") |
| 121 | + navbar = page.locator(".navbar") |
| 122 | + assert navbar.get_by_text("Home", exact=True).count() > 0 |
| 123 | + |
| 124 | + def test_navbar_has_interactive_explorer(self, page): |
| 125 | + page.goto(SITE_URL, wait_until="domcontentloaded") |
| 126 | + navbar = page.locator(".navbar") |
| 127 | + assert navbar.get_by_text("Interactive Explorer").count() > 0 |
| 128 | + |
| 129 | + def test_navbar_has_how_to_use(self, page): |
| 130 | + page.goto(SITE_URL, wait_until="domcontentloaded") |
| 131 | + navbar = page.locator(".navbar") |
| 132 | + assert navbar.get_by_text("How to Use").count() > 0 |
| 133 | + |
| 134 | + def test_navbar_has_about(self, page): |
| 135 | + page.goto(SITE_URL, wait_until="domcontentloaded") |
| 136 | + navbar = page.locator(".navbar") |
| 137 | + assert navbar.get_by_text("About", exact=True).count() > 0 |
0 commit comments