Skip to content

navigation

django_spire.testing.playwright.components.navigation

SideNavigation

Playwright component for django_spire/navigation/side_navigation.html

Source code in django_spire/testing/playwright/components/navigation.py
def __init__(self, page: Page) -> None:
    self.page = page

page = page instance-attribute

container property

scroll_container property

Source code in django_spire/testing/playwright/components/navigation.py
def click_link(self, text: str) -> None:
    self.get_link_by_text(text).click()
Source code in django_spire/testing/playwright/components/navigation.py
def get_link_by_text(self, text: str) -> Locator:
    return self.container.locator(f'a.nav-link:has-text("{text}")')
Source code in django_spire/testing/playwright/components/navigation.py
def get_link_count(self) -> int:
    return self.links.count()
Source code in django_spire/testing/playwright/components/navigation.py
def get_link_texts(self) -> list[str]:
    return [self.links.nth(i).inner_text() for i in range(self.get_link_count())]
Source code in django_spire/testing/playwright/components/navigation.py
def has_link(self, text: str) -> bool:
    return self.get_link_by_text(text).count() > 0

is_visible

Source code in django_spire/testing/playwright/components/navigation.py
def is_visible(self) -> bool:
    return self.container.is_visible()

TopNavigation

Playwright component for django_spire/navigation/top_navigation.html

Source code in django_spire/testing/playwright/components/navigation.py
def __init__(self, page: Page) -> None:
    self.page = page

page = page instance-attribute

container property

notification_bell property

theme_selector property

title property

user_menu property

click_notification_bell

Source code in django_spire/testing/playwright/components/navigation.py
def click_notification_bell(self) -> None:
    self.notification_bell.click()

click_theme_selector

Source code in django_spire/testing/playwright/components/navigation.py
def click_theme_selector(self) -> None:
    self.theme_selector.click()

click_user_menu

Source code in django_spire/testing/playwright/components/navigation.py
def click_user_menu(self) -> None:
    self.user_menu.click()

get_title_text

Source code in django_spire/testing/playwright/components/navigation.py
def get_title_text(self) -> str:
    return self.title.inner_text()

is_visible

Source code in django_spire/testing/playwright/components/navigation.py
def is_visible(self) -> bool:
    return self.container.is_visible()

UserMenu

Playwright component for user dropdown menu in top navigation

Source code in django_spire/testing/playwright/components/navigation.py
def __init__(self, page: Page) -> None:
    self.page = page

page = page instance-attribute

menu property

trigger property

click_admin_panel

Source code in django_spire/testing/playwright/components/navigation.py
def click_admin_panel(self) -> None:
    self.menu.locator('a:has-text("Admin Panel")').click()

click_change_password

Source code in django_spire/testing/playwright/components/navigation.py
def click_change_password(self) -> None:
    self.menu.locator('a:has-text("Change Password")').click()

click_logout

Source code in django_spire/testing/playwright/components/navigation.py
def click_logout(self) -> None:
    self.menu.locator('a:has-text("Logout")').click()

click_theme_dashboard

Source code in django_spire/testing/playwright/components/navigation.py
def click_theme_dashboard(self) -> None:
    self.menu.locator('a:has-text("Theme Dashboard")').click()

is_open

Source code in django_spire/testing/playwright/components/navigation.py
def is_open(self) -> bool:
    return self.menu.is_visible()

open

Source code in django_spire/testing/playwright/components/navigation.py
def open(self) -> None:
    if not self.is_open():
        self.trigger.click()