|
| 1 | +""" |
| 2 | +Feature: Navbar Dropdown Menus |
| 3 | + As a visitor navigating iSamples |
| 4 | + I want dropdown menus on the navbar to reveal sub-pages |
| 5 | + So that I can quickly reach any section without using the sidebar |
| 6 | +
|
| 7 | + Wireframe ref: Figma frame [33:425] Home (6-item navbar) |
| 8 | + Implementation: PR #103 |
| 9 | +""" |
| 10 | +from conftest import SITE_URL |
| 11 | + |
| 12 | + |
| 13 | +def _open_dropdown(page, label, exact=False): |
| 14 | + """Click a Bootstrap 5 navbar dropdown toggle to reveal its menu.""" |
| 15 | + # Structure: li.nav-item.dropdown > a.dropdown-toggle > span.menu-text |
| 16 | + dropdown_li = page.locator(f".navbar li.dropdown:has(a:has-text('{label}'))") |
| 17 | + dropdown_li.locator("a.dropdown-toggle").click() |
| 18 | + menu = dropdown_li.locator("ul.dropdown-menu") |
| 19 | + menu.wait_for(state="visible", timeout=3000) |
| 20 | + return menu |
| 21 | + |
| 22 | + |
| 23 | +class TestHowToUseDropdown: |
| 24 | + """Scenario: How to Use dropdown shows 5 sub-items.""" |
| 25 | + |
| 26 | + def test_how_to_use_dropdown_has_overview(self, page): |
| 27 | + """Given I click How to Use, Then I see Overview.""" |
| 28 | + page.goto(SITE_URL, wait_until="domcontentloaded") |
| 29 | + menu = _open_dropdown(page, "How to Use") |
| 30 | + assert menu.get_by_text("Overview").count() > 0 |
| 31 | + |
| 32 | + def test_how_to_use_dropdown_has_deep_dive(self, page): |
| 33 | + """And I see Deep-Dive Analysis.""" |
| 34 | + page.goto(SITE_URL, wait_until="domcontentloaded") |
| 35 | + menu = _open_dropdown(page, "How to Use") |
| 36 | + assert menu.get_by_text("Deep-Dive Analysis").count() > 0 |
| 37 | + |
| 38 | + |
| 39 | +class TestAboutDropdown: |
| 40 | + """Scenario: About dropdown shows 4 sub-items.""" |
| 41 | + |
| 42 | + def test_about_dropdown_has_objectives(self, page): |
| 43 | + """Given I click About, Then I see Objectives.""" |
| 44 | + page.goto(SITE_URL, wait_until="domcontentloaded") |
| 45 | + menu = _open_dropdown(page, "About", exact=True) |
| 46 | + assert menu.get_by_text("Objectives").count() > 0 |
| 47 | + |
| 48 | + def test_about_dropdown_has_pis(self, page): |
| 49 | + """And I see PIs and Contributors.""" |
| 50 | + page.goto(SITE_URL, wait_until="domcontentloaded") |
| 51 | + menu = _open_dropdown(page, "About", exact=True) |
| 52 | + assert menu.get_by_text("PIs and Contributors").count() > 0 |
| 53 | + |
| 54 | + |
| 55 | +class TestArchitectureDropdown: |
| 56 | + """Scenario: Architecture & Vocabularies dropdown shows sub-items.""" |
| 57 | + |
| 58 | + def test_architecture_dropdown_has_requirements(self, page): |
| 59 | + """Given I click Architecture, Then I see Requirements.""" |
| 60 | + page.goto(SITE_URL, wait_until="domcontentloaded") |
| 61 | + menu = _open_dropdown(page, "Architecture") |
| 62 | + assert menu.get_by_text("Requirements").count() > 0 |
| 63 | + |
| 64 | + def test_architecture_dropdown_has_vocabularies(self, page): |
| 65 | + """And I see Vocabularies.""" |
| 66 | + page.goto(SITE_URL, wait_until="domcontentloaded") |
| 67 | + menu = _open_dropdown(page, "Architecture") |
| 68 | + assert menu.get_by_text("Vocabularies").count() > 0 |
| 69 | + |
| 70 | + |
| 71 | +class TestResearchDropdown: |
| 72 | + """Scenario: Research & Resources dropdown shows sub-items.""" |
| 73 | + |
| 74 | + def test_research_dropdown_has_publications(self, page): |
| 75 | + """Given I click Research, Then I see Publications & Conferences.""" |
| 76 | + page.goto(SITE_URL, wait_until="domcontentloaded") |
| 77 | + menu = _open_dropdown(page, "Research") |
| 78 | + assert menu.get_by_text("Publications").count() > 0 |
| 79 | + |
| 80 | + def test_research_dropdown_has_zenodo(self, page): |
| 81 | + """And I see Zenodo Community.""" |
| 82 | + page.goto(SITE_URL, wait_until="domcontentloaded") |
| 83 | + menu = _open_dropdown(page, "Research") |
| 84 | + assert menu.get_by_text("Zenodo").count() > 0 |
0 commit comments