Skip to content

modal

django_spire.testing.playwright.components.modal

Modal

Playwright component for django_spire/modal/modal.html

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

page = page instance-attribute

close_button property

content property

modal property

overlay property

close

Source code in django_spire/testing/playwright/components/modal.py
def close(self) -> None:
    self.close_button.click()

close_by_overlay

Source code in django_spire/testing/playwright/components/modal.py
def close_by_overlay(self) -> None:
    self.overlay.click()

is_open

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

wait_for_close

Source code in django_spire/testing/playwright/components/modal.py
def wait_for_close(self, timeout: int = 5000) -> None:
    self.modal.wait_for(state='hidden', timeout=timeout)

wait_for_open

Source code in django_spire/testing/playwright/components/modal.py
def wait_for_open(self, timeout: int = 5000) -> None:
    self.modal.wait_for(state='visible', timeout=timeout)

TitleModal

Bases: Modal

Playwright component for django_spire/modal/title_modal.html

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

title property

get_title_text

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

FormModal

Bases: TitleModal

Playwright component for modals containing forms

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

cancel_button property

form property

submit_button property

cancel

Source code in django_spire/testing/playwright/components/modal.py
def cancel(self) -> None:
    self.cancel_button.click()

fill_field

Source code in django_spire/testing/playwright/components/modal.py
def fill_field(self, name: str, value: str) -> None:
    self.form.locator(f'[name="{name}"]').fill(value)

get_field_value

Source code in django_spire/testing/playwright/components/modal.py
def get_field_value(self, name: str) -> str:
    return self.form.locator(f'[name="{name}"]').input_value()

submit

Source code in django_spire/testing/playwright/components/modal.py
def submit(self) -> None:
    self.submit_button.click()

DeleteModal

Bases: TitleModal

Playwright component for delete confirmation modals

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

cancel_button property

confirm_button property

cancel

Source code in django_spire/testing/playwright/components/modal.py
def cancel(self) -> None:
    self.cancel_button.click()

confirm

Source code in django_spire/testing/playwright/components/modal.py
def confirm(self) -> None:
    self.confirm_button.click()