Buckets:

download
raw
3.18 kB
"""E2E tests for the Remove Wine flow (formerly Checkout).
Requirements:
uv run python -m invoke start-background
Run with:
uv run python -m pytest -m e2e tests/test_checkout_e2e.py -v --override-ini="addopts="
"""
from typing import Generator
import pytest
from playwright.sync_api import Page, expect
from .playwright_utils import (
BASE_URL,
authenticated_page, # noqa: F401 — imported fixture
create_cli_worker_user,
e2e_preflight, # noqa: F401 — imported autouse fixture
)
@pytest.fixture(scope="session")
def worker_user(request: pytest.FixtureRequest) -> Generator[tuple[str, str], None, None]:
email, password = create_cli_worker_user(request, email_prefix="e2e_checkout", password="testpass123")
yield email, password
@pytest.mark.e2e
class TestCheckoutUI:
"""E2E tests for remove wine UI elements."""
def test_checkout_modal_exists(self, authenticated_page: Page) -> None:
"""Remove modal element exists in DOM."""
page = authenticated_page
page.click("a[data-page='cellar']")
page.wait_for_selector("#page-cellar", state="visible", timeout=5000)
expect(page.locator("#remove-modal")).to_be_attached()
def test_checkout_form_exists(self, authenticated_page: Page) -> None:
"""Remove form exists inside modal."""
page = authenticated_page
page.click("a[data-page='cellar']")
page.wait_for_selector("#page-cellar", state="visible", timeout=5000)
expect(page.locator("#remove-form")).to_be_attached()
def test_checkout_quantity_input_exists(self, authenticated_page: Page) -> None:
"""Remove quantity input exists in form."""
page = authenticated_page
page.click("a[data-page='cellar']")
page.wait_for_selector("#page-cellar", state="visible", timeout=5000)
expect(page.locator("#remove-quantity")).to_be_attached()
def test_checkout_wine_id_hidden_field(self, authenticated_page: Page) -> None:
"""Remove modal has hidden wine ID field."""
page = authenticated_page
page.click("a[data-page='cellar']")
page.wait_for_selector("#page-cellar", state="visible", timeout=5000)
expect(page.locator("#remove-wine-id")).to_be_attached()
def test_checkout_available_display(self, authenticated_page: Page) -> None:
"""Available quantity display element exists."""
page = authenticated_page
page.click("a[data-page='cellar']")
page.wait_for_selector("#page-cellar", state="visible", timeout=5000)
expect(page.locator("#remove-available")).to_be_attached()
def test_reason_picker_exists(self, authenticated_page: Page) -> None:
"""Reason picker cards exist in remove modal."""
page = authenticated_page
page.click("a[data-page='cellar']")
page.wait_for_selector("#page-cellar", state="visible", timeout=5000)
expect(page.locator("#remove-reason-picker")).to_be_attached()
# Five reason cards in the remove modal: DRINK, SELL, GIFT, BREAKAGE, OTHER
cards = page.locator("#remove-reason-picker .reason-card")
expect(cards).to_have_count(5)

Xet Storage Details

Size:
3.18 kB
·
Xet hash:
25b10da922a4e6c0789d8569753c87305d7e6215078d31b34326dac8d3d4c041

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.